Skip to content

Commit ec2d11a

Browse files
mfosterwclaude
andcommitted
Add docs Claude Code skill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9f90d2e commit ec2d11a

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

.claude/skills/docs/SKILL.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
name: docs
3+
description: Update, review, or build the Sphinx documentation for Democrasite
4+
disable-model-invocation: true
5+
argument-hint: "[what to update or check, e.g. 'review for accuracy' or 'add activitypub section']"
6+
---
7+
8+
## Task
9+
$ARGUMENTS
10+
11+
## Documentation structure
12+
13+
```
14+
docs/
15+
├── conf.py — Sphinx config (theme, extensions, Django setup)
16+
├── index.rst — Master toctree (README, CONTRIBUTING, howto, users, webiscite, api/)
17+
├── README.rst — Project overview (mirrors root README)
18+
├── CONTRIBUTING.rst — Dev setup and contribution guide
19+
├── howto.rst — Instructions for building and writing docs
20+
├── users.rst — Users app overview (minimal; relies on autodoc)
21+
├── webiscite.rst — Core app narrative (pipeline, bill lifecycle)
22+
└── api/ — Auto-generated RST files (do not edit manually)
23+
├── democrasite.rst
24+
├── democrasite.webiscite.rst
25+
├── democrasite.webiscite.models.rst
26+
├── democrasite.webiscite.managers.rst
27+
├── democrasite.webiscite.tasks.rst
28+
├── democrasite.webiscite.webhooks.rst
29+
├── democrasite.webiscite.constitution.rst
30+
├── democrasite.webiscite.views.rst
31+
├── democrasite.webiscite.api.rst
32+
├── democrasite.users.rst
33+
├── democrasite.activitypub.rst
34+
└── … (one file per module)
35+
```
36+
37+
## Key make commands
38+
39+
All run from the `docs/` directory (or with `make -C docs <target>`):
40+
41+
| Command | What it does |
42+
|---|---|
43+
| `make apidocs` | Regenerate all `docs/api/*.rst` from source using sphinx-apidoc. Run this whenever Python modules are added or removed. |
44+
| `make livehtml` | Build docs and serve with live reload at http://localhost:9000. Requires the docs Docker container (`docker compose -f docker-compose.docs.yml up`). |
45+
| `make clean` | Remove `_build/` and `api/` directories for a fresh build. |
46+
| `make html` | One-off HTML build into `_build/html/`. |
47+
48+
To serve with live reload locally (in Docker):
49+
```
50+
docker compose -f docker-compose.docs.yml up
51+
```
52+
53+
To regenerate API docs locally (sphinx-apidoc must be installed):
54+
```
55+
make -C docs apidocs
56+
```
57+
58+
## What is auto-generated vs. manual
59+
60+
- **`docs/api/`** — fully auto-generated by `make apidocs` (sphinx-apidoc). Never edit these files directly; edit the Python docstrings instead, then re-run `make apidocs`.
61+
- **`docs/webiscite.rst`** and **`docs/users.rst`** — manually maintained narrative docs. Keep these in sync with code changes (especially `webiscite.rst` for the PR pipeline and bill lifecycle).
62+
- **`docs/CONTRIBUTING.rst`** and **`docs/howto.rst`** — manually maintained.
63+
64+
## Docstring style
65+
66+
Use Google-style docstrings (supported via the Napoleon extension). Example:
67+
68+
```python
69+
def my_function(arg: int) -> str:
70+
"""One-line summary.
71+
72+
Longer description if needed.
73+
74+
Args:
75+
arg: Description of the argument.
76+
77+
Returns:
78+
Description of the return value.
79+
80+
Raises:
81+
ValueError: When and why.
82+
"""
83+
```
84+
85+
Line length: 88 characters (enforced by ruff). Wrap long docstring lines to stay within this limit.
86+
87+
## Steps for common tasks
88+
89+
### Reviewing docs for accuracy
90+
1. Read `docs/webiscite.rst` and cross-check function/class references against actual source code
91+
2. Check that docstrings in `democrasite/webiscite/managers.py`, `models.py`, `tasks.py`, `webhooks.py`, and `constitution.py` have correct parameter names and return descriptions
92+
3. Run `make apidocs` if modules have been added or removed since the last regeneration
93+
4. Run `just lint` to confirm no ruff line-length violations were introduced
94+
95+
### Adding or updating narrative docs
96+
1. Edit the relevant `.rst` file in `docs/` (not under `docs/api/`)
97+
2. Use Sphinx cross-references for code identifiers:
98+
- `:class:\`~democrasite.webiscite.models.Bill\`` — class link
99+
- `:func:\`~democrasite.webiscite.tasks.submit_bill\`` — function link
100+
- `:meth:\`~democrasite.webiscite.webhooks.PullRequestHandler.opened\`` — method link
101+
3. Verify the build: `docker compose -f docker-compose.docs.yml up`
102+
103+
### Adding a new Python module
104+
1. Write a module-level docstring at the top of the file
105+
2. Run `make apidocs` to regenerate `docs/api/` — this creates the new RST file and adds it to the relevant package toctree automatically
106+
3. Commit the updated `docs/api/` files alongside the new module
107+
108+
### Updating docs after refactoring
109+
1. Update any cross-references in `docs/webiscite.rst` or `docs/users.rst` that point to renamed/removed identifiers
110+
2. Update affected docstrings in source files
111+
3. Run `make apidocs` if the module structure changed (files added/removed)
112+
4. Run `just lint` to verify no line-length violations
113+
114+
## Published docs
115+
- ReadTheDocs URL: https://cookiestocracy.readthedocs.io/en/latest/
116+
- Builds automatically on push to the main branch

0 commit comments

Comments
 (0)