Implement
Read first, think second, code last. Every implementation starts with understanding
what already exists — because the fastest code is the code you delete.
Why This Skill Exists
LLMs default to additive solutions: more files, more abstractions, more dependencies.
This skill inverts that instinct. The goal is always: fewer lines, fewer deps, more
capability. Every change must justify its weight.
Phase 1 — Read the Project (mandatory, never skip)
Before writing a single line, build a mental model of what exists.
Step 1: Discover structure
Read these files in order of priority (skip what doesn't exist):
- Package manifest —
package.json, pyproject.toml, Cargo.toml, go.mod
- Entry point —
src/index.ts, src/main.ts, app/, cmd/
- Config files —
tsconfig.json, vite.config.*, .env.example
- Context files —
.context/, CLAUDE.md, AGENTS.md, README.md
- Existing skills — check for sibling skill folders in the skills directory
Step 2: Detect tech stack
From the manifest and configs, identify:
- Language & version (TypeScript 5.x, Python 3.12, etc.)
- Framework (React, Next.js, Fastify, FastAPI, etc.)
- State management (Zustand, Redux, Pinia, etc.)
- Validation (Zod, Pydantic, Valibot, etc.)
- Build tool (Vite, esbuild, Turbopack, Ruff, etc.)
- Test framework (Vitest, pytest, Jest, etc.)
Step 3: Score codebase health
Quick heuristics — no tooling needed:
| Signal |
Healthy |
Unhealthy |
| Largest file |
<200 LOC |
>500 LOC |
| Dependencies |
<20 prod deps |
>50 prod deps |
any types |
0 |
>5 |
utils/ or helpers/ folders |
absent |
present |
| Default exports |
0 |
>3 |
| Dead code signals |
clean imports |
unused imports visible |
Record findings mentally. These inform which strategies to apply.
Phase 2 — Choose Strategy
Based on the project analysis, select the approach:
Decision tree
Is this a new feature?
├── Yes → Check if existing module can absorb it (prefer extension over creation)
│ If new module needed → follow spec-driven skill (Spec → Schema → Module)
│ Apply lean-typescript patterns for implementation
│
Is this a refactor/cleanup?
├── Yes → Score health first
│ High bloat → apply lean-typescript debloating references
│ Architectural issues → apply spec-driven 4-pillar restructure
│ Dead code → run Knip or manual dead-export scan
│
Is this a bug fix?
├── Yes → apply debug-loop skill (reproduce → isolate → fix → verify)
│
Is this unclear?
├── Yes → ask the user one clarifying question, then proceed
Sibling skill selection
Read the relevant sibling skill when the task matches:
lean-typescript/ — any TypeScript work, anti-bloat, patterns, toolchain
spec-driven/ — new modules, API contracts, schema design
debug-loop/ — bugs, startup failures, runtime errors
roadmap/ — planning, milestones, sprint organization
Load only what's needed. Don't read all skills for every task.
Phase 3 — Implement
The Lean Implementation Checklist
Before writing code, answer these questions:
- Can I solve this by deleting code? If yes, do that instead.
- Can I extend an existing module? Prefer modification over creation.
- Does this need a new dependency? Only add if it saves >50 LOC and is <5KB gzipped.
- Is the file I'm creating <150 lines? If not, split by domain concern.
- Am I adding types that TypeScript already infers? Remove redundant annotations.
- Am I validating data that's already typed? Validate at boundaries only.
Implementation patterns (apply contextually)
- Functions over classes — unless the domain genuinely needs state + methods together
- Named exports only — better tree-shaking, better refactoring
- Feature folders — group by domain, not by technical layer
- Result types over exceptions — explicit error flow, no hidden control jumps
- Zod/Pydantic at boundaries — trust internal types, validate external data
- Pure core, I/O shell — business logic as pure functions, I/O at the edges
What to reject
Stop and reconsider if you catch yourself:
- Creating a
utils.ts or helpers.ts
- Wrapping every async call in try-catch
- Adding JSDoc that restates the type signature
- Building a class hierarchy (Manager → Service → Handler)
- Adding a config option for something that never changes
- Writing >20 lines of defensive null-checking inside typed code
Phase 4 — Verify
After implementation, check your work:
- Line count delta — did the codebase grow? By how much? Justify every new line.
- Dependency delta — did you add deps? Each must pass the <5KB / >50LOC-saved test.
- Type safety — run
tsc --noEmit or equivalent. Zero errors.
- Tests — run existing tests. If you changed behavior, update or add tests.
- Build — verify the project builds cleanly.
Completion summary
When done, report to the user:
## Changes
- [what changed, 1-2 sentences]
## Impact
- Files changed: N
- Lines added/removed: +X / -Y (net: ±Z)
- Dependencies added/removed: [list or "none"]
## Verified
- [ ] Types check
- [ ] Tests pass
- [ ] Build succeeds
Anti-patterns
- Implementing before reading — you will duplicate existing functionality
- Adding abstractions "for the future" — YAGNI; implement what's needed now
- Choosing a heavier tool when a lighter one exists in the project
- Ignoring existing patterns — match the project's style, don't impose your own
- Skipping verification — unverified changes are unfinished changes
1---2name: implement3description: Agentic implementation skill that reads a project's structure, detects its tech stack, scores codebase health, and then selects the best strategies and sibling skills to implement the user's request — optimizing for smaller codebases and higher power-to-weight ratio. Use this skill whenever the user asks to: add a feature, refactor code, reduce bundle size, clean up a codebase, implement something new, improve code quality, reduce complexity, or says anything like "make this smaller", "make this better", "implement X", "build X", "clean this up", "reduce bloat", or "refactor". Also trigger when the user pastes code and asks for improvements, or when starting work on an unfamiliar project.4---56# Implement78Read first, think second, code last. Every implementation starts with understanding9what already exists — because the fastest code is the code you delete.1011## Why This Skill Exists1213LLMs default to additive solutions: more files, more abstractions, more dependencies.14This skill inverts that instinct. The goal is always: **fewer lines, fewer deps, more15capability**. Every change must justify its weight.1617---1819## Phase 1 — Read the Project (mandatory, never skip)2021Before writing a single line, build a mental model of what exists.2223### Step 1: Discover structure2425Read these files in order of priority (skip what doesn't exist):26271. **Package manifest** — `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`282. **Entry point** — `src/index.ts`, `src/main.ts`, `app/`, `cmd/`293. **Config files** — `tsconfig.json`, `vite.config.*`, `.env.example`304. **Context files** — `.context/`, `CLAUDE.md`, `AGENTS.md`, `README.md`315. **Existing skills** — check for sibling skill folders in the skills directory3233### Step 2: Detect tech stack3435From the manifest and configs, identify:3637- **Language & version** (TypeScript 5.x, Python 3.12, etc.)38- **Framework** (React, Next.js, Fastify, FastAPI, etc.)39- **State management** (Zustand, Redux, Pinia, etc.)40- **Validation** (Zod, Pydantic, Valibot, etc.)41- **Build tool** (Vite, esbuild, Turbopack, Ruff, etc.)42- **Test framework** (Vitest, pytest, Jest, etc.)4344### Step 3: Score codebase health4546Quick heuristics — no tooling needed:4748| Signal | Healthy | Unhealthy |49|--------|---------|-----------|50| Largest file | <200 LOC | >500 LOC |51| Dependencies | <20 prod deps | >50 prod deps |52| `any` types | 0 | >5 |53| `utils/` or `helpers/` folders | absent | present |54| Default exports | 0 | >3 |55| Dead code signals | clean imports | unused imports visible |5657Record findings mentally. These inform which strategies to apply.5859---6061## Phase 2 — Choose Strategy6263Based on the project analysis, select the approach:6465### Decision tree6667```68Is this a new feature?69├── Yes → Check if existing module can absorb it (prefer extension over creation)70│ If new module needed → follow spec-driven skill (Spec → Schema → Module)71│ Apply lean-typescript patterns for implementation72│73Is this a refactor/cleanup?74├── Yes → Score health first75│ High bloat → apply lean-typescript debloating references76│ Architectural issues → apply spec-driven 4-pillar restructure77│ Dead code → run Knip or manual dead-export scan78│79Is this a bug fix?80├── Yes → apply debug-loop skill (reproduce → isolate → fix → verify)81│82Is this unclear?83├── Yes → ask the user one clarifying question, then proceed84```8586### Sibling skill selection8788Read the relevant sibling skill when the task matches:8990- **`lean-typescript/`** — any TypeScript work, anti-bloat, patterns, toolchain91- **`spec-driven/`** — new modules, API contracts, schema design92- **`debug-loop/`** — bugs, startup failures, runtime errors93- **`roadmap/`** — planning, milestones, sprint organization9495Load only what's needed. Don't read all skills for every task.9697---9899## Phase 3 — Implement100101### The Lean Implementation Checklist102103Before writing code, answer these questions:1041051. **Can I solve this by deleting code?** If yes, do that instead.1062. **Can I extend an existing module?** Prefer modification over creation.1073. **Does this need a new dependency?** Only add if it saves >50 LOC and is <5KB gzipped.1084. **Is the file I'm creating <150 lines?** If not, split by domain concern.1095. **Am I adding types that TypeScript already infers?** Remove redundant annotations.1106. **Am I validating data that's already typed?** Validate at boundaries only.111112### Implementation patterns (apply contextually)113114- **Functions over classes** — unless the domain genuinely needs state + methods together115- **Named exports only** — better tree-shaking, better refactoring116- **Feature folders** — group by domain, not by technical layer117- **Result types over exceptions** — explicit error flow, no hidden control jumps118- **Zod/Pydantic at boundaries** — trust internal types, validate external data119- **Pure core, I/O shell** — business logic as pure functions, I/O at the edges120121### What to reject122123Stop and reconsider if you catch yourself:124125- Creating a `utils.ts` or `helpers.ts`126- Wrapping every async call in try-catch127- Adding JSDoc that restates the type signature128- Building a class hierarchy (Manager → Service → Handler)129- Adding a config option for something that never changes130- Writing >20 lines of defensive null-checking inside typed code131132---133134## Phase 4 — Verify135136After implementation, check your work:1371381. **Line count delta** — did the codebase grow? By how much? Justify every new line.1392. **Dependency delta** — did you add deps? Each must pass the <5KB / >50LOC-saved test.1403. **Type safety** — run `tsc --noEmit` or equivalent. Zero errors.1414. **Tests** — run existing tests. If you changed behavior, update or add tests.1425. **Build** — verify the project builds cleanly.143144### Completion summary145146When done, report to the user:147148```149## Changes150- [what changed, 1-2 sentences]151152## Impact153- Files changed: N154- Lines added/removed: +X / -Y (net: ±Z)155- Dependencies added/removed: [list or "none"]156157## Verified158- [ ] Types check159- [ ] Tests pass160- [ ] Build succeeds161```162163---164165## Anti-patterns166167- **Implementing before reading** — you will duplicate existing functionality168- **Adding abstractions "for the future"** — YAGNI; implement what's needed now169- **Choosing a heavier tool** when a lighter one exists in the project170- **Ignoring existing patterns** — match the project's style, don't impose your own171- **Skipping verification** — unverified changes are unfinished changes