Provides methodology and security patterns to protect against common API vulnerabilities.

Install

mkdir -p .claude/skills/api-patterns-ngannk-fptu && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18341" && unzip -o skill.zip -d .claude/skills/api-patterns-ngannk-fptu && rm skill.zip

Installs to .claude/skills/api-patterns-ngannk-fptu

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Security patterns for APIs (REST, GraphQL, tRPC). Broken Object Level Authorization (BOLA), Rate Limiting, Injection, and Mass Assignment.
138 charsno explicit “when” trigger
Advanced

Key capabilities

  • Enumerate API endpoints for REST, GraphQL, and tRPC
  • Check authentication middleware for gaps and validation logic
  • Audit authorization logic to ensure controller checks ownership
  • Identify REST verb tampering and content-type vulnerabilities
  • Detect GraphQL introspection and depth limit issues
  • Verify tRPC input validation and context trust

How it works

The skill analyzes API endpoints, authentication middleware, and authorization logic to find vulnerabilities. It applies specific checks for REST, GraphQL, and tRPC APIs.

Inputs & outputs

You give it
API routes, middleware, authorization logic, or schema
You get back
Identified API vulnerabilities, security patterns, or Semgrep rules

When to use api-patterns

  • Secure API endpoints
  • Audit authorization middleware
  • Prevent BOLA vulnerabilities

About this skill

API Security Patterns

"The API is the door to the database. Is it locked?"

1. Top API Vulnerabilities (OWASP API Top 10)

IDNameThe "Smell"
API1BOLA (IDOR)/api/user/123 -> Can I see user 124?
API2Broken AuthWeak tokens, no rotation, exposed keys.
API3BFLA (Function Level)/admin/deleteUser -> Can a regular user call this?
API6Mass AssignmentupdateUser({ role: 'admin' }) -> Did it work?

2. Analysis Methodology

Step 1: Endpoint Enumeration

Find the routes.

  • REST: Look for app.get(), router.post().
  • GraphQL: Look for type Query, type Mutation.
  • tRPC: Look for .query(), .mutation().

Step 2: Auth Check

Map the middleware.

  • Matches: app.use(authMiddleware)
  • Gaps: Are there routes defined before the middleware?
  • Logic: Does the middleware actually validate the token?

Step 3: Authorization (The Hard Part)

Does the controller check ownership?

// BAD
app.get('/notes/:id', (req) => {
  return db.find(req.params.id); // Returns note regardless of owner
})

// GOOD
app.get('/notes/:id', (req) => {
  return db.find({ id: req.params.id, ownerId: req.user.id });
})

3. Technology Specifics

REST

  • Verb Tampering: Can I use HEAD to bypass auth?
  • Content-Type: Can I send XML (XXE) to a JSON endpoint?

GraphQL

  • Introspection: Is it enabled in prod? (Info disclosure)
  • Depth Limit: Can I ask for user { friends { user { friends ... } } }? (DoS)

tRPC

  • Input Validation: Is Zod validation applied to inputs?
  • Context: Is ctx.user trusted blindly?

4. Semgrep Rules for APIs

rules:
  - id: express-shadowed-middleware
    patterns:
      - pattern: |
          app.get($ROUTE, ...)
          app.use($MIDDLEWARE)
    message: "Route defined before middleware. It might be unauthenticated."
    severity: ERROR

5. When to Use

  • "Review this API for IDOR."
  • "Check if Mass Assignment is possible on the update profile endpoint."
  • "Audit the GraphQL schema for excessive complexity."

How it compares

This skill provides a structured methodology for API security analysis, identifying specific vulnerabilities and patterns across different API types, unlike a general security review.

Compared to similar skills

api-patterns side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
api-patterns (this skill)05moReviewAdvanced
backend-security-coder243moNo flagsIntermediate
api-security-best-practices156moReviewIntermediate
xss-testing16moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry