optimize-skill

A command that improves an existing agent skill by studying its past successes and failures. It creates possible revisions, evaluates them, and proposes the selected changes as a diff for review.

In plain words
What is it for?
Use it to refine a skill's instructions when usage data and failure traces show where it needs improvement.
Why use it?
It helps turn real failure reports into targeted improvements instead of changing a skill based only on guesswork.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/okdk7788/skill-evolution/optimize-skill
Clone the repo
git clone --depth 1 https://github.com/okdk7788/skill-evolution
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,463 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.01463
Opus 5 $0.00023 $0.00732
Sonnet 5 $0.00009 $0.00293
Haiku 4.5 $0.00005 $0.00146

Measured yesterday against content hash b3c2dfd8dca2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

optimize-skill scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/skill-evolution/commands/optimize-skill.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

한 학습 스킬(~/.claude/skills/<name>/SKILL.md)을 측정 기반으로 진화시킵니다. 이것은 self-improving-skills 플러그인이 갖지 못한 축입니다 — 그 플러그인은 스킬을 획득·유지하지만, 실제 성능을 측정해 다듬지는 않습니다. 이 커맨드가 Hermes의 GEPA(반영적 텍스트 진화) 루프를 이식합니다.

0. 대상 선정

  • $ARGUMENTS 에 스킬 이름이 있으면 그 스킬을 대상으로 합니다.
  • 없으면 랭킹에서 1순위 후보를 고릅니다:
    python3 "${CLAUDE_PLUGIN_ROOT}/scripts/evolution_report.py" candidate
    
    빈 문자열이면 "아직 최적화할 데이터(outcome)가 없다"고 사용자에게 알리고 중단하세요. /evolution-status 로 현재 상태를 보여주세요.

대상 스킬의 현재 통계도 함께 확인하세요:

python3 "${CLAUDE_PLUGIN_ROOT}/scripts/evolution_report.py" json

1. 근거 수집 (traces → "왜 실패했나")

GEPA의 핵심은 실패 여부가 아니라 입니다. 대상 스킬이 실제로 쓰인 세션을 찾아 실패의 원인을 모으세요:

  1. 대상 SKILL.md 전문을 읽습니다.
  2. 이 스킬이 사용된 트레이스를 프로젝트 기록에서 찾습니다 (Grep 도구 사용):
    • ~/.claude/projects/**/*.jsonl 에서 "skill":"<name>" 또는 "<name>" 이 등장하는 세션.
    • 그 사용 지점 이후의 is_error tool_result, 사용자 정정 발언, 재시도를 읽어 무엇이 어긋났는지 3~6개 구체적 실패 양상으로 정리하세요.
  3. 트레이스가 빈약하면(신규 스킬 등) 스킬 설명·본문 자체의 약점(모호한 트리거 조건, 빠진 엣지케이스, 과한 "MUST ALWAYS" 방어문구, 낡은 명령/경로)을 근거로 삼으세요.

이 실패 목록이 GEPA가 말하는 Actionable Side Information — 변이의 방향을 주는 신호입니다.

2. 변이 생성 (candidates)

실패 목록을 겨냥해 SKILL.md의 후보 변형 2~3개를 만드세요. 서로 다른 전략을 쓰세요 (한 방향으로만 바꾸지 말 것):

  • A: 트리거 조건(description의 "이런 상황에 사용")을 실패 사례에 맞게 더 정확히.
  • B: 본문 절차에 빠진 단계·엣지케이스·검증을 보강.
  • C: 군더더기를 덜어내 더 짧고 선명하게(같은 커버리지, 적은 토큰).

각 후보는 반드시:

  • 유효한 frontmatter(name, description) 유지, 의미(원래 목적) 보존.
  • 크기 상한 존중: 본문 15KB 이하 권장, description 500자 이하 권장(초과 시 매 세션 컨텍스트 비용).

3. 평가 (evaluate) — LLM-judge

원본 + 각 후보를, 1단계 실패 목록을 루브릭으로 삼아 채점하세요. 각 실패 양상마다 "이 버전이라면 막았을까?"를 판정하고, 다음을 0~5로 스코어링:

  • failure coverage — 정리한 실패들을 실제로 예방하는가 (가장 중요).
  • trigger precision — 써야 할 때 켜지고, 아닐 때 안 켜지는가.
  • clarity/actionability — 상황매칭 서술인가, 방어적 명령 나열인가.
  • cost — 크기/토큰 (작을수록 가점).

정직하게 채점하세요. 원본이 이미 최선이면 "개선 없음"이 정답입니다.

4. 선별 (Pareto)

품질(coverage+precision+clarity)을 1차 기준, cost를 동점 시 2차 기준으로 파레토 최적 후보를 고르세요. 원본이 파레토 프론트를 지배하면 변경하지 않습니다.

5. 적용 (human-gated)

  • 선택한 후보와 원본의 diff, 그리고 각 변경이 어떤 실패를 겨냥하는지를 사용자에게 먼저 보여주세요.
  • 사용자가 승인하면 Edit 도구로 ~/.claude/skills/<name>/SKILL.md 를 그 내용으로 교체하세요.
    • 이 Edit은 self-improving-skills 플러그인의 PreToolUse(백업)·PostToolUse(검증·롤백) 훅을 자동으로 통과합니다 — frontmatter가 깨지면 자동 롤백됩니다. 별도 백업 불필요.
  • 적용 후 최적화 시점을 기록하세요(다음 outcome이 실제로 나아졌는지 나중에 비교할 수 있게):
    python3 "${CLAUDE_PLUGIN_ROOT}/scripts/outcome_store.py" optimized "<name>"
    
  • 마지막으로 무엇을·왜 바꿨는지 2~3줄로 요약하세요.

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 77 lines · 45 tokens per session scan A b3c2dfd8dca2

Subscribe to this mod's changes

optimize-skill is a command published in the GitHub repository okdk7788/skill-evolution (1 stars, last pushed 1mo ago), licensed MIT. It adds 45 tokens to every session and 1,463 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.