harden-endpoint

harden-endpoint is a command for Claude Code from sigistry/marketplace. It costs 25 tokens per session (1,110 once invoked), scanned A, original, MIT.

A command that adds common production safeguards to an API endpoint. An endpoint is a specific URL and method that a program exposes for requests.

In plain words
What is it for?
It is for adding validation, RFC 9457 error responses, idempotency for safe retries, pagination, and rate-limit headers to handlers or routes.
Why use it?
It addresses recurring implementation gaps around invalid input, consistent errors, retries, pagination, and request-rate limits.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: model in frontmatter.

Part of the api-contract-keeper plugin — 4 skills, 3 commands, 2 agents shipped together

Good fit It is for adding validation, RFC 9457 error responses, idempotency for safe retries, pagination, and rate-limit headers to handlers or routes.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/sigistry/marketplace/harden-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.

Clone the repo
git clone --depth 1 https://github.com/sigistry/marketplace

Made for: Claude Code.

Or install api-contract-keeper, the plugin that ships this one along with the rest of its 4 skills, 3 commands, 2 agents.

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 harden-endpoint

README.md
[![agentmods](https://agentmods.dev/badge/commands/sigistry/marketplace/harden-endpoint/github.svg)](https://agentmods.dev/commands/sigistry/marketplace/harden-endpoint)
Your own site
<a href="https://agentmods.dev/commands/sigistry/marketplace/harden-endpoint"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/harden-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 harden-endpoint

Your own site · 80×15
<a href="https://agentmods.dev/commands/sigistry/marketplace/harden-endpoint"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/harden-endpoint.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,110 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.00025 $0.01110
Opus 5 $0.00013 $0.00555
Sonnet 5 $0.00005 $0.00222
Haiku 4.5 $0.00003 $0.00111

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

Security

Grade A, and why

harden-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 10d 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.

plugins/api-contract-keeper/commands/harden-endpoint.md · 49 lines

How it starts

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

Harden the endpoint(s) in $ARGUMENTS (a handler/controller/route file, or the file in the current diff) with the boilerplate that teams get subtly wrong: request validation, a consistent error envelope, safe retries, pagination, and rate-limit headers, each idiomatic to the detected stack. Load the error-envelope skill (validation + RFC 9457) and the idempotency-patterns skill (idempotency, pagination, rate limits). This is an additive edit: preserve existing behavior; add the guards around it.

Process

Step 1: Detect stack and endpoint shape

Read the file. Identify the framework and the validation library already in use (or the idiomatic one for the stack). Determine each route's method, path, params, and body, and whether the method is unsafe (POST/PATCH/PUT/DELETE) and non-idempotent by HTTP semantics (POST is the key case).

Stack Idiomatic validator Error hook
Express/Koa (JS/TS) Zod, Joi, express-validator, JSON Schema (Ajv) error middleware (err, req, res, next)
Fastify JSON Schema (schema:), Zod via fastify-type-provider-zod setErrorHandler
NestJS class-validator DTOs + ValidationPipe exception filter
FastAPI Pydantic models exception_handler / RequestValidationError
Django REST Framework serializers (is_valid(raise_exception=True)) custom exception_handler
Flask marshmallow/pydantic, webargs errorhandler
Spring Boot Bean Validation (@Valid, @NotNull) @ControllerAdvice
Go (net/http/Gin) go-playground/validator, binding: tags central error writer
Rails strong params + model validations / dry-validation rescue_from

Step 2: Add request validation

Validate params, query, and body at the boundary, reject unknown fields (strict/.strict()/forbid_extra_keys/additionalProperties: false), coerce/parse types, and enforce required vs optional. On failure, do not leak the raw validator error; map it into the error envelope (Step 3) with a 422/400 and a machine-readable list of field violations. See error-envelope references/validation-patterns.md.

Read the full file on GitHub · 49 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. 10d ago First seen · 49 lines · 25 tokens per session scan A b699b5cdefd4

Subscribe to this mod's changes

harden-endpoint is a command published in the GitHub repository sigistry/marketplace (3 stars, last pushed today), licensed MIT. It adds 25 tokens to every session and 1,110 once invoked, about $0.0001 per session on Opus 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-08-31.