Files
myclaude/skills/do/SKILL.md
cexll 97dfa907d9 feat(skills): add per-task skill spec auto-detection and injection
Replace external inject-spec.py hook with built-in zero-config skill
detection in codeagent-wrapper. The system auto-detects project type
from fingerprint files (go.mod, package.json, etc.), maps to installed
skills, and injects SKILL.md content directly into sub-agent prompts.

Key changes:
- Add DetectProjectSkills/ResolveSkillContent in executor/prompt.go
- Add Skills field to TaskSpec with parallel config parsing
- Add --skills CLI flag for explicit override
- Update /do SKILL.md Phase 4 with per-task skill examples
- Remove on-stop.py global hook (not needed)
- Replace inject-spec.py with no-op (detection now internal)
- Add 20 unit tests covering detection, resolution, budget, security

Security: path traversal protection via validSkillName regex,
16K char budget with tag overhead accounting, CRLF normalization.

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
2026-02-09 11:06:36 +08:00

7.4 KiB

name, description, allowed-tools
name description allowed-tools
do This skill should be used for structured feature development with codebase understanding. Triggers on /do command. Provides a 5-phase workflow (Understand, Clarify, Design, Implement, Complete) using codeagent-wrapper to orchestrate code-explorer, code-architect, code-reviewer, and develop agents in parallel.
Bash(.claude/skills/do/scripts/setup-do.py:*)
Bash(.claude/skills/do/scripts/task.py:*)

do - Feature Development Orchestrator

An orchestrator for systematic feature development. Invoke agents via codeagent-wrapper, never write code directly.

Loop Initialization (REQUIRED)

When triggered via /do <task>, follow these steps:

Step 1: Ask about worktree mode

Use AskUserQuestion to ask:

Develop in a separate worktree? (Isolates changes from main branch)
- Yes (Recommended for larger changes)
- No (Work directly in current directory)

Step 2: Initialize task directory

# If worktree mode selected:
python3 ".claude/skills/do/scripts/setup-do.py" --worktree "<task description>"

# If no worktree:
python3 ".claude/skills/do/scripts/setup-do.py" "<task description>"

This creates a task directory under .claude/do-tasks/ with:

  • task.md: Single file containing YAML frontmatter (metadata) + Markdown body (requirements/context)

Task Directory Management

Use task.py to manage task state:

# Update phase
python3 ".claude/skills/do/scripts/task.py" update-phase 2

# Check status
python3 ".claude/skills/do/scripts/task.py" status

# List all tasks
python3 ".claude/skills/do/scripts/task.py" list

Worktree Mode

When worktree mode is enabled in task.json, ALL codeagent-wrapper calls that modify code MUST include --worktree:

codeagent-wrapper --worktree --agent develop - . <<'EOF'
...
EOF

Read-only agents (code-explorer, code-architect, code-reviewer) do NOT need --worktree.

Hard Constraints

  1. Never write code directly. Delegate all code changes to codeagent-wrapper agents.
  2. Parallel-first. Run independent tasks via codeagent-wrapper --parallel.
  3. Update phase after each phase. Use task.py update-phase <N>.
  4. Expect long-running codeagent-wrapper calls. High-reasoning modes can take a long time.
  5. Timeouts are not an escape hatch. If a call times out, retry with narrower scope.
  6. Respect worktree setting. If enabled, always pass --worktree to develop agent calls.

Agents

Agent Purpose Needs --worktree
code-explorer Trace code, map architecture, find patterns No (read-only)
code-architect Design approaches, file plans, build sequences No (read-only)
code-reviewer Review for bugs, simplicity, conventions No (read-only)
develop Implement code, run tests Yes (if worktree enabled)

Issue Severity Definitions

Blocking issues (require user input):

  • Impacts core functionality or correctness
  • Security vulnerabilities
  • Architectural conflicts with existing patterns
  • Ambiguous requirements with multiple valid interpretations

Minor issues (auto-fix without asking):

  • Code style inconsistencies
  • Naming improvements
  • Missing documentation
  • Non-critical test coverage gaps

5-Phase Workflow

Phase 1: Understand (Parallel, No Interaction)

Goal: Understand requirements and map codebase simultaneously.

Actions: Run code-architect and 2-3 code-explorer tasks in parallel.

codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p1_requirements
agent: code-architect
workdir: .
---CONTENT---
Analyze requirements completeness (score 1-10):
1. Extract explicit requirements, constraints, acceptance criteria
2. Identify blocking questions (issues that prevent implementation)
3. Identify minor clarifications (nice-to-have but can proceed without)

Output format:
- Completeness score: X/10
- Requirements: [list]
- Non-goals: [list]
- Blocking questions: [list, if any]

---TASK---
id: p1_similar_features
agent: code-explorer
workdir: .
---CONTENT---
Find 1-3 similar features, trace end-to-end. Return: key files with line numbers, call flow, extension points.

---TASK---
id: p1_architecture
agent: code-explorer
workdir: .
---CONTENT---
Map architecture for relevant subsystem. Return: module map + 5-10 key files.

---TASK---
id: p1_conventions
agent: code-explorer
workdir: .
---CONTENT---
Identify testing patterns, conventions, config. Return: test commands + file locations.
EOF

Phase 2: Clarify (Conditional)

Goal: Resolve blocking ambiguities only.

Actions:

  1. Review p1_requirements output for blocking questions
  2. IF blocking questions exist → Use AskUserQuestion
  3. IF no blocking questions (completeness >= 8) → Skip to Phase 3

Phase 3: Design (No Interaction)

Goal: Produce minimal-change implementation plan.

codeagent-wrapper --agent code-architect - . <<'EOF'
Design minimal-change implementation:
- Reuse existing abstractions
- Minimize new files
- Follow established patterns from Phase 1 exploration

Output:
- File touch list with specific changes
- Build sequence
- Test plan
- Risks and mitigations
EOF

Phase 4: Implement + Review

Goal: Build feature and review in one phase.

  1. Invoke develop to implement. For full-stack projects, split into backend/frontend tasks with per-task skills: injection. Use --parallel when tasks can be split; use single agent when the change is small or single-domain.

Single-domain example (add --worktree if enabled):

codeagent-wrapper --worktree --agent develop --skills golang-base-practices - . <<'EOF'
Implement with minimal change set following the Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan
- Run narrowest relevant tests
EOF

Full-stack parallel example (adapt task IDs, skills, and content based on Phase 3 design):

codeagent-wrapper --worktree --parallel <<'EOF'
---TASK---
id: p4_backend
agent: develop
workdir: .
skills: golang-base-practices
---CONTENT---
Implement backend changes following Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan

---TASK---
id: p4_frontend
agent: develop
workdir: .
skills: frontend-design,vercel-react-best-practices
dependencies: p4_backend
---CONTENT---
Implement frontend changes following Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan
EOF

Note: Choose which skills to inject based on Phase 3 design output. Only inject skills relevant to each task's domain.

  1. Run parallel reviews:
codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p4_correctness
agent: code-reviewer
workdir: .
---CONTENT---
Review for correctness, edge cases, failure modes.
Classify each issue as BLOCKING or MINOR.

---TASK---
id: p4_simplicity
agent: code-reviewer
workdir: .
---CONTENT---
Review for KISS: remove bloat, collapse needless abstractions.
Classify each issue as BLOCKING or MINOR.
EOF
  1. Handle review results:
    • MINOR issues only → Auto-fix via develop, no user interaction
    • BLOCKING issues → Use AskUserQuestion: "Fix now / Proceed as-is"

Phase 5: Complete (No Interaction)

Goal: Document what was built.

codeagent-wrapper --agent code-reviewer - . <<'EOF'
Write completion summary:
- What was built
- Key decisions/tradeoffs
- Files modified (paths)
- How to verify (commands)
- Follow-ups (optional)
EOF

Output the completion signal:

<promise>DO_COMPLETE</promise>