The commands, subagents, and hooks stories are well-covered. Skills — the newer sibling — are less understood. This post walks through building a skill for a real workflow, end to end, including the parts that took us a few tries to get right.
The skill we'll build: helping our team write API endpoint code that matches our house style. Not "generate an endpoint" (that's a command) and not "review my endpoint" (that's an agent) — a set of persistent knowledge and helpers that Claude loads whenever the task involves API endpoints. If you've read Skills, commands, subagents: when to use which, this is the practical version.
The problem we're solving
Every team has house conventions that new members (human and AI) don't know. In our case: how errors should be formatted, how validation should be structured, what response envelope to use, when to use which auth pattern, how to name things, what NOT to do.
For human team members, this lives in an onboarding doc and a code review process. For Claude, it should live in a skill. A skill is loaded when the task activates it (in this case, when Claude notices it's working on API endpoint code) and provides the knowledge and helpers Claude would otherwise have to reason about from scratch.
A skill is knowledge Claude should have activated for a class of tasks — not a specific task Claude should perform.
Step 1: Define activation conditions
The first design decision: when should this skill activate? Skills that activate too broadly consume context on tasks that don't need them. Skills that activate too narrowly get missed on tasks where they'd help.
For our API endpoint skill, activation conditions:
- Working file is under
src/api/orsrc/handlers/ - Working file matches
*.route.ts,*.handler.ts, or*.endpoint.ts - Task description contains "endpoint," "route," "handler," "API," or similar keywords
- Any of the above; the skill activates on the union
Getting activation wrong is the single most common skill design mistake. Err on the side of specific — you can always broaden later if teammates report the skill not activating when it should.
Step 2: Design the file layout
A skill is a directory. Ours looks like this:
.claude/skills/api-endpoints/
├── SKILL.md ← activation, purpose, table of contents
├── conventions.md ← the house rules
├── patterns/
│ ├── auth.md ← how we do auth on endpoints
│ ├── validation.md ← input validation patterns
│ ├── errors.md ← error response format
│ └── responses.md ← success response envelope
├── examples/
│ ├── simple-get.ts ← reference implementation
│ ├── auth-protected.ts ← reference implementation
│ └── file-upload.ts ← reference implementation
└── checklists/
└── pre-commit.md ← what to verify before mergingThe SKILL.md is the entry point — activation conditions, purpose, and pointers to the specific files. Claude reads SKILL.md first, decides what's relevant, and reads deeper.
A monolithic SKILL.md that contains everything gets loaded in full every time. The split lets Claude load conventions.md when writing new code, patterns/auth.md only when auth is relevant, examples only when it needs a reference. Big skills are efficient this way; monolithic ones aren't.
Step 3: Write SKILL.md
The entry file is short and structured:
---
name: api-endpoints
description: House conventions and patterns for writing API endpoint code
activates_on:
- path: src/api/**
- path: src/handlers/**
- filename: *.route.ts
- filename: *.handler.ts
- keywords: [endpoint, route, handler, API]
---
# API endpoints skill
## What this skill provides
- House conventions for writing endpoint code
- Reference implementations for common endpoint types
- Pre-commit checklist to verify before merging
## When you're about to write an endpoint
1. Read `conventions.md` for the house rules
2. Pick the closest example from `examples/`
3. Check the relevant pattern file:
- Auth needed? Read `patterns/auth.md`
- Complex validation? Read `patterns/validation.md`
- Non-trivial errors? Read `patterns/errors.md`
## When you're reviewing endpoint code
Run through `checklists/pre-commit.md` before signing off.
## What this skill does NOT do
- Does not describe our REST vs GraphQL choices (that's in the arch ADR)
- Does not cover database access patterns (see the `data-access` skill)
- Does not handle deployment or ops concernsThe frontmatter tells Claude when to activate. The body tells Claude what's available and when to reach for what. The "does NOT do" section is important — it keeps this skill from expanding beyond its scope over time.
Step 4: Write the conventions file
This is the file Claude reads first when writing new code. Keep it high-signal:
# API endpoint conventions
## Naming
- Handler functions: `handleXVerb` (e.g., `handleGetUser`)
- Route files: `x.route.ts` for the route, `x.handler.ts` for the logic
- Never put business logic in the route file — that's just wiring
## Error responses
- Always return the shape defined in `patterns/errors.md`
- Never leak internal error messages to clients — sanitize first
- Log the full error server-side with the request ID for tracing
## Response envelope
- Success responses use the shape defined in `patterns/responses.md`
- Never return raw model objects — always shape them via a serializer
## Auth
- Every endpoint declares its auth requirements at the top of the handler
- Use middleware, never manual token checks in handlers
- See `patterns/auth.md` for the patterns
## Invariants
- Handlers must be pure functions of (request) → (response) as much as possible
- Side effects (database writes, external API calls) go through repository layers
- Never call `console.log` — use the structured logger
## What NOT to do
- No inline route definitions (breaks OpenAPI generation)
- No global mutable state
- No throwing raw errors — always use the typed error classesNotice the shape: mostly rules Claude wouldn't infer from the code alone. "Use meaningful variable names" isn't here because Claude does that anyway. "Handler functions are named handleXVerb" is here because Claude wouldn't know that specific convention.
Step 5: Write reference examples
Concrete examples beat abstract rules. For each common endpoint shape, write one reference implementation that shows the house style in action.
The key: use real code, not pseudocode. Pseudocode is easy to read and useless to reference — Claude will produce pseudocode-shaped output when it should produce real code. Real code (with imports, types, error handling, all the noise) shows exactly what the output should look like.
Don't include every possible pattern. Three good reference examples that cover the common cases are better than fifteen edge-case examples. Claude interpolates well from good examples; it drowns in a flood of them.
Step 6: Write the checklist
The pre-commit checklist is what Claude uses when reviewing endpoint code. Keep it as a list of concrete, checkable items:
# Pre-commit checklist for endpoint code
Before signing off on an endpoint change, verify:
- [ ] Handler is separated from the route file
- [ ] Auth requirements are declared at the top of the handler
- [ ] Input validation exists for all body/query params
- [ ] Errors return the standard shape
- [ ] Success responses use the standard envelope
- [ ] No console.log; only the structured logger
- [ ] No leaking internal error messages
- [ ] The endpoint has at least one test (unit or integration)
- [ ] OpenAPI/schema definitions match the actual behaviorWhen someone asks Claude "review my endpoint," this checklist becomes the substance of the review. Every item that's missing gets flagged.
Mistakes we made
Trying to make one skill do everything
The first version of this skill also covered database access, authentication implementation, testing patterns, and deployment. It was 12 files and 2000 lines, and it activated on almost every code task in the repo. Result: every session paid for all of it whether relevant or not.
Split into six focused skills. Each activates on narrower criteria. Sessions load only what applies. Better output, less context waste, easier to maintain.
Aspirational conventions
Our first conventions.md described the endpoint style we wanted — including patterns we'd agreed to move toward but hadn't actually adopted. Claude followed the aspirational patterns, which didn't match the surrounding code, which confused reviewers.
Fixed by moving aspirational content to an ADR and keeping conventions.md aligned with actual current practice. When the migration completes, we'll update conventions.md.
Not updating on drift
Six months in, some of the conventions.md items had drifted from real practice. Nobody had updated the skill. Claude was following outdated rules and producing code that felt "off" to reviewers.
Fixed by adding skills to the quarterly review cycle. Same review as CLAUDE.md; different files. Not a big commitment; important that it happens.
Before you ship your first skill
A pre-ship checklist for skill designers:
- Activation is scoped. The skill activates on tasks it can genuinely help with, not everything vaguely related.
- SKILL.md points to other files. Big skills split content by concern rather than being one long file.
- Conventions describe reality. Not the target state; the current state.
- Examples are real code. Not pseudocode. Not simplified.
- Checklists are checkable. Every item is a yes/no with a concrete referent.
- The scope is written down. Both what the skill does and what it doesn't.
- You have a maintenance plan. Skills rot without one.
Skills are a newer piece of the Claude Code toolkit, and the patterns are still shaking out. What's clear from six months of use: the skills that survived are the ones treated like a discipline — carefully scoped, honestly aligned with practice, actively maintained. The ones that died were the ones treated like a document you write once and forget.
When your team notices Claude producing output that's "close but not quite in our style," the answer is usually a skill. Twenty minutes of design work up front, forty minutes of writing, and a maintenance cycle every quarter — and Claude starts producing code that fits your team's house style without anyone asking for it.
Get cctk running in one command
85 slash commands, 12 subagents, 12 MCP integrations, 12 hooks. All the patterns from this post are shipped in cctk.