agentleFS
justnau1020justnau1020/claude-os/skills/development/new-endpoint/SKILL.md

new-endpoint

Skill3 starsChanged 8 months agoApache-2.0View on GitHub

Scaffold a new REST API endpoint. Use when adding a new API route or extending the REST API with new functionality.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 10 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    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:

    Check if an existing route file covers this domain (read the API directory for existing route files).

    line 22
  2. Distinctive:

    Follow patterns from existing routes in the project.

    line 26
  3. Distinctive:

    Authentication: Use the project's auth dependency injection pattern

    line 43
  4. Distinctive:

    Error responses: Use specific HTTP status codes (422, 404, 429, 503) with actionable messages

    line 45
  5. Very specific:

    Async only: All endpoint functions must be async def

    line 46
  6. Very specific:

    If you created a new route file, register it in the app's router registration (e.g., app.include_router()).

    line 51
  7. Distinctive:

    Create or extend tests for the new endpoint:

    line 55
  8. Distinctive:

    Test successful request with valid auth

    line 56
  9. Distinctive:

    Test unauthorized access (missing/invalid credentials)

    line 57
  10. Distinctive:

    Test ownership enforcement (if applicable)

    line 58
  11. Distinctive:

    Test validation errors (bad input)

    line 59
  12. Distinctive:

    Test edge cases specific to this endpoint

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

Create a New API Endpoint

Scaffold a new REST API endpoint following the project's existing conventions.

Arguments

  • $0 -- HTTP method (GET, POST, PUT, DELETE)
  • $1 -- Route path (e.g., /users/{user_id}/settings)
  • $2 -- Optional description of what the endpoint does

Steps

1. Determine route file

Check if an existing route file covers this domain (read the API directory for existing route files). If this fits an existing domain, add to that file. Otherwise, create a new route file.

2. Create the endpoint

Follow patterns from existing routes in the project. Example (FastAPI):

from fastapi import APIRouter, Depends, HTTPException

router = APIRouter(prefix="/resource", tags=["domain"])

@router.$0("$1")
async def endpoint_name(
    resource_id: str,
    user=Depends(get_current_user),
):
    ...

3. Conventions (NON-NEGOTIABLE)

  • Authentication: Use the project's auth dependency injection pattern
  • Typed models: Request/response bodies use typed models, not raw dicts
  • Error responses: Use specific HTTP status codes (422, 404, 429, 503) with actionable messages
  • Async only: All endpoint functions must be async def
  • Type hints: Full type annotations on all parameters and return types

4. Register the router

If you created a new route file, register it in the app's router registration (e.g., app.include_router()).

5. Write tests

Create or extend tests for the new endpoint:

  • Test successful request with valid auth
  • Test unauthorized access (missing/invalid credentials)
  • Test ownership enforcement (if applicable)
  • Test validation errors (bad input)
  • Test edge cases specific to this endpoint

6. Verify

pytest tests/ -v -k "test_<domain>"

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.