Bruno API Documentation Generator Skill
Inputs & Modes
This Skill expects one of:
- A path to a single Bruno file (usually
*.bru), OR
--scan <dir> to analyze all .bru files under a directory.
Optional flags:
--dry-run – produce an analysis plan only (no deep codebase search).
--output <path> – write the generated markdown documentation to a file.
If inputs are missing or ambiguous, ask the user to confirm:
- Which
.bru file(s) to analyze.
- Whether they want
--dry-run or full documentation.
- Whether an output file should be written.
Output Shape & Severity Tags
Dry-run output
Return a short plan containing:
- Endpoint summary: method, URL, auth, and any detected params/body.
- Where you will look in the Django codebase (specific file paths/directories).
- Which documentation sections will be generated.
- Complexity notes (e.g., “DRF ViewSet + serializer” vs “Ninja router + schema”).
Full documentation output
Generate a single markdown document for each endpoint using this structure:
# <Endpoint Name>
<METHOD> <URL Pattern>
- Authentication, Permissions, Multi-tenant
## Overview
## Request (headers + params/body with types/validation)
## Response (success example + common error cases)
## Implementation Details (URL config + view + serializer/schema; always with file.py:line)
## Business Logic (step-by-step, include side effects like tasks/external calls)
## Frontend Integration (TypeScript types + call example + React Query hook example)
## Testing (Bruno tests + edge cases + required fixtures/data)
## Notes (perf considerations, related endpoints, rollout notes)
Use severity tags only when something prevents correctness/completeness:
[BLOCKING] – cannot locate the endpoint implementation or critical auth/permission logic.
[SHOULD_FIX] – documentation gaps due to missing/incomplete source details (e.g., response shape unclear).
[NOTE] – optional improvements, related endpoints, refactors, or performance observations.
Workflow
Step 1 — Parse the Bruno file(s)
For each .bru file:
- Extract:
- HTTP method
- URL / path pattern
- Headers
- Query parameters
- Path parameters (from the URL pattern)
- Request body (and infer a schema where possible)
- Detect authentication intent:
- JWT / token headers
- Session/cookie usage
- Explicit “no auth” signals
- Capture any Bruno test/assert blocks as testing hints.
Step 2 — Locate the Django route & implementation
Treat these repo conventions as first-class when present:
- If the URL starts with
/api/v2/:
- Check
dashboardapp/v2_urls.py.
- Check
dashboardapp/views/v2/ for the view/viewset.
- If the URL starts with
/api/v2/pulse/:
- Check
pulse_iq/api/ for Django Ninja routers/endpoints.
- Otherwise:
- Search app-level
urls.py modules for the path prefix.
- If needed,
Grep for a distinctive path segment from the Bruno URL.
Once the route is found, identify the implementation type:
- DRF
- View / ViewSet class and handler method (
list, retrieve, create, custom actions).
- Serializer(s) used (including nested serializers) and validation rules.
- Permissions / authentication classes.
- Queryset and filtering (especially company/org scoping).
- Ninja
- Router and endpoint function.
- Pydantic schema(s) and validation.
- Auth configuration/decorators.
- Multi-tenant scoping and access control.
Always record code references with line numbers (path/to/file.py:123).
Step 3 — Extract behavior and contracts
For the located endpoint:
- Summarize the business purpose and any key invariants.
- Document validation and error behavior:
- Common 400 reasons (schema/serializer validation).
- Auth failures (401) and permission failures (403).
- Not-found cases (404) and domain-specific error cases.
- Identify multi-tenant constraints:
- How company/org is inferred (JWT claims, request context, URL param).
- Which queryset filters enforce scoping.
- Note side effects:
- Background tasks (Celery), emails, webhooks, external service calls.
- Writes to critical models and any transactional boundaries.
Step 4 — Generate documentation
Write the markdown doc per “Full documentation output”.
Rules:
- Prefer precise types over “string/number” when you can infer them.
- Include at least one realistic example request and success response.
- If response shape is dynamic or large, document the stable contract and
include a representative sample, not the entire universe of fields.
- When you’re unsure, be explicit about assumptions and mark with
[SHOULD_FIX].
Step 5 — Handle --output and --scan
- If
--scan <dir>:
- Find all
.bru files recursively under that directory.
- Generate one markdown doc per file.
- If no
--output is provided, return docs in the response (grouped by file).
- If
--output <path> is provided:
- Write output to that path.
- If scanning multiple files, either:
- Write a single combined doc (with a clear table of contents), OR
- Write multiple files under an output directory (ask the user which they want).
Compatibility Notes
This Skill is designed to work with both Claude Code and OpenAI Codex.
- Claude Code: install the corresponding plugin and use its slash commands (see
plugins/bruno-api/commands/).
- Codex: install the Skill directory and invoke
name: bruno-api.
For installation, see this repo's README.md.
1---2name: bruno-api3description: Generate comprehensive API docs from Bruno (.bru) files by mapping requests to a Django implementation (DRF/Django Ninja), including auth, multi-tenant filtering, schemas, and code references.4---5
6# Bruno API Documentation Generator Skill
7
8## Inputs & Modes
9
10This Skill expects one of:
11
12- A path to a single Bruno file (usually `*.bru`), OR
13- `--scan <dir>` to analyze all `.bru` files under a directory.
14
15Optional flags:
16
17- `--dry-run` – produce an analysis plan only (no deep codebase search).
18- `--output <path>` – write the generated markdown documentation to a file.
19
20If inputs are missing or ambiguous, ask the user to confirm:
21
22- Which `.bru` file(s) to analyze.
23- Whether they want `--dry-run` or full documentation.
24- Whether an output file should be written.
25
26## Output Shape & Severity Tags
27
28### Dry-run output
29
30Return a short plan containing:
31
32- Endpoint summary: method, URL, auth, and any detected params/body.
33- Where you will look in the Django codebase (specific file paths/directories).
34- Which documentation sections will be generated.
35- Complexity notes (e.g., “DRF ViewSet + serializer” vs “Ninja router + schema”).
36
37### Full documentation output
38
39Generate a single markdown document for each endpoint using this structure:
40
41- `# <Endpoint Name>`
42- ``<METHOD> <URL Pattern>``
43- **Authentication**, **Permissions**, **Multi-tenant**
44- `## Overview`
45- `## Request` (headers + params/body with types/validation)
46- `## Response` (success example + common error cases)
47- `## Implementation Details` (URL config + view + serializer/schema; always with `file.py:line`)
48- `## Business Logic` (step-by-step, include side effects like tasks/external calls)
49- `## Frontend Integration` (TypeScript types + call example + React Query hook example)
50- `## Testing` (Bruno tests + edge cases + required fixtures/data)
51- `## Notes` (perf considerations, related endpoints, rollout notes)
52
53Use severity tags only when something prevents correctness/completeness:
54
55- `[BLOCKING]` – cannot locate the endpoint implementation or critical auth/permission logic.
56- `[SHOULD_FIX]` – documentation gaps due to missing/incomplete source details (e.g., response shape unclear).
57- `[NOTE]` – optional improvements, related endpoints, refactors, or performance observations.
58
59## Workflow
60
61### Step 1 — Parse the Bruno file(s)
62
63For each `.bru` file:
64
65- Extract:
66 - HTTP method
67 - URL / path pattern
68 - Headers
69 - Query parameters
70 - Path parameters (from the URL pattern)
71 - Request body (and infer a schema where possible)
72- Detect authentication intent:
73 - JWT / token headers
74 - Session/cookie usage
75 - Explicit “no auth” signals
76- Capture any Bruno test/assert blocks as testing hints.
77
78### Step 2 — Locate the Django route & implementation
79
80Treat these repo conventions as first-class when present:
81
82- If the URL starts with `/api/v2/`:
83 - Check `dashboardapp/v2_urls.py`.
84 - Check `dashboardapp/views/v2/` for the view/viewset.
85- If the URL starts with `/api/v2/pulse/`:
86 - Check `pulse_iq/api/` for Django Ninja routers/endpoints.
87- Otherwise:
88 - Search app-level `urls.py` modules for the path prefix.
89 - If needed, `Grep` for a distinctive path segment from the Bruno URL.
90
91Once the route is found, identify the implementation type:
92
93- **DRF**
94 - View / ViewSet class and handler method (`list`, `retrieve`, `create`, custom actions).
95 - Serializer(s) used (including nested serializers) and validation rules.
96 - Permissions / authentication classes.
97 - Queryset and filtering (especially company/org scoping).
98- **Ninja**
99 - Router and endpoint function.
100 - Pydantic schema(s) and validation.
101 - Auth configuration/decorators.
102 - Multi-tenant scoping and access control.
103
104Always record code references with line numbers (`path/to/file.py:123`).
105
106### Step 3 — Extract behavior and contracts
107
108For the located endpoint:
109
110- Summarize the business purpose and any key invariants.
111- Document validation and error behavior:
112 - Common 400 reasons (schema/serializer validation).
113 - Auth failures (401) and permission failures (403).
114 - Not-found cases (404) and domain-specific error cases.
115- Identify multi-tenant constraints:
116 - How company/org is inferred (JWT claims, request context, URL param).
117 - Which queryset filters enforce scoping.
118- Note side effects:
119 - Background tasks (Celery), emails, webhooks, external service calls.
120 - Writes to critical models and any transactional boundaries.
121
122### Step 4 — Generate documentation
123
124Write the markdown doc per “Full documentation output”.
125
126Rules:
127
128- Prefer precise types over “string/number” when you can infer them.
129- Include at least one realistic example request and success response.
130- If response shape is dynamic or large, document the stable contract and
131 include a representative sample, not the entire universe of fields.
132- When you’re unsure, be explicit about assumptions and mark with `[SHOULD_FIX]`.
133
134### Step 5 — Handle `--output` and `--scan`
135
136- If `--scan <dir>`:
137 - Find all `.bru` files recursively under that directory.
138 - Generate one markdown doc per file.
139 - If no `--output` is provided, return docs in the response (grouped by file).
140- If `--output <path>` is provided:
141 - Write output to that path.
142 - If scanning multiple files, either:
143 - Write a single combined doc (with a clear table of contents), OR
144 - Write multiple files under an output directory (ask the user which they want).
145
146## Compatibility Notes
147
148This Skill is designed to work with both Claude Code and OpenAI Codex.
149
150- Claude Code: install the corresponding plugin and use its slash commands (see `plugins/bruno-api/commands/`).
151- Codex: install the Skill directory and invoke `name: bruno-api`.
152
153For installation, see this repo's `README.md`.