Skip to content
Back to skills

Adding A Feature

ASecurity

How a new page, API endpoint, or admin route is wired through this repo's layers, and which files must change together. Use when adding or removing a route, page, or endpoint, when a new route 404s or its client script never runs, or when scaffolding a new service.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 3, 2026
ai-agentsgoapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add alexpricedev/Billet --skill adding-a-feature --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Adding A Feature?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Adding A Feature
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alexpricedev-adding-a-feature/badge)](https://www.skillsdirectory.com/skills/alexpricedev-adding-a-feature)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: adding-a-feature
description: How a new page, API endpoint, or admin route is wired through this repo's layers, and which files must change together. Use when adding or removing a route, page, or endpoint, when a new route 404s or its client script never runs, or when scaffolding a new service.
---

# Adding a feature

The layering is strict, and it's what makes the codebase testable:

- **Routes** map a URL to a controller method. Nothing else.
- **Controllers** orchestrate — call services, then render a template or return JSON.
- **Services** own all business logic and data access. Controllers never query the database.
- **Templates** are pure presentation, receiving fully resolved data as props.

Data is fetched before render, so templates never need loading states.

Types are the contract between layers: export a type from the service alongside its functions and
import that same type in the controller and template. Don't redeclare the shape at each layer —
if a template's props drift from the service's return type, that's the bug.

Wiring is spread across several files and a missed one fails quietly. Follow the checklist for
what you're adding:

- New page → `references/page.md`
- New API endpoint → `references/api-endpoint.md`

Both end the same way: add the co-located test (see the `writing-tests` skill) and run
`bun run check` and `bun run test` (see `verifying-changes`).

## Client bundles

A page's client code goes in the existing `main.js` bundle (`src/client/`). A separate bundle —
something only some pages load, or a package's browser code — is one entry in `BUNDLES`
(`src/server/services/bundles.ts`): its `source`, its output `name`, and an `inLayout` check if the
layouts should render its tag. That one entry is what the build, the dev watchers, serving,
fingerprinting and the layouts read; don't add a `bun build` to `package.json`.

## Migrations

New tables go in `src/server/database/migrations/` as `NNN_snake_case.ts`. Create one with
`bun run migrate:create`. They apply automatically on server start and at the top of the test
run — a failed migration means the server won't boot. Each migration runs in its own transaction, so a failure leaves nothing behind; a statement Postgres refuses inside a transaction (`CREATE INDEX CONCURRENTLY`, `VACUUM`) can't go in a migration. Add any new table to `cleanupTestData` in
`src/server/test-utils/helpers.ts` or tests will bleed into each other.

Files in this skill

  • SKILL.md1.7 KB
  • references/api-endpoint.md5.9 KB
  • references/page.md3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.