AgentSkillsCN

speckit-worker-light

轻量级调度器,适用于在里程碑之外进行单一功能开发。每次仅执行一条 Speckit 命令,并进行验证。在无需里程碑或进度追踪开销的情况下,仅凭描述即可构建独立功能时,应使用此技能。

SKILL.md
--- frontmatter
name: speckit-worker-light
description: Lightweight dispatcher for single-feature development outside of milestones. Executes speckit commands one at a time with validation. This skill should be used when building a standalone feature from a description without milestone or progress tracking overhead.

Speckit Worker Light

A lightweight dispatcher that executes speckit commands one at a time for single-feature development. Designed for building features outside of milestone tracking, with the same quality gates as speckit-worker but simplified state management.


⚠️ CRITICAL: SINGLE ITERATION MODE ⚠️

This skill runs in an automated loop. Exit after ONE iteration.

MANDATORY BEHAVIOR:

  1. Execute exactly ONE speckit command (e.g., /speckit.specify, /speckit.plan, /speckit.implement)
  2. Output a completion signal (see below)
  3. IMMEDIATELY FINISH YOUR RESPONSE - Do NOT continue with more work

WHY THIS MATTERS:

  • The outer loop (loop.sh) will restart Claude for the next iteration
  • Each iteration gets fresh context and state
  • If the response continues, the loop cannot proceed correctly

HOW TO EXIT:

After outputting the completion signal, simply end the response. Do not:

  • Start another speckit command
  • Say "let me continue with..."
  • Do any additional work

The loop will call again for the next step.


Completion Signals

Output exactly ONE of these signals when appropriate:

SignalWhen
COMMAND_COMPLETE: <command>Single command finished and validated successfully
FEATURE_COMPLETE: <feature-id>All phases complete AND PR merged
WORKER_BLOCKED: <reason>Cannot proceed (validation failed, manual intervention needed)

Triggers

PatternAction
build: <feature-description>Start building a new feature
build resumeResume from state file
build statusReport current progress

Examples

code
build: Add rate limiting to API endpoints
build: User avatar upload with S3 storage
build: WebSocket notifications for order status
build resume
build status

State File

Location: .specify/workflow-state/speckit-worker-light.json

typescript
interface LightWorkerState {
  // Feature identification
  feature_id: string;              // Generated slug from description
  feature_description: string;     // Original input description

  // Complexity assessment
  complexity: "LOW" | "MEDIUM" | "HIGH";
  complexity_reasoning: string;

  // Last action tracking
  last_command: string;            // "speckit.specify"
  last_command_status: "success" | "failed";
  last_command_timestamp: string;  // ISO timestamp
  last_command_output?: string;    // Brief result summary

  // Phase tracking (for one-phase-at-a-time implementation)
  current_phase: string | null;    // "Phase 1: Core Implementation"
  phases_completed: string[];      // ["Phase 1: Core Implementation", ...]

  // Feedback tracking (for one-feedback-at-a-time resolution)
  pending_feedback: string[];      // Unresolved feedback items from review.md
  feedback_resolved: string[];     // Resolved feedback items this cycle

  // Git/PR tracking
  feature_branch: string | null;   // "feature/<feature-id>"
  pr_number: number | null;        // GitHub PR number once created
  pr_url: string | null;           // Full PR URL
  pr_status: "none" | "created" | "approved" | "merged";

  // Workflow flags
  research_needed: boolean;
  research_done: boolean;
  analyze_done: boolean;
  review_done: boolean;
  reflect_done: boolean;

  // Counters
  iteration_count: number;
  started_at: string;              // ISO timestamp
}

Execution Protocol

Every iteration: Read → Decide → Execute ONE → Validate → Update → STOP

Step 0: INITIALIZE (First Iteration Only)

When starting a new feature:

  1. Generate feature ID from description:

    code
    "Add rate limiting to API endpoints" → "add-rate-limiting-to-api-endpoints"
    
  2. Assess complexity:

    ComplexityCriteria
    LOWSingle file, no external deps, < 100 LOC estimated
    MEDIUM2-5 files, simple external deps, 100-500 LOC estimated
    HIGH5+ files, complex integrations, security/auth, > 500 LOC estimated

    Automatic HIGH triggers:

    • External API integrations (Redis, S3, databases)
    • Authentication/authorization code
    • Payment or financial processing
    • ML model serving or data pipelines
    • Performance-critical paths
  3. Create fresh branch from origin/main:

    bash
    git fetch origin
    git checkout main
    git reset --hard origin/main
    git checkout -b feature/<feature-id>
    
  4. Initialize state file with assessed complexity

Step 1: READ State

  1. Read state file .specify/workflow-state/speckit-worker-light.json
    • If not exists and prompt is build resume: WORKER_BLOCKED: No state file found
    • If not exists and prompt is build: <desc>: Initialize new state (Step 0)
  2. Check current git branch - ensure on correct feature branch

Step 2: DECIDE Next Command

Use the Decision Tree below to determine exactly ONE command to run.

Step 3: EXECUTE One Command

Run the selected /speckit.* command directly (NOT via subagents).

IMPORTANT for /speckit.implement: Only implement ONE phase from tasks.md OR solve ONE feedback item from review.md per iteration.

Step 4: VALIDATE Result

Check validation criteria for the executed command. See Validation Rules below.

Step 5: UPDATE State

  • If validation passes: Update state file
  • If validation fails: Update state file with failure status

Step 6: STOP AND EXIT

Output completion signal and >>> STOP.


Decision Tree

code
┌─────────────────────────────────────────────────────────────────┐
│ spec.md missing?                                                │
│ └─> IF NEW FEATURE (no feature_branch in state):                │
│     └─> Assess complexity                                       │
│     └─> Create fresh branch from origin/main                    │
│     └─> UPDATE state: feature_id, complexity, feature_branch    │
│ └─> Ensure on correct feature branch                            │
│ └─> Run: /speckit.specify <feature-description>                 │
│ └─> VALIDATE: spec.md exists in specs/<feature-id>/             │
│ └─> git add + git commit                                        │
│ └─> >>> STOP                                                    │
├─────────────────────────────────────────────────────────────────┤
│ spec.md exists, plan.md missing?                                │
│ └─> Read specs/<feature-id>/spec.md                             │
│ └─> Check for [NEEDS CLARIFICATION] markers                     │
│     ├─> If found: Run /speckit.clarify, commit → STOP           │
│     └─> If clear: Check for research triggers                   │
│         ├─> If research needed & not done:                      │
│         │   Run /speckit.research, commit → STOP                │
│         └─> If no research needed OR research done:             │
│             Run /speckit.plan, commit → STOP                    │
│ └─> VALIDATE: plan.md exists (or clarifications resolved)       │
│ └─> >>> STOP                                                    │
├─────────────────────────────────────────────────────────────────┤
│ plan.md exists, tasks.md missing?                               │
│ └─> Run: /speckit.tasks                                         │
│ └─> VALIDATE: tasks.md exists with task items                   │
│ └─> git add + git commit                                        │
│ └─> >>> STOP                                                    │
├─────────────────────────────────────────────────────────────────┤
│ tasks.md exists, implementation incomplete?                     │
│ └─> Check if analyze needed (HIGH complexity & not yet done):   │
│     └─> If needed: Run /speckit.analyze → STOP                  │
│ └─> **CRITICAL**: Check if specs/<feature-id>/research.md exists│
│     └─> If exists: Read file contents into context BEFORE impl  │
│     └─> Pass research findings to /speckit.implement            │
│ └─> Identify NEXT INCOMPLETE PHASE in tasks.md                  │
│ └─> Run: /speckit.implement <phase-name> (ONE PHASE ONLY!)      │
│ └─> VALIDATE: Phase tasks [X], tests pass                       │
│ └─> git add + git commit (commit after each phase)              │
│ └─> Check if MORE PHASES remain:                                │
│     ├─> If phases remain:                                       │
│     │   └─> Output: COMMAND_COMPLETE: speckit.implement <phase> │
│     │   └─> >>> STOP (next iteration continues)                 │
│     └─> If all phases done:                                     │
│         └─> Check if review needed (MEDIUM/HIGH complexity)     │
│         └─> >>> STOP                                            │
├─────────────────────────────────────────────────────────────────┤
│ Implementation done, review needed & !review_done?              │
│ └─> Run: /speckit.review                                        │
│ └─> VALIDATE: review.md exists                                  │
│ └─> Check review.md for unresolved feedback (- [ ] items):      │
│     ├─> If unresolved feedback found:                           │
│     │   └─> Mark implementation as needing rework               │
│     │   └─> Pass feedback to next /speckit.implement            │
│     │   └─> >>> STOP                                            │
│     └─> If no unresolved feedback:                              │
│         └─> Set review_done=true                                │
│         └─> >>> STOP                                            │
├─────────────────────────────────────────────────────────────────┤
│ Implementation done, review_done (or not needed), !reflect_done?│
│ └─> Run: /speckit.reflect                                       │
│ └─> git add + git commit (if CLAUDE.md changed)                 │
│ └─> Set reflect_done=true                                       │
│ └─> >>> STOP                                                    │
├─────────────────────────────────────────────────────────────────┤
│ All phases complete, reflect_done, pr_status="none"?            │
│ └─> Push branch, create PR, check status, merge if ready:       │
│     git push -u origin feature/<feature-id>                     │
│     gh pr create --base main --title "<feature-id>" ...         │
│     gh pr view --json mergeable,state,reviewDecision            │
│     ├─> If checks failing: WORKER_BLOCKED: PR checks failing    │
│     ├─> If changes requested: WORKER_BLOCKED: PR needs changes  │
│     ├─> If pending review: WORKER_BLOCKED: PR awaiting review   │
│     ├─> If mergeable & approved (or no review required):        │
│     │   └─> gh pr merge --squash --delete-branch                │
│     │   └─> git checkout main && git pull origin main           │
│     │   └─> Output: FEATURE_COMPLETE: <feature-id>              │
│     │   └─> >>> STOP                                            │
├─────────────────────────────────────────────────────────────────┤
│ pr_status = "created" (blocked on previous iteration)?          │
│ └─> Re-check PR status and attempt merge (same as above)        │
│ └─> >>> STOP                                                    │
└─────────────────────────────────────────────────────────────────┘

Optional Commands - When to Include

CommandInclude WhenPurpose
/speckit.clarifyspec.md contains [NEEDS CLARIFICATION] markersResolves ambiguities before planning
/speckit.researchspec.md has TBD/TODO items, external library integrations, or complex technology choicesResolves technical unknowns before planning
/speckit.analyzetasks.md created AND complexity is HIGHValidates cross-artifact consistency
/speckit.reviewAfter implementation completes, for MEDIUM/HIGH complexityPost-implementation cleanup, code quality
/speckit.reflectAfter review completes (or after implement if no review)Captures learnings to CLAUDE.md

Research Triggers

Run research when spec.md contains ANY of:

  • TBD, TODO, [NEEDS CLARIFICATION] markers related to technology choices
  • External library/framework references (e.g., "use Redis", "integrate with S3")
  • Complex patterns (caching, queuing, authentication, ML pipelines)
  • Version-specific API questions
  • Performance requirements needing validation

IMPORTANT: When research.md exists, ALWAYS load it into context before running /speckit.implement.

Review Triggers

Run review when:

  • Feature complexity is MEDIUM or HIGH
  • Feature touches security/authentication code
  • After first implementation attempt completes

Validation Rules

CommandValidation CriteriaOn SuccessOn Failure
speckit.specifyspecs/<feature-id>/spec.md exists, commit createdContinueWORKER_BLOCKED: specify failed
speckit.clarify[NEEDS CLARIFICATION] count reduced OR clarifications section addedContinue to planRetry or WORKER_BLOCKED
speckit.researchspecs/<feature-id>/research.md exists with Technologies sectionSet research_done=trueLog warning, continue
speckit.planspecs/<feature-id>/plan.md exists, commit createdContinueWORKER_BLOCKED: plan failed
speckit.tasksspecs/<feature-id>/tasks.md exists with - [ ] items, commit createdContinueWORKER_BLOCKED: tasks failed
speckit.analyzeReport generated, no CRITICAL issuesContinue to implementIf CRITICAL: WORKER_BLOCKED
speckit.implementOne phase tasks [X] OR one feedback resolved, tests pass, commit createdContinue if phases remainWORKER_BLOCKED: implement failed
speckit.reviewspecs/<feature-id>/review.md existsCheck for unresolved feedbackLog warning, continue
speckit.reflectCLAUDE.md updated OR "no new learnings" messageSet reflect_done=trueLog warning, continue
pr-workflowPR created, checks pass, merged successfullyFEATURE_COMPLETEWORKER_BLOCKED: <reason>

Example Execution Traces

LOW Complexity Feature (4-5 iterations)

code
Iter 1: specify   → assess LOW, branch + spec + commit   >>> STOP
Iter 2: plan      → COMMAND_COMPLETE + commit            >>> STOP
Iter 3: tasks     → COMMAND_COMPLETE + commit            >>> STOP
Iter 4: implement → single phase + commit                >>> STOP
Iter 5: pr-workflow → push + PR + merge → FEATURE_COMPLETE >>> STOP

MEDIUM Complexity Feature (6-8 iterations)

code
Iter 1: specify   → assess MEDIUM, branch + spec + commit >>> STOP
Iter 2: plan      → COMMAND_COMPLETE + commit             >>> STOP
Iter 3: tasks     → COMMAND_COMPLETE + commit             >>> STOP
Iter 4: implement Phase 1 → COMMAND_COMPLETE + commit     >>> STOP
Iter 5: implement Phase 2 → COMMAND_COMPLETE + commit     >>> STOP
Iter 6: reflect   → COMMAND_COMPLETE + commit             >>> STOP
Iter 7: pr-workflow → push + PR + merge → FEATURE_COMPLETE >>> STOP

HIGH Complexity Feature (10-15 iterations)

code
Iter 1:  specify   → assess HIGH, branch + spec + commit  >>> STOP
Iter 2:  research  → COMMAND_COMPLETE + commit            >>> STOP
Iter 3:  plan      → COMMAND_COMPLETE + commit            >>> STOP
Iter 4:  tasks     → COMMAND_COMPLETE + commit            >>> STOP
Iter 5:  analyze   → COMMAND_COMPLETE                     >>> STOP
Iter 6:  implement Phase 1 → COMMAND_COMPLETE + commit    >>> STOP
Iter 7:  implement Phase 2 → COMMAND_COMPLETE + commit    >>> STOP
Iter 8:  implement Phase 3 → COMMAND_COMPLETE + commit    >>> STOP
Iter 9:  review    → Found 2 feedback items               >>> STOP
Iter 10: implement feedback-1 → COMMAND_COMPLETE + commit >>> STOP
Iter 11: implement feedback-2 → COMMAND_COMPLETE + commit >>> STOP
Iter 12: review    → All resolved, review_done=true       >>> STOP
Iter 13: reflect   → Learnings captured + commit          >>> STOP
Iter 14: pr-workflow → push + PR + merge → FEATURE_COMPLETE >>> STOP

Constraints

MUST

  • Validate command result before updating state
  • Write state file at END of every iteration
  • Use /speckit.* commands directly (not subagents)
  • Re-run /speckit.implement with feedback when review has unresolved items
  • Run /speckit.reflect before PR workflow to capture learnings
  • Complete PR workflow (push → create → check → merge) in single iteration
  • Wait for PR to be merged before outputting FEATURE_COMPLETE
  • Use squash merge to keep main branch history clean

MUST NOT

  • Execute multiple speckit commands in one iteration
  • Implement multiple phases in a single /speckit.implement call
  • Resolve multiple feedback items in a single /speckit.implement call
  • Skip validation steps
  • Modify constitution.md without explicit user approval
  • Skip /speckit.reflect - learnings must be captured before PR
  • Call /speckit.implement without loading research.md when it exists
  • Work on main branch directly - always use feature branches
  • Mark feature complete before PR is merged
  • Force push to main branch
  • Merge without passing CI checks

Error Recovery

Error TypeDetectionRecovery
Command failsNon-zero exit or missing output fileLog error, WORKER_BLOCKED
Validation failsExpected file/content not foundDon't update state, STOP for retry
Test failurepytest returns non-zeroWORKER_BLOCKED with test output
Git conflictMerge conflict during branch creationgit reset --hard origin/main, retry
Branch existsFeature branch already existsCheck state - resume if same feature
PR checks failingCI/CD checks not passingWORKER_BLOCKED: fix failing checks
PR changes requestedReviewer requested changesWORKER_BLOCKED: address review comments
PR merge conflictBranch diverged from mainRebase: git fetch origin && git rebase origin/main

On WORKER_BLOCKED

  1. Output blocking reason with details
  2. Save state with last_command_status: "failed"
  3. >>> STOP
  4. User must resolve issue before next iteration

Differences from speckit-worker

Aspectspeckit-workerspeckit-worker-light
InputMilestone ID → looks up features in MILESTONES.mdFeature description directly
Progress trackingUpdates docs/progress.mdNone - state file only
Feature sourceReads from docs/MILESTONES.mdTakes description from prompt
State filespeckit-worker.jsonspeckit-worker-light.json
ComplexityDetermined by feature definitionAuto-assessed from description
Use caseBatch processing of milestone featuresSingle standalone feature

Speckit Worker Light - Build one feature at a time, no milestone overhead.