name: 复合文档 description: 可搜索的解决方案文档系统,使用YAML frontmatter。从已解决的问题中构建机构知识。在调查新问题前主动查阅过去的解决方案。 user-invocable: false
复合文档 — 制度知识库
可搜索、分类的解决方案文档,使每次调试会话都比上次更容易。
目录结构
.claude/solutions/
├── ecto-issues/
├── liveview-issues/
├── oban-issues/
├── otp-issues/
├── security-issues/
├── testing-issues/
├── phoenix-issues/
├── deployment-issues/
├── performance-issues/
└── build-issues/
铁律
- 始终在调查前搜索解决方案 — 在调试前检查
.claude/solutions/中的现有修复 - YAML frontmatter 是强制性的 — 每个解决方案都需要根据
references/schema.md验证的元数据 - 每个文件一个问题 — 永远不要合并多个解决方案
- 包括预防措施 — 每个解决方案都记录如何防止复发
解决方案文件格式
---
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]
---
# 用户帖子关联未加载
## 症状
在过滤后的UserListLive中访问user.posts时引发Ecto.Association.NotLoaded。
## 根本原因
Accounts上下文中的查询缺少对:posts的preload。
## 解决方案
在`list_users/1`中添加`Repo.preload(:posts)`。
## 预防
在发布列表视图前使用n1检查技能。
搜索解决方案
# 按症状搜索
grep -rl "NotLoaded" .claude/solutions/
# 按标签搜索
grep -rl "tags:.*preload" .claude/solutions/
# 按组件搜索
grep -rl "component: ecto" .claude/solutions/
集成
/phx:compound在此创建解决方案文档/phx:investigate在调试前在此搜索/phx:plan为已知风险咨询learn-from-fix反馈到此系统
参考文献
references/schema.md— YAML frontmatter验证模式references/resolution-template.md— 完整解决方案模板