agentleFS
fangkangmifangkangmi/agent-harness/.claude/skills/new-route/SKILL.md

new-route

Skill0 starsChanged 6 months agoMITView on GitHub

Example "add an HTTP route" recipe — handler → service → route → contract → snapshot → integration test stub. Use when adding routes to any of your project's services.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. code-with-mehedi/nextjs-claude-starter★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask the user for any of these that aren't already clear:

    line 15
  2. Very specific:

    Don't bundle integration tests into /check — they require external services to be up.

    line 58
  3. Very specific:

    If the request is more than a thin CRUD-style endpoint (touches async queues, adds a new entity, changes auth semantics), stop after step 1 …

    line 66

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/new-route — add an HTTP route to a service

Example "add a route" recipe. Each route flows handler → service → route → contract → snapshot. Don't skip or reorder. Fork the file paths and suite-directory mapping below for your project's actual layout.

Inputs

Ask the user for any of these that aren't already clear:

  • Service — which deployable owns the route. Refuse to create a new service / deployable — that needs explicit user discussion.
  • Method + path — e.g. POST /resources/{id}/submit-for-action. URLs use plural nouns and kebab-case actions.
  • Request / response shape — JSON, camelCase. New optional fields use #[serde(default)] (in Rust) or equivalent.
  • Roles — which auth context / role check applies.

Steps (in order)

  1. Handler in <service>/src/<area>_handlers.rs. Thin: extract state + auth context, delegate to the service. Return a result type; never panic.
  2. Service method in shared/src/services/<service>.rs. Apply RBAC via the auth context. Business logic lives here, not in the handler.
  3. Repository call through the trait — never the raw DB client.
  4. Wire the route in <service>/src/routing.rs:
    .route("<path>", <method>(handler_fn))
  5. API contract — update the OpenAPI spec (or equivalent). JSON: camelCase. Use existing schemas where possible.
  6. Snapshot tests — if the response model is new or changed, run the project's snapshot test command and review:
    cargo test
    cargo insta review
    Code, snapshots, and contract must land in the same commit.
  7. Integration test stub — drop a thin test file under the matching directory in the integration test tree. Reuse fixtures where possible — they typically form a pyramid (cheaper fixtures on top, richer ones built on top); pick the cheapest level that covers your route. At minimum, write one happy path + one auth/validation rejection. Pattern off the closest existing file.

    Don't bundle integration tests into /check — they require external services to be up. Run them yourself before PR.

  8. Local sanity check — bring the service up and curl the endpoint with a token. Confirm the happy path before opening a PR.

Stop early

If the request is more than a thin CRUD-style endpoint (touches async queues, adds a new entity, changes auth semantics), stop after step 1 and remind the user: "this looks non-trivial — should we write a plan in docs/plans/ first?" (see /new-plan).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.