api-patterns

api-patterns is a skill for Claude Code, Codex from bybren-llc/safe-agentic-workflow. It costs 57 tokens per session (1,427 once invoked), scanned A, original, MIT.

A set of patterns for building server-side API routes, including access control, input checking, webhooks, and error handling. RLS (row-level security) limits which database records each request can access.

In plain words
What is it for?
Use it when creating CRUD endpoints, validating requests and responses, processing webhooks, delivering protected content, or handling API errors. It is not intended for frontend-only changes or database migrations without API work.
Why use it?
It helps avoid unsafe routes that skip access checks or accept invalid data. It also provides established approaches for common API work instead of requiring each route to be designed from scratch.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when creating CRUD endpoints, validating requests and responses, processing webhooks, delivering protected content, or handling API errors. It is not intended for frontend-only changes or database migrations without API work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bybren-llc/safe-agentic-workflow/api-patterns
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 bybren-llc/safe-agentic-workflow --skill api-patterns
Clone the repo
git clone --depth 1 https://github.com/bybren-llc/safe-agentic-workflow

Made for: Claude Code, Codex.

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 api-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/bybren-llc/safe-agentic-workflow/api-patterns/github.svg)](https://agentmods.dev/skills/bybren-llc/safe-agentic-workflow/api-patterns)
Your own site
<a href="https://agentmods.dev/skills/bybren-llc/safe-agentic-workflow/api-patterns"><img src="https://agentmods.dev/badge/skills/bybren-llc/safe-agentic-workflow/api-patterns/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 api-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/bybren-llc/safe-agentic-workflow/api-patterns"><img src="https://agentmods.dev/badge/skills/bybren-llc/safe-agentic-workflow/api-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,427 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00057 $0.01427
Opus 5.5 $0.00023 $0.00571
Sonnet 5.5 $0.00011 $0.00285
Haiku 4.5 $0.00006 $0.00143

Measured 1mo ago against content hash 74ddedb0e337, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-patterns 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 1mo 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.

.agents/skills/api-patterns/SKILL.md · 216 lines

How it starts

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

API Patterns Skill

TEMPLATE: This skill uses {{PLACEHOLDER}} tokens. Replace with your project values before use.

Purpose

Route to existing API patterns and provide checklists for safe, validated API route implementation. All API routes MUST use RLS context helpers -- see rls-patterns skill.

When This Skill Applies

  • Creating new API routes
  • Implementing CRUD endpoints
  • Adding request/response validation
  • Handling webhooks
  • Implementing error handling patterns

Authoritative References (MUST READ)

Pattern Location Purpose
User Context API patterns_library/api/user-context-api.md User-scoped operations
Admin Context API patterns_library/api/admin-context-api.md Admin-scoped operations
Zod Validation patterns_library/api/zod-validation-api.md Request/response validation
Webhook Handler patterns_library/api/webhook-handler.md Webhook processing
Bonus Content patterns_library/api/bonus-content-delivery.md Protected content delivery

Stop-the-Line Conditions

FORBIDDEN Patterns

// FORBIDDEN: Direct ORM/DB calls (bypass RLS)
const users = await db.user.findMany();
// Must use: withUserContext, withAdminContext, or withSystemContext

// FORBIDDEN: Missing authentication check
export async function GET(req: Request) {
  return getUserData(); // No auth check!
}

// FORBIDDEN: Unvalidated user input
const { userId } = await req.json();
// Must validate with schema validation (Zod, Pydantic, etc.)

// FORBIDDEN: Generic error responses
return new Response("Error", { status: 500 });
// Must use structured error response

CORRECT Patterns

// CORRECT: RLS context + auth check
export async function GET(req: Request) {
  const { userId } = await auth();
  if (!userId) {
    return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
  }

  const data = await withUserContext(db, userId, async (client) => {
    return client.user.findUnique({ where: { user_id: userId } });
  });

  return NextResponse.json(data);
}

// CORRECT: Schema validation
const schema = z.object({
  email: z.string().email(),
  name: z.string().min(1),
});

const result = schema.safeParse(body);
if (!result.success) {
  return NextResponse.json(
    { error: "Validation failed", details: result.error.flatten() },
    { status: 400 },
  );
}

Read the full file on GitHub · 216 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 216 lines · 57 tokens per session scan A 74ddedb0e337

Subscribe to this mod's changes

api-patterns is a skill published in the GitHub repository bybren-llc/safe-agentic-workflow (425 stars, last pushed 3mo ago), licensed MIT. It adds 57 tokens to every session and 1,427 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-08-30.

Related

Other skills, from other repositories

kirby-content-migration

Plans and applies safe Kirby content migrations using runtime content tools, update schemas, and explicit confirmation. Use when users need to rename/move/transform fields, clean up content, or bulk-update pages/files across languages.

bnomei/kirby-mcp · 49 tokens

migration-helper

Guide safe database and code migrations with zero-downtime strategies.

nguyenthienthanh/aura-frog · 16 tokens

drogon-gen-orm-model

A code generator that creates Drogon ORM model classes from PostgreSQL, MySQL, or SQLite3 tables. An ORM maps database tables to program objects so code can query and update them through those objects.

voidvec/drogon-claude-plugin · 46 tokens

backend-server

A guide for building backend services, the server-side code and data systems that support an app. It covers APIs, databases, authentication, deployment, and services such as Supabase, Cloudflare Workers, Vapor, and Firebase.

wangjianqi/AppStore · 58 tokens

tdx-dev-guide

A complete development process for adding a new TDX data fetcher. A fetcher retrieves data, while a cleaner converts it into the format used by the database.

Grid0723/skills · 51 tokens

nornicdb-grpc

Drive NornicDB over gRPC — the Qdrant-compatible surface (Collections, Points, Snapshots) plus the additive NornicSearch service. Use when ingesting via Qdrant SDKs, migrating from Qdrant, or running hybrid text+vector search from a non-Bolt client. Covers connection, RPC catalog, collection→database mapping…

orneryd/NornicDB · 98 tokens