Designs technical solutions and architecture. Use when user says "design solution", "architecture design", "technical design", or "方案设计" WITHOUT mentioning PRD...
Analyzes requirements and creates technical solution documents for software implementation.
Use this skill when you need to:
Install through apb skills add ./skills/architecting-solutions --scope global --target all --link when possible.
The skill guides Claude through a structured workflow:
{PROJECT_ROOT}/docs/IMPORTANT: Use prd-planner when the user asks for a PRD. This skill writes non-PRD architecture and solution artifacts to the project's docs/ folder.
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 solution 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" src/ --include="*.ts" --include="*.tsx"
# Find relevant directory structures
find . -type d -name "*keyword*"
# Check existing patterns
find src -maxdepth 4 -type d -name '*similar*'
Critical for Refactoring:
# Find all imports/usages of a module
grep -r "existing-interface" src/ --include="*.ts" --include="*.tsx"
grep -r "related-event" src/ --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 the solution document:
For each major decision, document:
| Option | Pros | Cons | Selected |
|---|---|---|---|
| Approach A | Pro1, Pro2 | Con1 | ✓ |
| Approach B | Pro1 | Con1, Con2 |
IMPORTANT: Always write the solution document to the project's docs/ directory, never to plan files or hidden locations. Use prd-planner instead when the requested artifact is a PRD.
Output location: {PROJECT_ROOT}/docs/{feature-name}-solution.md
Example:
/Users/user/my-project/, write to /Users/user/my-project/docs/feature-name-solution.mddata-refresh-logic-refactoring-solution.mdBefore finalizing:
For bugs, state, refresh, or lifecycle issues, verify:
Common mistakes include assuming separate instances share state, leaving inert callbacks, checking only the first link in a chain, and confusing an event's registration with proof that it fired.
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
rg -n "ModuleName|PublicInterfaceName" .
Dependency usage points are covered: Every consumer of the changed interface is identified
| 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 |
Illustrative lesson: A request to refresh after an operation completes may need only an existing completion signal, not a new shared state subsystem. Trace the current lifecycle before proposing a broader abstraction.
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) |