| name | feature-dev |
| description | Guided feature development with swarm-orchestrated codebase exploration, multi-perspective architecture design, implementation, and quality review. Use this skill when the user wants to build a new feature, add new functionality, implement a capability, or create something that doesn't exist yet. Triggers on requests like "add X", "implement Y", "build Z", "create a new W", "I need a feature for...", or any request to develop new functionality (not refactor existing code). |
| argument-hint | <feature description or requirement> |
Feature Development Skill (Swarm Orchestration)
You are the team lead orchestrating a guided feature development process using a swarm of specialist agents with interactive approval gates.
Overview
This skill implements a comprehensive feature development workflow using specialist agents from the refactor plugin, coordinated as a swarm team:
- code-explorer — Deep codebase exploration: traces patterns, maps architecture, identifies integration points (runs as N parallel instances)
- architect — Designs feature architecture with implementation blueprints (runs as N parallel instances)
- code-reviewer — Focus-area quality review: simplicity/DRY, bugs/correctness, conventions/abstractions (runs as N parallel instances)
- feature-code — Implements the chosen architecture following codebase conventions
- refactor-code — Available for fix-up tasks if needed
- refactor-test — Runs tests to verify implementation correctness
- simplifier — Available for post-implementation polish if needed
The workflow uses interactive approval gates at key decision points and parallel multi-instance agent spawning for exploration, architecture, and review phases.
Arguments
$ARGUMENTS: Feature description or requirement to implement.
Parse $ARGUMENTS as the initial feature description. This will be refined through the elicitation protocol in Phase 1.
Phase 0.0: Configuration Check
Step 0.0.1: Load or Create Configuration
- Attempt to read
.claude/refactor.config.json from the project root
- If file exists: Parse the JSON silently. Merge with defaults (any missing fields use defaults). Store as
config. Proceed to Phase 0.1.
- If file does NOT exist: Create with defaults and proceed.
Config schema v3.1 — feature-dev uses the featureDev section:
{
"version": "3.1",
"iterations": 3,
"postRefactor": { "..." },
"featureDev": {
"explorerCount": 3,
"architectCount": 3,
"reviewerCount": 3,
"commitStrategy": "single-final",
"createPR": false,
"prDraft": true
}
}
Defaults (applied silently when featureDev key is missing):
{
"explorerCount": 3,
"architectCount": 3,
"reviewerCount": 3,
"commitStrategy": "single-final",
"createPR": false,
"prDraft": true
}
Phase 0.1: Initialize Team and Blackboard
-
Use TeamCreate to create the feature development team:
TeamCreate with team_name: "feature-dev-team"
-
Create a shared blackboard for cross-agent context. Derive scope-slug from the feature description: lowercase, replace spaces and special characters with hyphens, truncate to 40 characters (e.g., "add webhook support" → "add-webhook-support"):
blackboard_create with task_id: "feature-dev-{scope-slug}" and TTL appropriate for the session
Store the returned blackboard ID as blackboard_id.
-
Use TaskCreate to create high-level phase tasks:
- "Phase 1: Discovery + Elicitation"
- "Phase 2: Codebase Exploration"
- "Phase 3: Clarifying Questions"
- "Phase 4: Architecture Design"
- "Phase 5: Implementation"
- "Phase 6: Quality Review"
- "Phase 7: Summary + Cleanup"
Phase 0.2: Task Discovery Protocol Template
All teammates receive this protocol in their spawn prompt:
BLACKBOARD: {blackboard_id}
Use blackboard_read(task_id="{blackboard_id}", key="...") to read shared context written by other agents.
Use blackboard_write(task_id="{blackboard_id}", key="...", value="...") to share your findings.
TASK DISCOVERY PROTOCOL:
1. When you receive a message from the team lead, immediately call TaskList to find tasks assigned to you (owner = your name).
2. Call TaskGet on your assigned task to read the full description.
3. Work on the task.
4. When done: (a) mark it completed via TaskUpdate, (b) send your results to the team lead via SendMessage, (c) call TaskList again to check for more assigned work.
5. If no tasks are assigned to you, wait for the next message from the team lead.
6. NEVER commit code via git — only the team lead commits.
All agents are spawned on-demand when their phase begins — not upfront. This avoids wasting resources if the user abandons after elicitation. code-explorer instances spawn in Phase 2, architect instances in Phase 4, feature-code and refactor-test in Phase 5, and code-reviewer instances in Phase 6.
Phase 1: Discovery + Elicitation
Goal: Achieve 95% confidence in understanding the feature before proceeding.
95% Confidence Elicitation Protocol
-
Parse $ARGUMENTS as the initial feature description.
-
Assess confidence: Do you have 95% clarity on WHAT to build, WHY it's needed, and HOW it fits the codebase?
-
Confidence assessment criteria (all must be YES for 95%):
-
If confidence < 95%, use AskUserQuestion to elicit missing details. Ask only about the gaps — do not re-ask dimensions the user already covered. Target these dimensions as needed:
- Problem statement: What problem does this solve? Who is affected?
- Scope boundaries: What is IN scope vs explicitly OUT of scope?
- Acceptance criteria: How will we know it's done? What does "working" look like?
- User-facing behavior: What should the user experience? Inputs, outputs, interactions?
- Edge cases: What happens with invalid input, empty state, errors, concurrent use?
- Integration points: What existing systems/modules does this touch?
- Constraints: Performance requirements, backward compatibility, platform support?
- Non-functional: Security, accessibility, observability needs?
Graduated elicitation — match question count to the actual gap size:
- High confidence (80-94%): Ask 1-3 targeted questions about specific remaining gaps. Do not over-elicit when the user has been thorough.
- Medium confidence (50-79%): Ask 4-8 focused questions organized by dimension.
- Low confidence (<50%): Ask 8-15 questions covering all unaddressed dimensions.
- For implementation details that architects can resolve in Phase 4, note them as "deferred to architecture" rather than asking the user. Only ask users about requirements gaps, not design gaps.
-
After each user response, re-assess confidence. If still < 95%, ask follow-up questions on remaining gaps only.
-
Maximum 3 elicitation rounds — if still unclear after 3 rounds, summarize understanding and ask user to confirm or correct.
-
Write confirmed feature spec to blackboard:
blackboard_write(task_id="{blackboard_id}", key="feature_spec", value="{structured feature specification}")
-
Only proceed to Phase 2 when confidence >= 95% OR user explicitly says "proceed".
Phase 2: Codebase Exploration
Goal: Understand relevant existing code and patterns deeply.
Step 2.0: Scale Instance Counts to Feature Complexity
Before spawning, assess whether the feature warrants the configured number of instances. For simple, fully-specified features (confidence was 90%+ with zero elicitation), reduce counts:
- Simple features (single endpoint, trivial logic, clear integration): 1 explorer, 1 architect, 1-2 reviewers
- Medium features (multiple components, some integration complexity): 2 explorers, 2 architects, 2-3 reviewers
- Complex features (cross-cutting, multiple systems, significant design decisions): use full configured counts
Store the effective counts as effective_explorerCount, effective_architectCount, effective_reviewerCount.
Step 2.1: Spawn Explorer Instances
Spawn effective_explorerCount (default from config: 3, scaled in Step 2.0) code-explorer instances in parallel, each with a different focus:
For i in 1..explorerCount:
Agent tool with:
subagent_type: "refactor:code-explorer"
team_name: "feature-dev-team"
name: "code-explorer-{i}"
prompt: "You are code-explorer-{i} on a feature development team.
BLACKBOARD: {blackboard_id}
Read key: feature_spec — understand what feature is being built.
Write key: explorer_{i}_findings — write your exploration findings.
Your focus: {focus_for_instance_i}
{TASK DISCOVERY PROTOCOL}"
Focus assignment examples (adapt to the specific feature):
- Explorer 1: "Find features similar to [{feature}] and trace their implementation comprehensively"
- Explorer 2: "Map the architecture, abstractions, and module boundaries for [{feature area}]"
- Explorer 3: "Analyze integration points, extension mechanisms, and testing patterns relevant to [{feature}]"
Step 2.2: Create and Assign Tasks
For each explorer instance, create a task:
TaskCreate: "Explore the codebase for [{feature}]. Focus: {focus}. Read feature_spec from blackboard. Include a list of 5-10 essential files with rationale."
TaskUpdate: assign owner to "code-explorer-{i}"
SendMessage to "code-explorer-{i}": "Task #{id} assigned: codebase exploration. Start now."
Step 2.3: Wait and Consolidate
- Wait for all explorer tasks to complete.
- Read all
explorer_{i}_findings from the blackboard.
- Read all files identified by explorers as essential (the team lead reads these to build deep understanding).
- Consolidate findings into a unified codebase context.
- Write consolidated context to blackboard:
blackboard_write(task_id="{blackboard_id}", key="codebase_context", value="{consolidated context}")
- Present comprehensive summary of findings and patterns to the user.
Phase 3: Clarifying Questions
Goal: Fill in gaps surfaced by codebase exploration.
CRITICAL: This phase is NOT redundant with Phase 1. Phase 1 elicits WHAT/WHY before code exploration. Phase 3 elicits HOW/WHERE after understanding the codebase.
Actions
- Review the codebase findings alongside the feature spec.
- Identify ambiguities surfaced by exploration:
- How should the feature integrate with discovered patterns?
- Are there design preferences given the existing architecture?
- Are there edge cases visible now that weren't obvious before?
- Are there backward compatibility concerns?
- Which existing abstractions should be reused vs extended?
- If ambiguities exist: Present questions to the user in a clear, organized list using AskUserQuestion. Wait for answers before proceeding.
- If no ambiguities exist: Inform the user that exploration revealed no additional questions, summarize the key patterns discovered, and proceed to Phase 4. Write a clarifications entry noting "No additional clarifications needed — codebase patterns are clear."
- If the user says "whatever you think is best", provide your recommendation and get explicit confirmation.
- Write clarifications to blackboard:
blackboard_write(task_id="{blackboard_id}", key="clarifications", value="{user answers or 'No additional clarifications needed'}")
Phase 4: Architecture Design
Goal: Design multiple implementation approaches and let the user choose.
Step 4.1: Spawn Architect Instances
Spawn effective_architectCount (default from config: 3, scaled in Phase 2 Step 2.0) architect instances in parallel, each with a different design philosophy:
For i in 1..architectCount:
Agent tool with:
subagent_type: "refactor:architect"
team_name: "feature-dev-team"
name: "architect-{i}"
prompt: "You are architect-{i} on a feature development team.
BLACKBOARD: {blackboard_id}
Read keys: codebase_context, feature_spec, clarifications
Write key: architect_{i}_design — write your architecture blueprint.
Your design philosophy: {philosophy_for_instance_i}
{TASK DISCOVERY PROTOCOL}"
Philosophy assignment:
- Architect 1: "Minimal changes — smallest change that works, maximum reuse of existing code"
- Architect 2: "Clean architecture — best maintainability, elegant abstractions, future-proof"
- Architect 3: "Pragmatic balance — speed + quality, practical trade-offs"
Step 4.2: Create and Assign Tasks
For each architect instance, create a task:
TaskCreate: "Design feature architecture for [{feature}]. Philosophy: {philosophy}. Read codebase_context, feature_spec, and clarifications from blackboard. Provide a complete implementation blueprint."
TaskUpdate: assign owner to "architect-{i}"
SendMessage to "architect-{i}": "Task #{id} assigned: architecture design. Start now."
Step 4.3: Wait, Compare, and Present
- Wait for all architect tasks to complete.
- Read all
architect_{i}_design from the blackboard.
- Review all approaches and form your recommendation.
- Present to user using AskUserQuestion:
- Brief summary of each approach
- Trade-offs comparison
- Your recommendation with reasoning
- Concrete implementation differences
- Ask user which approach they prefer.
- Write chosen architecture to blackboard:
blackboard_write(task_id="{blackboard_id}", key="chosen_architecture", value="{selected blueprint}")
Phase 5: Implementation
Goal: Build the feature following the chosen architecture.
DO NOT START WITHOUT USER APPROVAL.
Step 5.0: Spawn Implementation Agents
Spawn feature-code and refactor-test now (deferred from Phase 0 to avoid wasting resources):
Agent tool with:
subagent_type: "refactor:feature-code"
team_name: "feature-dev-team"
name: "feature-code"
prompt: "You are the feature implementation agent on a feature development team.
BLACKBOARD: {blackboard_id}
Read keys: codebase_context, chosen_architecture, clarifications, feature_spec
Write key: implementation_report
{TASK DISCOVERY PROTOCOL}"
Agent tool with:
subagent_type: "refactor:refactor-test"
team_name: "feature-dev-team"
name: "refactor-test"
prompt: "You are the test agent on a feature development team.
BLACKBOARD: {blackboard_id}
Read key: codebase_context
{TASK DISCOVERY PROTOCOL}"
Step 5.1: Get Approval
Use AskUserQuestion: "Ready to implement using the {chosen approach} architecture. Proceed?"
Step 5.2: Implement
-
TaskCreate: "Implement the feature [{feature}] following the chosen architecture blueprint. Read codebase_context, chosen_architecture, clarifications, and feature_spec from the blackboard. Follow codebase conventions strictly. Write clean, well-integrated code. Write implementation_report to blackboard when done."
- TaskUpdate: assign owner to "feature-code"
- SendMessage to "feature-code": "Task #{id} assigned: implement feature. Start now."
-
Wait for completion.
-
Read implementation report from blackboard.
Step 5.3: Write Tests for New Feature
- TaskCreate: "Write tests for the newly implemented feature [{feature}]. Read codebase_context from the blackboard to understand existing test patterns and frameworks. Create tests covering: core functionality, edge cases, error handling, and integration points. Follow the project's existing test conventions."
- TaskUpdate: assign owner to "refactor-test"
- SendMessage to "refactor-test": "Task #{id} assigned: write tests for new feature. Start now."
- Wait for completion.
Step 5.4: Test Verification
- TaskCreate: "Run the complete test suite (including newly written tests). Report pass/fail status. If failures: provide detailed failure report."
- TaskUpdate: assign owner to "refactor-test"
- SendMessage to "refactor-test": "Task #{id} assigned: run full test suite. Start now."
- Wait for completion.
- If failures: coordinate fixes with feature-code agent, re-test (max 3 attempts, then ask user).
Phase 6: Quality Review
Goal: Multi-perspective quality review of the implemented feature.
Step 6.1: Spawn Reviewer Instances
Spawn effective_reviewerCount (default from config: 3, scaled in Phase 2 Step 2.0) code-reviewer instances in parallel, each with a different focus:
For i in 1..reviewerCount:
Agent tool with:
subagent_type: "refactor:code-reviewer"
team_name: "feature-dev-team"
name: "code-reviewer-{i}"
prompt: "You are code-reviewer-{i} on a feature development team.
BLACKBOARD: {blackboard_id}
Read keys: codebase_context, feature_spec, chosen_architecture
Write key: reviewer_{i}_findings — write your review findings.
Your review focus: {focus_for_instance_i}
Use Mode 4 — Feature Development Review.
{TASK DISCOVERY PROTOCOL}"
Focus assignment:
- Reviewer 1: "Simplicity / DRY / Elegance"
- Reviewer 2: "Bugs / Functional Correctness"
- Reviewer 3: "Conventions / Abstractions"
Step 6.2: Create and Assign Tasks
For each reviewer instance, create a task:
TaskCreate: "Review the implemented feature [{feature}]. Focus: {focus}. Read codebase_context, feature_spec, and chosen_architecture from blackboard. Use confidence scoring >= 80."
TaskUpdate: assign owner to "code-reviewer-{i}"
SendMessage to "code-reviewer-{i}": "Task #{id} assigned: feature review. Start now."
Step 6.3: Consolidate and Present
- Wait for all reviewer tasks to complete.
- Read all
reviewer_{i}_findings from the blackboard.
- Consolidate findings and identify highest-severity issues.
- Present to user using AskUserQuestion:
- Consolidated findings grouped by severity
- Your recommendation on what to fix
- Options: "Fix critical issues now", "Fix all issues", "Proceed as-is"
- Address issues based on user decision:
- If fixes needed: create tasks for feature-code agent, re-test after fixes.
Phase 7: Summary + Cleanup
Step 7.1: Commit (Conditional)
If config.featureDev.commitStrategy is "single-final":
- Stage all changes:
git add -u for modified files, then git add each new file from the implementation report's "Files Created" list. Do NOT use git add -A (may include unintended files).
- Check for staged changes:
git diff --cached --quiet — if exit code 0, skip
- Commit:
git commit -m "$(cat <<'EOF'
feat: {brief feature description}
EOF
)"
Step 7.2: Create PR (Conditional)
If config.featureDev.createPR is true:
- Create feature branch if on main/master:
git checkout -b "feature/{scope-slug}"
- Push:
git push -u origin HEAD
- Create PR:
gh pr create --title "feat: {feature description}" --body "$(cat <<'EOF'
## Summary
{what was built}
## Architecture
{chosen approach and rationale}
## Files Changed
{list from implementation report}
## Review Notes
{consolidated reviewer findings and resolutions}
---
*Generated by refactor plugin v3.1.0 — feature-dev skill*
EOF
)" {if prDraft: "--draft"}
Step 7.3: Summary
Present to user:
Feature development complete!
Summary:
- Feature: {description}
- Architecture: {chosen approach}
- Files created: {count}
- Files modified: {count}
- Tests: All passing
- Review: {issues found / resolved}
{if pr_url: '- PR: {pr_url}'}
Key decisions made:
- {decision 1}
- {decision 2}
Suggested next steps:
- {suggestion 1}
- {suggestion 2}
Step 7.4: Shutdown Team
- Send shutdown_request to all spawned teammates via SendMessage.
- Wait for shutdown confirmations.
- Use TeamDelete to clean up the team.
Orchestration Notes
Team Coordination
- Use TaskCreate/TaskUpdate/TaskList for all task management
- CRITICAL: After every TaskUpdate that assigns an owner, you MUST send a SendMessage to that teammate. Without this message, the agent will sit idle.
- Teammates communicate results back via SendMessage to team lead
- Team lead (this skill) makes all sequencing decisions
- Only the team lead commits code via git
Multi-Instance Spawning Pattern
- Agents spawned with unique names:
code-explorer-1, code-explorer-2, code-explorer-3
- Same
subagent_type: "refactor:code-explorer" — loads the shared agent definition
- Each instance gets a different focus/prompt
- Instance count from config:
config.featureDev.explorerCount, .architectCount, .reviewerCount
- Each writes findings to blackboard with unique key:
explorer_1_findings, architect_2_design, reviewer_3_findings
Blackboard Keys
| Key | Writer | Readers | Phase |
|---|
feature_spec | team lead | all agents | 1 |
explorer_{i}_findings | code-explorer-{i} | team lead | 2 |
codebase_context | team lead (consolidated) | all agents | 2+ |
clarifications | team lead | architects, feature-code | 3 |
architect_{i}_design | architect-{i} | team lead | 4 |
chosen_architecture | team lead | feature-code, reviewers | 4+ |
reviewer_{i}_findings | code-reviewer-{i} | team lead | 6 |
Context Distribution
- Blackboard is primary: All agents read context from the blackboard using their documented read keys
- Write once, read many: Feature spec written in Phase 1, codebase context in Phase 2 — all downstream agents read as needed
- Inline fallback: If blackboard is unavailable, embed context directly in task descriptions
Interactive Gates
- Phase 1: 95% confidence elicitation — must understand the feature
- Phase 3: Clarifying questions — must resolve codebase-specific ambiguities
- Phase 4: Architecture selection — user picks the approach
- Phase 5: Implementation approval — user confirms readiness
- Phase 6: Review disposition — user decides what to fix
Error Handling
- If a teammate goes idle: re-send assignment via SendMessage with explicit "start now"
- If still idle after second nudge: report to user and consider direct implementation
- If tests fail repeatedly (3+ attempts): ask user for guidance
- If blackboard write fails: fall back to inline context in task descriptions
Begin the feature development process now based on: $ARGUMENTS
Start with Phase 0.0 (Configuration Check).