secure-api-endpoint
Skill1 starsChanged 26 days agoApache-2.0View on GitHub
Use when adding or modifying an API endpoint by hand (route, handler, serializer, validation, authorization policy). Applies the two-layer auth model, public-identifier-only exposure, tenant-safe persistence and the input, query, upload and log checklist.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- blitzhash360-web/blitzhash-vibe-coding-rulestheir own version, first seen Nov 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- blitzhash360-web/blitzhash-vibe-coding-rules★ 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 repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-coordinationSkill
- api-code-generationSkill
- api-test-generationSkill
- ci-cd-changeSkill
- frontend-changeSkill
- guidance-maintenanceSkill
- infrastructure-changeSkill
- refactoringSkill
- secret-and-pii-handlingSkill
- tenant-safe-changeSkill
- workspace-importSkill
- agent-coordinationSkill
- api-code-generationSkill
- api-test-generationSkill
- ci-cd-changeSkill
- frontend-changeSkill
- guidance-maintenanceSkill
- infrastructure-changeSkill
- refactoringSkill
- secret-and-pii-handlingSkill
- secure-api-endpointSkill
- tenant-safe-changeSkill
- workspace-importSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Expose public identifiers only: Never the internal sequential or sortable id (it leaks volume and enables enumeration), never tokens, …
- Distinctive: line 39
Uploads: check type against an allowlist.
- Distinctive: line 41
Throttle public mutations: Every unauthenticated write route carries a rate limit.
- Distinctive: line 42
Log without secrets: No password, token or key in a new log line.
- Very specific: line 49
If it touches tenant data, follow .agents/skills/tenant-safe-change/SKILL.md first.
- Distinctive: line 50
Write handler, serializer, validation, policy and route following the sibling's shape.
- Distinctive: line 51
Write tests that assert authorization denial for the wrong role, validation failure, and the happy path, using the same URL prefix clients …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Secure API endpoint
Required context
.agents/areas.json: the area the endpoint lives in, its guardrail and itsverifycommand. For service code the guardrail is.agents/guardrails/code-style.mduntil the adopter adds a dedicated API rulebook; if one is declared, it wins..agents/guardrails/data-handling.md: logs, PII, exposure..agents/skills/tenant-safe-change/SKILL.md: when the endpoint reads or writes tenant data.- The sibling endpoint closest to yours: its route, handler, serializer, validation and tests. The sibling is the convention in force.
For an endpoint generated from a schema, use .agents/skills/api-code-generation/SKILL.md
instead; for its tests, .agents/skills/api-test-generation/SKILL.md.
The rules that bite
- Two layers, both present. Authentication middleware establishes identity; the handler authorizes the action as its first step, before any query with side effects. A route being authenticated is not the same as the caller being allowed, and the gap is where cross-account access lives.
- One authorization source. Register the new permission in the permission matrix the codebase already uses. An inline role check is a second mechanism that drifts from the first.
- List endpoints scope the query to what the caller may see, rather than checking a blanket "may list everything" permission and returning the table.
- Expose public identifiers only. Never the internal sequential or sortable id (it leaks volume and enables enumeration), never tokens, password hashes or secrets.
- One versioned route prefix, identical in routes, tests and clients. Register a literal segment before a parameter route of the same prefix, or the parameter swallows it.
- Validate every writable field. Clamp every page-size parameter to a hard maximum, because an unbounded page is a denial-of-service parameter.
- Escape pattern-matching input (LIKE wildcards), and bind raw SQL parameters, never concatenate.
- Uploads check type against an allowlist; never allow active content (SVG, HTML) without a reviewed reason, because it executes in the browser of whoever opens it.
- Throttle public mutations. Every unauthenticated write route carries a rate limit.
- Log without secrets. No password, token or key in a new log line.
- Errors use the shared envelope. A new ad-hoc error shape breaks every client that parses errors generically.
Steps
- Confirm the resource's database connection and tenancy from the sibling model.
- If it touches tenant data, follow
.agents/skills/tenant-safe-change/SKILL.mdfirst. - Write handler, serializer, validation, policy and route following the sibling's shape.
- Write tests that assert authorization denial for the wrong role, validation failure, and the happy path, using the same URL prefix clients use.
Verify
<the area's test runner, filtered to the new test class> # fastest proof first
make verify # every gate, including tools/check-secrets.shThen the area's verify command exactly as .agents/areas.json declares it. Reviewers:
api-standards-reviewer, security-data-reviewer, and tenant-safety-reviewer for tenant data.
Escalate when
- The change alters the authentication or authorization model itself, not just a permission.
- A public contract breaks: a field removed or renamed that clients read, a status code changed.
- A new dependency is needed (
.agents/policy/model-policy.mdtreats it as an escalation). - The endpoint exposes confidential data classes (
.agents/policy/data-classification.yml) to a caller class that did not see them before.
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
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.

