Pedantic backend pre-commit + atomic-commit skill for Django/Optimo repos that enforces local AGENTS.md, repo-local docs, pre-commit hooks, and repo-local commit hygiene without AI signatures.
npx claudepluginhub diversioteam/agent-skills-marketplace --plugin backend-atomic-commitThis skill is limited to using the following tools:
Use this Skill in backend/Django repos (especially the Diversio monolith
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Use this Skill in backend/Django repos (especially the Diversio monolith backend) when you want:
/backend-atomic-commit:pre-commit – to actively fix the current code
(formatting, imports, type hints, logging, etc.) so that it matches:
AGENTS.md, linked repo-local docs, and quality gates..pre-commit-config.yaml expectations..security/ diff helpers (ruff and local imports)./backend-atomic-commit:atomic-commit – to run the same checks plus:
/backend-atomic-commit:commit – to run atomic-commit, then create the commit once all gates are green (no bypassing commit-msg hooks).Representative prompt shapes live in references/usage-examples.md.
If you’re not in a backend repo (no manage.py, no backend-style AGENTS.md,
no .pre-commit-config.yaml, no backend quality docs), this Skill should say
so explicitly and fall back to a lighter “generic Python pre-commit” behavior.
This Skill behaves differently based on how it is invoked:
pre-commit mode – invoked via /backend-atomic-commit:pre-commit:
atomic-commit mode – invoked via /backend-atomic-commit:atomic-commit:
pre-commit mode.commit mode – invoked via /backend-atomic-commit:commit:
atomic-commit mode.The command markdown sets the mode. You should detect the mode from the command description/context and adjust behavior accordingly.
Emulate Monty’s backend engineering and review taste, tuned for pre-commit:
date +%Y-%m-%d or Python datetime — never compute
dates manually. Date calculation errors have been a recurring friction
point in real sessions.AGENTS.md as the canonical entrypoint,
follow linked repo-local docs and directory-scoped AGENTS.md files for
per-topic truth, and do not treat CLAUDE.md as a unique rule source..security/* helpers, and
.pre-commit-config.yaml hooks as documented, not ad-hoc commands.TypedDict/dataclasses,
and structured logging over untyped dicts and log soup.git log.Always prioritize [BLOCKING] issues over style and nits.
When this Skill runs, you should first gather context using Bash, Read,
Glob, and Grep:
git status --porcelaingit branch --show-currentgit diff --cached --statgit diff --cached --name-onlygit log --oneline -10AGENTS.md first for repo-specific rules and doc routing.AGENTS.md
files, and any GitHub-first workflow sections covering branch naming,
issue linkage, or PR readiness.CLAUDE.md exists, treat it as a pointer to AGENTS.md, not as a
source of unique behavioral rules.repo-docs plugin so rules stop living in
tribal knowledge..pre-commit-config.yaml..security/ scripts, especially:
./.security/gate_cache.sh./.security/ruff_pr_diff.sh./.security/local_imports_pr_diff.shmanage.py / Django project layout.uv and .bin/ wrappers:
.bin/ruff, .bin/ty, .bin/pyright, .bin/mypy, .bin/django,
.bin/pytest.uv run or plain python / pytest / ruff where necessary.docs/python-typing-3.14-best-practices.md, TY_MIGRATION_GUIDE.md) and
follow them over this default.If the repo clearly isn’t the Diversio backend / Django4Lyfe style, say so and adjust expectations (but you can still run generic Python pre-commit checks).
If ./.security/gate_cache.sh exists, treat it as the canonical wrapper for
heavy deterministic checks. Use it by default for type gates and Django checks.
./.security/gate_cache.sh --gate ty-check --scope index -- .bin/ty check .
./.security/gate_cache.sh --gate django-system-check --scope index -- uv run python manage.py check --fail-level WARNING
Use scope=index for commit-focused gating and scope=working when results are
expected to depend on unstaged edits. Do not bypass cache unless explicitly
requested or debugging:
CHECK_CACHE_BUST=1 ./.security/gate_cache.sh --gate ty-check --scope index -- .bin/ty check .
./.security/gate_cache.sh --clear-this-checkout
For Ruff/local-import diff helpers, call the scripts directly. They already use cache-aware execution internally and include local staged/unstaged tracked files. Prefer running them through pre-commit hooks first; call scripts directly only for targeted diagnosis or when a matching hook is missing/disabled.
In both pre-commit and atomic-commit modes, follow this pipeline:
git status and git diff --cached:
optimo_*, dashboardapp, survey, etc.)..pre-commit-config.yaml, pyproject.toml,
requirements*.txt).Run pre-commit first (primary execution path)
.pre-commit-config.yaml exists, run hooks on the intended file set
before any direct per-tool commands.atomic-commit mode:
pre-commit run --files $(git diff --cached --name-only --diff-filter=ACMR)
pre-commit mode:
CHANGED_FILES="$(
{
git diff --name-only --diff-filter=ACMR
git ls-files --others --exclude-standard
} | sed '/^$/d' | sort -u
)"
pre-commit run --files $CHANGED_FILES
Direct command fallback (targeted, non-duplicative)
CHECKS_ALLOW_FETCH_SKIP=1 when a local skip is explicitly acceptable../.security/ruff_pr_diff.sh./.security/local_imports_pr_diff.shorigin/<base>..HEAD,
staged, and unstaged tracked Python changes.Type checking with active repository gate (ty-first)
ty if configured ([tool.ty], ty.toml, .bin/ty, or CI/pre-commit).pyright if configured.mypy if configured.# ty example - staged files (atomic-commit mode):
.bin/ty check $(git diff --cached --name-only --diff-filter=ACMR | grep '\.py$')
# ty example - all modified files (pre-commit mode):
.bin/ty check $(git diff --name-only --diff-filter=ACMR | grep '\.py$')
# pyright example - staged files (atomic-commit mode):
.bin/pyright $(git diff --cached --name-only --diff-filter=ACMR | grep '\.py$')
# pyright example - all modified files (pre-commit mode):
.bin/pyright $(git diff --name-only --diff-filter=ACMR | grep '\.py$')
# mypy example - staged files (atomic-commit mode):
.bin/mypy $(git diff --cached --name-only --diff-filter=ACMR | grep '\.py$')
# mypy example - all modified files (pre-commit mode):
.bin/mypy $(git diff --name-only --diff-filter=ACMR | grep '\.py$')
_
may satisfy ruff but break ty if the method signature must match a parent
class (e.g., Django admin methods). Always run both checks together.[BLOCKING]
for atomic-commit mode or [SHOULD_FIX] for pre-commit mode.Django system checks
./.security/gate_cache.sh --gate django-system-check --scope index -- uv run python manage.py check --fail-level WARNING.bin/django check or equivalent:
uv run python manage.py check --fail-level WARNING.pytest subsets based on changed apps:
dashboardapp/ changes → pytest dashboardapp/tests/.[SHOULD_FIX] and often [BLOCKING] for
atomic-commit.Interaction with pre-commit hooks
.pre-commit-config.yaml exists:
git status and restage modified files as
appropriate.check_prepare_commit_msg_hook.py
referenced but not present), do not crash:
[SHOULD_FIX] issue stating which hook is missing and why it
matters.Convergence loop (do not stop early)
git status and restage only the
intended files (atomic commits should not accidentally grow).You are stuck on a check when any of these are true:
When stuck:
[BLOCKING] with:
Do not use TodoWrite or TaskCreate to track individual gate results.
This is a fixed, known sequence — not an open-ended task list. Tracking ruff/
djlint/type-check failures as todo items wastes tokens and context window. Report
results directly in the final output using the existing severity-tagged
sections (Checks run, Needs changes, etc.).
When you need concrete auto-fix heuristics, load:
references/backend-taste-and-fix-rules.mdUse that reference when actively editing backend code, templates, logging, types, tests, migrations, or other recurring lint targets. It contains the safe-fix guidance that used to live inline here.
If you discover a recurring failure that is hard to infer from the repo
harness, emit a [SHOULD_FIX] follow-up recommending a docs, wrapper, or CI
improvement instead of letting the rule stay tribal.
In atomic-commit mode (invoked via /backend-atomic-commit:atomic-commit),
you must be very strict:
Atomicity of staged changes
git diff --cached --name-only, determine if staged changes belong
to one coherent change:
survey/ plus an unrelated optimo bugfix and docs tweak.[BLOCKING] if the staged set is clearly multiple logical changes.[SHOULD_FIX] for minor opportunistic cleanups that could be split.All gates must be green
./.security/ruff_pr_diff.sh./.security/local_imports_pr_diff.sh.bin/ruff check / ruff formatty/pyright/mypy).bin/django check / manage.py checkpytest subsets for risky changes.pre-commit-config.yaml./.security/gate_cache.sh
instead of ad-hoc direct invocation.--auto style usage, you may skip conversational confirmation, but
you must not relax these gates.[SHOULD_FIX] and usually [BLOCKING].Commit message generation (no AI signature)
AGENTS.md[SHOULD_FIX] and follow the
documented AGENTS.md convention for suggestions.Your atomic-commit output should include:
Checks run – listing each gate and its status.What’s aligned – strengths and good patterns in the staged changes.Needs changes – bullets with [BLOCKING], [SHOULD_FIX], [NIT].Proposed commit – suggested commit message and list of files.Workflow notes – only when the current branch appears inconsistent with repo-local branch or PR conventions.[BLOCKING] items; otherwise “❌ Not ready to commit” with concrete next steps.You should never encourage the user to run git commit as-is if any
[BLOCKING] issues remain.
Workflow boundary: this skill does not own branch creation or PR state by
itself. See references/workflow-boundary.md.
In pre-commit mode (invoked via /backend-atomic-commit:pre-commit):
.security/*, active type gate, Django
checks, tests as appropriate).Fixes applied – concrete edits you made.Remaining issues – with severity tags.Checks run – which gates passed/failed.This mode is the “make my working tree clean and standards-compliant” helper before running an atomic commit.
Always structure findings using severity tags and sections:
[BLOCKING] – must be fixed before a commit is considered ready:
.security scripts or pre-commit hooks.AGENTS.md (e.g., Ninja Query constants, legacy
survey models).atomic-commit mode.[SHOULD_FIX] – important, strongly recommended changes:
[NIT] – minor cleanups:
Output shape for both modes:
What’s alignedNeeds changesChecks runHarness follow-ups (only when docs/tooling should be improved)Proposed commit (only in atomic-commit mode)Be direct, specific, and actionable in each bullet, pointing to file/area and suggesting concrete corrections. Never hide behind vague "consider improving" phrases when you can be precise.
Works in both Claude Code and OpenAI Codex. For installation, see this repo's
README.md.