api-patterns
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.zipInstalls 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.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
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)
| ID | Name | The "Smell" |
|---|---|---|
| API1 | BOLA (IDOR) | /api/user/123 -> Can I see user 124? |
| API2 | Broken Auth | Weak tokens, no rotation, exposed keys. |
| API3 | BFLA (Function Level) | /admin/deleteUser -> Can a regular user call this? |
| API6 | Mass Assignment | updateUser({ 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
HEADto 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.usertrusted 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| api-patterns (this skill) | 0 | 5mo | Review | Advanced |
| backend-security-coder | 24 | 3mo | No flags | Intermediate |
| api-security-best-practices | 15 | 6mo | Review | Intermediate |
| xss-testing | 1 | 6mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
backend-security-coder
sickn33
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
api-security-best-practices
davila7
Implement secure API design patterns including authentication, authorization, input validation, rate limiting, and protection against common API vulnerabilities
xss-testing
Ed1s0nZ
XSS跨站脚本攻击测试的专业技能
permission-model-change-guide
TencentBlueKing
IAM RBAC 权限模型变更规则,涵盖资源类型定义、操作权限配置、权限迁移脚本、IAM 回调实现。当用户修改权限模型、添加新资源类型、配置操作权限或编写权限迁移脚本时使用。
api-design
Yisuescopeta
Design robust, scalable, and intuitive APIs (REST, GraphQL, etc.). Enforces best practices for resource naming, HTTP methods, error handling, versioning, and security. Use this when designing or refactoring backend endpoints.
aptos-scanner
0x-Shashi
>-