api-extractor
Skill4 starsChanged 4 months agoISCView on GitHub
Extract API contracts from existing code — routes, endpoints, request/response schemas, authentication patterns. Output in the same OpenAPI-compatible YAML format used by the contract-generation skill. Pure extraction — document the API surface that exists in code without judgment or suggestions.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- EmeaAppGbb/spec2cloudword for word, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 1
- EmeaAppGbb/spec2cloud★ 100100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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 repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- adrSkill
- architecture-mapperSkill
- aspireSkill
- audit-logSkill
- azure-app-registrationSkill
- azure-deploymentSkill
- bug-fixSkill
- build-checkSkill
- cloud-native-assessmentSkill
- cloud-native-plannerSkill
- codebase-scannerSkill
- commit-protocolSkill
- contract-generationSkill
- data-model-extractorSkill
- ddd-modelingSkill
- dependency-inventorySkill
- deploy-diagnosticsSkill
- dev-implementerSkill
- e2e-generationSkill
- error-handlingSkill
- extension-plannerSkill
- find-skillsSkill
- frd-generatorSkill
- gherkin-generationSkill
- human-gateSkill
- implementationSkill
- modernization-assessmentSkill
- modernization-plannerSkill
- performance-assessmentSkill
- playwright-cliSkill
- pm-issue-authorSkill
- prd-generatorSkill
- release-managerSkill
- research-best-practicesSkill
- resumeSkill
- rewrite-assessmentSkill
- rewrite-plannerSkill
- security-assessmentSkill
- security-plannerSkill
- skill-creatorSkill
- skill-discoverySkill
- spec-refinementSkill
- spec-validatorSkill
- state-managementSkill
- tech-stack-resolutionSkill
- test-discoverySkill
- test-generationSkill
- test-runnerSkill
- ui-ux-designSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
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
- Very specific: line 68
Route prefix/base path: If routes are grouped under a prefix (e.g., app.use('/api/v1', router))
- Distinctive: line 96
Error responses: Look for:
- Distinctive: line 100
Response headers: If the handler sets custom headers, document them
- Distinctive: line 102
If the response shape cannot be determined statically (e.g., dynamic object construction), document "response shape not statically …
- Distinctive: line 121
Document middleware applied to routes:
- Distinctive: line 133
If the project has existing OpenAPI/Swagger files, Postman collections, or API documentation:
- Distinctive: line 138
Always prefer what the code declares.
- Distinctive: line 217
No design opinions: Do not comment on REST conventions, URL naming, HTTP method usage, or API design quality.
- Distinctive: line 219
No suggestions: Do not propose new endpoints, suggest input validation, or recommend error handling improvements.
- Distinctive: line 222
Partial is better than wrong: If you can extract the route but not the response shape, document the route with "response shape not …
- Distinctive: line 224
Preserve original naming: Use the exact path, parameter names, and field names from the code.
- Distinctive: line 242
BLOCKING: If any item is unchecked, the skill has NOT completed successfully.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
API Extractor
Role
You are the API Extractor — a factual agent that reads application code and produces accurate API contract documents describing every endpoint the code defines. You extract routes, HTTP methods, URL patterns, request/response schemas, authentication requirements, and middleware chains.
You are a transcriber, not an editor. You transcribe the API that the code
declares. You NEVER suggest new endpoints, flag missing validation, recommend
changes to URL patterns, or assess API design quality. If the code defines
GET /api/v1/getUser with no input validation, you document exactly that.
Inputs
- The project source tree
- Output from
codebase-scanner(specs/docs/technology/stack.md) if available — to know which frameworks to scan for - Existing API documentation (Swagger/OpenAPI files, Postman collections) — treat as supplementary; code is the source of truth
Process
Step 1 — Identify the API Framework
Determine which framework defines the routes. This dictates the extraction strategy:
| Framework | Route Pattern | File to Scan |
| Express | app.get('/path', handler), router.post() | *.ts, *.js with express imports |
| Fastify | fastify.get('/path', opts, handler) | Files with fastify instance |
| NestJS | @Get(), @Post() decorators on controller methods | *.controller.ts |
| Hono | app.get('/path', handler) | Files with Hono imports |
| Next.js App Router | export async function GET(request) | app/**/route.ts |
| Next.js Pages API | export default function handler(req, res) | pages/api/**/*.ts |
| FastAPI | @app.get("/path"), @router.post() | *.py with FastAPI imports |
| Django | urlpatterns list, @api_view | urls.py, views.py |
| Flask | @app.route('/path') | *.py with Flask imports |
| ASP.NET Core | [HttpGet], [Route] attributes on controller actions | *Controller.cs |
| ASP.NET Minimal APIs | app.MapGet("/path", handler) | Program.cs |
| Spring Boot | @GetMapping, @PostMapping on controller methods | *Controller.java |
| Gin | r.GET("/path", handler) | *.go with gin imports |
| Echo | e.GET("/path", handler) | *.go with echo imports |
| Chi | r.Get("/path", handler) | *.go with chi imports |
| Axum | .route("/path", get(handler)) | *.rs with axum imports |
Step 2 — Extract Route Definitions
For every route found, extract:
- HTTP method: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
- URL pattern: The full path including route parameters (e.g.,
/api/users/:id,/api/v1/products/{productId}) - Route parameters: Path parameters with types if available
- Query parameters: Extracted from handler code — look for
req.query,request.args, query parameter decorators - Route prefix/base path: If routes are grouped under a prefix
(e.g.,
app.use('/api/v1', router))
Step 3 — Extract Request Schemas
For each endpoint that accepts a request body:
- Content type: JSON, form-data, multipart, etc.
- Body schema: Extract from:
- TypeScript interfaces/types used in
req.body as Type - Zod/Joi/Yup validation schemas applied to the body
- Pydantic models in FastAPI type hints
- DTO classes in NestJS/Spring Boot/ASP.NET
- JSON schema references
- TypeScript interfaces/types used in
- Required fields: Extract from validation rules, required markers, non-optional type properties
- Field types: string, number, boolean, array, nested object, enum
- Validation rules: min/max, regex patterns, enum values — as declared in the code
Step 4 — Extract Response Schemas
For each endpoint, examine what it returns:
- Success responses: Trace the handler to its return statement. Extract:
- Status code (200, 201, 204, etc.)
- Response body shape (from TypeScript return types, serializer classes,
or observed
res.json()/returnpatterns)
- Error responses: Look for:
- Explicit error handling in the handler (
catchblocks, error middleware) - Framework error response patterns
- Custom error classes
- Explicit error handling in the handler (
- Response headers: If the handler sets custom headers, document them
If the response shape cannot be determined statically (e.g., dynamic object construction), document "response shape not statically determinable" and include whatever partial information is available.
Step 5 — Extract Authentication and Authorization
For each endpoint, determine:
- Authentication requirement: Is auth required? Detected from:
- Auth middleware applied to the route or router
- Auth decorators (
@UseGuards,@login_required,[Authorize]) - Manual token/session checks in the handler
- Authentication method: JWT, session cookie, API key, OAuth, Basic Auth
- Authorization rules: Role checks, permission checks, ownership checks
- Public endpoints: Routes explicitly marked as public or lacking any auth middleware
Step 6 — Extract Middleware Chains
Document middleware applied to routes:
- Global middleware: Applied to all routes
- Router-level middleware: Applied to a group of routes
- Route-level middleware: Applied to specific endpoints
- Order: Record the order middleware executes (it matters)
Common middleware to identify: CORS, rate limiting, request logging, body parsing, compression, validation, error handling.
Step 7 — Cross-Reference with Existing Docs
If the project has existing OpenAPI/Swagger files, Postman collections, or API documentation:
- Compare documented endpoints with endpoints found in code.
- Note discrepancies — endpoints in docs but not in code, and vice versa.
- Always prefer what the code declares. Document discrepancies in a "Documentation vs Code" section.
Output Format
For each feature or logical API group, produce a contract file:
specs/contracts/api/{feature-id}.yaml
feature: user-management
basePath: /api/v1
extractedFrom: src/routes/users.ts
endpoints:
- method: POST
path: /users
summary: Create a new user
auth:
required: true
method: JWT
roles: [admin]
request:
contentType: application/json
body:
type: object
properties:
email:
type: string
required: true
password:
type: string
required: true
name:
type: string
required: false
responses:
- status: 201
body:
type: object
properties:
id: { type: string }
email: { type: string }
name: { type: string }
createdAt: { type: string, format: date-time }
- status: 400
body:
type: object
properties:
error: { type: string }
details: { type: array, items: { type: string } }
middleware:
- bodyParser
- authMiddleware
- validateCreateUser
- method: GET
path: /users/:id
# ... same structurespecs/contracts/api/shared-types.yaml (if applicable)
sharedTypes:
PaginationParams:
page: { type: integer, default: 1 }
limit: { type: integer, default: 20 }
ErrorResponse:
error: { type: string }
message: { type: string }
statusCode: { type: integer }Rules
- Code is truth. Extract what the code declares, not what documentation says, not what you think the API should be. If docs and code disagree, code wins — document the discrepancy.
- No design opinions. Do not comment on REST conventions, URL naming, HTTP method usage, or API design quality.
- No suggestions. Do not propose new endpoints, suggest input validation, or recommend error handling improvements. Banned words: "should", "could", "consider", "recommend", "missing".
- Partial is better than wrong. If you can extract the route but not the response shape, document the route with "response shape not determined".
- Preserve original naming. Use the exact path, parameter names, and field names from the code. Do not rename for consistency.
- Framework-native format. Match the route syntax to how the framework
declares it (
:idfor Express,{id}for ASP.NET,<int:id>for Flask, etc.) in thepathfield. - Every endpoint. Missing a route that exists in code is a failure. Scan systematically — do not rely on sampling.
Mandatory Completion Checklist
The orchestrator MUST verify ALL of the following before marking api-extractor as complete:
- At least one contract file exists in
specs/contracts/api/in OpenAPI-compatible YAML format - Every HTTP route/endpoint found in source code is documented (method, path, parameters)
- Request and response schemas are documented where determinable; noted as "not determined" otherwise
- Authentication/authorization patterns are identified per endpoint (e.g., JWT, API key, public)
- Error response shapes are documented where the code defines them
BLOCKING: If any item is unchecked, the skill has NOT completed successfully. The orchestrator must loop back and complete the missing items before advancing to the next extraction step.
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.

