agentleFS
suitenumeriquesuitenumerique/docs/.agents/skills/docs-backend-django/SKILL.md

docs-backend-django

Skill17k starsChanged 7 days agoMITView on GitHub

Work safely and efficiently on the Django backend of La Suite Docs. Use this skill when modifying Python/Django backend code, API endpoints, serializers, permissions, models, migrations, Celery tasks, database queries, tests, or backend configuration.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about suitenumerique/docs

The biggest 5 of 110 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 110

Talked about on GitHub, Bluesky, YouTube and Hacker News (110 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 47

42 more on Bluesky

On YouTube · 11

6 more on YouTube

On Hacker News · 2

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 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.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the Makefile and the bin/ wrappers: they set the Docker user, the environment and the configuration.

    line 14
  2. Distinctive:

    Run the focused tests first, then the affected module, and the full suite only once at the end.

    line 34
  3. Very specific:

    New setting: read it in impress/settings.py and document it in documentation/env.md.

    line 60
  4. Very specific:

    Use the settings fixture of pytest-django, not override_settings.

    line 74
  5. Very specific:

    Queries: no N+1 or query in a loop.

    line 82
  6. Distinctive:

    Authorization: never trust the frontend; filter the queryset by what the user may see rather than checking after fetching.

    line 89
  7. Very specific:

    Migrations: check that makemigrations generated only the intended change, and that it is safe for a rolling deployment: no long lock or …

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Docs Django backend

The backend lives in src/backend/ and runs in the app-dev compose service (mounted on /app, DJANGO_CONFIGURATION=Development, API on http://localhost:8071). The Celery worker is celery-dev, on the same image.

Commands

Use the Makefile and the bin/ wrappers: they set the Docker user, the environment and the configuration. Never call python manage.py from the host.

taskcommand
start the backend servicesmake run-backend (make status, make logs)
management command./bin/manage <command> (e.g. ./bin/manage check)
migrationsmake makemigrations, make migrate
shellsmake shell, make dbshell (PostgreSQL on localhost:15432)
tests, all./bin/pytest -n auto
tests, focused./bin/pytest -n auto path/to/test.py::test_name -x -q --tb=short
lint, files you touched (paths relative to src/backend/)docker compose run --rm app-dev ruff check core/models.py
lint, allmake lint (ruff format, ruff check --fix, pylint)
  • bin/pytest runs pytest in app-dev with DJANGO_CONFIGURATION=Test and accepts every pytest option.
  • make lint rewrites files (ruff format, ruff check --fix): review the diff afterwards. make lint-pylint only checks the files changed from origin/main, so fetch it first.

Run the focused tests first, then the affected module, and the full suite only once at the end.

Docs specifics

  • The content of a document is not in the database. It lives in the collaboration server (yhub) and is read and written through core/services/yhub_services.py (YHubService). There is no Document.content.
  • Permissions are computed by get_abilities(user) on each model (Document, accesses, invitations, comments…) and enforced by the classes of core/api/permissions.py (DocumentPermission maps the action to an ability). A document's rights come from the document and all its ancestors in the tree:

    • the user's accesses, direct or through a team, the highest role winning (get_role, RoleChoices: reader, commenter, editor, administrator, owner);
    • the link reach and role (LinkReachChoices: restricted, authenticated, public; ancestors_link_definition, computed_link_reach);
    • soft deletion: a document under a deleted ancestor (itself included) answers 404 to everyone but its owner, and to everyone once the trashbin cutoff is past.

    The abilities are serialized to the frontend, and yhub reads them from GET /documents/{id}/abilities/ to accept or refuse a connection (src/yhub-server/src/authz-cache.ts): changing one changes what both allow.

  • New setting: read it in impress/settings.py and document it in documentation/env.md. In post_setup, change lists and dicts in place, as a reassignment is ignored.

Tests

  • Tests are split per endpoint and action: core/tests/documents/test_api_documents_<action>.py. Glob for the file before creating one.
  • Build data with core/factories.py.
  • Mock yhub, never call it. The yhub_content fixture of core/tests/conftest.py fakes YHubService.get_ydoc; patch the other YHubService methods the same way. Celery tasks run inline (CELERY_TASK_ALWAYS_EAGER=True in Test).
  • Use the settings fixture of pytest-django, not override_settings.
  • Pin the query count of list and detail endpoints with django_assert_num_queries, as the existing tests do.
  • For a permission change, cover anonymous, authenticated without access, each relevant role, and each link reach.

Checklist

  • Queries: no N+1 or query in a loop; select_related and prefetch_related only where the relation is actually traversed; no unbounded queryset; an index for a new frequent lookup.
  • Writes: transaction.atomic() around related writes; no check-then-create race (use a constraint or get_or_create); Celery tasks idempotent, given IDs rather than objects, and scheduled with transaction.on_commit when they depend on the transaction.
  • Authorization: never trust the frontend; filter the queryset by what the user may see rather than checking after fetching; an ID from the request must not reach another user's object.
  • API contract: status codes, error shape, nullable vs missing fields, pagination. Search the frontend for the endpoint before changing its response.
  • Migrations: check that makemigrations generated only the intended change, and that it is safe for a rolling deployment: no long lock or table rewrite, no non-null column without a default on a populated table, no code depending on the schema before every instance has migrated. Keep large data migrations apart from schema changes.
  • Redis is a cache: never the only copy of state or of an authorization decision.

Before finishing

Review git diff for unrelated changes, then report what changed, the tests and lint actually run, and what was not verified. Never claim a check passed without running it.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.