text-truncator
FreeNo executable scriptsNot checkedIntelligently truncate text while preserving content integrity and semantic coherence. Suitable for long text preprocessing, ensuring text does not exceed…
by VanGong1999★ 533 GitHub starsAbout this skill
Text Truncator Tool
Functionality
Intelligently truncate text while maintaining content integrity and semantic coherence, limiting text to a specified length.
Usage Scenarios
- Preprocess text that exceeds length limits to meet agent input requirements
- Extract key sections for text previews or summary generation to improve efficiency and readability
- Assist content creation by intelligently trimming generated long text to avoid redundancy
Core Capabilities
- Semantic-Priority Truncation: Prioritize truncation at natural semantic boundaries (periods, question marks, exclamation points) to maximize sentence integrity
- Paragraph Integrity: When semantic boundaries are insufficient, prioritize truncation at paragraph ends or line breaks to avoid breaking paragraph structure
- Precise Length Control: Strictly adhere to user-specified maximum length limits, ensuring output text does not exceed limits
- Truncation Marker Insertion (optional): Automatically add custom truncation markers (such as "...") at the end of truncated text to indicate content omission
Input Requirements
- Text Content: Original text to be truncated (string)
- Maximum Length Limit: Maximum length after text truncation (integer, such as character count or token count)
- Truncation Marker (optional): Custom truncation marker, such as "..." or "[content truncated]"
Output Format
[Text Truncation Report]
- Original text length: [integer] words/tokens
- Truncated length: [integer] words/tokens
- Truncation position: [position description, such as "at end of sentence X"] or "not truncated"
### Truncated Text
[truncated text content]
Constraints
- Truncated text length must strictly comply with maximum length limits
- Ensure truncated text remains as semantically coherent and complete as possible
- If text does not reach maximum length, do not truncate; return original text
- Output format must be structured, clearly displaying length information before and after truncation and truncated text content
Resources
Install text-truncator in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the text-truncator skill do?
Intelligently truncate text while preserving content integrity and semantic coherence. Suitable for long text preprocessing, ensuring text does not exceed specified length limits
How do I install the text-truncator skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the text-truncator skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic