Sample Text Processor

alirezarezvani/claude-skills/engineering/skills/skill-tester/assets/sample-skill

作者 alirezarezvani19392f7a0826无许可证27K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Reference BASIC-tier skill used as a fixture by skill-tester. Counts words and characters and applies basic text transformations. Use when validating skill-tester itself or when you need a minimal, known-good skill layout to copy. Not a production skill.

包含脚本AI & Agents
AI 生成的概览

统计文本文件中的单词和字符数量,并执行基本的大小写转换,可输出 JSON 或文本。

功能
这是一个极简的参考技能,用于分析文本文件,报告总词数、唯一词数、词频、字符数和行数。它还能将文本转换为大写、小写或标题格式,并可批量处理目录中的文件。结果以人类可读或 JSON 形式输出,技能附带一个 Python 脚本和示例素材。
适用场景
当你需要一个最小且已知可用的技能结构作为模板复制,或需要验证技能测试工具时使用。它明确不用于生产环境的文本处理。
运行要求
需要 Python 3.7 或更高版本,仅使用标准库;无外部依赖或凭据。技能附带可执行脚本(scripts/text_processor.py)以及示例文本和 CSV 素材。

Sample Text Processor

This file is the fixture skill_validator.py and script_tester.py run against. It is deliberately minimal. Keep its frontmatter valid YAML and limited to the fields Claude Code reads: anything else here gets copied into new skills by authors treating it as a template.

Tier: BASIC. Dependencies: none, Python standard library only.

Description

The Sample Text Processor is a simple skill designed to demonstrate the basic structure and functionality expected in the claude-skills ecosystem. This skill provides fundamental text processing capabilities including word counting, character analysis, and basic text transformations.

This skill serves as a reference implementation for BASIC tier requirements and can be used as a template for creating new skills. It demonstrates proper file structure, documentation standards, and implementation patterns that align with ecosystem best practices.

The skill processes text files and provides statistics and transformations in both human-readable and JSON formats, showcasing the dual output requirement for skills in the claude-skills repository.

Features

Core Functionality

  • Word Count Analysis: Count total words, unique words, and word frequency
  • Character Statistics: Analyze character count, line count, and special characters
  • Text Transformations: Convert text to uppercase, lowercase, or title case
  • File Processing: Process single text files or batch process directories
  • Dual Output Formats: Generate results in both JSON and human-readable formats

Technical Features

  • Command-line interface with comprehensive argument parsing
  • Error handling for common file and processing issues
  • Progress reporting for batch operations
  • Configurable output formatting and verbosity levels
  • Cross-platform compatibility with standard library only dependencies

Usage

Basic Text Analysis

bash
python text_processor.py analyze document.txtpython text_processor.py analyze document.txt --output results.json

Text Transformation

bash
python text_processor.py transform document.txt --mode uppercasepython text_processor.py transform document.txt --mode title --output transformed.txt

Batch Processing

bash
python text_processor.py batch text_files/ --output results/python text_processor.py batch text_files/ --format json --output batch_results.json

Examples

Example 1: Basic Word Count

bash
$ python text_processor.py analyze sample.txt=== TEXT ANALYSIS RESULTS ===File: sample.txtTotal words: 150Unique words: 85Total characters: 750Lines: 12Most frequent word: "the" (8 occurrences)

Example 2: JSON Output

bash
$ python text_processor.py analyze sample.txt --format json{  "file": "sample.txt",  "statistics": {    "total_words": 150,    "unique_words": 85,    "total_characters": 750,    "lines": 12,    "most_frequent": {      "word": "the",      "count": 8    }  }}

Example 3: Text Transformation

bash
$ python text_processor.py transform sample.txt --mode titleOriginal: "hello world from the text processor"Transformed: "Hello World From The Text Processor"

Installation

This skill requires only Python 3.7 or later with the standard library. No external dependencies are required.

  1. Clone or download the skill directory
  2. Navigate to the scripts directory
  3. Run the text processor directly with Python
bash
cd scripts/python text_processor.py --help

Configuration

The text processor supports various configuration options through command-line arguments:

  • --format: Output format (json, text)
  • --verbose: Enable verbose output and progress reporting
  • --output: Specify output file or directory
  • --encoding: Specify text file encoding (default: utf-8)

Architecture

The skill follows a simple modular architecture:

  • TextProcessor Class: Core processing logic and statistics calculation
  • OutputFormatter Class: Handles dual output format generation
  • FileManager Class: Manages file I/O operations and batch processing
  • CLI Interface: Command-line argument parsing and user interaction

Error Handling

The skill includes comprehensive error handling for:

  • File not found or permission errors
  • Invalid encoding or corrupted text files
  • Memory limitations for very large files
  • Output directory creation and write permissions
  • Invalid command-line arguments and parameters

Performance Considerations

  • Efficient memory usage for large text files through streaming
  • Optimized word counting using dictionary lookups
  • Batch processing with progress reporting for large datasets
  • Configurable encoding detection for international text

Contributing

This skill serves as a reference implementation and contributions are welcome to demonstrate best practices:

  1. Follow PEP 8 coding standards
  2. Include comprehensive docstrings
  3. Add test cases with sample data
  4. Update documentation for any new features
  5. Ensure backward compatibility

Limitations

As a BASIC tier skill, some advanced features are intentionally omitted:

  • Complex text analysis (sentiment, language detection)
  • Advanced file format support (PDF, Word documents)
  • Database integration or external API calls
  • Parallel processing for very large datasets

This skill demonstrates the essential structure and quality standards required for BASIC tier skills in the claude-skills ecosystem while remaining simple and focused on core functionality.

来源与署名

来源:alirezarezvani/claude-skills位于engineering/skills/skill-tester/assets/sample-skill提交19392f7

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架