architecting-solutions by charon-fan/agent-playbook
npx skills add https://github.com/charon-fan/agent-playbook --skill architecting-solutions分析需求并为软件实现创建详细的 PRD 文档。
在以下情况下使用此技能:
此技能通常全局安装在 ~/.claude/skills/architecting-solutions/。
该技能引导 Claude 完成结构化工作流程:
{PROJECT_ROOT}/docs/ 目录重要提示:始终将 PRD 写入项目的 docs/ 文件夹,切勿写入计划文件或隐藏位置。
复制此清单并跟踪进度:
Requirements Analysis:
- [ ] Step 1: Clarify user intent and success criteria
- [ ] Step 2: Identify constraints (tech stack, timeline, resources)
- [ ] Step 3: Analyze existing codebase patterns
- [ ] Step 4: Research best practices (if needed)
- [ ] Step 5: Design solution architecture
- [ ] Step 6: Generate PRD document (must be in {PROJECT_ROOT}/docs/)
- [ ] Step 7: Validate with user
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
提出以下问题以理解问题:
# Find similar patterns in the codebase
grep -r "related_keyword" packages/ --include="*.ts" --include="*.tsx"
# Find relevant directory structures
find packages/ -type d -name "*keyword*"
# Check existing patterns
ls -la packages/kit/src/views/similar-feature/
重构关键点:
查找被更改代码的所有使用者
识别所有状态/数据流
追踪所有入口点和出口点
寻找可能已解决问题的现有机制
grep -r "useBorrowContext" packages/ --include=".ts" --include=".tsx" grep -r "borrowRefreshReservesRef" packages/ --include=".ts" --include=".tsx"
关键:在提出重构之前,请询问:
寻找:
对于不熟悉的领域,搜索最佳实践。
在确定解决方案之前,始终提出多个选项:
示例:
Problem: Data doesn't refresh after operation
Option 1 (Minimal): Hook into existing pendingTx count decrease
- Changes: 1-2 files
- Risk: Low
- Selected: ✓
Option 2 (Medium): Add refresh callback through existing context
- Changes: 3-5 files
- Risk: Medium
Option 3 (Comprehensive): Migrate to Jotai Context pattern
- Changes: 10+ files, new atoms/actions
- Risk: High
- Time: 2-3 days
在编写 PRD 之前询问用户:
对于每个重大决策,记录:
| 选项 | 优点 | 缺点 | 已选 |
|---|---|---|---|
| 方法 A | 优点1, 优点2 | 缺点1 | ✓ |
| 方法 B | 优点1 | 缺点1, 缺点2 |
重要提示:始终将 PRD 写入项目的 docs/ 目录,切勿写入计划文件或隐藏位置。
输出位置:{PROJECT_ROOT}/docs/{feature-name}-prd.md
示例:
/Users/user/my-project/,则写入 /Users/user/my-project/docs/feature-name-prd.mdborrow-refresh-logic-refactoring-prd.md在最终确定之前:
对于错误和刷新问题,始终验证:
onRefresh,它是否实际实现了?常见的根本原因错误:
revalidateOnFocus 需要实际的焦点变化)所有现有状态都已考虑:列出正在迁移的每个状态片段
所有使用者都已识别:查找使用被更改代码的每个文件
# Must run: grep -r "import.*ModuleName" packages/
# Must run: grep -r "useHookName" packages/
Provider 使用点已覆盖:使用 Provider 的每个文件都已更新
无条件钩子:切勿有条件地调用钩子(例如,isBorrowType ? useHook() : null)
Ref 使用正确:如果使用 ref 模式,通过 .current 访问
useBorrowActions().current 而不是 useBorrowActions()根 Provider 已定义:主 Provider 组件存在
镜像 Provider 已定义:用于模态/覆盖上下文的镜像 Provider 存在
所有使用点已包装:使用 provider 的每个页面/组件都已包装
# Must verify: Each page that uses the context has the Provider wrapper
EJotaiContextStoreNames)| 反模式 | 更好的方法 |
|---|---|
| "优化代码" | "通过记忆化昂贵计算,将渲染时间从 100ms 减少到 16ms" |
| "使其更快" | "实现缓存,将会话的 API 调用从 5 次减少到 1 次" |
| "清理代码" | "将重复逻辑提取到共享实用函数中" |
| "修复错误" | "在用户不存在时处理 getUserById 中的空值情况" |
| "重构以使用 Jotai" | "从 Context+Ref 迁移到 Jotai:" |
| 过度工程 | 从最简单的解决方案开始,仅在需要时扩展 |
真实案例研究:
关键:全面解决方案应该是一种选择,而不是默认。
1. Read similar feature implementations
2. Identify reusable patterns
3. Design component hierarchy
4. Define state management approach
5. Specify API integration points
6. List all new files to create
7. List all existing files to modify
1. Analyze current implementation
2. Find ALL consumers (grep -r imports)
3. Identify pain points and technical debt
4. PROPOSE MULTIPLE SOLUTIONS (minimal → comprehensive)
5. GET USER APPROVAL on approach
6. Plan migration strategy (phased vs big-bang)
7. Define rollback approach
8. List migration checklist
# CRITICAL: Start with the simplest solution!
# Only propose comprehensive refactoring if user explicitly wants it.
1. Understand expected vs actual behavior
2. Locate root cause in code
3. Identify affected areas
4. Design fix approach
5. Specify testing for regression prevention
docs/ 文件夹中的现有 PRD| 错误 | 正确 | 原因 |
|---|---|---|
| "共享状态" | "每个实例独立轮询" | 除非显式连接,否则钩子不共享状态 |
| "待处理更改" | "待处理计数减少" | 代码检查 !isPending && prevIsPending(真→假) |
| "触发刷新" | "调用 navigation.goBack(),从而触发..." | 展示完整链 |
差:"onRefresh 触发数据刷新" 好:
onRefresh() → navigation.goBack() → BorrowHome focused
→ usePromiseResult (revalidateOnFocus: true) fires
→ refreshReserves() → handleRefresh()
→ fetchReserves() + refreshBorrowRewards() + refreshHealthFactor()
为每个步骤包含文件路径和行号!
如果模块有 5 个操作(Supply/Withdraw/Borrow/Repay/Claim),测试所有 5 个。不要只测试你关注的 2 个。
绘制时间线:
0s ---- Modal opens, user starts Supply
10s ---- Transaction submitted, pending: 0→1
15s ---- Modal closes
└─ BorrowHome's hook last polled at 5s
└─ Next poll at 35s (25s away!) ❌
这展示了它为何无效。
| 错误 | 示例 | 修复 |
|---|---|---|
| 空回调 | onRefresh: () => {} | 实现实际逻辑或移除 |
| 不完整的根本原因 | "它不刷新" | 解释原因:时机/范围/断开连接 |
| 缺少调用链 | "以某种方式触发刷新" | 用 file:line 记录每个步骤 |
| 不完整的测试 | 只测试 Supply/Withdraw | 还要测试 Borrow/Repay/Claim |
| 假设作为事实 | "revalidateOnFocus 在模态关闭时触发" | 验证:仅在发生实际焦点变化时触发 |
| 错误的触发条件 | "待处理更改" | 代码显示:!isPending && prevIsPending(减少) |
每周安装次数
70
仓库
GitHub 星标数
11
首次出现
2026年1月22日
安全审计
已安装于
opencode57
codex57
gemini-cli56
cursor54
github-copilot50
amp46
Analyzes requirements and creates detailed PRD documents for software implementation.
Use this skill when you need to:
This skill is typically installed globally at ~/.claude/skills/architecting-solutions/.
The skill guides Claude through a structured workflow:
{PROJECT_ROOT}/docs/ directoryIMPORTANT : Always write PRD to the project's docs/ folder, never to plan files or hidden locations.
Copy this checklist and track progress:
Requirements Analysis:
- [ ] Step 1: Clarify user intent and success criteria
- [ ] Step 2: Identify constraints (tech stack, timeline, resources)
- [ ] Step 3: Analyze existing codebase patterns
- [ ] Step 4: Research best practices (if needed)
- [ ] Step 5: Design solution architecture
- [ ] Step 6: Generate PRD document (must be in {PROJECT_ROOT}/docs/)
- [ ] Step 7: Validate with user
Ask these questions to understand the problem:
# Find similar patterns in the codebase
grep -r "related_keyword" packages/ --include="*.ts" --include="*.tsx"
# Find relevant directory structures
find packages/ -type d -name "*keyword*"
# Check existing patterns
ls -la packages/kit/src/views/similar-feature/
Critical for Refactoring:
Find ALL consumers of the code being changed
Identify ALL state/data flows
Trace ALL entry points and exit points
Look for existing mechanisms that might solve the problem already
grep -r "useBorrowContext" packages/ --include=".ts" --include=".tsx" grep -r "borrowRefreshReservesRef" packages/ --include=".ts" --include=".tsx"
CRITICAL: Before proposing a refactoring, ask:
Look for:
For unfamiliar domains, search for best practices.
Before settling on a solution, ALWAYS present multiple options:
Example:
Problem: Data doesn't refresh after operation
Option 1 (Minimal): Hook into existing pendingTx count decrease
- Changes: 1-2 files
- Risk: Low
- Selected: ✓
Option 2 (Medium): Add refresh callback through existing context
- Changes: 3-5 files
- Risk: Medium
Option 3 (Comprehensive): Migrate to Jotai Context pattern
- Changes: 10+ files, new atoms/actions
- Risk: High
- Time: 2-3 days
Ask user BEFORE writing PRD:
For each major decision, document:
| Option | Pros | Cons | Selected |
|---|---|---|---|
| Approach A | Pro1, Pro2 | Con1 | ✓ |
| Approach B | Pro1 | Con1, Con2 |
IMPORTANT : Always write PRD to the project's docs/ directory, never to plan files or hidden locations.
Output location: {PROJECT_ROOT}/docs/{feature-name}-prd.md
Example:
/Users/user/my-project/, write to /Users/user/my-project/docs/feature-name-prd.mdborrow-refresh-logic-refactoring-prd.mdBefore finalizing:
For bugs and refresh issues, ALWAYS verify:
onRefresh is provided, is it actually implemented?Common Root Cause Mistakes :
revalidateOnFocus requires actual focus change)ALL existing state is accounted for : List every piece of state being migrated
ALL consumers are identified : Find every file that uses the code being changed
# Must run: grep -r "import.*ModuleName" packages/
# Must run: grep -r "useHookName" packages/
Provider usage points are covered : Every file using the Provider is updated
No conditional hooks : Never call hooks conditionally (e.g., isBorrowType ? useHook() : null)
Ref usage is correct : If using ref pattern, access via .current
useBorrowActions().current not useBorrowActions()Root Provider is defined : Main Provider component exists
Mirror Provider is defined : Mirror Provider for modal/overlay contexts exists
All usage points wrapped : Every page/component using the provider is wrapped
# Must verify: Each page that uses the context has the Provider wrapper
EJotaiContextStoreNames)| Anti-Pattern | Better Approach |
|---|---|
| "Optimize the code" | "Reduce render time from 100ms to 16ms by memoizing expensive calculations" |
| "Make it faster" | "Implement caching to reduce API calls from 5 to 1 per session" |
| "Clean up the code" | "Extract duplicate logic into shared utility functions" |
| "Fix the bug" | "Handle null case in getUserById when user doesn't exist" |
| "Refactor to use Jotai" | "Migrate from Context+Ref to Jotai: " |
| Over-engineering | Start with simplest solution, extend only if needed |
Real Case Study:
Key : Comprehensive solutions should be a CHOICE, not the DEFAULT.
1. Read similar feature implementations
2. Identify reusable patterns
3. Design component hierarchy
4. Define state management approach
5. Specify API integration points
6. List all new files to create
7. List all existing files to modify
1. Analyze current implementation
2. Find ALL consumers (grep -r imports)
3. Identify pain points and technical debt
4. PROPOSE MULTIPLE SOLUTIONS (minimal → comprehensive)
5. GET USER APPROVAL on approach
6. Plan migration strategy (phased vs big-bang)
7. Define rollback approach
8. List migration checklist
# CRITICAL: Start with the simplest solution!
# Only propose comprehensive refactoring if user explicitly wants it.
1. Understand expected vs actual behavior
2. Locate root cause in code
3. Identify affected areas
4. Design fix approach
5. Specify testing for regression prevention
docs/ folder| Wrong | Correct | Why |
|---|---|---|
| "Shared state" | "Each instance polls independently" | Hooks don't share state unless explicitly connected |
| "Pending changes" | "Pending count decreases" | Code checks !isPending && prevIsPending (true→false) |
| "Triggers refresh" | "Calls navigation.goBack() which triggers..." | Show the complete chain |
Bad : "onRefresh triggers data refresh" Good :
onRefresh() → navigation.goBack() → BorrowHome focused
→ usePromiseResult (revalidateOnFocus: true) fires
→ refreshReserves() → handleRefresh()
→ fetchReserves() + refreshBorrowRewards() + refreshHealthFactor()
Include file paths and line numbers for each step!
If module has 5 operations (Supply/Withdraw/Borrow/Repay/Claim), test all 5. Don't just test the 2 you're focused on.
Draw out the timeline:
0s ---- Modal opens, user starts Supply
10s ---- Transaction submitted, pending: 0→1
15s ---- Modal closes
└─ BorrowHome's hook last polled at 5s
└─ Next poll at 35s (25s away!) ❌
This shows WHY it doesn't work.
| Mistake | Example | Fix |
|---|---|---|
| Empty callback | onRefresh: () => {} | Implement actual logic or remove |
| Incomplete root cause | "It doesn't refresh" | Explain WHY: timing/scope/disconnected |
| Missing call chain | "Somehow triggers refresh" | Document every step with file:line |
| Incomplete testing | Only test Supply/Withdraw | Also test Borrow/Repay/Claim |
| Assumptions as facts | "revalidateOnFocus fires on modal close" | Verify: only fires on actual focus change |
| Wrong trigger condition | "Pending changes" | Code shows: !isPending && prevIsPending (decreases) |
Weekly Installs
70
Repository
GitHub Stars
11
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode57
codex57
gemini-cli56
cursor54
github-copilot50
amp46
API设计指南:REST/GraphQL设计原则、规范文档与版本控制策略
11,500 周安装