compound-docs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Compound Docs — Institutional Knowledge Base

Compound Docs — 机构知识库

Searchable, categorized solution documentation that makes each debugging session easier than the last.
可搜索、分类的解决方案文档,让每次调试都比上一次更轻松。

Directory Structure

目录结构

.claude/solutions/
├── ecto-issues/
├── liveview-issues/
├── oban-issues/
├── otp-issues/
├── security-issues/
├── testing-issues/
├── phoenix-issues/
├── deployment-issues/
├── performance-issues/
└── build-issues/
.claude/solutions/
├── ecto-issues/
├── liveview-issues/
├── oban-issues/
├── otp-issues/
├── security-issues/
├── testing-issues/
├── phoenix-issues/
├── deployment-issues/
├── performance-issues/
└── build-issues/

Iron Laws

铁则

  1. ALWAYS search solutions before investigating — Check
    .claude/solutions/
    for existing fixes before debugging
  2. YAML frontmatter is MANDATORY — Every solution needs validated metadata per
    references/schema.md
  3. One problem per file — Never combine multiple solutions
  4. Include prevention — Every solution documents how to prevent recurrence
  1. 排查前务必先搜索解决方案 — 调试前先检查
    .claude/solutions/
    目录下是否已有现成的修复方案
  2. 必须包含YAML前置元数据 — 每个解决方案都需要符合
    references/schema.md
    中的验证元数据规范
  3. 一问题一文件 — 切勿将多个解决方案合并到同一个文件中
  4. 包含预防措施 — 每个解决方案都需记录如何避免问题再次发生

Solution File Format

解决方案文件格式

markdown
---
module: "Accounts"
date: "2025-12-01"
problem_type: runtime_error
component: ecto_schema
symptoms:
  - "Ecto.Association.NotLoaded on user.posts"
root_cause: missing_preload
severity: medium
tags: [preload, association, n-plus-one]
---
markdown
---
module: "Accounts"
date: "2025-12-01"
problem_type: runtime_error
component: ecto_schema
symptoms:
  - "Ecto.Association.NotLoaded on user.posts"
root_cause: missing_preload
severity: medium
tags: [preload, association, n-plus-one]
---

Association NotLoaded on User Posts

Association NotLoaded on User Posts

Symptoms

Symptoms

Ecto.Association.NotLoaded raised when accessing user.posts in UserListLive after filtering.
Ecto.Association.NotLoaded raised when accessing user.posts in UserListLive after filtering.

Root Cause

Root Cause

Query in Accounts context missing preload for :posts.
Query in Accounts context missing preload for :posts.

Solution

Solution

Added
Repo.preload(:posts)
to
list_users/1
.
Added
Repo.preload(:posts)
to
list_users/1
.

Prevention

Prevention

Use n1-check skill before shipping list views.
undefined
Use n1-check skill before shipping list views.
undefined

Searching Solutions

搜索解决方案

bash
undefined
bash
undefined

Search by symptom

Search by symptom

grep -rl "NotLoaded" .claude/solutions/
grep -rl "NotLoaded" .claude/solutions/

Search by tag

Search by tag

grep -rl "tags:.*preload" .claude/solutions/
grep -rl "tags:.*preload" .claude/solutions/

Search by component

Search by component

grep -rl "component: ecto" .claude/solutions/
undefined
grep -rl "component: ecto" .claude/solutions/
undefined

Integration

集成

  • /phx:compound
    creates solution docs here
  • /phx:investigate
    searches here before debugging
  • /phx:plan
    consults for known risks
  • learn-from-fix
    feeds into this system
  • /phx:compound
    会在此处创建解决方案文档
  • /phx:investigate
    会在调试前先在此处搜索
  • /phx:plan
    会参考此处内容识别已知风险
  • learn-from-fix
    会将内容同步到此系统中

References

参考资料

  • references/schema.md
    — YAML frontmatter validation schema
  • references/resolution-template.md
    — Full solution template
  • references/schema.md
    — YAML前置元数据验证 schema
  • references/resolution-template.md
    — 完整解决方案模板