skills-catalog/ln-775-api-docs-generator/SKILL.md
Configures Swagger/OpenAPI documentation for backend APIs. Use when adding interactive API docs to a project.
npx skillsauth add levnikolaevich/claude-code-skills ln-775-api-docs-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Type: L3 Worker Category: 7XX Project Bootstrap
Configures API documentation with Swagger/OpenAPI.
| Aspect | Details | |--------|---------| | Input | Context Store from ln-770 | | Output | Swagger/OpenAPI configuration | | Stacks | .NET (Swashbuckle), Python (FastAPI built-in) |
Accept Context Store and scan for API endpoints.
Required Context:
STACK: .NET or PythonPROJECT_ROOT: Project directory pathIdempotency Check:
AddSwaggerGen or UseSwagger{ "status": "skipped" }API Analysis:
Use MCP tools for current documentation.
For .NET:
MCP ref: "Swashbuckle ASP.NET Core OpenAPI Swagger configuration"
Context7: /domaindrivendev/Swashbuckle.AspNetCore
For Python:
MCP ref: "FastAPI OpenAPI documentation customization"
Context7: /tiangolo/fastapi
Key Patterns to Research:
| Field | Description | Required | |-------|-------------|----------| | Title | API name | ✓ Yes | | Version | API version (v1, v2) | ✓ Yes | | Description | Brief description | Optional | | Contact | Support contact | Optional | | License | API license | Optional |
| Scheme | Use Case | OpenAPI Type |
|--------|----------|--------------|
| JWT Bearer (Recommended) | Token in Authorization header | http + bearer |
| API Key | Key in header or query | apiKey |
| OAuth2 | Full OAuth2 flow | oauth2 |
| None | Public API | No security |
| Feature | .NET | Python | Default | |---------|------|--------|---------| | XML Comments | ✓ Supported | N/A | ✓ Enable | | Response Examples | ✓ Manual | ✓ Pydantic | ✓ Enable | | Request Validation | ✓ Annotations | ✓ Pydantic | ✓ Enable | | Try It Out | ✓ Yes | ✓ Yes | ✓ Enable |
| File | Purpose |
|------|---------|
| Extensions/SwaggerExtensions.cs | Swagger service registration |
| *.csproj (update) | Enable XML documentation |
Generation Process:
Packages to Add:
Swashbuckle.AspNetCoreRegistration Code:
builder.Services.AddSwaggerServices();
// ...
app.UseSwaggerServices();
csproj Update:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
| File | Purpose |
|------|---------|
| core/openapi_config.py | OpenAPI customization |
Generation Process:
Note: FastAPI has built-in OpenAPI support. This worker customizes the default configuration.
Registration Code:
from core.openapi_config import custom_openapi
app.openapi = lambda: custom_openapi(app)
Validation Steps:
Syntax check:
dotnet build --no-restorepython -m py_compile core/openapi_config.pyAccess documentation: | Stack | URL | |-------|-----| | .NET | http://localhost:5000/swagger | | Python | http://localhost:5000/docs | | Python (ReDoc) | http://localhost:5000/redoc |
Verify content:
OpenAPI spec validation:
# .NET
curl http://localhost:5000/swagger/v1/swagger.json | jq .
# Python
curl http://localhost:5000/openapi.json | jq .
// Structure only - actual code generated via MCP ref
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT Authorization header using Bearer scheme",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = "bearer",
BearerFormat = "JWT"
});
# Structure only - actual code generated via MCP ref
from fastapi.security import HTTPBearer
security = HTTPBearer()
{
"status": "success",
"files_created": [
"Extensions/SwaggerExtensions.cs"
],
"packages_added": [
"Swashbuckle.AspNetCore"
],
"registration_code": "builder.Services.AddSwaggerServices();",
"message": "Configured Swagger/OpenAPI documentation"
}
GenerateDocumentationFile and suppress warning 1591AddSwaggerGen/UseSwagger exists, return status: "skipped"dotnet build or py_compile)Version: 2.0.0 Last Updated: 2026-01-10
testing
Checks runtime lifecycle and config validation: bootstrap, shutdown, probes, cleanup, env sync, and fail-fast startup. Use for runtime readiness.
testing
Checks races, deadlocks, async hazards, TOCTOU, blocking I/O, and shared resource contention. Use when auditing concurrency correctness.
testing
Checks diagnosability through structured logs, metrics, traces, correlation IDs, and useful log levels. Use when auditing incident visibility.
development
Finds code that can be safely deleted: unreachable, unused, obsolete compatibility, and commented-out code. Use when pruning dead code.