From laraclaude
Generate API documentation from routes, controllers, and form requests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/laraclaude:api-docs [all | route-prefix][all | route-prefix]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate API documentation by analyzing route definitions, controller methods, form request validation rules, and response structures.
Generate API documentation by analyzing route definitions, controller methods, form request validation rules, and response structures.
| Subcommand | Description |
|---|---|
| (no argument) | Generate documentation for all API routes. |
all | Same as no argument -- document all API routes. |
[route-prefix] | Document only routes matching the given prefix (e.g., api/v1/properties). |
This is a generator skill -- it produces documentation output.
Use Read to load routes/api.php and any included route files.
Use Bash to get the full route list from Laravel (if Docker is available):
docker exec {container} php artisan route:list --json --path=api
If Docker is unavailable, parse route files manually to extract:
/api/v1/properties/{property})If a [route-prefix] argument is provided, filter routes to only those matching the prefix.
For each API route, use Read to load the controller and extract:
{property}, {id})$request->query(), $request->input() in GET handlersrules() method$request->validate([...]) inline validation$request->input('field') or $request->only([...]) for expected fieldsFor each validated field, extract:
Analyze the controller method's return statements:
return response()->json($data) -> extract $data structurereturn new JsonResource($model) -> read the resource class's toArray() methodreturn Model::collection($models) -> read the resource collection200, 201, 204, 404, 422)auth:sanctum, auth:api, or custom auth middleware$this->authorize(), Gate::allows()Output structured markdown documentation:
# API Documentation
## Authentication
All API endpoints require authentication via Bearer token (Laravel Sanctum).
Include the token in the `Authorization` header:
Authorization: Bearer {your-api-token}
---
## Properties
### List Properties
`GET /api/v1/properties`
**Query Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| page | integer | No | Page number for pagination |
| per_page | integer | No | Items per page (default: 15) |
| search | string | No | Search by name or reference |
| status | string | No | Filter by status (active, draft, archived) |
**Response (200):**
```json
{
"data": [
{
"id": 1,
"name": "Beach Villa",
"reference": "AB0012",
"status": "active",
"price": 450000,
"created_at": "2026-01-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"last_page": 5,
"per_page": 15,
"total": 72
}
}
POST /api/v1/properties
Request Body:
| Field | Type | Required | Rules |
|---|---|---|---|
| name | string | Yes | max:255 |
| address | string | Yes | max:500 |
| price | decimal | Yes | min:0 |
| status | string | No | in:active,draft |
Response (201):
{
"data": {
"id": 73,
"name": "New Property",
"reference": "AB0073",
"status": "draft"
}
}
Error Response (422):
{
"message": "The given data was invalid.",
"errors": {
"name": ["The name field is required."],
"price": ["The price must be at least 0."]
}
}
### Step 4: Include Example Requests
For each endpoint, generate example curl commands:
```bash
# List properties
curl -X GET "https://api.example.com/api/v1/properties?page=1&status=active" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json"
# Create property
curl -X POST "https://api.example.com/api/v1/properties" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"name": "Beach Villa", "address": "123 Coast Rd", "price": 450000}'
Present the full documentation as formatted markdown in the response. If the user wants to save it to a file, offer to write it to a specified location (e.g., docs/api.md), but do not create files unless asked.
JsonResource) are used, read the toArray() method for accurate response structures.$hidden and $visible on the model.npx claudepluginhub edulazaro/laraclaude --plugin laraclaudeGenerates API documentation for endpoints including HTTP methods, parameters, request bodies, responses, error codes, and curl examples. Outputs Markdown or OpenAPI/Swagger.
Generates Markdown templates for PHP REST API documentation, including endpoint details, parameters, request/response examples, authentication, and error handling.
Generates API documentation from code: endpoints, parameters, request/response examples, auth, errors, OpenAPI specs, and Postman collections for REST/GraphQL/WebSocket APIs.