add-endpoint

add-endpoint is a skill for Claude Code from MuhammadUsmanGM/claude-code-best-practices. It costs 48 tokens per session (670 once invoked), scanned A, original, MIT.

A coding skill that adds a new HTTP endpoint to a Rust service while following the project's existing handler, service, repository, and test structure. An HTTP endpoint is a URL and method through which a service accepts or returns data.

In plain words
What is it for?
Use it when adding a route or API method to a Rust service, including request and response types, storage queries when needed, business logic, route wiring, and tests.
Why use it?
It avoids inventing a new code layout or inconsistent error handling. It also ensures the route is connected through the relevant layers and includes a successful case and a validation-failure test.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it when adding a route or API method to a Rust service, including request and response types, storage queries when needed, business logic, route wiring, and tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/muhammadusmangm/claude-code-best-practices/add-endpoint
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add MuhammadUsmanGM/claude-code-best-practices --skill add-endpoint
Clone the repo
git clone --depth 1 https://github.com/MuhammadUsmanGM/claude-code-best-practices

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-endpoint

README.md
[![agentmods](https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/add-endpoint/github.svg)](https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/add-endpoint)
Your own site
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/add-endpoint"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/add-endpoint/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-endpoint

Your own site · 80×15
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/add-endpoint"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/add-endpoint.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 670 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.00670
Opus 5.5 $0.00019 $0.00268
Sonnet 5.5 $0.00010 $0.00134
Haiku 4.5 $0.00005 $0.00067

Measured 28d ago against content hash 10b1a0306628, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-endpoint scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 28d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

starters/rust/.claude/skills/add-endpoint/SKILL.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add Endpoint

Add a new HTTP endpoint across the layers the project already uses. Don't invent a layer that isn't there.

Steps

  1. Clarify once (if not given): method + path, request shape, response shape, and status codes for success and failure.
  2. Read one existing endpoint end to end — handler, service function, repository method, and their tests. Mirror the style exactly: error mapping, extractor order, naming.
  3. Edit files in this order:
    • src/models/<resource>.rs — request/response types, if new. Derive Debug, Serialize, Deserialize and serde(rename_all = "camelCase") on API-facing structs.
    • src/repositories/<resource>.rs — store method with a compile-time checked sqlx::query_as! (or stop here if no storage is needed).
    • src/services/<resource>.rs — the business function. Takes domain types, returns Result<_, AppError>. No HTTP or SQLx types.
    • src/routes/<resource>.rs — the handler. Extractors in, service call, map AppError via the shared IntoResponse impl, wrap the response.
    • src/routes/<resource>.rs tests — happy path plus one validation failure, using the existing test helpers.
  4. Wire the route in the router setup only if adding a new path.
  5. Run cargo fmt, then cargo clippy -- -D warnings, then cargo test <resource>. Report the outcome. Do not commit.

Default shape

// src/routes/widgets.rs
pub async fn create_widget(
    State(state): State<AppState>,
    Json(payload): Json<CreateWidgetRequest>,
) -> Result<impl IntoResponse, AppError> {
    let widget = state.widget_service.create(payload).await?;
    Ok((StatusCode::CREATED, Json(widget)))
}
// src/routes/widgets.rs (test)
#[tokio::test]
async fn create_widget_returns_201() {
    // build app state from the existing test helpers
    // assert status and decoded body shape
}

Rules

  • No new dependencies. Cargo.toml is reviewed.
  • No unwrap() or expect() in the new code — tests included if a fixture can fail realistically.
  • Handlers stay thin: decode, delegate, encode. Business logic belongs in the service.
  • If the endpoint needs a new repository method, define the signature where the service consumes it, implement it in the repository module.
  • Follow the project's existing response-envelope convention, if it has one. Don't introduce a second response shape.

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 28d ago First seen · 68 lines · 48 tokens per session scan A 10b1a0306628

Subscribe to this mod's changes

add-endpoint is a skill published in the GitHub repository MuhammadUsmanGM/claude-code-best-practices (94 stars, last pushed 28d ago), licensed MIT. It adds 48 tokens to every session and 670 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-16.

Related

Other skills, from other repositories

web3-testing

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.

wshobson/agents · 46 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

data-quality-frameworks

Implement data quality validation with Great Expectations, dbt tests, and data contracts. Use when building data quality pipelines, implementing validation rules, or establishing data contracts.

wshobson/agents · 37 tokens

dbt-transformation-patterns

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

wshobson/agents · 47 tokens

principle-test-behavior-not-implementation

Apply when you write, change, or keep a test. Call the code as its users do and assert the exact result they see. Rewrite or delete a test that would pass if every imported function returned undefined.

michael-denyer/pstack-claude · 52 tokens

flutter-bloc-state-management

Implement BLoC/Cubit state, events, transitions, and async concurrency in Flutter. Use for BLoC/Cubit feature logic, debounced/cancellable events, state rendering, or bloc tests—not generic widget-only work.

HoangNguyen0403/agent-skills-standard · 52 tokens