agentleFS
chrysogonuschrysogonus/prompt-maker-studio/.claude/skills/add-api-endpoint/SKILL.md

add-api-endpoint

Skill7 starsChanged 18 days agoApache-2.0View on GitHub

Add a new backend API endpoint to Prompt Maker Studio, following the repo's existing route/service/schema layering. Use when asked to add, create, or expose a new backend endpoint or API route.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow this order — each step depends on the last:

    line 8

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

Add a backend API endpoint

Follow this order — each step depends on the last:

  1. Schema — add or extend the Pydantic request/response models in the matching domain module under backend/app/schemas/ (e.g. prompts.py or accounts.py). Reuse existing field-validation patterns in that module (e.g. unique-name validation) rather than inventing new ones.
  2. Route — add the endpoint in the appropriate router file under backend/app/api/ (routes.py for prompt endpoints, session_routes.py, account_routes.py, password_routes.py, or llm_connection_routes.py for auth, eval_routes.py for evaluations, refine_routes.py for refinement, public_routes.py for unauthenticated /api/public endpoints, admin_routes.py for admin-only; oauth_routes.py and mcp_routes.py belong to the MCP/OAuth integration). Keep the handler thin: parse/validate via the schema, call a service function, return its result. Apply the existing auth dependency pattern (backend/app/auth/dependencies.py) if the endpoint should require authentication — check how neighboring endpoints in the same file do it. Register a new router in backend/app/main.py when needed; a new account router is composed in backend/app/api/auth_routes.py instead.
  3. Service logic — put any real logic in backend/app/services/ (new file or extend an existing one), not in the route handler. If the endpoint touches the database, follow the ownership-scoping pattern: services use services/prompts/ownership.py (get_owned_prompt), and route handlers use the api/deps.get_owned_prompt wrapper, which maps a missing or foreign prompt to 404; use OperationError in services and call_service in HTTP adapters to translate expected service failures at the HTTP boundary. REST and MCP share prompt services; MCP calls those services directly and maps failures to tool errors. Keep ownership checks in the shared operation. Resolve AI calls in route handlers through api/deps.get_llm_connection (not the /me/llm-connection handler or services/accounts/connections.get_llm_connection, which read the stored settings) and services/llm_client.py, with the existing budget and spend-ledger handling.
  4. Tests — add tests in backend/tests/ (there's already a test_api.py / test_auth.py / test_admin_routes.py split by router — put new tests in the matching file, or create a new one if the endpoint doesn't fit any existing file). Cover: happy path, validation failure (422), auth failure if applicable, and ownership isolation if the endpoint is user-scoped. Update the module table in backend/tests/README.md when adding a test file.
  5. Document the contract — update docs/api.md for public route changes. Update product/FEATURES.md — add or edit a row in the relevant table with the feature name, status, one-line description, and the file(s) it's implemented in. This file is the project's source-of-truth feature list and is easy to forget.
  6. Verify — run make lint-backend && make test before considering the work done.

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.