Skip to content
Back to skills

Add Rest Route

ASecurity

Add or change a REST route in Agentry's API: shared types, OpenAPI summary and tag, README table row, schema regeneration and tests. Use whenever a route or a shared type changes.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 3, 2026
ai-agentsgobashsqlapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 3, 2026

npx -y skills add yeyo11/agentry --skill add-rest-route --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Rest Route?

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

Security grade badge for Add Rest Route
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yeyo11-add-rest-route/badge)](https://www.skillsdirectory.com/skills/yeyo11-add-rest-route)

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: add-rest-route
description: Add or change a REST route in Agentry's API: shared types, OpenAPI summary and tag, README table row, schema regeneration and tests. Use whenever a route or a shared type changes.
---

# Adding or changing a REST route

CI fails on each of the steps below, so do them in this order.

1. **Contract first.** Add or change the types in `packages/shared/src/types.ts`. It is the API contract; the API schemas and the web client are typed against it.
2. **Persistence.** A settings-shaped document goes in a JSON file; a stream or accumulating record is a SQLite table with a migration in `packages/core/src/db.ts`, as rows. Two processes share one data dir, so a claim that must be unique uses a guarded update or `BEGIN IMMEDIATE`.
3. **Core.** Put the logic in `packages/core`, not in the route. A route validates, calls the service and answers.
4. **Route.** Add it in `apps/api/src/routes/<area>.ts`. Creating routes answer 201 when they create and 200 when nothing was added, like the other creating routes.
5. **Docs of the route.** In `apps/api/src/openapi/routes.ts` give it a **summary and a tag**; a test enforces both.
6. **README.** Add a row to the matching table under `## REST API` in `README.md`.
7. **Regenerate the schemas** when a shared type changed, and commit the result:
   ```bash
   pnpm --filter @agentry/api openapi:schemas
   ```
8. **Events.** If the change should reach the web live, emit an event and add what the web refetches in `apps/web/src/lib/events.ts`.
9. **Tests.** An API integration test with Fastify `inject`, and a core unit test for the logic. Name each after the behaviour it protects.
10. **Check.** Run `pnpm typecheck` and `pnpm test`.

Agentry's own docs (`docs/<area>.md`) get the route's behaviour and its Known gaps; the commit is `feat:` or `fix:` (Conventional Commits).

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.

Comments

Loading comments…