The /gsd:plan-phase command transforms a roadmap phase into executable plans. It researches the domain (optional), creates atomic task plans with XML structure, and verifies them against requirements.
When research is enabled, GSD investigates your domain:
Copy
Ask AI
# Phase 2 Research: User Authentication## Stack Investigation### NextAuth.js vs Clerk vs Auth0- NextAuth.js: Self-hosted, flexible, steeper learning curve- Clerk: Managed, beautiful UI, higher cost at scale- Auth0: Enterprise-grade, complex pricing, overkill for MVPRecommendation: NextAuth.js for cost control and flexibility## Implementation Patterns### Session Strategy- JWT: Stateless, works across services, can't invalidate easily- Database: Stateful, easy invalidation, needs DB queriesRecommendation: Database sessions (REQ-003 needs instant logout)## Common Pitfalls- Don't store passwords in JWT- Use httpOnly cookies (XSS protection)- Implement rate limiting on login endpoint- Hash passwords with bcrypt (min 10 rounds)
Research is saved to .planning/{phase_num}-RESEARCH.md and loaded during planning.
CONTEXT.md guides research. If you said βuse Clerkβ in discuss-phase, research focuses on Clerk best practices instead of comparing auth providers.
The planner agent creates 2-3 atomic plans per phase:
Copy
Ask AI
---phase: 2plan: 1title: User Registration Endpointdependencies: []estimated_tasks: 4---# Plan 01: User Registration Endpoint## GoalImplement secure user registration with email validation and password hashing.## Context- Uses NextAuth with database sessions (from RESEARCH.md)- Reuses database connection from Phase 1- Follow validation patterns from CONTEXT.md## Tasks<task type="auto"> <name>Create user registration API route</name> <files>src/app/api/auth/register/route.ts</files> <action> - Validate email format and password strength - Check for existing user (email unique) - Hash password with bcrypt (12 rounds) - Create user record in database - Return 201 on success, 400/409 on validation errors </action> <verify> POST /api/auth/register with valid data returns 201 POST with duplicate email returns 409 POST with weak password returns 400 </verify> <done> Users can register with email/password Passwords are securely hashed Duplicate emails are rejected </done></task><task type="auto"> <name>Add email validation</name> <files>src/lib/validation.ts</files> <action> - Create email validation function - Check format with regex - Verify domain has MX records (optional, nice-to-have) - Export for reuse across auth routes </action> <verify> validation.ts exports isValidEmail function Rejects invalid formats: no @, no domain, etc. </verify> <done> Email validation reusable across auth system </done></task><task type="auto"> <name>Add password strength validation</name> <files>src/lib/validation.ts</files> <action> - Min 8 chars, one uppercase, one number, one special - Return helpful error messages - Export isValidPassword function </action> <verify> Weak passwords rejected with clear error Strong passwords accepted </verify> <done> Password validation enforces security requirements </done></task><task type="auto"> <name>Write registration integration test</name> <files>tests/api/auth/register.test.ts</files> <action> - Test successful registration flow - Test duplicate email rejection - Test validation errors - Verify password is hashed (not plain text in DB) </action> <verify> npm test tests/api/auth/register.test.ts passes </verify> <done> Registration endpoint fully tested </done></task>
<task type="auto"> <name>Clear, action-oriented name</name> <files>Exact file paths to create/modify</files> <action> Precise instructions: - Use X library (not Y - reason) - Follow Z pattern from existing code - Handle edge case A </action> <verify> How executor agent confirms it works: - Command to run - Expected output </verify> <done> User-facing outcome achieved </done></task>
XML structure is optimized for Claudeβs attention mechanism. Tasks with clear structure get more consistent execution.
After plans are created, the checker agent verifies them:
1
Requirements Coverage
Does the plan achieve all requirements for this phase?
2
Dependency Validity
Are dependencies realistic? Can plans execute in declared order?
3
Atomic Scope
Is each plan small enough to execute in fresh context?
4
Task Clarity
Are actions specific enough to execute without guessing?
5
Verification Feasibility
Can verify steps be executed to confirm success?
If verification fails, the checker provides feedback and the planner iterates:
Copy
Ask AI
β Plan Verification FailedIssue: Plan 02 missing rate limiting (REQ-005 requires it)Feedback:- Add task for rate limiting middleware- Reference redis connection from Phase 1- Verify with load test (100 reqs/sec)Planner will revise plan...
Design for parallelization. Vertical slices (Plan 01: User auth end-to-end) parallelize better than horizontal layers (Plan 01: All models, Plan 02: All APIs).
π Phase 2: User AuthenticationGoal: Secure login and registrationRequirements: REQ-004, REQ-005, REQ-006Checking for existing research...No research found. Starting domain investigation...
2
Research completes
Copy
Ask AI
β Research complete: 02-RESEARCH.mdKey findings:- NextAuth.js recommended for flexibility- Database sessions for instant logout- bcrypt for password hashing (12 rounds)- Rate limiting required for login endpointSpawning planner agent...
β Plan verification passedCoverage:- REQ-004: User registration β- REQ-005: Rate limiting β- REQ-006: Secure sessions βDependencies:- 02-01: No dependencies (Wave 1)- 02-02: No dependencies (Wave 1)- 02-03: Depends on 02-02 (Wave 2)Next steps:- /gsd:execute-phase 2 - Run all plans- /gsd:plan-phase 3 - Plan next phase