Feature Build Skill
Orchestrates the complete feature development lifecycle with clear phases, entry/exit criteria, and conversation loop patterns. This skill transforms feature requests into shipped, tested, and documented code.
Philosophy
Core Principles
-
Acceptance Criteria First — Define what "done" looks like before writing code. Testable criteria prevent scope creep and enable verification.
-
Components Live in Style Guide — Every UI component starts in the style-guide page. This ensures reusability, documents all states, and provides a living reference.
-
Test What You Build — Use browser tools to verify each step. Don't wait until the end to discover issues.
-
KISS (Keep It Simple, Stupid) — Implement the simplest solution that meets the criteria. Avoid over-engineering.
-
Loop Back, Don't Push Forward — When something doesn't work, return to the appropriate phase rather than patching around issues.
Conversation Loop Model
Features are built through phases that can loop back when issues arise:
┌─────────────────────────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ Task │──▶│Component │──▶│ Build │──▶│ Analytics │ │
│ │Selection │ │ Design │ │ Loop │ │ Setup │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
│ ▲ │ │ │ │
│ │ ▼ ▼ ▼ │
│ │ ◀────────────◀─────────────────────────────────│
│ │ (loop back if criteria fail) │
│ │ │
│ │ ┌──────────────┐ │
│ └─────────────────────────────────────│ Commit & │◀──│
│ (next feature) │ Document │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Relationship to Other Skills
- design-system — Reference for UI patterns, component design principles, style-guide template
- feature-gating — Use when building pro/freemium features with PostHog flags
- versioning — Follow semantic versioning for releases
Phase 1: Task Selection
Entry Criteria
- Fresh conversation or user requests a feature
- TASKS.md exists in project
Actions
-
Read TASKS.md — Identify the next item from Current Sprint
Read TASKS.md and identify the next unchecked item in Current Sprint
-
Confirm Scope — Clarify with user what's included and excluded
- What exactly should this feature do?
- What should it NOT do?
- Are there edge cases to consider?
-
Break Down if Complex — Split large features into sub-tasks
- Each sub-task should be completable in one conversation
- Sub-tasks should have clear dependencies
-
Define Acceptance Criteria — Write testable criteria
markdown
1### Feature: [Name]
2
3**Acceptance Criteria:**
4- [ ] User can [specific action]
5- [ ] System [specific behavior] when [condition]
6- [ ] Error case: [scenario] displays [message]
7- [ ] Mobile: [behavior] works on viewport < 768px
Exit Criteria
Phase 2: Component Design
Entry Criteria
- Feature scope is clear
- Acceptance criteria are defined
Actions
-
Check Style Guide First — Look for existing components that can be reused or extended
Navigate to /style-guide and snapshot to see existing components
-
Design in Style Guide — Build new components in the style-guide page
- Components should be isolated and reusable
- Import from
components/ui/ barrel file
- Export new components from barrel file
-
Show All States — Document every component state:
- Default/resting
- Hover/focus
- Loading/pending
- Success/complete
- Error/invalid
- Disabled
- Empty (if applicable)
-
Mobile Considerations — Test responsive behavior
- Use PhoneFrame component for mobile mockups if available
- Consider touch targets (min 44px)
Style Guide Section Template
tsx
1<section id="my-component">
2 <SectionHeader title="My Component" />
3
4 <div className="space-y-6">
5 <h4 className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
6 Variants
7 </h4>
8 <div className="flex flex-wrap gap-3">
9 <MyComponent variant="default" />
10 <MyComponent variant="secondary" />
11 </div>
12
13 <h4 className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
14 States
15 </h4>
16 <div className="flex flex-wrap gap-3">
17 <MyComponent loading />
18 <MyComponent disabled />
19 <MyComponent error="Error message" />
20 </div>
21 </div>
22</section>
Exit Criteria
Phase 3: Build Loop
Entry Criteria
- Components designed and in style-guide
- Acceptance criteria ready for testing
Actions
3.1 Backend First
Build data layer and API before wiring to UI:
- Database schema — Add migrations if needed
- Service layer — Business logic functions
- API routes — REST endpoints with Zod validation
- Test API — Use browser network panel or curl to verify
3.2 Frontend Integration
Wire components to backend:
- State management — Zustand store or React state
- API hooks — Data fetching with proper loading/error states
- Component wiring — Connect UI to state and actions
3.3 Browser Testing
Test at each step using Cursor browser tools:
1. Navigate to the page being tested
2. Snapshot to get element references
3. Interact with elements (click, type, etc.)
4. Re-snapshot after state changes
5. Verify expected behavior
6. Screenshot if visual verification needed
See references/testing-patterns.md for detailed testing scenarios.
Testing Checklist by Component Type
Forms:
Lists/Tables:
Modals/Dialogs:
Navigation:
Loop Back Triggers
Return to Phase 2 if:
- Component needs additional states not designed
- UI pattern isn't working as expected
- Need to refactor component API
Return to Phase 1 if:
- Scope is unclear or expanding
- Acceptance criteria need revision
- Feature should be split differently
Exit Criteria
Phase 4: Analytics Setup
Entry Criteria
- Feature is working in browser
- All acceptance criteria pass
Actions
-
Identify Tracking Needs — What user actions matter?
| Feature Type | Typical Events |
|---|
| Form | {form}_submitted, {form}_error |
| Feature | {feature}_used, {feature}_completed |
| Navigation | {page}_viewed |
| Pro Feature | {feature}_attempted, {feature}_upgrade_shown |
-
Implement Events — Add PostHog capture calls
typescript
1posthog.capture('{feature}_{action}', {
2 feature: 'feature-name',
3 // action-specific properties
4})
-
Create Dashboard (if appropriate) — Use PostHog MCP tools
Use mcp_posthog-study-bible_dashboard-create for new dashboards
Use mcp_posthog-study-bible_insight-create-from-query for insights
-
Pro Features — If feature is gated, follow feature-gating skill:
- Create PostHog feature flag
- Implement
useProFeature() hook
- Track
_attempted, _upgrade_shown, _upgrade_clicked events
Event Naming Convention
{feature}_{action}
Examples:
- notes_created
- notes_synced
- chat_message_sent
- upgrade_modal_shown
- model_changed
Exit Criteria
Phase 5: Commit & Document
Entry Criteria
- Feature complete and tested
- Analytics implemented
Actions
-
Update TASKS.md
- Move completed items to Completed section
- Add completion date
- Check off sub-tasks
- Add any new backlog items discovered
-
Update CHANGELOG.md
- Add entry under current version or "Unreleased"
- Summarize what was added/changed/fixed
- Reference any breaking changes
-
Stage and Commit
- Use conventional commit format
- Keep commits atomic (one logical change per commit)
<type>(<scope>): <subject>
Types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert
Commit Summary Block
Provide at end of feature for easy copy-paste:
markdown
1### Done
2
3**Summary**: [Brief description of what was built]
4
5**Commits** (ohmyzsh):
6gaa && gcmsg "feat(scope): add feature description"
7gcmsg "fix(scope): fix related issue"
8gp
TASKS.md Update Pattern
markdown
1## Completed
2
3- [x] Feature name (YYYY-MM-DD)
4 - [x] Sub-task 1 ✓
5 - [x] Sub-task 2 ✓
6 - [x] Sub-task 3 ✓
Exit Criteria
Quick Reference
Phase Entry/Exit Summary
| Phase | Entry | Exit |
|---|
| 1. Task Selection | Feature request | Criteria defined |
| 2. Component Design | Criteria clear | Components in style-guide |
| 3. Build Loop | Components ready | All criteria pass |
| 4. Analytics | Feature working | Events instrumented |
| 5. Commit | Analytics done | Docs updated, committed |
Common Commands
bash
1# Start dev server
2npm run dev
3
4# Clear Next.js cache if issues
5rm -rf .next
6
7# Rebuild native modules
8npm rebuild better-sqlite3
9
10# Git workflow (ohmyzsh)
11gaa && gcmsg "feat(scope): description"
12gp
Browser Testing Quick Reference
1. mcp_cursor-ide-browser_browser_navigate → load page
2. mcp_cursor-ide-browser_browser_snapshot → get elements
3. mcp_cursor-ide-browser_browser_click/type → interact
4. mcp_cursor-ide-browser_browser_snapshot → verify changes
5. mcp_cursor-ide-browser_browser_take_screenshot → visual check