Context-engineered instruction templates for AI coding agents.
Universal CLAUDE.md & GEMINI.md templates optimized for minimal token consumption and maximum reasoning precision.
為 AI 編程代理打造的語境工程指令範本。
通用 CLAUDE.md 與 GEMINI.md 範本,以最少 token 消耗換取最高推理精度。
| Problem | Solution |
|---|---|
| AI wastes tokens on verbose output | Chain-of-Draft — each reasoning step ≤5 words |
| Long conversations degrade quality | Document & Clear — save state, clear context, resume |
| AI reads entire files unnecessarily | Script Delegation — run linters/tests, read output only |
| Context window fills up fast | Memory Bank — modular @-loading, never preload all docs |
| Instructions drift in Gemini | XML tags — structured boundaries for higher adherence |
| Repeated mistakes across sessions | Error logs — bidirectional sync between Claude & Gemini |
| 問題 | 解決方案 |
|---|---|
| AI 輸出冗長浪費 token | 草案鏈 (CoD) — 每步推理 ≤5 詞 |
| 長對話導致品質退化 | 記錄後清空 — 存狀態、清上下文、續接 |
| AI 不必要地讀取整個檔案 | 腳本委派 — 跑 linter/測試,只讀輸出 |
| 語境窗口快速填滿 | 記憶銀行 — 按需 @ 載入,不預載 |
| Gemini 指令漂移 | XML 標記 — 結構化邊界提升依從性 |
| 跨 session 重複犯錯 | 錯誤日誌 — Claude 與 Gemini 雙向同步 |
Archetype/
├── CLAUDE.md # Claude Code instruction template (Markdown)
├── GEMINI.md # Gemini CLI instruction template (XML tags)
├── CLAUDE_ERROR.md # Error log template (syncs → GEMINI_ERROR.md)
├── GEMINI_ERROR.md # Error log template (syncs → CLAUDE_ERROR.md)
└── specs/ # Spec files & task_status.md live here
- Copy
Archetype/into your project root - Fill in
[PROJECT_NAME],[architecture],[rules],[commands] - Start coding with Claude Code or Gemini CLI
- 複製
Archetype/到專案根目錄 - 填入
[PROJECT_NAME]、[architecture]、[rules]、[commands] - 開始使用 Claude Code 或 Gemini CLI 開發
Errors → Commit → Spec → Contract → Fact-check → Delegate → DoD → Min tokens → Context hygiene
EXPLORE → PLAN → EXECUTE → VERIFY → COMPLETE
100% certainty before coding. No skeleton. No demo. No "extend later".
| Trap | Fix |
|---|---|
| 20+ turns | /compact or /clear |
| Reading 1000+ lines | Read target functions only |
| Guessing file paths | Use @ exact path |
| Test fail loop | Plan → confirm → implement |
| Threshold | Action |
|---|---|
| 60k tokens or 30% window | /compact (Claude) or summarize (Gemini) |
| 5% remaining | Write specs/task_status.md → /clear → new session |
MIT