Skip to content

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

sample-text-processor

Verified

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.

references/api-reference.md

View on GitHub
# Text Processor API Reference

## Classes

### TextProcessor

Main class for text processing operations.

#### `__init__(self, encoding: str = 'utf-8')`

Initialize the text processor with specified encoding.

**Parameters:**
- `encoding` (str): Character encoding for file operations. Default: 'utf-8'

#### `analyze_text(self, text: str) -> Dict[str, Any]`

Analyze text and return comprehensive statistics.

**Parameters:**
- `text` (str): Text content to analyze

**Returns:**
- `dict`: Statistics including word count, character count, lines, most frequent word

**Example:**
```python
processor = TextProcessor()
stats = processor.analyze_text("Hello world")
# Returns: {'total_words': 2, 'unique_words': 2, ...}
```

#### `transform_text(self, text: str, mode: str) -> str`

Transform text according to specified mode.

**Parameters:**
- `text` (str): Text to transform
- `mode` (str): Transformation mode ('upper', 'lower', 'title', 'reverse')

**Returns:**
- `str`: Transformed text

**Raises:**
- `ValueError`: If mode is not supported

### OutputFormatter

Static methods for output formatting.

#### `format_json(data: Dict[str, Any]) -> str`

Format data as JSON string.

#### `format_human_readable(data: Dict[str, Any]) -> str`

Format data as human-readable text.

### FileManager

Handles file operations and batch processing.

#### `find_text_files(self, directory: str) -> List[str]`

Find all text files in a directory recursively.

**Supported Extensions:**
- .txt
- .md
- .rst
- .csv
- .log

## Command Line Interface

### Commands

#### `analyze`
Analyze text file statistics.

```bash
python text_processor.py analyze <file> [options]
```

#### `transform`
Transform text file content.

```bash
python text_processor.py transform <file> --mode <mode> [options]
```

#### `batch`
Process multiple files in a directory.

```bash
python text_processor.py batch <directory> [options]
```

### Global Options

- `--format {json,text}`: Output format (default: text)
- `--output FILE`: Output file path (default: stdout)
- `--encoding ENCODING`: Text file encoding (default: utf-8)
- `--verbose`: Enable verbose output

## Error Handling

The text processor handles several error conditions:

- **FileNotFoundError**: When input file doesn't exist
- **UnicodeDecodeError**: When file encoding doesn't match specified encoding
- **PermissionError**: When file access is denied
- **ValueError**: When invalid transformation mode is specified

All errors are reported to stderr with descriptive messages.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 319kUpdated Claude CodeCodexVerifiedInstall