improvement-loop
バグや失敗、想定外の動作が発生した際に、原因となったスキルやエージェント、スクリプトなどを改善し、同様の問題や非効率な点が繰り返し発生する場合には、事前に改善策を提案することで、継続的な品質向上を実現するSkill。
📜 元の英語説明(参考)
Use after resolving a bug, failed task, or unexpected agent behavior to improve the pipeline skills, agents, hooks, or scripts that contributed to the problem. Also proactively suggest improvements when recurring patterns or inefficiencies are observed.
🇯🇵 日本人クリエイター向け解説
バグや失敗、想定外の動作が発生した際に、原因となったスキルやエージェント、スクリプトなどを改善し、同様の問題や非効率な点が繰り返し発生する場合には、事前に改善策を提案することで、継続的な品質向上を実現するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o improvement-loop.zip https://jpskill.com/download/8586.zip && unzip -o improvement-loop.zip && rm improvement-loop.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8586.zip -OutFile "$d\improvement-loop.zip"; Expand-Archive "$d\improvement-loop.zip" -DestinationPath $d -Force; ri "$d\improvement-loop.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
improvement-loop.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
improvement-loopフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
改善ループ
概要
問題解決後に、.claude/ パイプラインを改善します。決して問題解決中には行わないでください。スキル、エージェント、フック、またはスクリプトが不適切な出力を生成した場合、まず正しい解決策を見つけ、その後、学んだことをパイプラインに反映させます。
中心となる原則: まず修正し、完全に理解し、最後に改善します。時期尚早な編集は、部分的な理解をコード化することになります。
どのような時に使用するか
digraph when_to_use {
"Issue resolved successfully?" [shape=diamond];
"Root cause in pipeline file?" [shape=diamond];
"Worth encoding permanently?" [shape=diamond];
"Run improvement cycle" [shape=box style=filled fillcolor=lightgreen];
"Keep working on the issue" [shape=box];
"Skip - not a pipeline problem" [shape=box];
"Skip - one-off or too specific" [shape=box];
"Issue resolved successfully?" -> "Root cause in pipeline file?" [label="yes"];
"Issue resolved successfully?" -> "Keep working on the issue" [label="no - finish first"];
"Root cause in pipeline file?" -> "Worth encoding permanently?" [label="yes"];
"Root cause in pipeline file?" -> "Skip - not a pipeline problem" [label="no"];
"Worth encoding permanently?" -> "Run improvement cycle" [label="yes"];
"Worth encoding permanently?" -> "Skip - one-off or too specific" [label="no"];
}
トリガー条件 (ユーザーに提案):
- エージェントが誤った出力を生成し、手動での修正が必要になった
- スキルにガイダンスが不足しており、誤ったアプローチにつながった
- 同じ間違いが複数のセッションで発生した
- フックが本来捕捉すべきものを捕捉できなかった
- オーケストレーションスクリプトが未処理のエッジケースに遭遇した
- サブエージェントが、エージェント定義で回答されるべき質問をした
- レビューフィードバックで、同じ種類の問題が繰り返し指摘される
トリガーしない場合:
- 元の問題をまだデバッグまたは反復処理している間
- 再発する可能性の低い、一度限りの問題の場合
- パイプライン外の問題 (ユーザーエラー、外部サービスの障害) の場合
- 修正がコードの変更であり、パイプラインの変更ではない場合
ゲート: 問題は解決しましたか?
このチェックは、改善作業を行う前に必須です。
digraph gate_check {
"Original task/issue complete?" [shape=diamond];
"Tests passing?" [shape=diamond];
"User confirmed resolution?" [shape=diamond];
"GATE PASSED - proceed to improvement" [shape=box style=filled fillcolor=lightgreen];
"STOP - return to the issue" [shape=box style=filled fillcolor=salmon];
"Original task/issue complete?" -> "Tests passing?" [label="yes"];
"Original task/issue complete?" -> "STOP - return to the issue" [label="no"];
"Tests passing?" -> "User confirmed resolution?" [label="yes"];
"Tests passing?" -> "STOP - return to the issue" [label="no"];
"User confirmed resolution?" -> "GATE PASSED - proceed to improvement" [label="yes"];
"User confirmed resolution?" -> "STOP - return to the issue" [label="no/unclear"];
}
続行する前に、これらすべてを確認してください。
- 元のタスクまたは問題が機能的に完了している
- すべてのテストに合格している (または修正がコミットされ、検証されている)
- ユーザーが問題を解決済みと見なしている (不明な場合は確認する)
いずれかのチェックに失敗した場合は、停止してください。 問題に戻ります。改善作業を開始しないでください。
事前検出
通常の作業中に改善の機会に気づいた場合は、すぐに行動しないでください。代わりに:
- 機会をメモする — 何がうまくいかなかったのか、どのパイプラインファイルが関係しているのかを心に留めておきます
- 現在のタスクを完了する — 作業中のものを完了させます
- ユーザーに尋ねる — 改善を明示的に提案します:
[タスク] の作業中に [具体的な問題] に気づきました。根本的な原因は、
[skill/agent/hook/script name] が [X に関するガイダンスが不足している / アンチパターンのギャップがある /
Y を処理しない] ことにあるようです。
改善サイクルを実行して更新してもよろしいでしょうか? これには以下が含まれます。
- [具体的な変更: 例: "ハードコードされた圧縮された変数名のアンチパターンエントリを追加する"]
- [推定範囲: 例: "エージェントのアンチパターンセクションへの1行の追加"]
開始する前に必ず確認してください。 ユーザーは、延期したり、改善をまとめて行ったり、別の方法で処理したい場合があります。
5段階のサイクル
ステップ 1: 問題を把握する
詳細が薄れる前に、何が起こったかを文書化します。
- 何がうまくいかなかったのか: 具体的な誤った出力または動作
- どのパイプラインファイルか: 関係するスキル、エージェント、フック、またはスクリプト
- 根本的な原因: パイプラインファイルが誤った結果につながった理由
- 正しい解決策: 正しいアプローチがどうなったか
- どのように発見したか: デバッグパス (より良いガイダンスを書くのに役立ちます)
ステップ 2: 改善を分類する
| タイプ | 対象 | 例 |
|---|---|---|
| アンチパターン | エージェント定義 | "sed パターンで圧縮された変数名をハードコードしないでください" |
| ガイダンスの欠落 | スキルの内容 | テクニックのスキルにエッジケースの処理を追加する |
| 新しいトリガー | スキルの説明 | このスキルを呼び出すべき症状を追加する |
| フックのギャップ | settings.json / フックスクリプト | フォーマッタがファイルタイプを捕捉していない |
| スクリプトのエッジケース | オーケストレーションスクリプト | ステージでの未処理のタイムアウト |
| スキルの欠落 | 新しいスキルファイル | どこにも文書化されていないテクニック |
| エージェントの欠落 | 新しいエージェントファイル | 定義されていない特殊な役割 |
ステップ 3: 最小限の変更を加える
問題の再発を防ぐ最小限の変更を記述します。
- アンチパターン? エージェントのアンチパターンセクションに1つのエントリを追加します
- ガイダンスの欠落? スキルに1つの段落またはコード例を追加します
- フックのギャップ? フックスクリプトに1つの条件を追加します
- スクリプトのエッジケース? オーケストレーションスクリプトに1つのエラーハンドラを追加します
しないでください:
- 「そこにいる間に」ファイル全体を書き換える
- まだ発生していない問題に対する推測的なガイダンスを追加する
- 問題に関係のない周囲のコードをリファクタリングする
ステップ 4: 変更を検証する
変更の種類に応じて:
| 変更の種類 | 検証 |
|---|---|
| エージェントのアンチパターン | 競合するガイダンスを Grep で検索 i |
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
The Improvement Loop
Overview
Improve the .claude/ pipeline after resolving the issue at hand — never during. When a skill, agent, hook, or script produces bad output, work through to the correct solution first, then update the pipeline with what you learned.
Core principle: Fix first, understand fully, improve last. Premature edits encode partial understanding.
When to Use
digraph when_to_use {
"Issue resolved successfully?" [shape=diamond];
"Root cause in pipeline file?" [shape=diamond];
"Worth encoding permanently?" [shape=diamond];
"Run improvement cycle" [shape=box style=filled fillcolor=lightgreen];
"Keep working on the issue" [shape=box];
"Skip - not a pipeline problem" [shape=box];
"Skip - one-off or too specific" [shape=box];
"Issue resolved successfully?" -> "Root cause in pipeline file?" [label="yes"];
"Issue resolved successfully?" -> "Keep working on the issue" [label="no - finish first"];
"Root cause in pipeline file?" -> "Worth encoding permanently?" [label="yes"];
"Root cause in pipeline file?" -> "Skip - not a pipeline problem" [label="no"];
"Worth encoding permanently?" -> "Run improvement cycle" [label="yes"];
"Worth encoding permanently?" -> "Skip - one-off or too specific" [label="no"];
}
Trigger conditions (suggest to user):
- An agent produced incorrect output that required manual correction
- A skill was missing guidance that caused a wrong approach
- The same mistake has occurred more than once across sessions
- A hook failed to catch something it should have
- An orchestration script hit an unhandled edge case
- A subagent asked questions that the agent definition should have answered
- Review feedback repeatedly flags the same class of issue
Do NOT trigger:
- While still debugging or iterating on the original issue
- For one-off problems unlikely to recur
- For issues outside the pipeline (user error, external service failures)
- When the fix is a code change, not a pipeline change
The Gate: Is the Issue Resolved?
This check is mandatory before any improvement work.
digraph gate_check {
"Original task/issue complete?" [shape=diamond];
"Tests passing?" [shape=diamond];
"User confirmed resolution?" [shape=diamond];
"GATE PASSED - proceed to improvement" [shape=box style=filled fillcolor=lightgreen];
"STOP - return to the issue" [shape=box style=filled fillcolor=salmon];
"Original task/issue complete?" -> "Tests passing?" [label="yes"];
"Original task/issue complete?" -> "STOP - return to the issue" [label="no"];
"Tests passing?" -> "User confirmed resolution?" [label="yes"];
"Tests passing?" -> "STOP - return to the issue" [label="no"];
"User confirmed resolution?" -> "GATE PASSED - proceed to improvement" [label="yes"];
"User confirmed resolution?" -> "STOP - return to the issue" [label="no/unclear"];
}
Verify ALL of these before proceeding:
- The original task or issue is functionally complete
- All tests pass (or the fix is committed and verified)
- The user considers the issue resolved (ask if unclear)
If ANY check fails, stop. Return to the issue. Do not start improvement work.
Proactive Detection
When you observe improvement opportunities during normal work, do not act immediately. Instead:
- Note the opportunity — mentally flag what went wrong and which pipeline file is involved
- Finish the current task — complete whatever you're working on
- Ask the user — suggest the improvement explicitly:
I noticed [specific problem] while working on [task]. The root cause appears to be
[skill/agent/hook/script name] which [lacks guidance on X / has an anti-pattern gap /
doesn't handle Y].
Would you like me to run an improvement cycle to update it? This would involve:
- [Specific change: e.g., "adding an anti-pattern entry for hardcoded minified variable names"]
- [Estimated scope: e.g., "a one-line addition to the agent's anti-patterns section"]
Always ask before starting. The user may want to defer, batch improvements, or handle it differently.
The Five-Step Cycle
Step 1: Capture the Problem
Document what happened before details fade:
- What went wrong: The specific incorrect output or behavior
- Which pipeline file: The skill, agent, hook, or script involved
- Root cause: Why the pipeline file led to the wrong outcome
- Correct solution: What the right approach turned out to be
- How you discovered it: The debugging path (helps write better guidance)
Step 2: Classify the Improvement
| Type | Target | Example |
|---|---|---|
| Anti-pattern | Agent definition | "NEVER hardcode minified variable names in sed patterns" |
| Missing guidance | Skill content | Add edge case handling to a technique skill |
| New trigger | Skill description | Add symptom that should invoke this skill |
| Hook gap | settings.json / hook script | Formatter not catching a file type |
| Script edge case | Orchestration script | Unhandled timeout in a stage |
| Missing skill | New skill file | Technique not documented anywhere |
| Missing agent | New agent file | Specialized role not defined |
Step 3: Make the Minimal Change
Write the smallest change that prevents the problem from recurring.
- Anti-pattern? Add one entry to the agent's anti-patterns section
- Missing guidance? Add one paragraph or code example to the skill
- Hook gap? Add one condition to the hook script
- Script edge case? Add one error handler to the orchestration script
Do NOT:
- Rewrite entire files while you're "in there"
- Add speculative guidance for problems that haven't occurred
- Refactor surrounding code that isn't related to the issue
Step 4: Verify the Change
Depending on the type of change:
| Change Type | Verification |
|---|---|
| Agent anti-pattern | Grep for conflicting guidance in the agent file |
| Skill content | Read the skill end-to-end — does the new content fit? |
| Hook logic | Run the hook manually with test input |
| Orchestration script | Run relevant BATS tests |
| New skill/agent | Follow writing-skills or writing-agents skill (includes testing) |
Step 5: Commit and Communicate
git add .claude/[changed-file]
git commit -m "improve: [file] - [what was added and why]"
Tell the user what was changed and why:
Updated [file] with [change]. This prevents [problem] which occurred during [task].
Routing to the Right Tool
| What Needs Changing | How to Change It |
|---|---|
| Existing skill (small edit) | Edit directly |
| Existing agent (small edit) | Edit directly |
| New skill | Invoke writing-skills skill |
| New agent | Invoke writing-agents skill |
| Orchestration script | Dispatch cc-orchestration-writer agent via Task tool |
| Hook script | Dispatch bash-script-craftsman agent via Task tool |
| settings.json | Edit directly |
For new skills and agents: The writing-skills and writing-agents skills have their own TDD cycles. Follow them — don't shortcut.
Preventing Improvement Drift
Improvements can spiral. Guard against these anti-patterns:
| Anti-Pattern | Prevention |
|---|---|
| Yak shaving — improving A leads to improving B leads to C... | One improvement per cycle. If you discover more, note them and ask the user about a separate cycle. |
| Speculative improvements — "while I'm here, let me also..." | Only fix the problem that actually occurred. YAGNI applies to pipeline improvements too. |
| Encoding partial understanding — improving before fully resolving | The gate check (Step 0) prevents this. Never skip it. |
| Over-engineering — turning a one-line anti-pattern into a new skill | Match the weight of the fix to the weight of the problem. |
| Stale improvements — guidance that was correct once but isn't anymore | When you notice outdated guidance during work, flag it as an improvement opportunity. |
Batching Improvements
When multiple improvement opportunities arise in one session:
- Note each one as you encounter it (don't act)
- Finish the current work completely
- Present the batch to the user:
I identified 3 potential pipeline improvements during this session:
1. [agent-name]: Missing anti-pattern for [X] (occurred during task Y)
2. [skill-name]: Edge case not covered for [Z] (caused wrong approach in task W)
3. [hook]: Not catching [file type] (missed formatting on 2 files)
Would you like me to address these? I can handle them as:
a) One batch (fastest, ~5 min)
b) Individual cycles (most thorough)
c) Skip for now
Red Flags
- Improving while the issue is unresolved — STOP. Fix the issue first. This is the #1 violation.
- Making changes without asking — Always ask the user before starting improvement work.
- Improving after a single occurrence — One instance rarely justifies a pipeline change. Note it and watch for recurrence.
- Rewriting instead of appending — Most improvements are additions (anti-patterns, guidance, examples), not rewrites.
- Skipping verification — An untested improvement can introduce new problems.
Key Insight
"When a skill or agent produces bad output, don't immediately edit it. Work through to the correct solution first. Then update the skill with what you learned."
The instinct to jump into the pipeline file and tweak is strong. Resist it. Partial understanding encoded as guidance creates more problems than it solves. The improvement only becomes reliable after full resolution.