sample-text-processor – skill Lập trình cho agent AI
Skill mẫu cấp BASIC, dùng làm fixture cho skill-tester. Đếm từ và ký tự, áp dụng các phép biến đổi văn bản cơ bản. Dùng khi kiểm thử chính skill-tester hoặc khi cần một cấu trúc skill tối giản, đã kiểm chứng để sao chép. Không phải skill production.
Cài skill sample-text-processor bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/sample-text-processor-9338d.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /sample-text-processor – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/sample-text-processor-9338d.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $sample-text-processor – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/sample-text-processor-9338d.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /sample-text-processor – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/sample-text-processor-9338d.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /sample-text-processor – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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
python text_processor.py analyze document.txt
python text_processor.py analyze document.txt --output results.jsonText Transformation
python text_processor.py transform document.txt --mode uppercase
python text_processor.py transform document.txt --mode title --output transformed.txtBatch Processing
python text_processor.py batch text_files/ --output results/
python text_processor.py batch text_files/ --format json --output batch_results.jsonExamples
Example 1: Basic Word Count
$ python text_processor.py analyze sample.txt
=== TEXT ANALYSIS RESULTS ===
File: sample.txt
Total words: 150
Unique words: 85
Total characters: 750
Lines: 12
Most frequent word: "the" (8 occurrences)Example 2: JSON Output
$ 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
$ python text_processor.py transform sample.txt --mode title
Original: "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
cd scripts/
python text_processor.py --helpConfiguration
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.
Skill liên quan
- finishing-a-development-branch – Dùng khi triển khai đã hoàn tất, mọi test đều pass, và cần quyết định cách tích hợp công…
- scenario-war-room – Mô hình hóa what-if đa chức năng cho các kịch bản nhiều biến số chồng chéo. Khác với…
- five-axis-code-review – Checklist review code theo năm trục (tính đúng đắn, bảo mật, khả năng đọc, hiệu năng, độ…
- fix-review – Xác minh các commit sửa lỗi đã xử lý đúng phát hiện của audit mà không gây lỗi mới
- fp-async – Mẫu xử lý bất đồng bộ thực tế với TaskEither - pipeline gọn gàng thay vì try/catch rối…
- fp-backend – Mẫu lập trình hàm cho phát triển backend Node.js/Deno với fp-ts, ReaderTaskEither và…
- fp-errors – Đừng throw ở mọi nơi - xử lý lỗi như giá trị bằng Either và TaskEither để code gọn gàng…
- fp-pragmatic – Hướng dẫn thực tế, không biệt ngữ về lập trình hàm - cách tiếp cận 80/20 mang lại kết…