Claude Codeのknown-failures.mdを育てる運用設計 A practical guide to maintaining a known-failures.md file for Claude Code: how to write en…
- Claude Codeで再発する失敗パターンを記録するknown-failures.mdの運用法を解説。
- 書き方や読み込ませ方、情報が陳腐化した際の対処を含め、AIコーディング支援を継続的に改善する仕組みを提案する。
English summary
- A practical guide to maintaining a known-failures.md file for Claude Code: how to write entries, how to feed them back to the agent, and how to handle staleness so AI-assisted coding keeps improving over time.
Claude CodeのようなAIコーディングエージェントを実務で使い続けると、同じ種類のミスが何度も繰り返される現象に直面する。本記事は、そうした失敗を蓄積・参照するためのknown-failures.mdというドキュメントを「育てる」運用論を提示している。
中心となるのは三つの観点だ。第一に書き方で、失敗の症状・原因・回避策を簡潔に構造化し、後から検索しやすい粒度でエントリ化する。冗長な議事録ではなく、エージェントが文脈として取り込んだ際に行動を変えられるレベルの密度が望ましいとされる。第二に読ませ方で、CLAUDE.mdやプロジェクトのコンテキストファイルから参照させ、関連タスク時に自動的にロードされる導線を設計する。常時全文を読ませるとトークンを浪費するため、ファイル分割や用途別タグ付けで取捨選択させる工夫が紹介されている。
第三が陳腐化対処である。ライブラリのアップデートや仕様変更で、過去の回避策がかえって誤誘導になる場合がある。著者は記録に日付や対象バージョンを明記し、定期的に棚卸しして無効化・削除するプロセスを提案している。
書き方や読み込ませ方、情報が陳腐化した際の対処を含め、AIコーディング支援を継続的に改善する仕組みを提案する。
背景として、こうした「エージェント向けメモリ」をリポジトリ内に置く運用は、AnthropicのCLAUDE.md規約やCursorのrules、AiderのCONVENTIONS.md、GitHub CopilotのカスタムインストラクションなどAIコーディングツール全般で共通化しつつある。失敗ログを資産化する発想はポストモーテム文化やADR(アーキテクチャ決定記録)とも親和性が高く、人間とエージェントの双方が読むドキュメントへと役割が拡張されつつあると見られる。一方で、肥大化したコンテキストはハルシネーションや指示無視を誘発する可能性も指摘されており、何を残し何を捨てるかの編集判断が今後の鍵となりそうだ。
Anyone who uses an AI coding agent like Claude Code in real projects eventually notices the same classes of mistakes recurring. This article proposes a disciplined way to capture and reuse those lessons through a living document called known-failures.md, and discusses how to grow it over time rather than letting it rot.
The author structures the operational design around three concerns. The first is how to write entries. Rather than verbose postmortems, each entry should compactly describe the symptom, the underlying cause, and the workaround at a granularity dense enough that the agent, once given the context, actually changes its behavior. Searchability and consistent formatting matter, because the file is read by both humans and an LLM with limited attention.
The second concern is how to make the agent read it. Simply committing the file is not enough; it needs to be wired into the project context, typically via CLAUDE.md or similar entry-point files, so relevant entries surface during related tasks. Loading the entire log on every prompt wastes tokens, so the piece suggests splitting by topic or tagging by use case to let the agent pull only what is relevant.
The third concern, and arguably the most underappreciated, is staleness. Library upgrades, API changes, or model updates can turn a once-valid workaround into actively misleading guidance. The author recommends stamping each entry with dates and target versions, and scheduling periodic reviews to retire or rewrite stale items, treating the file like code that needs maintenance rather than an append-only journal.
This pattern fits a broader trend across AI coding tools. Anthropic's CLAUDE.md convention, Cursor's rules, Aider's CONVENTIONS.md, and GitHub Copilot's custom instructions all converge on the idea of in-repo memory that steers an agent. Treating recurring failures as a first-class artifact also echoes long-standing engineering practices like postmortems and Architecture Decision Records, suggesting that these documents are evolving into shared artifacts read by both humans and machines.
There is a tension worth flagging. Bloated context can itself degrade model behavior, encouraging hallucination or causing the agent to ignore instructions buried deep in a long file. The value of known-failures.md therefore depends less on exhaustive coverage than on editorial judgment about what to keep, what to compress, and what to delete. In that sense, maintaining such a file may become a small but meaningful new craft for teams shipping with AI assistance, sitting somewhere between documentation, prompt engineering, and knowledge management.
本ページの本文・要約は AI による自動生成です。正確性は元記事 (zenn.dev) をご確認ください。