Optimize Agent and Skill Definitions

VerifiedSafe

Optimizes agent and skill definitions by reducing token count and clarifying boundaries.

Sby Skills Guide Bot
DevelopmentIntermediate
207/24/2026
Claude Code
#optimization#agent-definition#skill-definition#token-efficiency

Recommended for

Our review

Optimizes agent and skill definitions for conciseness, clarity, and reduced token consumption.

Strengths

  • Significant token reduction (30-50% for skills, under 500 tokens for agents).
  • Cross-checks boundaries between agents to prevent trigger overlap.
  • Provides structured output with a unified diff and actionable recommendations.
  • Preserves all critical functionality during optimization.

Limitations

  • Only works on existing agent/skill files in the standard Claude Code format.
  • May oversimplify complex agents that require verbose instructions.
  • Requires contextual understanding to avoid overly aggressive optimization.
When to use it

Use this skill when you want to reduce token usage and improve clarity of existing agent or skill definitions in your project.

When not to use it

Do not use this skill for creating new definitions from scratch or for definitions that do not follow the standard agent/skill format in Claude Code.

Security analysis

Safe
Quality score92/100

The skill only uses read, write, and grep within the project to optimize text files. It does not execute shell commands, network calls, or destructive actions, and there is no obfuscation or exfiltration risk.

No concerns found

Examples

Optimize a specific agent
Optimize the agent 'web-research' located in .claude/agents/ for token efficiency and clarity.
Optimize custom skill
Analyze and optimize my custom skill for summarizing documents, focusing on reducing token count and removing redundancies.
Batch optimize all agents
Optimize all agent definitions in .claude/agents/ to reduce token usage and ensure no trigger overlap.

description: Optimizes agent/skill definitions by reducing tokens and clarifying boundaries allowed-tools: [read, write, grep]

Optimize Agent or Skill

You optimize Claude Code agent and skill definitions for conciseness, clarity, and reduced token consumption.

Input

  1. target: Name or path of agent/skill to optimize
  2. additional_instructions (optional): Specific focus areas

Process

Step 1: Analysis

  1. Read the target agent/skill file
  2. Read ALL other agents in .claude/agents/ for boundary context
  3. Count current tokens
  4. Identify redundancies, verbose examples, unclear triggers

Step 2: Detect Type

  • Agent (.md in .claude/agents/): Optimize description field
  • Skill (.md in .claude/skills/): Optimize instructions section

Step 3: Optimize

For Agents (target: max 500 tokens):

  • Remove verbose examples, replace with concise trigger lists
  • Convert paragraphs to bullet points
  • Structure: What it does (1 line) -> Use for (4 items) -> Trigger (3-5 items) -> NOT for (optional)

For Skills (target: 30-50% reduction):

  • Remove redundant explanations and filler phrases
  • Convert prose to structured steps
  • Use tables for comparisons
  • Keep technical precision

Step 4: Boundary Analysis

Cross-check with all other agents:

  • No trigger overlap
  • Clear functional separation
  • Explicit "NOT for" sections where needed

Step 5: Language Rules

  • English, imperative mood ("Use for", not "This agent can be used for")
  • Avoid filler: "comprehensive", "detailed", "robust", "powerful"
  • MAX 2 short examples OR 1 example + trigger list
  • 3-5 trigger patterns using actual user phrases

Step 6: Quality Checks

  • [ ] Token count reduced by at least 30% (unless already optimal)
  • [ ] All critical functionality preserved
  • [ ] No trigger overlap with other agents
  • [ ] Concrete use cases, not vague descriptions
  • [ ] Proper frontmatter syntax maintained

Output Format

# Optimization Analysis: [name]

## Current State
- Type: [Agent/Skill]
- Token Count: XXX tokens
- Issues: [main problems]

## Optimization Results
- New Token Count: XXX tokens (XX% reduction)
- Key Changes: [list]

## Boundary Analysis
- Potential conflicts: [list]
- Recommendations: [suggestions]

## Proposed Changes (Diff)
[Unified diff]

## Additional Recommendations
[If any]
Related skills