{"slug":"quality-gates-python","title":"quality-gates-python","summary":"Use when the active repository is a Python project (`pyproject.toml` present) and the software-engineer must produce falsifiable evidence for the quality gates. Every gate is recorded once, after the story's last work commit, in a log kept in a Git-ignored directory. Provides the","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:42:33.63486Z","repo":{"url":"https://github.com/SebastienDegodez/skraft-plugin","stars":17,"forks":3,"license":"GPL-3.0","updatedAt":"2026-11-29T00:18:21Z"},"bodyHtml":"<hr>\n<h2>name: quality-gates-python\ndescription: \"Use when the active repository is a Python project (<code>pyproject.toml</code> present) and the software-engineer must produce falsifiable evidence for the quality gates. Every gate is recorded once, after the story's last work commit, in a log kept in a Git-ignored directory. Provides the cross-platform scripts (Node, no shell) that run pytest, the build check and import-linter from the project's virtual environment and map their outputs onto the tech-agnostic schema. Coverage and mutation never run in a delivery: the project's CI runs them.\"</h2>\n<h1>Quality Gates — Python Adapter</h1>\n<p>Binds the gates of <code>quality-gates-evidence-contract</code> to the Python toolchain. Load\nquality bar (<code>skraft-quality-bar</code>) first. Every gate below blocks; a gate whose\ntool is missing is <code>status: \"fail\"</code> with the captured output, never <code>not_applicable</code>.</p>\n<h2>Prerequisites</h2>\n<ul>\n<li>The project interpreter is <code>.venv</code> at the repository root (<code>.venv/bin/python</code>, or\n<code>.venv\\Scripts\\python.exe</code> on Windows); otherwise pass <code>--python &lt;path&gt;</code> to every script.</li>\n<li>The package is installed editable in it (<code>pip install -e \".[dev]\"</code>); the dev dependencies\nhold <code>pytest</code> and <code>import-linter</code>. Never install a tool during a gate run.</li>\n<li>Python 3.11 or later.</li>\n</ul>\n<h2>Output paths</h2>\n<p><code>&lt;skill&gt;</code> is this skill's folder, the one holding this SKILL.md; every script ships in\n<code>&lt;skill&gt;/scripts/</code>, never in the consumer repository. <code>$EV</code> is\n<code>.copilot-tracking/skraft-plans/{projectSlug}/evidence/{date}/{story}/</code> — one per story, never\nshared, ignored by Git (<code>.copilot-tracking/skraft-plans/*/evidence/</code> in <code>.gitignore</code>), never\ncommitted — and <code>$LOG</code> is <code>$EV/qg-{story}.json</code>. <code>$EV</code> holds the log and the screenshots, nothing\nelse. Every script runs with <code>node</code> and no shell, so the same line works in bash and PowerShell.</p>\n<h2>test.acceptance / test.unit / build.compile / build.lint — commands through <code>capture.mjs</code></h2>\n<p><code>capture.mjs</code> runs one command without a shell from the repository root, prints the last 40\nlines of its output and records the gate(s) named by <code>--gate</code> in <code>$LOG</code>: <code>pass</code> on exit 0,\n<code>fail</code> otherwise, the last output line as <code>summary</code>. <code>{python}</code> is the project interpreter. Its\nexit code is the command's. No <code>.stdout</code>, <code>.exit</code> or hash file is written, and no agent ever\ntypes a status.</p>\n<table>\n<thead>\n<tr>\n<th>Gate</th>\n<th>Command</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>test.acceptance</code> / <code>test.unit</code></td>\n<td><code>node \"&lt;skill&gt;/scripts/capture.mjs\" --root . --log \"$LOG\" --gate test.acceptance,test.unit -- {python} -m pytest -q -p no:cacheprovider</code></td>\n</tr>\n<tr>\n<td><code>build.compile</code></td>\n<td><code>node \"&lt;skill&gt;/scripts/capture.mjs\" --root . --log \"$LOG\" --gate build.compile -- {python} -m compileall -q src</code>; a project that checks in a <code>mypy</code> config runs <code>{python} -m mypy src</code> instead</td>\n</tr>\n<tr>\n<td><code>build.lint</code></td>\n<td><code>node \"&lt;skill&gt;/scripts/capture.mjs\" --root . --log \"$LOG\" --gate build.lint -- {python} -c \"from importlinter.cli import lint_imports_command; lint_imports_command()\"</code> (import-linter has no <code>-m</code> entry point); a project that checks in a <code>ruff</code> config runs both in the same command: <code>... --gate build.lint -- {python} -c \"import subprocess as s, sys; c = [[sys.executable, '-m', 'ruff', 'check'], [sys.executable, '-c', 'from importlinter.cli import lint_imports_command; lint_imports_command()']]; sys.exit(max([s.call(x) for x in c]))\"</code></td>\n</tr>\n</tbody>\n</table>\n<p>When the story's acceptance tests live apart, run them once more with <code>--gate test.acceptance</code>\nand the narrowed pytest line; the later run replaces the gate's verdict.</p>\n<p><code>build.lint</code> is one command with one exit code: the project's checked-in <code>ruff</code> config, when\nthere is one, then import-linter, both always run. Import-linter carries the architecture\nboundaries declared in <code>[tool.importlinter]</code>; a project with no import-linter contract records\n<code>build.lint</code> <code>fail</code> — <code>clean-architecture-python</code> requires one.</p>\n<h2>test.no-mocks-core — No mocks in Domain/Application</h2>\n<p>The core is every Python source under a folder whose name ends with <code>domain</code> or <code>application</code>\n(<code>src/payment/domain</code>, <code>billing_domain</code>), test files aside; with none, <code>test.no-mocks-core</code> blocks.</p>\n<pre><code>node \"&lt;skill&gt;/scripts/no-mocks-in-core.mjs\" --root . --log \"$LOG\"\n</code></pre>\n<p>Scans the core sources and <code>tests/unit</code> (<code>--tests &lt;dir&gt;</code>, repeatable, for another\nunit package) for <code>unittest.mock</code>, <code>mock</code>, <code>pytest-mock</code>, <code>patch</code>, <code>flexmock</code>, <code>doublex</code> and\n<code>mockito</code>. It prints one hit per line and records the gate: <code>pass</code> on exit 0, <code>fail</code> otherwise.</p>\n<h2>commit.convention and test.integrity — derived by qg-verify</h2>\n<p>Nothing to record: <code>qg-verify</code> reads every commit since the DELIVER base and checks its full\nmessage, and guards every test file DISTILL's <code>test</code> commit holds — a later commit may only add\nlines to it, unless its message records <code>PLAN_DEVIATION:</code>. No commit list, no cycle, no snapshot.</p>\n<h2>evidence.screenshots — Frontend stories</h2>\n<p>A story whose commits touch a <code>@visual</code> scenario, <code>tests/e2e/</code>, a <code>package.json</code> declaring\n<code>react</code> or a <code>playwright.config.*</code> records at least one screenshot taken by\n<code>playwright-evidence</code>:\n<code>node \"&lt;skill&gt;/scripts/gate-log.mjs\" --log \"$LOG\" --screenshot &lt;png&gt; [--screenshot &lt;png&gt; …]</code>\ncopies each PNG into <code>$EV/screenshots/</code> and records its sha256.</p>\n<p>A gate that genuinely does not apply is recorded with its reason, never by hand:\n<code>node \"&lt;skill&gt;/scripts/gate-log.mjs\" --log \"$LOG\" --not-applicable &lt;gate&gt; --rationale \"&lt;why&gt;\"</code>.</p>\n<h2>Not run by this adapter</h2>\n<p>Coverage (<code>ci.coverage</code>) and mutation (<code>ci.mutation</code>) are not pipeline gates, and architecture\nhas no gate of its own: <code>build.lint</code> enforces it. Coverage at 100% of Domain and Application,\nwith no exclusion, and the mutation step run in the project's CI; the developer runs\n<code>/skraft-mutation</code> by hand. Never record them in the log.</p>\n<h2>Producer flow at the end of the story</h2>\n<ol>\n<li>Run <code>test.acceptance</code>/<code>test.unit</code>, <code>build.compile</code>, <code>build.lint</code>, <code>test.no-mocks-core</code> — each\nthrough <code>capture.mjs</code> or its script, after the story's last work commit. The scripts refuse a\n<code>$LOG</code> Git does not ignore: add <code>.copilot-tracking/skraft-plans/*/evidence/</code> to <code>.gitignore</code>\nin a work commit.</li>\n<li>Record the screenshots of a frontend story with <code>gate-log.mjs</code>.</li>\n<li><code>node \"&lt;skill&gt;/scripts/qg-verify/cli/qg-verify.mjs\" --log \"$LOG\"</code> must print\n<code>\"verdict\": \"pass\"</code>; otherwise fix the code and run the gate again, never edit the log.</li>\n</ol>\n<p>Nothing is committed: the log and the screenshots stay in <code>$EV</code>.</p>\n","files":[{"path":"scripts/capture.mjs","sizeBytes":2785,"isText":false},{"path":"scripts/gate-log.mjs","sizeBytes":8330,"isText":false},{"path":"scripts/gate-policy.mjs","sizeBytes":2747,"isText":false},{"path":"scripts/no-mocks-in-core.mjs","sizeBytes":2561,"isText":false},{"path":"scripts/python-toolchain.mjs","sizeBytes":3782,"isText":false},{"path":"scripts/qg-verify/adapters/infrastructure/active-slug-store.mjs","sizeBytes":902,"isText":false},{"path":"scripts/qg-verify/adapters/infrastructure/git-repository.mjs","sizeBytes":1853,"isText":false},{"path":"scripts/qg-verify/adapters/infrastructure/tracking-root-resolver.mjs","sizeBytes":1626,"isText":false},{"path":"scripts/qg-verify/application/evidence-verification-service.mjs","sizeBytes":4756,"isText":false},{"path":"scripts/qg-verify/cli/qg-verify.mjs","sizeBytes":2576,"isText":false},{"path":"scripts/qg-verify/domain/commit-convention.mjs","sizeBytes":744,"isText":false},{"path":"scripts/qg-verify/domain/config-schema.mjs","sizeBytes":1669,"isText":false},{"path":"scripts/qg-verify/domain/evidence-verification-policy.mjs","sizeBytes":22578,"isText":false},{"path":"scripts/qg-verify/domain/result.mjs","sizeBytes":325,"isText":false},{"path":"scripts/qg-verify/domain/tracking-layout-policy.mjs","sizeBytes":957,"isText":false},{"path":"scripts/qg-verify/domain/value-objects.mjs","sizeBytes":1636,"isText":false},{"path":"scripts/qg-verify/GENERATED.md","sizeBytes":684,"isText":true},{"path":"SKILL.md","sizeBytes":6346,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:44:24.525806Z","sha256":"D8942EFF54657CE20A5108C05764D2F8B3E6B9FAF7B9457448B53F91911A4055","sizeBytes":28890},"review":null,"source":{"repositoryUrl":"https://github.com/SebastienDegodez/skraft-plugin","path":"plugins/skraft-framework/skills/quality-gates-python","license":"GPL-3.0","commit":"c6117c6236a25490bf1916b131866069740c9b22","subtreeSha":"18AF733C1FF6138F9A28B682EAF37C8FF7FB1CF54AE79762B737AB0F673140C9","lastSyncedAt":"2026-11-29T00:42:27.348488Z"},"reviewedAt":"2026-11-29T00:48:35.599457Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/SebastienDegodez/skraft-plugin/tree/main/plugins/skraft-framework/skills/quality-gates-python"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install sebastiendegodez-skraft-plugin@llmmart"},{"target":"git","command":"git clone https://github.com/SebastienDegodez/skraft-plugin.git"}]}