speedpy / rules
Cursor rule81 starsChanged 3 months agoMITView on GitHub
Rules for working on HTTP API endpoints under /api/v1/
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-integration-apiSkill
- applikuSkill
- start-speedpySkill
- strip-demoSkill
The file
We split this api.mdc into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Read AGENTS.md sections "HTTP API" and "Webhook Extension Guide" before making changes — they are the source of truth for file layout, URL …
- Very specific: line 22
Run all Django commands from this directory (speedpy/).
- Very specific: line 27
Every endpoint needs @extend_schema with tags, operation_id, summary, and request/response serializers.
- Very specific: line 29
Use HasScope from speedpycom.api.permissions with required_scopes on views.
- Distinctive: line 42
When a webhook event is needed for a new API resource, follow the
- Very specific: line 45
Add constant to mainapp/webhooks/events.py (WebhookEvent class + ALL set).
- Very specific: line 46
Call dispatch_event(team, event_type, data) after the DB write.
- Very specific: line 47
Add test in mainapp/tests/test_webhooks.py.
- Very specific: line 48
Document event in speedpy-docs/docs/webhooks.md.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
--- description: Rules for working on HTTP API endpoints under /api/v1/ globs: - mainapp/api/** - speedpycom/api/** - usermodel/api.py - project/api_urls.py - mainapp/tests/test_api_*.py - mainapp/webhooks/** - mainapp/tasks/webhooks.py --- # HTTP API work Read **`AGENTS.md` sections "HTTP API" and "Webhook Extension Guide"** before making changes — they are the source of truth for file layout, URL conventions, serializer patterns, scopes, tenant isolation, testing requirements, and webhook events. ## Quick rules - Run all Django commands from this directory (`speedpy/`). - API code lives in the **owning app**, not a separate `api` Django app. - Business resources: `mainapp/api/<domain>.py` + route in `project/api_urls.py`. - User/profile API: `usermodel/api.py` (single-file; do not package-split). - Shared permissions/mixins: `speedpycom/api/`. - Every endpoint needs `@extend_schema` with `tags`, `operation_id`, `summary`, and request/response serializers. - Use `HasScope` from `speedpycom.api.permissions` with `required_scopes` on views. - Team-scoped endpoints: resolve `team_id` from URL, verify membership, filter querysets through `TeamMembership`. Never trust `team_id` from request body. - New scopes: add to `OAUTH2_PROVIDER["SCOPES"]` in `project/settings.py` and `SPECTACULAR_SETTINGS["APPEND_COMPONENTS"]`. The PAT form picks them up automatically via the scope registry in `speedpycom.api.scopes`. - Tests in `mainapp/tests/test_api_<domain>.py`: anonymous rejection, happy path, field contract, tenant isolation, role boundaries, schema validation. - Validate after changes: run `spectacular --validate --fail-on-warn` using the wrapper from `AGENTS-local.md`. ## Webhooks (optional) When a webhook event is needed for a new API resource, follow the **Webhook Extension Guide** in `AGENTS.md`. Quick checklist: 1. Add constant to `mainapp/webhooks/events.py` (`WebhookEvent` class + `ALL` set). 2. Call `dispatch_event(team, event_type, data)` after the DB write. 3. Add test in `mainapp/tests/test_webhooks.py`. 4. Document event in `speedpy-docs/docs/webhooks.md`. ## Full recipe For the complete step-by-step (model, serializer, views, scopes, URLs, tests, schema, webhooks, CLI/MCP examples), use the `/add-integration-api` skill.
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.

