optimize-agents

Audit Claude Code agent markdown files and assign cost-efficient model tiers.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/cosmicdreams/claude-plugins --skill optimize-agents
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimize-agents
Source: https://github.com/cosmicdreams/claude-plugins/tree/main/admin/skills/optimize-agents
Command: npx skills add https://github.com/cosmicdreams/claude-plugins --skill optimize-agents

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It reduces the cost and latency of running Claude Code agents by auditing agent definition files and trimming wasted tokens and bloated prompt text.

Core Features & Use Cases

  • Agent inventory & completeness checks: Scans all agent .md definitions and flags missing or incomplete YAML frontmatter fields (name, description, color, tools, model).
  • Model tier assignment: Recommends the cheapest viable model tier (haiku/sonnet/opus), based on whether the agent is procedural vs. reasoning-heavy, with opus reserved for explicit justification.
  • Token efficiency optimization: Flags overly long agent bodies and provides targeted cut guidance to achieve a lean 25–40 line body while preserving functional instructions.
  • Change application & verification: Updates frontmatter, adjusts model: tiers, trims bodies when over 50 lines, and includes a verification loop to confirm the results.

Quick Start

Ask the AI to run optimize-agents to audit your .claude/agents/ files, recommend haiku vs sonnet per agent, and trim any agents over 50 lines.

Frequently Asked Questions about optimize-agents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Claude Code agent costs by switching models?

Reduce Claude Code agent costs by auditing agent definition files to assign the cheapest viable model tier, using haiku for procedural tasks and reserving opus for explicit reasoning-heavy justification.

How do I trim bloated Claude Code agent prompts to save tokens?

Trim bloated Claude Code agent prompts by extracting YAML frontmatter fields and body length from agent markdown files, then applying targeted cut guidance to achieve a lean 25 to 40 line body while preserving functional instructions.

What is the best way to audit YAML frontmatter completeness in Claude Code agents?

Auditing YAML frontmatter completeness involves scanning all agent markdown definitions to flag missing or incomplete fields like name, description, color, tools, and model to ensure proper configuration maintenance.

When should I use opus instead of haiku for Claude Code agent configurations?

Assign opus only when an agent is reasoning-heavy with explicit justification, whereas haiku is recommended for procedural agents to optimize token efficiency and reduce latency.

Does Claude Code agent prompt trimming preserve functional instructions?

Yes, prompt trimming preserves functional instructions by enforcing a target body size and producing concrete frontmatter and trimming changes that remove wasted tokens without losing core agent directives.