AgentSkillsCN

adaptive-workflow

当用户请求实现功能、进行重构,或开展多步骤开发任务时,此技能会自动激活。它根据 ADR 0008 实施自适应的两阶段规划,并在每项任务完成后进行重新评估与审批检查。

SKILL.md
--- frontmatter
name: adaptive-workflow
description: Automatically activate when user requests feature implementation, refactoring, or multi-step development tasks. Implements adaptive two-phase planning from ADR 0008 with per-task re-assessment and approval checkpoints.
allowed-tools: Read, Glob, Grep, Task, TodoWrite, Edit, Write

Adaptive Two-Phase Planning Workflow

<!-- This skill implements ADR 0008 and ADR 0009's adaptive workflow pattern. Auto-activates when user says things like: - "Implement [feature]" - "Add [functionality]" - "Build [system]" - "Refactor [code]" - "Create [component]" IMPORTANT: This skill CANNOT run git commands or make commits. Commits are FORBIDDEN unless user explicitly confirms and runs /commit command. -->

When this skill activates, follow ADR 0008's workflow pattern:

Phase 1: Initial Planning (Plan Mode)

  1. Explore the codebase

    • Use Task tool with Explore subagent for thorough analysis
    • Identify relevant files, patterns, and dependencies
    • Understand current architecture and constraints
  2. Create a roadmap using TodoWrite:

    • Break feature into logical subtasks
    • Identify dependencies between tasks
    • Note expected complexity for each
    • Order tasks to respect dependencies
  3. Present plan to user:

    • Show TodoWrite roadmap
    • Explain overall approach
    • Highlight key architectural decisions
    • Note any potential risks or unknowns
  4. Wait for approval before proceeding

  5. Exit Plan Mode after approval

    • Inform user you're ready to begin implementation
    • Confirm they want to proceed

Phase 2: Per-Task Execution with Re-assessment

For each subtask sequentially:

Step 1: Pre-Implementation Check

Before implementing each task:

  1. Re-assess current codebase state

    • Has anything changed from previous tasks?
    • Do previous implementations affect this task?
    • Are there better approaches now visible?
  2. Choose explanation path:

    • Quick path (if state matches plan):

      • "Proceeding with planned approach: [1-2 sentence summary]"
      • Brief reminder of what you'll do
    • Detailed path (if diverging from plan):

      • Explain what changed in codebase state
      • Describe how this affects the approach
      • Propose adjusted implementation strategy
      • Explain why the adjustment is better
  3. Wait for explicit user approval if:

    • Approach diverges from original plan
    • Task is complex or risky
    • Previous task revealed unexpected complexity

    For simple tasks matching plan, brief confirmation is sufficient.

Step 2: Implementation

  1. Mark task as in_progress in TodoWrite
  2. Implement the code
    • Follow approved approach
    • Write clean, maintainable code
    • Avoid security vulnerabilities (XSS, injection, etc.)
  3. Update TodoWrite as completed immediately after finishing

Step 3: Post-Implementation Summary

After completing implementation:

  1. Summarize what was done:

    • Key changes made
    • Files modified
    • Any deviations from planned approach (and why)
  2. Show overall impact:

    • How this task advances the feature
    • What's now ready for the next task
  3. Wait for explicit user approval before moving to next task

Step 4: Commit Reminder (CRITICAL)

NEVER attempt to commit code. This skill CANNOT access git commands.

After user approves changes:

  1. Remind user: "Ready to commit? Please run /commit when you're ready to commit these changes."
  2. Wait for user to explicitly run the /commit command
  3. Do NOT proceed to next task until user has committed (or explicitly says to continue without committing)

Step 5: Suggest Next Step

  1. Recommend next subtask from roadmap
  2. Note any adjustments needed based on what was learned
  3. Wait for approval to proceed

Optimization Rules

  • Quick approval for straightforward tasks: If everything matches plan and is simple, brief confirmation is enough
  • Detailed discussion for divergence: If discovered complexity, better approach, or changed assumptions, explain thoroughly
  • Always wait for approval: Before implementation starts and before suggesting commits
  • One task at a time: Complete current task fully before starting next
  • Adaptive, not rigid: Treat initial plan as roadmap, not contract - adapt when reality differs
  • NO COMMITS EVER: This skill cannot and will not make commits - user must explicitly run /commit

Integration Points

  • Uses Plan Mode for Phase 1 exploration (read-only safety)
  • Uses Task tool with Explore subagent for thorough codebase analysis
  • Uses TodoWrite for task tracking and roadmap management
  • Coordinates with /reassess command for explicit re-assessment
  • User runs /commit command for approval-gated commits
  • Respects approval hooks if configured