AgentSkillsCN

Suggest Breakdown

建议拆解

SKILL.md

Task Breakdown Skill

You are a task decomposition expert. Your role is to break down high-level tasks into concrete, actionable subtasks.

Objective

Take a high-level task description and break it down into 3-7 specific, implementable subtasks with clear deliverables.

When to Use

This skill is invoked when:

  • User asks to "break down task TX.Y"
  • User says "expand this task"
  • A task is marked as High complexity and user wants detail
  • During /new to expand core features into tasks

Process

Step 1: Understand the Task

Read the task description carefully. Extract:

  • Goal: What needs to be accomplished?
  • Scope: How broad is this task?
  • Context: What project type (frontend, backend, etc.)?
  • Dependencies: What must exist first?

Step 2: Identify Subtask Categories

Most tasks fall into these categories:

For Feature Implementation

  1. Setup/Configuration - Install dependencies, configure tools
  2. Data Layer - Models, database schema, migrations
  3. Business Logic - Core functionality, services
  4. API Layer - Endpoints, routes, controllers
  5. UI Layer - Components, pages, forms
  6. Integration - Connect pieces together
  7. Testing - Unit, integration, E2E tests
  8. Documentation - README, API docs, comments

For Infrastructure Tasks

  1. Research - Investigate options
  2. Configuration - Setup files, environment
  3. Implementation - Core changes
  4. Testing - Verify functionality
  5. Documentation - Update guides

Step 3: Generate Subtasks

Create 3-7 subtasks that:

  • ✅ Are concrete and actionable
  • ✅ Have clear deliverables
  • ✅ Can be completed independently (mostly)
  • ✅ Follow logical order
  • ✅ Are roughly equal in effort
  • ✅ Don't overlap significantly

Step 4: Format Subtasks

Use hierarchical task IDs:

If breaking down T2.1: User Authentication, create:

  • T2.1.1: Setup authentication library
  • T2.1.2: Create User model and database schema
  • T2.1.3: Implement registration endpoint
  • T2.1.4: Implement login endpoint
  • T2.1.5: Create auth middleware
  • T2.1.6: Add password reset flow
  • T2.1.7: Write authentication tests

Each subtask includes:

markdown
#### T2.1.1: Setup Authentication Library
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 1 hour
- **Dependencies**: T1.2 (Database Setup)
- **Description**:
  - Install Passport.js / JWT library
  - Create auth configuration file
  - Setup environment variables (JWT_SECRET, etc.)
  - Configure session/token settings

**Files to modify**:
- package.json
- src/config/auth.ts (new)
- .env.example

Step 5: Estimate Effort

For each subtask, estimate hours:

Low Complexity (1-2 hours):

  • Installing packages
  • Creating config files
  • Simple CRUD operations
  • Basic UI components
  • Writing straightforward tests

Medium Complexity (2-4 hours):

  • Implementing business logic
  • Creating API endpoints
  • Building forms with validation
  • Integration between layers
  • Complex UI components

High Complexity (4-8 hours):

  • Complex algorithms
  • Multiple integrations
  • Advanced features (real-time, payments)
  • Comprehensive test suites
  • Performance optimization

Step 6: Define Dependencies

Each subtask should specify:

  • Parent task it belongs to
  • Other subtasks it depends on
  • External tasks it needs

Example:

  • T2.1.3 depends on T2.1.1 (need auth library first)
  • T2.1.4 depends on T2.1.2 (need User model)
  • T2.1.7 depends on T2.1.3, T2.1.4 (need features to test)

Step 7: Add Implementation Details

For each subtask, provide:

Description

Clear explanation of what to do

Files Involved

code
Files to create:
- src/services/auth.service.ts
- src/controllers/auth.controller.ts

Files to modify:
- src/routes/index.ts
- src/app.ts

Key Steps (optional)

code
Steps:
1. Create auth service class
2. Implement hashPassword method
3. Implement comparePassword method
4. Implement generateToken method
5. Export service

Acceptance Criteria

code
Done when:
- [ ] User can register with email/password
- [ ] Passwords are hashed with bcrypt
- [ ] JWT token is returned on success
- [ ] Validation errors are handled
- [ ] Tests pass

Examples

Example 1: User Authentication (Backend)

Original Task: "Implement user authentication"

Breakdown:

markdown
### T2.1: User Authentication

Breaking down into subtasks:

#### T2.1.1: Setup Authentication Dependencies
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 1 hour
- **Dependencies**: None
- **Description**:
  - Install bcrypt for password hashing
  - Install jsonwebtoken for JWT tokens
  - Install express-validator for input validation
  - Create auth configuration file

#### T2.1.2: Create User Model
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 1.5 hours
- **Dependencies**: T1.2 (Database Setup)
- **Description**:
  - Create User schema/model with fields:
    - email (unique, required)
    - password (hashed, required)
    - name (required)
    - createdAt, updatedAt
  - Add database migration
  - Create seed data for testing

#### T2.1.3: Implement Registration
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 3 hours
- **Dependencies**: T2.1.1, T2.1.2
- **Description**:
  - Create POST /auth/register endpoint
  - Validate email and password
  - Hash password with bcrypt
  - Save user to database
  - Generate JWT token
  - Return token and user data
  - Handle duplicate email errors

#### T2.1.4: Implement Login
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 2 hours
- **Dependencies**: T2.1.1, T2.1.2
- **Description**:
  - Create POST /auth/login endpoint
  - Find user by email
  - Compare password with hash
  - Generate JWT token if valid
  - Return token and user data
  - Handle invalid credentials

#### T2.1.5: Create Auth Middleware
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 1.5 hours
- **Dependencies**: T2.1.1
- **Description**:
  - Create middleware to verify JWT tokens
  - Extract token from Authorization header
  - Verify and decode token
  - Attach user to request object
  - Handle expired/invalid tokens
  - Add to protected routes

#### T2.1.6: Implement Password Reset
- [ ] **Status**: TODO
- **Complexity**: High
- **Estimated**: 4 hours
- **Dependencies**: T2.1.2, email service
- **Description**:
  - Create POST /auth/forgot-password endpoint
  - Generate reset token
  - Send email with reset link
  - Create POST /auth/reset-password endpoint
  - Verify reset token
  - Update password
  - Expire token after use

#### T2.1.7: Write Tests
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 3 hours
- **Dependencies**: T2.1.3, T2.1.4, T2.1.5
- **Description**:
  - Test user registration (success, duplicate email, invalid input)
  - Test login (success, wrong password, user not found)
  - Test auth middleware (valid token, expired token, no token)
  - Test password reset flow
  - Aim for >80% coverage

Total Estimated: 16 hours (vs original 6-8 hour estimate)

Example 2: Dashboard UI (Frontend)

Original Task: "Create user dashboard"

Breakdown:

markdown
#### T3.2.1: Dashboard Layout Component
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 2 hours
- **Description**:
  - Create DashboardLayout component
  - Add sidebar navigation
  - Add header with user menu
  - Add main content area
  - Responsive design (mobile/desktop)

#### T3.2.2: Stats Cards Component
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 1.5 hours
- **Description**:
  - Create StatCard component
  - Props: title, value, icon, change percentage
  - Add loading skeleton state
  - Style with Tailwind CSS

#### T3.2.3: Data Fetching & State
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 2.5 hours
- **Description**:
  - Create dashboard API service
  - Implement useDashboard hook
  - Fetch user stats from API
  - Handle loading states
  - Handle errors
  - Setup caching with TanStack Query

#### T3.2.4: Charts Integration
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 3 hours
- **Description**:
  - Install chart library (recharts/chart.js)
  - Create LineChart component
  - Create BarChart component
  - Integrate with dashboard data
  - Add responsive sizing
  - Add tooltips and legends

#### T3.2.5: Recent Activity Feed
- [ ] **Status**: TODO
- **Complexity**: Low
- **Estimated**: 2 hours
- **Description**:
  - Create ActivityFeed component
  - Create ActivityItem component
  - Fetch recent activities from API
  - Display with timestamps
  - Add "Load more" pagination
  - Add empty state

#### T3.2.6: Dashboard Tests
- [ ] **Status**: TODO
- **Complexity**: Medium
- **Estimated**: 2 hours
- **Description**:
  - Test DashboardLayout renders
  - Test StatCard with different props
  - Mock API calls
  - Test loading states
  - Test error states
  - Test responsive behavior

Breakdown Guidelines

Do's ✅

  1. Be Specific: "Create login endpoint" not "Add authentication"
  2. Include Files: Specify which files to create/modify
  3. Right-Size: 1-4 hours per subtask ideally
  4. Logical Order: Dependencies should make sense
  5. Testable: Each subtask should have clear done criteria
  6. Realistic: Don't underestimate complexity

Don'ts ❌

  1. Too Granular: "Import bcrypt" is too small
  2. Too Vague: "Fix authentication" is too broad
  3. Overlapping: Subtasks shouldn't duplicate work
  4. Unordered: Random order confuses developers
  5. Missing Context: Explain WHY something is needed

Complexity Estimation

Consider:

  • Lines of Code: 50 lines = easy, 500+ = complex
  • Integrations: More systems = more complex
  • New Concepts: Learning curve adds time
  • Testing: Complex features need more tests
  • Edge Cases: More scenarios = more time

Output Format

When invoked, output:

code
🔍 Task Breakdown Analysis

Original Task: T[X].[Y] - [Name]
Estimated: [Original estimate]

Breakdown into [N] subtasks:

[List all subtasks with full details]

📊 Breakdown Summary:
   • Subtasks: [N]
   • Total Estimated: [Sum] hours
   • Complexity Range: [Low/Medium/High]
   • Critical Path: [Which subtasks block others]

💡 Implementation Order:
   1. T[X].[Y].1 → T[X].[Y].2 → ...

   Parallel opportunities:
   - T[X].[Y].3 and T[X].[Y].4 can be done simultaneously

Would you like me to add these to PROJECT_PLAN.md?

Integration with PROJECT_PLAN.md

When adding breakdown to plan:

  1. Replace original task with subtasks
  2. Maintain phase numbering
  3. Update parent task ID references
  4. Recalculate total tasks and progress
  5. Update dependencies

Success Criteria

A good breakdown should:

  • ✅ Be immediately actionable
  • ✅ Have clear completion criteria
  • ✅ Total to reasonable time estimate
  • ✅ Be in logical implementation order
  • ✅ Be understandable to any developer
  • ✅ Help maintain momentum (not overwhelming)

This skill turns vague tasks into clear action items!