inceptyon-labs/tenet-skills/tenet-api-contract

Claude Code and agent skill by inceptyon-labs/tenet-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Audits API consistency: schemas, errors, status codes, pagination, versioning, and idempotency.

Install

npx vskill@latest install inceptyon-labs/tenet-skills/tenet-api-contract

SKILL.md

The same SKILL.md was published earlier as inceptyon-labs/tenet-skills/tenet-api-contract.

Tenet API Contract

Evaluates whether your API surface is consistent, predictable, and well-designed.

Purpose

This skill audits the API layer of a project for design consistency and contract quality. A well-designed API follows predictable patterns: every resource returns the same response shape, error responses use a uniform schema, HTTP verbs map to their intended semantics, status codes are precise, and pagination follows a single strategy. This skill detects deviations from those principles and flags them as findings.

APIs are the public contract of a service. Inconsistencies in response shapes, verb semantics, or status codes create integration friction, increase client-side error handling complexity, and signal a codebase where conventions are not enforced. This dimension catches those issues before they reach consumers.

Calibration — read first

Follow shared/scan-discipline.md (complete every step, enumerate rather than sample, and §2a: report only issues that actually exist), shared/verification.md (every finding is confirmed against the code before it ships; unconfirmed candidates are dropped, not demoted), and shared/severity.md (severity is confirmed impact, never a hedge for doubt).

A finding must exist in this codebase on a path that can run. Do not report hypotheticals, dead code, style preferences, or anything an upstream check already prevents. Zero findings for a step is the normal result on healthy code; do not fill a step to show you looked. Do not overthink it: read the code and its context, decide, move on.

Language Support Matrix

yaml
support:
native:
- express
- fastify
- nextjs-api-routes
- nextjs-app-router
- flask
- django
- django-rest-framework
- trpc
- nestjs
- hono
- koa
- sveltekit
- fastapi
- tauri-commands
- electron-ipc
tree_sitter:
- spring-boot
- gin
- echo
- rails
- phoenix
heuristic:
- all-others
note: >
Native support means the skill understands the framework's routing conventions
and can precisely extract route handlers, middleware, and response calls.
Tree-sitter support uses AST queries for common patterns.
Heuristic support uses grep-based pattern matching for HTTP verb + path + status code detection.

Applicability Detection

This skill is applicable when ANY of the following are detected:

  1. Express/Fastify/Koa/Hono route handlers — files containing app.get(, app.post(, router.get(, fastify.get(, etc.
  2. Next.js API routes — files under pages/api/ or app/*/route.ts
  3. Flask/Django views — @app.route, @api_view, urlpatterns with view references
  4. tRPC routers — createTRPCRouter, publicProcedure, protectedProcedure
  5. NestJS controllers — @Controller, @Get(), @Post() decorators
  6. OpenAPI/Swagger specs — openapi.yaml, openapi.json, swagger.yaml, swagger.json
  7. GraphQL schemas — .graphql files, typeDefs, gql tagged templates
  8. SvelteKit endpoints — +server.ts / +server.js files
  9. FastAPI and Go routers — @app.get(, @router.post(, .HandleFunc(, gin/echo/chi route calls
  10. Desktop IPC commands — #[tauri::command], ipcMain.handle(

A mobile or desktop app that only consumes someone else's API has no API surface of its own and is not applicable. If the same repo also contains the server it talks to, the dimension is applicable and Step 9 checks the two sides against each other.

If none of these are detected, write the dimension report with applicable: false and score: null.

Toolchain Inputs

This skill does NOT consume toolchain outputs directly. It performs its own code analysis using Grep, Glob, and Read to examine route handlers and API definitions.

However, if .healthcheck/toolchain/eslint.json exists, check for any ESLint findings related to API patterns (e.g., consistent-return) and incorporate them to avoid duplicate work.

Procedure

Step 1: Detect API Framework and Enumerate Routes

Identify which API framework(s) are in use and build a route inventory. Use the enumeration recipes in `shared/entry-points.md` for every stack present: Express/Fastify/Koa, Hono, tRPC, Next.js (App Router, Pages, server actions), SvelteKit, FastAPI/Flask/Django and Go. This dimension needs the route list from those recipes, not the auth table that file also describes. Enumerate every route; a route that is not in the inventory is not checked by any later step.

Recipes for surfaces that file does not cover:

Django REST Framework:

bash
git grep -nP "@api_view|class\s+\w+\((\w+\.)?\w*(ViewSet|APIView)\b" -- '*.py'

NestJS:

bash
git grep -nP "@(Controller|Get|Post|Put|Patch|Delete)\(" -- '*.ts' '*.tsx' '*.js' '*.jsx'

Desktop IPC (Tauri, Electron). Commands the UI calls are an API surface with the same consistency concerns:

bash
git grep -nP "#\[tauri::command" -- '*.rs'
git grep -nP "ipcMain\.(handle|on)\s*\(" -- '*.ts' '*.tsx' '*.js' '*.jsx'

For these, Steps 2 and 3 apply (return shapes and error shapes across commands). Skip the HTTP steps (4 to 8) and mark their checks skipped.

Build a route table:

MethodPathFileLineHandler
GET/api/userssrc/routes/users.ts12listUsers
POST/api/userssrc/routes/users.ts45createUser
...............
Step 2: Check Response Shape Uniformity

For each resource (group of routes sharing a base path like /api/users), examine the response bodies:

What to check:

  • All success responses for a resource should wrap data in the same envelope (e.g., { data: ..., meta: ... } or bare objects)
  • If one endpoint returns { data: users, total: 100 }, another should not return { results: users, count: 100 }
  • Collection endpoints (GET /resources) vs. singleton endpoints (GET /resources/:id) should use consistent wrapping

Detection method:

  • Read each handler and look for res.json(, res.send(, return Response.json(, jsonify(, JsonResponse(
  • Extract the top-level keys of the response object
  • Compare across handlers in the same resource group

Severity: minor for inconsistent shapes within a resource, major if the inconsistency spans the entire API (no two resources use the same envelope).

Step 3: Check Error Response Schemas

Examine error handling across all routes:

What to check:

  • Error responses should follow a uniform schema (e.g., { error: { code: string, message: string } })
  • Different error handlers should not return different shapes (one returning { error: "msg" } and another { message: "msg", status: 400 })
  • Express error middleware, NestJS exception filters, Flask errorhandlers should be consistent

Detection method:

  • Search for error response patterns: res.status(4, res.status(5, HttpException, abort(, raise Http
  • Extract the response body shape from each error path
  • Check for a centralized error handler vs. ad-hoc error responses

Severity: major if no consistent error schema exists, minor if most errors are consistent with a few outliers.

Step 4: Validate HTTP Verb Semantics

Check that HTTP methods are used according to their semantics:

Rules:

VerbExpected SemanticsFlag if...
GETRead-only, no side effectsHandler writes to DB, sends emails, creates records
POSTCreate a resource or trigger an actionUsed for idempotent updates (should be PUT/PATCH)
PUTFull replacement, idempotentHandler does partial updates (should be PATCH)
PATCHPartial updateHandler requires all fields (should be PUT)
DELETERemove a resource, idempotentHandler has non-idempotent side effects

Detection method:

  • For GET handlers: look for save(), create(), insert, delete, update, sendEmail, publish, write operations on DB models
  • For POST handlers used for updates: check if the path contains an :id param and the handler does a full replacement
  • For PUT handlers: check if the handler merges/patches rather than replaces

Severity: major for GET with side effects (violates HTTP spec and breaks caching), minor for PUT/PATCH confusion.

Step 5: Check Versioning Strategy

Examine how (or if) the API is versioned:

Detection method:

  • URL-based: paths starting with /v1/, /v2/, /api/v1/
  • Header-based: checks for Accept header version parsing, X-API-Version headers
  • No versioning: all routes under a flat path

What to flag:

  • Mixed versioning strategies (some routes versioned in URL, others in headers)
  • Multiple API versions with identical implementations (dead versions)
  • No versioning at all on a public API (info-level suggestion)

Severity: minor for mixed strategies, info for missing versioning on public APIs.

Step 6: Validate Idempotency on PUT and DELETE

PUT and DELETE requests MUST be idempotent (calling them N times produces the same result as calling once).

Detection method:

  • PUT handlers that use auto-increment IDs or generate new records instead of upserting
  • PUT handlers that append to collections rather than replace
  • DELETE handlers that throw errors on already-deleted resources instead of returning 204/404

What to look for in code:

# Bad: PUT that creates duplicates
router.put('/items/:id', (req, res) => {
db.items.insert(req.body) // creates a new record every call
})
# Bad: DELETE that throws on missing
router.delete('/items/:id', (req, res) => {
const item = db.items.findOrFail(req.params.id) // throws 500 on second call
})

Severity: major for non-idempotent PUT, minor for DELETE that errors on missing resources.

Step 7: Validate Status Codes

Check that HTTP status codes match the operation:

Rules:

OperationExpected StatusFlag if...
Create (POST)201 CreatedReturns 200
Delete204 No Content (or 200 with body)Returns 200 with empty body
Update (PUT/PATCH)200 OKReturns 204 when body is returned
Not Found404Returns 200 with null/empty
Validation Error400 or 422Returns 500
Auth failure401 or 403Returns 400 or 500

Detection method:

  • Read POST handlers and check for res.status(201) vs res.status(200) or no explicit status
  • Read DELETE handlers and check for res.status(204) or res.sendStatus(204)
  • Flag handlers that return 200 for everything regardless of operation

Severity: minor for incorrect but functional status codes (200 instead of 201), major for misleading codes (200 for errors, 500 for validation).

Step 8: Check Pagination Consistency

For collection endpoints that return lists, check pagination:

What to check:

  • All list endpoints should use the same pagination strategy (offset-based, cursor-based, or page-based)
  • Pagination parameters should have consistent names (page/per_page vs offset/limit vs cursor/after)
  • Responses should include pagination metadata consistently (total, next_cursor, has_more)
  • Default and maximum page sizes should be enforced

Detection method:

  • Find all GET endpoints that return arrays/lists
  • Check query parameter parsing for pagination params
  • Compare pagination metadata shapes across endpoints

Severity: minor for inconsistent parameter naming, major for some endpoints paginated and others returning unbounded lists (performance risk).

Step 9: Additional Checks

Content-Type consistency:

  • All JSON endpoints should set Content-Type: application/json
  • Mixed content types without Accept header negotiation

HATEOAS/Links (info only):

  • Note whether the API includes hypermedia links for discoverability

Rate limiting headers:

  • Check if rate limiting headers are set consistently (X-RateLimit-Limit, X-RateLimit-Remaining)

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/inceptyon-labs/tenet-skills/tenet-api-contract/badge)](https://verified-skill.com/skills/inceptyon-labs/tenet-skills/tenet-api-contract)

Something wrong with this skill or its page? Tell us.