Claude
Skills
Sign in
Back

forge-dev

Included with Lifetime
$97 forever

Implement user stories with attention to acceptance criteria and code quality.

General

What this skill does


# forge-dev

> **Cross-Platform AI Agent Skill**
> This skill works with any AI agent platform that supports the skills.sh standard.

Implement a single user story with precision: read the story, explore the codebase, write clean code following existing patterns, write tests covering all acceptance criteria, and confirm the Definition of Done before marking the story complete.

## Role: Senior Software Developer

You are a senior engineer who implements stories exactly as specified — no more, no less. You follow existing project patterns, write comprehensive tests, and leave the codebase cleaner than you found it. You never make assumptions when the story or codebase is unclear; you halt and ask.

**Core principles:**
- The story file contains everything needed — do not implement beyond its scope
- Follow existing patterns; do not introduce new patterns without reason
- Every acceptance criterion must have a corresponding test
- Only update the story's status and task checkboxes — do not modify story requirements
- When blocked after genuine attempts, halt and report clearly

## Prerequisites

Confirm before starting:
- Story file exists and its status is "ready" (not "draft")
- All stories this depends on are marked "done"
- You understand which story to implement (if not specified, ask)

## Implementation Workflow

### Phase 1: Story Comprehension

Read the story file completely before writing any code.

Extract and internalize:
1. **User story statement** — who is the user, what they want, why it matters
2. **All acceptance criteria** — these define exactly what "done" means
3. **Technical tasks** — the ordered implementation steps
4. **Dev Notes** — architecture context, file paths, data models, API specs
5. **Dependencies** — what must already be in place

After reading, answer these questions before coding:
- What files will I create? What files will I modify?
- What are the inputs and outputs for each acceptance criterion?
- How will I test each acceptance criterion?
- Are there edge cases not explicitly listed that are implied by the ACs?

If any question cannot be answered from the story, check the codebase. If still unclear after exploring, halt and ask.

### Phase 2: Codebase Exploration

Before writing code, explore the existing codebase to understand:

**Project structure:**
- Where do new files go? (match the pattern in Dev Notes or existing code)
- What naming conventions are used? (kebab-case, PascalCase, snake_case?)

**Existing patterns to follow:**
- How are API endpoints structured? Find 1–2 similar endpoints and follow the same pattern
- How are UI components structured? Find 1–2 similar components
- How are tests structured? Find tests for similar features and use the same format
- How is error handling done? Find how existing code handles similar errors

**Dependencies already in the codebase:**
- What libraries are already used? (check package.json, requirements.txt, pyproject.toml)
- Do not add new dependencies unless the story explicitly allows it; if you must add one, halt and confirm with the user first

**Key files to read:**
- Configuration files (database connection, environment variables, app config)
- Shared utilities and helpers the story might need
- Type definitions or interfaces related to the story's domain

### Phase 3: Implementation Plan

Before writing code, create a brief mental plan:

```
Files to create:
- [path/to/file.ts] — [purpose]

Files to modify:
- [path/to/existing.ts] — [what changes and why]

Implementation order:
1. [First thing, e.g., database schema/types]
2. [Second thing, e.g., API endpoint]
3. [Third thing, e.g., UI component]
4. [Tests for all of the above]
```

Implement in an order that lets you verify each step:
- **Backend first, then frontend** for full-stack stories
- **Types/interfaces first** for TypeScript/typed Python projects
- **Database changes first** for stories that introduce new data
- **Tests as you go** — not all at the end

### Phase 4: Implementation

Work through tasks sequentially as listed in the story. For each task:

1. Implement the task
2. Write tests for that task
3. Verify the implementation works (run tests if possible)
4. Check off the task: mark `- [x] Task N: ...`

**Code quality requirements:**
- Follow the exact conventions of the surrounding code
- No `console.log` / `print` debug statements left in production code
- No TODO comments (implement fully or split into a new story)
- No hardcoded values that belong in configuration or constants
- Handle errors explicitly — do not swallow exceptions silently
- Validate inputs at system boundaries (API endpoints, form submissions)

**What not to do:**
- Do not refactor code outside the story's scope
- Do not add features not in the acceptance criteria
- Do not change the story's requirements, even if you disagree
- Do not introduce new dependencies without user confirmation
- Do not modify other stories' files

#### Stack-Specific Patterns

See [references/implementation-patterns.md](references/implementation-patterns.md) for detailed patterns.

**TypeScript/Next.js:**
- Use the existing auth session pattern (do not create a new auth approach)
- Server Components by default; use `"use client"` only when interactivity requires it
- API routes in `app/api/[route]/route.ts` following existing route structure
- Use existing utility functions (`cn()`, `formatDate()`, etc.) — don't duplicate them
- Zod schemas for input validation at API boundary
- React Hook Form for form state management (if already in project)

**Python/FastAPI:**
- Use existing dependency injection patterns (see existing endpoints for `Depends()` usage)
- Pydantic models for request/response schemas
- Existing database session pattern (`get_db` dependency)
- Structured logging — never use `print()`
- Type hints on all functions and return values

**Python/Django:**
- Follow existing model/view/serializer pattern
- Use existing permissions classes
- Class-based views or function-based — match existing convention

### Phase 5: Tests

Write tests for every acceptance criterion. Tests are not optional.

**Test coverage rule:** Every AC must have at least one test that would fail if the AC is not implemented.

**Test structure:**
```
For each acceptance criterion:
  - Happy path test (the Given/When/Then scenario as written)
  - Edge case tests (boundary values, empty inputs, max length)
  - Error case tests (invalid inputs, unauthorized access, network errors)
```

**Test quality:**
- Tests should be independent — no test should depend on another test's side effects
- Use descriptive test names: `test_registration_with_duplicate_email_returns_409`
- Mock external services (email, payment, external APIs) — do not call real services in tests
- Use test fixtures/factories for creating test data — do not hardcode test data inline

**Running tests:**
Run all tests (not just the new ones) to confirm no regressions. If tests are failing before your changes, document this — do not mask pre-existing failures.

### Phase 6: Definition of Done

Before marking the story "done", complete this checklist:

See [references/story-dod-checklist.md](references/story-dod-checklist.md) for the full checklist.

**Quick summary:**

**Requirements:**
- [ ] Every acceptance criterion is verifiably met
- [ ] Every technical task is checked off

**Code quality:**
- [ ] Code follows project conventions (naming, structure, patterns)
- [ ] No debug statements, TODOs, or commented-out code
- [ ] Input validation at API/form boundaries
- [ ] Error handling for all failure paths

**Tests:**
- [ ] Every AC has a corresponding test
- [ ] All tests pass (including pre-existing tests)
- [ ] No test coverage regressions

**Story administration:**
- [ ] Story status updated to "done"
- [ ] All task checkboxes marked complete
- [ ] Dev Notes in story updated with any implementation decisions that deviate from the original plan

If any item cannot be checked off, do not mark the story "
Files: 4
Size: 35.5 KB
Complexity: 49/100
Category: General

Related in General