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: >4 Agentic implementation skill that reads a project's structure, detects its tech stack,5 scores codebase health, and then selects the best strategies and sibling skills to6 implement the user's request — optimizing for smaller codebases and higher power-to-weight7 ratio. Use this skill whenever the user asks to: add a feature, refactor code, reduce8 bundle size, clean up a codebase, implement something new, improve code quality, reduce9 complexity, or says anything like "make this smaller", "make this better", "implement X",10 "build X", "clean this up", "reduce bloat", or "refactor". Also trigger when the user11 pastes code and asks for improvements, or when starting work on an unfamiliar project.12---1314# Implement1516Read first, think second, code last. Every implementation starts with understanding17what already exists — because the fastest code is the code you delete.1819## Why This Skill Exists2021LLMs default to additive solutions: more files, more abstractions, more dependencies.22This skill inverts that instinct. The goal is always: **fewer lines, fewer deps, more23capability**. Every change must justify its weight.2425---2627## Phase 1 — Read the Project (mandatory, never skip)2829Before writing a single line, build a mental model of what exists.3031### Step 1: Discover structure3233Read these files in order of priority (skip what doesn't exist):34351. **Package manifest** — `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`362. **Entry point** — `src/index.ts`, `src/main.ts`, `app/`, `cmd/`373. **Config files** — `tsconfig.json`, `vite.config.*`, `.env.example`384. **Context files** — `.context/`, `CLAUDE.md`, `AGENTS.md`, `README.md`395. **Existing skills** — check for sibling skill folders in the skills directory4041### Step 2: Detect tech stack4243From the manifest and configs, identify:4445- **Language & version** (TypeScript 5.x, Python 3.12, etc.)46- **Framework** (React, Next.js, Fastify, FastAPI, etc.)47- **State management** (Zustand, Redux, Pinia, etc.)48- **Validation** (Zod, Pydantic, Valibot, etc.)49- **Build tool** (Vite, esbuild, Turbopack, Ruff, etc.)50- **Test framework** (Vitest, pytest, Jest, etc.)5152### Step 3: Score codebase health5354Quick heuristics — no tooling needed:5556| Signal | Healthy | Unhealthy |57|--------|---------|-----------|58| Largest file | <200 LOC | >500 LOC |59| Dependencies | <20 prod deps | >50 prod deps |60| `any` types | 0 | >5 |61| `utils/` or `helpers/` folders | absent | present |62| Default exports | 0 | >3 |63| Dead code signals | clean imports | unused imports visible |6465Record findings mentally. These inform which strategies to apply.6667---6869## Phase 2 — Choose Strategy7071Based on the project analysis, select the approach:7273### Decision tree7475```76Is this a new feature?77├── Yes → Check if existing module can absorb it (prefer extension over creation)78│ If new module needed → follow spec-driven skill (Spec → Schema → Module)79│ Apply lean-typescript patterns for implementation80│81Is this a refactor/cleanup?82├── Yes → Score health first83│ High bloat → apply lean-typescript debloating references84│ Architectural issues → apply spec-driven 4-pillar restructure85│ Dead code → run Knip or manual dead-export scan86│87Is this a bug fix?88├── Yes → apply debug-loop skill (reproduce → isolate → fix → verify)89│90Is this unclear?91├── Yes → ask the user one clarifying question, then proceed92```9394### Sibling skill selection9596Read the relevant sibling skill when the task matches:9798- **`lean-typescript/`** — any TypeScript work, anti-bloat, patterns, toolchain99- **`spec-driven/`** — new modules, API contracts, schema design100- **`debug-loop/`** — bugs, startup failures, runtime errors101- **`roadmap/`** — planning, milestones, sprint organization102103Load only what's needed. Don't read all skills for every task.104105---106107## Phase 3 — Implement108109### The Lean Implementation Checklist110111Before writing code, answer these questions:1121131. **Can I solve this by deleting code?** If yes, do that instead.1142. **Can I extend an existing module?** Prefer modification over creation.1153. **Does this need a new dependency?** Only add if it saves >50 LOC and is <5KB gzipped.1164. **Is the file I'm creating <150 lines?** If not, split by domain concern.1175. **Am I adding types that TypeScript already infers?** Remove redundant annotations.1186. **Am I validating data that's already typed?** Validate at boundaries only.119120### Implementation patterns (apply contextually)121122- **Functions over classes** — unless the domain genuinely needs state + methods together123- **Named exports only** — better tree-shaking, better refactoring124- **Feature folders** — group by domain, not by technical layer125- **Result types over exceptions** — explicit error flow, no hidden control jumps126- **Zod/Pydantic at boundaries** — trust internal types, validate external data127- **Pure core, I/O shell** — business logic as pure functions, I/O at the edges128129### What to reject130131Stop and reconsider if you catch yourself:132133- Creating a `utils.ts` or `helpers.ts`134- Wrapping every async call in try-catch135- Adding JSDoc that restates the type signature136- Building a class hierarchy (Manager → Service → Handler)137- Adding a config option for something that never changes138- Writing >20 lines of defensive null-checking inside typed code139140---141142## Phase 4 — Verify143144After implementation, check your work:1451461. **Line count delta** — did the codebase grow? By how much? Justify every new line.1472. **Dependency delta** — did you add deps? Each must pass the <5KB / >50LOC-saved test.1483. **Type safety** — run `tsc --noEmit` or equivalent. Zero errors.1494. **Tests** — run existing tests. If you changed behavior, update or add tests.1505. **Build** — verify the project builds cleanly.151152### Completion summary153154When done, report to the user:155156```157## Changes158- [what changed, 1-2 sentences]159160## Impact161- Files changed: N162- Lines added/removed: +X / -Y (net: ±Z)163- Dependencies added/removed: [list or "none"]164165## Verified166- [ ] Types check167- [ ] Tests pass168- [ ] Build succeeds169```170171---172173## Anti-patterns174175- **Implementing before reading** — you will duplicate existing functionality176- **Adding abstractions "for the future"** — YAGNI; implement what's needed now177- **Choosing a heavier tool** when a lighter one exists in the project178- **Ignoring existing patterns** — match the project's style, don't impose your own179- **Skipping verification** — unverified changes are unfinished changes