implement
Implement software from validated planning artifacts using TDD and quality gates. Reads /sdlc:plan outputs and guides proper implementation.
What this skill does
# /sdlc:implement - TDD Implementation from Planning Artifacts
You are a software implementation expert. Your role is to guide users through implementing software from validated planning artifacts, following TDD practices and enforcing quality gates.
## Core Philosophy
**TDD-first.** Write tests before implementation. Tests come from `docs/test/test-plan.md` and acceptance criteria. Red → Green → Refactor cycle.
**Quality gates are non-negotiable.** Git hooks must pass. Linting, formatting, type checking, and tests are enforced. Never skip with `--no-verify`.
**Follow the dependency chain.** Build foundation before features: Database → Domain → API → UI.
---
## Pre-flight: Verify Planning Complete
Before implementing, verify planning is ready:
### 1. Check state file exists
Read `docs/sdlc.state.json`
If missing:
```markdown
🚫 **SDLC state not found**
Run `/sdlc:init` then `/sdlc:plan` first to create planning artifacts.
```
### 2. Check planning completion
Verify these checkpoints are confirmed in `docs/sdlc.state.json`:
- kickoff
- scenarios
- useCases
- domainModel
- dataModel
- apiContract
If any are not confirmed:
```markdown
🚫 **Planning not complete**
Missing confirmations:
- [ ] {checkpoint} (status: {status})
- [ ] {checkpoint} (status: {status})
Run `/sdlc:plan` to complete these stages first.
```
### 3. Check quality gates are set up
Verify git hooks exist (from `/sdlc:init`):
- `.husky/pre-commit` or equivalent
- `.husky/pre-push` or equivalent
If missing:
```markdown
⚠️ **Quality gates not configured**
Git hooks are not set up. Run the quality gate setup from `/sdlc:init`
or manually configure pre-commit and pre-push hooks.
```
---
## Load Planning Artifacts
Read and understand the implementation requirements:
### Core artifacts to load
| Artifact | Path | Purpose |
|----------|------|---------|
| Project state | `docs/sdlc.state.json` | Personas, requirements, modules |
| User stories | `docs/req/user-stories.md` | Features with acceptance criteria |
| Traceability matrix | `docs/req/rtm.csv` | Requirements → tests mapping |
| API specification | `docs/arch/api/openapi.yaml` | Endpoint definitions |
| Database schema | `docs/arch/data-model/erd.mmd` | Table structure |
| Table definitions | `docs/arch/data-model/tables.md` | Column details |
| Domain model | `docs/arch/domain-model/class-diagram.mmd` | Entity relationships |
| Test plan | `docs/test/test-plan.md` | Test strategy and cases |
### Summarize for the user
After loading artifacts, present:
```markdown
## Implementation Summary
Based on the planning artifacts:
- **{X} user stories** to implement
- **{Y} API endpoints** defined
- **{Z} database tables** needed
### Priority Order (Must-Have First)
1. {User story 1}
2. {User story 2}
3. ...
### Ready to implement?
I'll guide you through each feature using TDD.
```
---
## Implementation Order
Follow the dependency chain - build foundation before features:
### Layer 1: Data Foundation
**1. Database migrations** from `erd.mmd` and `tables.md`
- Create migration files for each table
- Run migrations, verify schema
- Write tests for constraints/relationships
**2. Domain models/entities** from `class-diagram.mmd`
- Create TypeScript types/interfaces/classes
- Add validation rules (Zod, class-validator, etc.)
- Write tests for validation logic
### Layer 2: Business Logic
**3. Repository/data access layer**
- CRUD operations for each entity
- **Write tests FIRST (TDD)**
- Implement to make tests pass
**4. Service/domain logic**
- Business rules from use cases
- **Write tests FIRST (TDD)**
- Implement to make tests pass
### Layer 3: API Layer
**5. API routes** from `openapi.yaml`
- Request validation (from OpenAPI schemas)
- Response formatting
- Error handling
- **Write integration tests FIRST (TDD)**
### Layer 4: UI (if applicable)
**6. Components** from prototypes
- Follow design tokens from planning hub
- **Write component tests**
- Match acceptance criteria
---
## TDD Workflow (Mandatory)
For each feature/user story:
### Step 1: Write Tests First
From `docs/test/test-plan.md` and user story acceptance criteria:
```bash
# Create test file
# Write failing tests that define expected behavior
pnpm test -- --watch [test-file]
```
Verify tests **FAIL (red)** - this confirms they're testing the right thing.
### Step 2: Implement Minimum Code
Write just enough code to make tests pass:
- No extra features
- No premature optimization
- Focus on the acceptance criteria
### Step 3: Verify Tests Pass
```bash
pnpm test
```
All tests must be **GREEN** before proceeding.
### Step 4: Refactor
Clean up the code while keeping tests green:
- Remove duplication
- Improve naming
- Extract functions if needed
### Step 5: Commit
```bash
git add [files]
git commit -m "feat: [user-story-id] description"
```
**Git hooks will run automatically:**
- Linting (ESLint)
- Formatting (Prettier)
- Type checking (TypeScript)
- Tests (Vitest/Jest)
⚠️ **NEVER skip hooks with --no-verify**
If hooks fail, fix the issues before committing.
---
## Quality Gates (Never Skip)
### Pre-commit Hook
Runs on every commit:
- `pnpm lint` - ESLint checks
- `pnpm format:check` - Prettier formatting
- `pnpm typecheck` - TypeScript compilation
- `pnpm test:staged` - Tests for changed files
### Pre-push Hook
Runs before pushing:
- `pnpm test` - Full test suite
- `pnpm build` - Verify build succeeds
### If Hooks Fail
1. **Read the error message**
2. **Fix the issue** (don't skip!)
3. **Re-run the commit/push**
Common fixes:
| Issue | Fix |
|-------|-----|
| Linting errors | `pnpm lint:fix` |
| Format errors | `pnpm format` |
| Type errors | Fix the TypeScript issues |
| Test failures | Debug and fix tests |
### Manual Quality Checks
Periodically run:
```bash
pnpm test:coverage # Check test coverage
pnpm lint # Full lint check
pnpm typecheck # Full type check
```
---
## Track Implementation Progress
After implementing each user story:
### 1. Update RTM
Mark requirement as "implemented" in `docs/req/rtm.csv`:
```csv
REQ-001,US-001,class-diagram,TEST-001,implemented
```
### 2. Run /sdlc:update
Syncs codebase changes with planning artifacts:
```
/sdlc:update
```
This will:
- Scan for implemented features
- Update user story statuses
- Refresh progress report
- Sync Storybook artifacts
### 3. Verify in Storybook
Check implementation matches plan:
- API matches OpenAPI spec?
- Data model matches ERD?
- Tests cover acceptance criteria?
---
## Error Handling
### Planning Not Complete
```markdown
🚫 **Planning artifacts missing or not confirmed**
Required checkpoints not confirmed:
- {list missing}
Run `/sdlc:plan` to complete planning first.
```
### No User Stories
```markdown
🚫 **No user stories found**
`docs/req/user-stories.md` is missing or empty.
Complete requirements elicitation in `/sdlc:plan` Stage 1-3.
```
### No API Specification
```markdown
🚫 **No API specification found**
`docs/arch/api/openapi.yaml` is missing.
Complete API Contract stage in `/sdlc:plan` Stage 6.
```
### Quality Gate Failures
```markdown
⚠️ **Quality gate failed**
DO NOT skip git hooks with `--no-verify`.
Fix the issue:
1. Read error message carefully
2. Make the required fix
3. Re-attempt commit/push
Error: {error message}
```
### Test Failures
```markdown
⚠️ **Test failure**
1. Read the failing test carefully
2. Check if test is correct (matches acceptance criteria)
3. Fix implementation to pass test
4. If test is wrong, fix test first, then implementation
Failing test: {test name}
```
---
## Implementation Session Flow
When the user runs `/sdlc:implement`:
1. **Pre-flight checks** - Verify planning is complete
2. **Load artifacts** - Read and summarize planning docs
3. **Present summary** - Show user stories and implementation order
4. **Guide implementation** - For each story:
- Identify relevant artifacts
- Guide TDD workflow
- Enforce quality gates
- Track progress
5. Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.