| name | code-implementer |
| description | This skill should be used when the user asks to 'implement', 'write code', 'build a feature', 'create a function', 'add functionality', 'code this', 'make this work', or needs to write production code for Java/Spring Boot or TypeScript/Next.js following FP, DDD, and testability patterns. Ensures code follows functional core/imperative shell, proper invariants, Either-based error handling, and is designed for testing without mocks. |
Code Implementer Skill
Expert implementation guidance ensuring code follows FP principles, DDD patterns, and is designed for maximum testability.
This is an IMPLEMENTATION skill - write production code following the architectural patterns. For design decisions and architectural review, use /architecture-tech-lead instead.
Context Loading
Before implementing, load the relevant rules. Read ONLY what's needed:
Always read:
~/.dotfiles/claude/project/meta/rules/architecture.md - core principles (FC/IS, DDD, immutability)
Java (if implementing Java/Spring Boot):
~/.dotfiles/claude/project/java/rules/java-patterns.md - records, sealed types, Either, railway-oriented programming
~/.dotfiles/claude/project/java/rules/property-testing.md - jqwik invariants
TypeScript (if implementing TypeScript/Next.js):
~/.dotfiles/claude/project/typescript/rules/typescript-patterns.md - discriminated unions, branded types, ts-pattern
Rust (if implementing Rust):
~/.dotfiles/claude/project/rust/rules/rust-patterns.md - newtype, typestate, Result combinators
Pre-Implementation Checklist
Before writing code, verify:
During Implementation
Structure Code as Functional Core + Imperative Shell
Imperative Shell (thin):
- Fetches data (DB, APIs)
- Calls pure functions
- Persists results
- Handles I/O errors
Functional Core (where logic lives):
- Pure functions, no side effects
- Receives all data as parameters
- Returns new data, never mutates
- Trivially unit testable
Apply Type Design
Apply patterns from loaded rules:
- Java: Records, sealed types, pattern matching (see java-patterns.md)
- TypeScript: Discriminated unions, ts-pattern, Zod (see typescript-patterns.md)
- Rust: Newtypes, enums, typestate (see rust-patterns.md)
Handle Errors Properly
Use Either/Result for all expected failures:
- Chain operations with
flatMap
- Collect validation errors with
Eithers.allFailures()
- Never throw for expected failures - return typed errors
Post-Implementation Checklist
After writing code, verify:
Implementation Patterns Quick Reference
Data Transformation Flow
fetch (I/O) -> transform (pure) -> persist (I/O)
Service Method Structure
1. Fetch required data (shell - I/O)
2. Call pure function with data (core - testable)
3. Persist result (shell - I/O)
4. Return result
Invariant Enforcement
Constructor validates -> Object always valid -> No defensive checks elsewhere
Error Handling Chain
validate -> process -> transform -> (all via flatMap/map)
Test Strategy
For every implementation, consider:
Unit Tests (core logic)
- Test pure functions with plain data
- No mocks needed
- Cover edge cases
Property Tests (invariants)
- What must ALWAYS be true?
- Round-trip properties
- Idempotence where applicable
Integration Tests (shell only)
- Minimal - just verify I/O works
- Use real DB/APIs in test containers
- Don't test business logic here
Quality Standards
- Complete: Implement full feature, not partial
- Testable: Every function testable without mocks
- Typed Errors: Either/Result for all failures
- Immutable: No mutations without justification
- Validated: Parse, don't validate - return validated types