From charon-fan-agent-playbook
Designs technical solutions and architectures by clarifying requirements, analyzing codebases, proposing designs with trade-offs, and generating PRD markdown in project docs/ folder.
npx claudepluginhub zhaono1/agent-playbookThis skill is limited to using the following tools:
Analyzes requirements and creates detailed PRD documents for software implementation.
Creates structured PRDs via 4-file persistent planning (notes, task-plan, prd, tech-md). Activates on explicit PRD, product requirements document, or 产品需求文档 mentions.
Guides architecture design via Socratic questioning, generates technical docs like overview.md, domain-model.md, and ADR for new features, systems, or project structuring.
Refines rough ideas into fully-formed designs via phased process: Socratic questioning for understanding, alternative exploration with trade-offs, and incremental validation before coding.
Share bugs, ideas, or general feedback.
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 imports/usages of a module
grep -r "useFeatureContext" packages/ --include="*.ts" --include="*.tsx"
grep -r "refreshSignalRef" 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 pending request count decrease
- Changes: 1-2 files
- Risk: Low
- Selected: ✓
Option 2 (Medium): Add refresh callback through existing shared context
- Changes: 3-5 files
- Risk: Medium
Option 3 (Comprehensive): Migrate to a centralized state-store 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.mddata-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., isAdvancedMode ? useHook() : null)
Ref usage is correct: If using ref pattern, access via .current
useFeatureActions().current not useFeatureActions()# Must verify: Each page that uses the context has the Provider wrapper
EContextStoreNames)| 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 the state layer" | "Migrate from Context+Ref to a centralized store: " |
| 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() → Dashboard focused
→ usePromiseResult (revalidateOnFocus: true) fires
→ refreshItems() → handleRefresh()
→ fetchItems() + refreshSummary() + refreshMetrics()
Include file paths and line numbers for each step!
If module has 5 operations (Create/Edit/Delete/Import/Export), test all 5. Don't just test the 2 you're focused on.
Draw out the timeline:
0s ---- Modal opens, user starts Edit
10s ---- Action submitted, pending: 0→1
15s ---- Modal closes
└─ Dashboard 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 Create/Edit | Also test Delete/Import/Export |
| 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) |