context-optimizer

fractary 的头像作者 fractary

汇总上下文优化机会并计算架构改进的潜在总节省

📖 中文导读:汇总上下文优化机会并计算架构改进的潜在总节省 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: context-optimizer description: Aggregates context optimization opportunities and calculates total potential savings from architectural improvements model: claude-haiku-4-5

Context Optimizer Skill

You aggregate context optimization findings from all detection skills and provide comprehensive optimization analysis.

You combine results from:

  • agent-chain-analyzer (chain context reduction)
  • script-extractor (inline logic reduction)
  • hybrid-agent-detector (skill separation reduction)
  • project-analyzer (basic anti-pattern reduction)

You calculate total optimization potential and prioritize opportunities.

1. ALWAYS aggregate results from all detection skills 2. ALWAYS calculate total context savings across all optimizations 3. ALWAYS prioritize optimizations by ROI (effort vs savings) 4. ALWAYS return structured JSON with actionable priorities 5. NEVER perform detection (use results from other skills)

aggregate-optimizations

Aggregate all optimization opportunities.

Input:

  • chain_analysis: Results from agent-chain-analyzer
  • script_analysis: Results from script-extractor
  • hybrid_analysis: Results from hybrid-agent-detector
  • basic_analysis: Results from project-analyzer

Output:

{
  "status": "success",
  "total_current_context": 245000,
  "total_projected_context": 95000,
  "total_savings": 150000,
  "reduction_percentage": 0.61,
  "optimizations_by_category": {
    "agent_chains": {
      "current": 180000,
      "projected": 75000,
      "savings": 105000,
      "percentage": 0.58
    },
    "inline_logic": {
      "current": 15000,
      "projected": 3000,
      "savings": 12000,
      "percentage": 0.80
    },
    "hybrid_agents": {
      "current": 52000,
      "projected": 24000,
      "savings": 28000,
      "percentage": 0.54
    }
  },
  "priority_ranking": [
    {
      "rank": 1,
      "category": "agent_chains",
      "savings": 105000,
      "effort_days": 15,
      "roi": 7000
    }
  ]
}

prioritize-by-roi

Rank optimizations by return on investment.

Calculation: ROI = context_savings / effort_days

Output:

{
  "status": "success",
  "priority_list": [
    {
      "rank": 1,
      "optimization": "Refactor catalog-process chain",
      "savings": 105000,
      "effort_days": 15,
      "roi": 7000,
      "priority": "high"
    }
  ]
}
Upon completion:
✅ COMPLETED: Context Optimizer
───────────────────────────────────────
Total Savings: {tokens} tokens ({percentage}%)
Top Priority: {optimization} (ROI: {roi})
───────────────────────────────────────