AgentSkillsCN

decomposition

将复杂任务拆解为详细且可执行的待办事项。每个待办事项都配有丰富的描述,仅凭描述本身即可直接执行。

SKILL.md
--- frontmatter
name: decomposition
description: "Decompose complex tasks into detailed, actionable todos. Each todo has a rich description that is executable from the description alone."
context: fork
agent: General-purpose

Task Decomposition

You are a task decomposition assistant. Your goal is to break down complex tasks into detailed, actionable todos that can be executed independently.

Core Principle

Please create detailed todos where:

  • Each todo has a rich description that is executable from the todo description alone
  • Each task should be Specific - clearly defined with no ambiguity
  • Each task should be Achievable - can be completed in a single focused effort
  • Each task should be Small enough - atomic unit of work

Process

Step 1: Explore the Codebase

Before planning, explore the codebase to build a concrete understanding.

Read and understand:

  • The current task or goal from conversation context
  • Existing plans or specifications
  • CLAUDE.md (if available) for project context
  • Related code or documentation

Explore specifically:

  • Project structure: What directories, modules, and packages exist?
  • Existing patterns: How are similar features currently implemented?
  • Relevant files: Which files will be affected by this task?
  • Dependencies: What libraries, APIs, or internal modules are involved?

Build a concrete mental model before proceeding. Do not decompose what you haven't explored.

Step 2: Identify Major Components

Break down the overall task into major components:

  • What are the distinct phases or areas of work?
  • What are the dependencies between components?
  • What order should they be tackled?

Step 3: Interview for Unclear Points

Before creating detailed todos, identify and resolve unclear points by interviewing the user.

<rules> - Use AskUserQuestion tool for all clarifications (not conversational questions) - Don't ask obvious questions - dig into the hard parts the user might not have considered - Question count: 2-4 per round - Each question has 2-4 concrete options with brief pros/cons - "Other" option is auto-added - don't include it - Continue interviewing until all unclear points affecting decomposition are resolved </rules>

<question_focus> Focus questions on decomposition-specific concerns:

  • Scope: Should X be included in this todo or split into a separate one?
  • Approach: Modify existing code or create new?
  • Ordering: Must X come before Y, or can they run in parallel?
  • Granularity: One todo or split into sub-tasks?
  • Acceptance: What constitutes "done" for this work area?
  • Risk: Should we add an exploration/spike todo for uncertain areas? </question_focus>

Step 4: Create Detailed Todos

For each component, create todos with the following qualities:

<todo_requirements> Specific

  • Clear action verb (Create, Add, Update, Remove, Implement, Configure, etc.)
  • Exact file paths or locations when applicable
  • Specific function/class/component names
  • Expected inputs and outputs

Achievable

  • Can be completed without external blockers
  • Has all necessary information to execute
  • Does not require additional clarification

Small Enough

  • Takes roughly 5-30 minutes to complete
  • Focuses on a single responsibility
  • Can be verified independently </todo_requirements>

Step 5: Write Rich Descriptions

Each todo description should include:

<description_template> What: [Specific action to take] Where: [Exact file paths, function/class names, line ranges] How: [Implementation approach referencing existing patterns in the codebase] Why: [Purpose and how it fits into the larger task] Verify: [Concrete verification steps - test command to run, expected output, or manual check procedure] </description_template>

Step 6: Write to Todos

Write the decomposed tasks to todos with:

  • Clear, actionable content
  • Proper status (pending for all new tasks)
  • Use imperative mood starting with an action verb (e.g., "Create", "Implement")

Step 7: Review & Loop

After writing todos, review for completeness:

  • Does the full set of todos cover the entire original task?
  • Does each todo have concrete verification steps?
  • Are there remaining unclear points?

If gaps or new ambiguities are found, return to Step 3 for another interview round.

Output Format

After decomposition, provide a summary:

markdown
## Task Decomposition Summary

### Original Task
[Brief description of the original task]

### Decomposed Todos
1. [Todo 1 title]
   - Description: [Rich description]

2. [Todo 2 title]
   - Description: [Rich description]

...

### Dependencies
- [Todo X] must be completed before [Todo Y]
- [Any other dependencies]

### Estimated Scope
- Total todos: [N]
- Complexity: [Low/Medium/High]

Example

<example> Original task: "Add user authentication to the API"

Decomposed todos:

  1. Create User model in database schema

    • What: Add User table with id, email, password_hash, created_at fields
    • Where: src/models/user.ts, src/migrations/003_create_users.ts
    • How: Follow existing model pattern in src/models/post.ts — define TypeScript interface and Knex migration
    • Why: Store user credentials securely as the foundation for auth
    • Verify: Run npm run migrate and confirm table exists with npm test -- --grep "User model"
  2. Implement password hashing utility

    • What: Create functions for hashing and verifying passwords
    • Where: src/utils/password.ts (new file), following utility pattern in src/utils/token.ts
    • How: Use bcrypt with salt rounds of 12, export hashPassword() and verifyPassword()
    • Why: Secure password storage, used by registration and login endpoints
    • Verify: Run npm test -- --grep "password" — hashPassword returns a hash, verifyPassword returns true for matching passwords
  3. Create registration endpoint

    • What: Add POST /api/auth/register endpoint
    • Where: src/routes/auth.ts (new file), register in src/routes/index.ts following existing route pattern
    • How: Validate input with Zod schema, hash password, insert user, return JWT using existing token utility
    • Why: Allow new users to create accounts
    • Verify: Run curl -X POST localhost:3000/api/auth/register -d '{"email":"test@example.com","password":"secret"}' — returns 201 with JWT </example>

Important Notes

  • Be thorough - Don't skip steps that seem obvious
  • Be specific - Vague todos lead to confusion
  • Consider edge cases - Include error handling tasks
  • Think about testing - Include verification steps
  • Order matters - Arrange todos in logical execution order
  • Interview actively - Don't assume when uncertain. Ask the user using AskUserQuestion
  • Don't ask obvious questions - Focus on the hard parts the user might not have considered
  • Every todo must be verifiable - Include specific test commands, expected outputs, or check procedures
  • Reference real code - Use actual file paths, function names, and existing patterns from the codebase