AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

sample-text-processor

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.

Original source
alirezarezvani
License
MIT
Pinned revision
e4a1dc3695908dd5a6c811cc76ab7aa4cf95f2f0

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read alirezarezvani--sample-text-processor at revision e4a1dc3695908dd5a6c811cc76ab7aa4cf95f2f0, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 4

references/api-reference.md

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:

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.

python text_processor.py analyze <file> [options]

transform

Transform text file content.

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

batch

Process multiple files in a directory.

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.