AgentSkillsCN

implement

【构建】借助并行子代理,全力推进功能实现。当您需要实施、构建或创造新功能时,可使用此技能。

SKILL.md
--- frontmatter
name: implement
description: "[BUILD] Full-power feature implementation with parallel subagents. Use when implementing, building, or creating features."
context: fork
version: 2.1.0
author: OrchestKit
tags: [implementation, feature, full-stack, parallel-agents, reflection, worktree]
user-invocable: true
allowedTools: [AskUserQuestion, Bash, Read, Write, Edit, Grep, Glob, Task, TaskCreate, TaskUpdate, mcp__context7__query-docs, mcp__mem0__add-memory, mcp__memory__search_nodes]
skills: [api-design-framework, react-server-components-framework, type-safety-validation, unit-testing, integration-testing, explore, verify, memory, worktree-coordination]

Implement Feature

Maximum utilization of parallel subagent execution for feature implementation with built-in scope control and reflection.

Quick Start

bash
/implement user authentication
/implement real-time notifications
/implement dashboard analytics

STEP 0: Verify User Intent with AskUserQuestion

BEFORE creating tasks or doing ANY work, ask the user to clarify scope:

python
AskUserQuestion(
  questions=[
    {
      "question": "What scope for this implementation?",
      "header": "Scope",
      "options": [
        {"label": "Full-stack (Recommended)", "description": "Backend + frontend + tests + docs"},
        {"label": "Backend only", "description": "API + database + backend tests"},
        {"label": "Frontend only", "description": "UI components + state + frontend tests"},
        {"label": "Quick prototype", "description": "Minimal working version, skip tests"}
      ],
      "multiSelect": false
    },
    {
      "question": "Any constraints I should know about?",
      "header": "Constraints",
      "options": [
        {"label": "None (Recommended)", "description": "Use best practices and modern patterns"},
        {"label": "Match existing patterns", "description": "Follow existing codebase conventions exactly"},
        {"label": "Minimal dependencies", "description": "Avoid adding new packages"},
        {"label": "Specific tech stack", "description": "I'll specify the technologies to use"}
      ],
      "multiSelect": false
    }
  ]
)

Based on user's answers, adjust the workflow:

  • Full-stack: All 10 phases, all parallel agents
  • Backend only: Skip frontend agents (phases 5b, 6b)
  • Frontend only: Skip backend agents (phases 5a, 6a)
  • Quick prototype: Skip phases 7-10 (scope check, verification, docs, reflection)

CRITICAL: Task Management is MANDATORY (CC 2.1.16)

BEFORE doing ANYTHING else, create tasks to track progress:

python
# 1. Create main implementation task IMMEDIATELY
TaskCreate(
  subject="Implement: {feature}",
  description="Full-stack implementation with parallel agents",
  activeForm="Implementing {feature}"
)

# 2. Create subtasks for each phase (10-phase process)
TaskCreate(subject="Research best practices", activeForm="Researching best practices")
TaskCreate(subject="Design architecture", activeForm="Designing architecture")
TaskCreate(subject="Micro-plan each task", activeForm="Creating micro-plans")
TaskCreate(subject="Setup git worktree (optional)", activeForm="Setting up worktree")
TaskCreate(subject="Implement backend", activeForm="Implementing backend")
TaskCreate(subject="Implement frontend", activeForm="Implementing frontend")
TaskCreate(subject="Write tests", activeForm="Writing tests")
TaskCreate(subject="Integration verification", activeForm="Verifying integration")
TaskCreate(subject="Scope creep check", activeForm="Checking for scope creep")
TaskCreate(subject="Post-implementation reflection", activeForm="Reflecting on implementation")

# 3. Update status as you progress
TaskUpdate(taskId="2", status="in_progress")  # When starting
TaskUpdate(taskId="2", status="completed")    # When done

Workflow Overview

PhaseActivitiesOutput
1. Discovery & PlanningResearch, break into tasksTask list
2. Micro-PlanningDetailed plan per taskMicro-plans
3. Worktree SetupIsolate in git worktree (optional)Clean workspace
4. Architecture Design5 parallel agentsDesign specs
5. Implementation8 parallel agentsWorking code
6. Integration & Validation4 parallel agentsTested code
7. Scope Creep CheckCompare vs original scopeScope report
8. E2E VerificationBrowser testingEvidence
9. DocumentationSave decisions to memoryPersisted knowledge
10. ReflectionWhat worked, what didn'tLessons learned

Phase 1: Discovery & Planning

1a. Create Task List

Break into small, deliverable, testable tasks:

  • Each task completable in one focused session
  • Each task MUST include its tests
  • Group by domain (frontend, backend, AI, shared)

1b. Research Current Best Practices

python
# PARALLEL - Web searches (launch all in ONE message)
WebSearch("React 19 best practices 2026")
WebSearch("FastAPI async patterns 2026")
WebSearch("TypeScript 5.x strict mode 2026")

1c. Context7 Documentation

python
# PARALLEL - Library docs (launch all in ONE message)
mcp__context7__query-docs(libraryId="/vercel/next.js", query="app router")
mcp__context7__query-docs(libraryId="/tiangolo/fastapi", query="dependencies")

Phase 2: Micro-Planning Per Task (NEW)

Goal: Create detailed mini-plans for each task BEFORE implementation.

Micro-Plan Template

For each task from Phase 1, create a micro-plan:

markdown
## Micro-Plan: [Task Name]

### Scope (What's IN)
- [ ] Specific change 1
- [ ] Specific change 2
- [ ] Test for change 1
- [ ] Test for change 2

### Out of Scope (What's NOT in this task)
- Feature X (separate task)
- Optimization Y (future task)

### Files to Touch
| File | Change Type | Description |
|------|-------------|-------------|
| path/file.py | CREATE | New service class |
| path/test.py | CREATE | Tests for service |
| path/api.py | MODIFY | Add endpoint |

### Acceptance Criteria
- [ ] Tests pass
- [ ] Lint clean
- [ ] Types valid
- [ ] Manually verified

### Estimated Time
[X] minutes / hours

Phase 3: Git Worktree Isolation (Optional but Recommended)

Goal: Isolate feature work in a dedicated worktree to avoid polluting main workspace.

When to Use Worktrees

ScenarioUse Worktree?
Large feature (5+ files)YES
Experimental/risky changesYES
Quick bug fix (1-2 files)No
Hotfix to productionYES
Parallel feature developmentYES

Worktree Setup

bash
# Create feature worktree
git worktree add ../project-feature-name feature/feature-name

# Navigate to worktree
cd ../project-feature-name

# Work in isolation...

# When done, merge and cleanup
git checkout main
git merge feature/feature-name
git worktree remove ../project-feature-name

Phase 4: Parallel Architecture Design (5 Agents)

Launch ALL 5 agents in ONE Task message with run_in_background: true:

AgentFocus
workflow-architectArchitecture planning, dependency graph
backend-system-architectAPI, services, database
frontend-ui-developerComponents, state, hooks
llm-integratorLLM integration (if needed)
ux-researcherUser experience, accessibility

Launch all 5 agents with run_in_background=True. Each agent returns a SUMMARY line.

Phase 5: Parallel Implementation (8 Agents)

AgentTask
backend-system-architect #1API endpoints
backend-system-architect #2Database layer
frontend-ui-developer #1UI components
frontend-ui-developer #2State & API hooks
llm-integratorAI integration
rapid-ui-designerStyling
test-generator #1Test suite
prioritization-analystProgress tracking

Phase 6: Integration & Validation (4 Agents)

AgentTask
backend-system-architectBackend + database integration
frontend-ui-developerFrontend + API integration
code-quality-reviewer #1Full test suite
security-auditorSecurity audit

Phase 7: Scope Creep Detector (NEW)

Goal: Compare implementation against original scope to catch unplanned additions.

Scope Creep Check Process

python
Task(
  subagent_type="workflow-architect",
  prompt="""SCOPE CREEP DETECTION for: $ARGUMENTS

  Compare implementation against original micro-plans:

  1. PLANNED vs ACTUAL FILES
     - Files that were planned
     - Files actually modified
     - Unplanned file changes?

  2. PLANNED vs ACTUAL FEATURES
     - Features in original scope
     - Features actually implemented
     - Unplanned features added?

  3. SCOPE CREEP INDICATORS
     - "While I'm here..." changes
     - Premature optimization
     - Goldplating (unnecessary polish)
     - Refactoring outside scope

  4. IMPACT ASSESSMENT
     - Time spent on unplanned work
     - Risk introduced by unplanned changes
     - Testing gaps from scope expansion

  Output:
  {
    "planned_files": N,
    "actual_files": M,
    "unplanned_changes": ["file - change type - justification needed"],
    "scope_creep_score": 0-10 (0=perfect, 10=major creep),
    "recommendations": ["action"]
  }

  SUMMARY: End with: "SCOPE: [score]/10 creep - [N] unplanned changes - [key issue]"
  """,
  run_in_background=True
)

Scope Creep Response

ScoreLevelAction
0-2MinimalProceed to reflection
3-5ModerateDocument unplanned changes, justify or revert
6-8SignificantReview with user, potentially split into separate PR
9-10MajorStop, reassess, likely need to split work

Phase 8: E2E Verification

If UI changes, verify with agent-browser:

bash
agent-browser open http://localhost:5173
agent-browser wait --load networkidle
agent-browser snapshot -i
agent-browser screenshot /tmp/feature.png
agent-browser close

Phase 9: Documentation

Save implementation decisions to memory MCP for future reference:

python
mcp__mem0__add-memory(content="Implementation decisions...", userId="project-decisions")

Phase 10: Post-Implementation Reflection (NEW)

Goal: Capture lessons learned while context is fresh.

Reflection Questions

After implementation is complete and verified, answer these questions:

python
Task(
  subagent_type="workflow-architect",
  prompt="""POST-IMPLEMENTATION REFLECTION for: $ARGUMENTS

  Reflect on the implementation process:

  1. WHAT WENT WELL
     - Approaches that worked smoothly
     - Good decisions made
     - Time-saving patterns used

  2. WHAT COULD BE IMPROVED
     - Pain points encountered
     - Decisions that had to be revised
     - Time sinks

  3. ESTIMATION ACCURACY
     - Original estimate: [X]
     - Actual time: [Y]
     - Variance reason: [why]

  4. REUSABLE PATTERNS
     - Patterns worth extracting to skills
     - Code worth making into utilities
     - Documentation worth adding

  5. TECHNICAL DEBT
     - Shortcuts taken (with justification)
     - TODOs left behind
     - Known limitations

  6. KNOWLEDGE GAPS DISCOVERED
     - Things we didn't know at start
     - Research needed mid-implementation
     - Skills/tools to learn for future

  Output:
  {
    "went_well": ["item"],
    "improvements": ["item"],
    "estimate_accuracy": "X%",
    "reusable_patterns": ["pattern - where to use"],
    "tech_debt": ["debt - priority - plan"],
    "knowledge_gaps": ["gap - how filled"]
  }

  SUMMARY: End with: "REFLECTION: [estimate accuracy]% accuracy - [key lesson]"
  """,
  run_in_background=True
)

Persist Lessons Learned

python
# Store in memory for future implementations
mcp__memory__create_entities(entities=[{
  "name": "{feature}-lessons-learned",
  "entityType": "Reflection",
  "observations": [
    "Lesson 1: ...",
    "Lesson 2: ...",
    "Pattern to reuse: ..."
  ]
}])

Continuous Feedback Loop (NEW)

Throughout implementation, maintain a feedback loop:

After Each Task Completion

python
# Quick checkpoint after each task
print(f"""
TASK CHECKPOINT: {task_name}
- Completed: {what_was_done}
- Tests: {pass/fail}
- Time: {actual} vs {estimated}
- Blockers: {any issues}
- Scope changes: {any deviations}
""")

# Update task status
TaskUpdate(taskId=task_id, status="completed")

Feedback Triggers

TriggerAction
Task takes 2x estimated timePause, reassess scope
Test keeps failingConsider design issue, not just implementation
Scope creep detectedStop, discuss with user
Blocker foundCreate blocking task, switch to parallel work

Summary

Total Parallel Agents: 17 across 4 phases

Tools Used:

  • context7 MCP (library documentation)
  • mem0 MCP (decision persistence)
  • agent-browser CLI (E2E verification)

Key Principles:

  • Tests are NOT optional
  • Parallel when independent (use run_in_background: true)
  • CC 2.1.6 auto-loads skills from agent frontmatter
  • Evidence-based completion
  • Micro-plan before implementing
  • Detect and address scope creep
  • Reflect and capture lessons learned

Related Skills

  • explore: Explore codebase before implementing
  • verify: Verify implementations work correctly
  • worktree-coordination: Git worktree management patterns

References