AgentSkillsCN

text-processor

执行文本操作,包括大小写转换(大写、小写、首字母大写)、文本反转以及单词计数。当用户需要对文本字符串进行转换、分析或操作时,可使用此功能。

SKILL.md
--- frontmatter
name: text-processor
description: Performs text manipulation operations including case conversion (uppercase, lowercase, capitalize), text reversal, and word counting. Use when the user needs to transform, analyze, or manipulate text strings.
license: MIT
metadata:
  author: agent-skills-poc
  version: "1.0"
  category: text

Text Processor Skill

This skill performs various text manipulation and analysis operations.

When to Use

Use this skill when:

  • The user needs to change text case (uppercase, lowercase, capitalize)
  • Text needs to be reversed
  • Word count or text analysis is required
  • The user mentions terms like "convert to uppercase", "make lowercase", "capitalize", "reverse text", "count words", "text transformation"

Instructions

Operation: Uppercase

  1. Take the input text
  2. Convert all characters to uppercase
  3. Return the transformed text

Operation: Lowercase

  1. Take the input text
  2. Convert all characters to lowercase
  3. Return the transformed text

Operation: Capitalize

  1. Take the input text
  2. Split the text into words (separated by spaces)
  3. For each word:
    • Convert the first character to uppercase
    • Convert remaining characters to lowercase
  4. Join the words back together with spaces
  5. Return the transformed text

Operation: Reverse

  1. Take the input text
  2. Split the text into individual characters
  3. Reverse the order of characters
  4. Join the characters back together
  5. Return the reversed text

Operation: Word Count

  1. Take the input text
  2. Trim leading and trailing whitespace
  3. Split the text by whitespace (spaces, tabs, newlines)
  4. Filter out empty strings
  5. Count the number of remaining words
  6. Return the count

Examples

Example 1: Uppercase Conversion

Input: "Convert 'hello world' to uppercase" Steps:

  1. Operation: Uppercase
  2. Input text: "hello world"
  3. Transform: HELLO WORLD Output: "HELLO WORLD"

Example 2: Capitalize

Input: "Capitalize 'the quick brown fox'" Steps:

  1. Operation: Capitalize
  2. Input text: "the quick brown fox"
  3. Split into words: ["the", "quick", "brown", "fox"]
  4. Capitalize each: ["The", "Quick", "Brown", "Fox"]
  5. Join: "The Quick Brown Fox" Output: "The Quick Brown Fox"

Example 3: Reverse Text

Input: "Reverse the text 'hello'" Steps:

  1. Operation: Reverse
  2. Input text: "hello"
  3. Split: ['h', 'e', 'l', 'l', 'o']
  4. Reverse: ['o', 'l', 'l', 'e', 'h']
  5. Join: "olleh" Output: "olleh"

Example 4: Word Count

Input: "How many words are in 'The quick brown fox jumps over the lazy dog'?" Steps:

  1. Operation: Word count
  2. Input text: "The quick brown fox jumps over the lazy dog"
  3. Split by spaces: ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]
  4. Count: 9 words Output: "The text contains 9 words"

Example 5: Word Count with Extra Spaces

Input: "Count words in ' hello world '" Steps:

  1. Operation: Word count
  2. Input text: " hello world "
  3. Trim and split: ["hello", "world"]
  4. Count: 2 words Output: "The text contains 2 words"

Common Edge Cases

  • Empty strings: Return appropriate message (e.g., "0 words" for word count)
  • Multiple spaces: Treat consecutive spaces as a single separator for word counting
  • Special characters: Preserve special characters in all operations except word counting
  • Unicode characters: Handle international characters appropriately
  • Newlines and tabs: Treat as whitespace for word counting
  • Mixed case input: Process according to the operation requested

Tips

  • Always preserve the original text structure (spaces, punctuation) unless the operation specifically modifies it
  • For capitalize operation, consider whether acronyms or proper nouns need special handling
  • When counting words, clarify what constitutes a "word" if the text contains numbers or special characters
  • Show both the original and transformed text in your response for clarity