AgentSkillsCN

Implement

实施

SKILL.md

/implement [feature] [unit]

Execute a single atomic unit of work from an implementation plan.

Purpose

The implement skill executes one unit of work at a time, following the acceptance criteria defined in the Implementation Plan. It ensures each unit is completed, tested, and committed before proceeding.

Invocation

code
/implement [feature-name] [unit-number]
/implement [feature-name] all

Prerequisites:

  • Implementation Plan exists from /planning [feature]
  • Review completed from /review [feature] (recommended)

Examples:

  • /implement autopilot-system 1 - Execute Unit 1 only
  • /implement autopilot-system 3 - Execute Unit 3 only
  • /implement autopilot-system all - Execute all units sequentially

Process

Step 1: Load Implementation Plan

  • Read reports/[feature]-implementation-plan-*.md
  • Parse the specified unit(s) of work
  • Verify unit exists and has not been marked complete

Step 2: Mark Unit In Progress

  • Update plan status if tracking in document
  • Begin work on the unit

Step 3: Execute Unit

Based on unit type:

For Code Units:

  • Read target files
  • Make required changes
  • Follow project code style (CLAUDE.md)
  • Avoid over-engineering

For Documentation Units:

  • Create/update markdown files
  • Follow templates from DEVELOPMENT_PROCESS.md

For Test Units:

  • Add test cases
  • Verify tests pass

Step 4: Verify Acceptance Criteria

For each criterion in the unit:

  • Run specified test method
  • Confirm pass/fail
  • Document any issues

If criteria fail:

  • Fix issues
  • Re-verify
  • Loop until passing

Step 4.5: Quality Validation

Best Practices Check (.claude/agents/best-practices.md):

  • Verify code follows CLAUDE.md conventions
  • Check imports use .js extensions and named exports
  • Confirm naming conventions (camelCase functions, UPPER_SNAKE constants)
  • Ensure no over-engineering or unnecessary abstractions

Regression Check (.claude/agents/regression-checker.md):

  • Run affected test suites
  • Verify adjacent features still work
  • Check for side effects in shared modules
  • For high-risk changes, run full regression suite

Step 5: Commit Changes

bash
git add [specific-files]
git commit -m "[Unit N] Description

- Specific change 1
- Specific change 2

Files: file1.js, file2.js"

Step 6: Mark Unit Complete

  • Update unit status
  • Report completion
  • Proceed to next unit (if all mode)

Output

Primary: Code changes committed to feature branch

Secondary: Status updates in CLI:

code
=== UNIT [N] COMPLETE ===
Description: [unit description]
Files modified: file1.js, file2.js
Acceptance criteria: 3/3 passing
Commit: abc1234

Next: /implement [feature] [N+1]

Unit Execution Guidelines

Code Quality

  • Follow CLAUDE.md code style exactly
  • Use .js extensions in imports
  • Named exports, not default
  • camelCase functions with verb prefixes
  • Don't add unnecessary error handling
  • Don't over-engineer

Safety Checks

  • Read files before editing
  • Verify edits are correct
  • Don't introduce security vulnerabilities
  • Test after each change

Commit Discipline

  • One commit per unit
  • Specific files only (no git add -A)
  • Descriptive commit message
  • Never skip hooks without permission

Error Handling

If a unit cannot be completed:

  1. Document the blocker
  2. Do not commit partial work
  3. Report the issue
  4. Await user guidance

Handling Unit Dependencies

Independent Units

  • Can be executed in any order
  • No special handling needed

Dependent Units

  • Must execute in order
  • Earlier unit provides foundation
  • Later unit builds on it

Blocked Units

  • If dependency fails, skip this unit
  • Report the dependency chain
  • Await user decision

Rollback Procedure

If a unit needs to be undone:

bash
git revert [commit-hash]

Or if not yet committed:

bash
git checkout -- [files]

Tools Used

This skill uses (for code units):

  • Read - Load files before editing
  • Edit - Make precise changes
  • Write - Create new files
  • Bash - Git operations, running tests

Note: This skill DOES create/modify code files (unlike the framework build itself).

Quality Criteria

A successful unit implementation:

  • All acceptance criteria pass
  • Code follows project style
  • Changes are minimal and focused
  • Best practices check passes (best-practices agent)
  • Regression check passes (regression-checker agent)
  • Commit message is descriptive
  • No regressions introduced

Failure Modes

FailureDetectionRecovery
Criteria unclearCan't determine pass/failAsk for clarification
Technical blockerImplementation not possibleReport and await guidance
Test failureTests don't passDebug and fix
Merge conflictGit conflict on commitResolve manually

Integration

  • Follows: /review [feature] (recommended)
  • Precedes: /verify [feature] (after all units)
  • Invokes: best-practices (per unit), regression-checker (per unit)
  • Loops: Repeats for each unit until all complete

Unit Types Reference

TypeDescriptionTypical Criteria
ScaffoldingCreate structure, stubsFiles exist, no errors
DataAdd data structuresData accessible
LogicImplement algorithmCorrect output for inputs
IntegrationWire componentsComponents communicate
UIAdd interface elementsElements render correctly
TestAdd test coverageTests pass
PolishEdge cases, cleanupEdge cases handled

Reference

See DEVELOPMENT_PROCESS.md Phase 4: Implementation for the canonical process definition.