Claude
Skills
Sign in
Back

implement-feature

Included with Lifetime
$97 forever

Implement features with senior staff engineer best practices and parallel subagents. Activates when users want to implement, build, or add new functionality.

General

What this skill does


# Feature Implementation

Implement a new feature as a **Senior Staff Engineer** following best practices (SOLID, DRY, YAGNI) to create a secure, fast, and reliable production application.

## Feature to Implement

$ARGUMENTS

## Anti-Hallucination Guidelines

**CRITICAL**: Before implementing anything:
1. **Discover project commands first** - Do NOT assume `bun`, `npm`, `make`, etc. exist
2. **Read CLAUDE.md** - Every project may have different conventions
3. **Verify tools exist** - Check for `Makefile`, `justfile`, `package.json`, `pyproject.toml`, etc.
4. **Never guess test commands** - Find the actual test runner used by this project

## Quality Gates

This skill includes automatic implementation verification before completion:

### Completion Verification (Stop Hook)

When you attempt to stop working (mark implementation as complete), an automated verification agent runs to ensure quality:

**Verification Steps:**
1. **Test Suite**: Runs discovered test command from Phase 0 (e.g., `make test`, `npm test`, `pytest`)
2. **Linting**: Runs discovered lint command from Phase 0 (e.g., `make lint`, `npm run lint`, `ruff check`)
3. **Type Checking**: If applicable, runs type-check or build command

**Behavior:**
- ✅ **All checks pass**: Implementation marked complete
- ❌ **Any check fails**: Completion blocked, error details provided, Claude continues working to fix issues
- ℹ️ **Commands not found**: Hook attempts to discover commands from CLAUDE.md or project files

**Example blocked completion:**
```
⚠️ Implementation verification failed:

Tests: ❌ FAILED (3 tests failing)
  - test_user_authentication: AssertionError
  - test_oauth_flow: Connection timeout
  - test_token_refresh: Invalid token

Lint: ✅ PASSED
Type Check: ✅ PASSED

🔧 Cannot complete implementation until all tests pass. Please fix the failing tests.
```

**Benefits:**
- Prevents marking features "complete" when tests are failing
- Catches regressions before moving on
- Enforces test-driven development discipline
- Ensures production-ready code quality

## Task Management

This skill uses Claude Code's Task Management System to track implementation progress with dependency-aware task tracking.

**When to Use Tasks:**
- Complex multi-step implementations (3+ phases)
- Features with parallel subagent work
- Work requiring progress tracking across sessions

**When to Skip Tasks:**
- Simple 1-2 file changes
- Trivial bug fixes
- Quick refactorings

**Task Structure:**
Each implementation creates tasks for all 6 phases with dependencies, tracking progress and blocking relationships. Tasks support parallel execution where independent work can proceed simultaneously.

## Implementation Workflow

**Task tracking replaces TodoWrite.** Create task structure at start, update as completing each phase.

### Phase 0: Project Discovery (REQUIRED)

**Step 0.1: Create Task Structure**

Before starting implementation, create the dependency-aware task structure:

```
TaskCreate:
  subject: "Phase 0: Discover project workflow"
  description: "Identify test, lint, build, dev server commands from CLAUDE.md and task runners"
  activeForm: "Discovering project workflow"

TaskCreate:
  subject: "Phase 1: Research best practices"
  description: "Web search and Context7 research for [FEATURE]"
  activeForm: "Researching best practices"

TaskCreate:
  subject: "Phase 2: Create implementation plan"
  description: "Enter plan mode and get user approval"
  activeForm: "Creating implementation plan"

TaskCreate:
  subject: "Phase 3: Implement feature"
  description: "Execute implementation with parallel subagents"
  activeForm: "Implementing feature"

TaskCreate:
  subject: "Phase 4: Verify implementation"
  description: "Run full test suite, lint, type-check"
  activeForm: "Verifying implementation"

TaskCreate:
  subject: "Phase 5: Final commit"
  description: "Create conventional commit with summary"
  activeForm: "Creating final commit"

# Set up dependencies (strict sequential chain)
TaskUpdate: { taskId: "2", addBlockedBy: ["1"] }  # Research after Discovery
TaskUpdate: { taskId: "3", addBlockedBy: ["2"] }  # Plan after Research
TaskUpdate: { taskId: "4", addBlockedBy: ["3"] }  # Implement after Plan
TaskUpdate: { taskId: "5", addBlockedBy: ["4"] }  # Verify after Implement
TaskUpdate: { taskId: "6", addBlockedBy: ["5"] }  # Commit after Verify

# Mark first task as in progress
TaskUpdate: { taskId: "1", status: "in_progress" }
```

**Step 0.2: Discover Project Workflow**

Use Haiku-powered Explore agent for token-efficient discovery:

```
Use Task tool with Explore agent:
- prompt: "Discover the development workflow for this project:
    1. Read CLAUDE.md if it exists - extract all development commands
    2. Check for task runners: Makefile, justfile, package.json scripts, pyproject.toml scripts
    3. Identify the test command (e.g., make test, just test, npm test, pytest, bun test)
    4. Identify the lint command (e.g., make lint, npm run lint, ruff check)
    5. Identify the build/type-check command
    6. Identify the dev server command if applicable
    7. Note any pre-commit hooks or quality gates
    Return a structured summary of all available commands."
- subagent_type: "Explore"
- model: "haiku"  # Token-efficient for discovery
```

Store discovered commands for use in later phases. Example output:
```
Project Commands:
- Test: `make test` or `pytest`
- Lint: `make lint` or `ruff check`
- Type Check: `make type-check` or `pyright`
- Build: `make build` or `npm run build`
- Dev Server: `make dev` or `npm run dev`
- Quality: `make check` (runs all checks)
```

**Step 0.3: Complete Phase 0**

```
TaskUpdate: { taskId: "1", status: "completed" }
TaskList  # Check that Task 2 is now unblocked
```

### Phase 1: Research & Discovery

**Step 1.1: Start Phase 1**

```
TaskUpdate: { taskId: "2", status: "in_progress" }
```

**Step 1.2: Research Best Practices**

Before implementing, research best practices and understand the codebase context using Haiku-powered Explore agent:

```
Use Task tool with Explore agent:
- prompt: "Research and gather context for implementing [FEATURE]:

    1. **Best Practices Research**: Search the web for 'latest best practices' and 'current year best practices' related to [FEATURE]. Look for:
       - Current industry standards and patterns
       - Security considerations
       - Performance recommendations
       - Common pitfalls to avoid

    2. **Library Documentation** (if using external libraries/frameworks):
       - Use Context7 MCP to fetch up-to-date documentation
       - Validate API usage patterns against current docs
       - Check for deprecated methods or breaking changes

    3. **Codebase Exploration**:
       - Find similar existing implementations to reference
       - Identify coding patterns and conventions used
       - Locate test patterns and fixtures
       - Note file organization and naming conventions

    Return a comprehensive summary with:
    - Relevant best practices (with sources)
    - Library API patterns to follow (if applicable)
    - Specific file paths and existing patterns from the codebase"
- subagent_type: "Explore"
- model: "haiku"  # Token-efficient for research
```

**Step 1.3: Complete Phase 1**

```
TaskUpdate: { taskId: "2", status: "completed" }
TaskList  # Check that Task 3 is now unblocked
```

### Phase 2: Planning

**Step 2.1: Start Phase 2**

```
TaskUpdate: { taskId: "3", status: "in_progress" }
```

**Step 2.2: Create Implementation Plan**

1. **Enter Plan Mode**: Use `EnterPlanMode` to create a detailed implementation plan
2. **Plan Contents**:
   - Break down the feature into discrete, parallelizable tasks
   - Identify which tasks can be done by subagents concurrently
   - Define clear interfaces between components
   - Consider security implications
   - Plan test coverage strategy
3. **Get User Approval**: Exit plan mode only after user approves the plan

**Step 2.3: Complete Phase 2**

```
TaskUpdate: { taskI
Files: 2
Size: 25.2 KB
Complexity: 43/100
Category: General

Related in General