quality-gate
Skill1 starsChanged 58 days agoApache-2.0View on GitHub
Generate a deterministic quality-gate shell script (scripts/quality-gate.sh) that runs lint, type-check, tests and a coverage threshold for a Python project, using bash strict mode. Use this whenever the user wants a single command that runs all checks, a CI-and-local quality gate, a pre-merge or pre-commit check script, to enforce a coverage threshold, or to stop lint/test commands drifting between the Makefile and CI. Detects ruff, mypy/pyright, pytest and coverage config and bakes them into one ShellCheck-clean script that CI and `make check` both call.
42 other projects use a version of this.
Adopted by
Most recently taken up by
- jodyjdc/ultimate-best-seller-studiotheir own version, first seen Nov 8, 2026
- unlockers-ai/unlockers-skills-librarytheir own version, first seen Nov 8, 2026
- TerryFYL/ai-research-armytheir own version, first seen Nov 8, 2026
- Romandredan/1c-quality-gatetheir own version, first seen Nov 4, 2026
- shimo4228/zenn-contenttheir own version, first seen Nov 2, 2026
- matheuskotayko/skillstheir own version, first seen Nov 1, 2026
Other versions42 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 42
- RapierCraftStudios/ForgeDock★ 119same name
- microsoft/webui★ 100same name
- impecablemee/gtm-mcp★ 66same name
- microsoft/devsquad-copilot★ 50same name
- Romandredan/1c-quality-gate★ 49same name
- TerryFYL/ai-research-army★ 9same name
- Felpix-Studios/social-science-research★ 8same name
- BerryKuipers/claude-code-toolkit★ 7same name
- freskhu/genesis★ 5same name
- unlockers-ai/unlockers-skills-library★ 4same name
32 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- agent-core/AGENTS.mdAGENTS.md
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- behavioral-regression/AGENTS.mdAGENTS.md
- claude-foundation/AGENTS.mdAGENTS.md
- config/AGENTS.mdAGENTS.md
- corpora/AGENTS.mdAGENTS.md
- demo/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- examples/AGENTS.mdAGENTS.md
- experiments/AGENTS.mdAGENTS.md
- flow-corpus/AGENTS.mdAGENTS.md
- flow-protocol/AGENTS.mdAGENTS.md
- openspec/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- claude-foundation/CLAUDE.mdCLAUDE.md
- merge-gate-auditorSkill
- update-executive-reportSkill
- update-executive-reportSkill
- architecture-drift-guardSkill
- commonSkill
- corpus-guardianSkill
- dataset-lintSkill
- deploySkill
- e2e-matrix-sentinelSkill
- eval-corpus-forgeSkill
- hierarchical-recursive-brainstormSkill
- model-benchSkill
- openai-judgeSkill
- openspec-implementation-reviewSkill
- openspec-peer-reviewSkill
- openspec-quality-planSkill
- pre-pr-gateSkill
- project-setupSkill
- refactoring-decomposerSkill
- repo-invariant-reviewSkill
- test-completeness-guardSkill
The file
Files
quality-gate — gate-script writer
Emit one script — scripts/quality-gate.sh — that is the single source of truth for a
project's checks. CI and local developers run the same script, so the two cannot drift. The
generator inspects the project once; the script it writes runs with zero inference and uses
set -euo pipefail so any failing step aborts non-zero.
1. Preconditions (input contract)
- A target project directory exists (default: the current directory).
- Optionally
pyproject.tomland/or config for ruff, mypy/pyright, pytest, and coverage. Only the checks that are actually configured are emitted — nothing is fabricated. - Python 3.10+ (
tomlion 3.10; 3.11+ uses stdlibtomllib).
2. Procedure (the E2E steps)
python scripts/gen_gate.py --root <project> [--lint-path P]... [--typecheck-path P]... \
[--out <path>] [--stdout] [--check] [--print-ci]- Inspect the project: ruff, mypy vs pyright (+ paths), pytest, pytest-cov, coverage
source(s) and
fail_underthreshold. ALL declared[tool.coverage.run] sourceentries are kept (rendered as repeated--cov=flags) — measuring a subset would weaken the gate. - Explicit paths (optional, repeatable):
--lint-path/--typecheck-pathrecord facts that live outsidepyproject.toml(e.g. a CI matrix that lintssrc tests scriptsand runs mypy per-path to avoid module-name collisions). Multiple typecheck paths render one invocation each. The exact invocation is embedded as a# regenerate:provenance comment, so the artifact documents its own reproduction. A--typecheck-pathwithout a detected type checker — or a--lint-pathwithout a detected ruff configuration — is ignored with a warning and excluded from the provenance comment: flags cannot fabricate a step. - Emit
scripts/quality-gate.shwith strict mode, aloghelper, onedo_<step>function per supported check, an aggregatedo_all(which runs coverage instead of a bare test run when both exist, so tests never run twice), and amaindispatcher forlint | typecheck | test | coverage | all(defaultall). - Extend by hand below the marker. Everything above the
# --- hand-maintained extensions below ... ---line is generator-owned; below it is yours and survives regeneration. Definedo_extra()there (before the finalmain "$@"line) andallruns it automatically — project-specific steps join the gate without the generator guessing them. - Wire CI to the same script (
--print-ciprints a ready GitHub Actions step) so CI == local. - Review and commit.
PYTHONis always${PYTHON:-default}overridable.TYPECHECK_PATHSis${TYPECHECK_PATHS:-default}overridable in single-path mode (a documented debug affordance for a non-thresholded check); multi-path type-check commands render literal (quoted, escaped) arguments instead, with a stderr notice if the env var is set anyway.COVERAGE_SOURCEandCOV_FAIL_UNDERare gate-integrity values, not a debug affordance: both are always generation-time literals, single-source or multi-source alike — never a live env override. Setting either at runtime prints an "is ignored" notice to stderr and has no other effect.PYTEST_ADDOPTSis read natively by pytest, so the coverage and test steps additionally warn andunsetit before invoking pytest — a gate stage has no opt-out.
3. Output contract (postconditions — what "done" means)
scripts/quality-gate.shis written (mode+x), starts with#!/usr/bin/env bash, sets-euo pipefail, and ends in exactly one newline (LF).- Re-running on an unchanged project produces a byte-identical script (no timestamps).
./scripts/quality-gate.sh allexits 0 when every check passes and non-zero on the first failure; an unknown subcommand exits 2.- ShellCheck-clean: every variable expansion is double-quoted; no variables in printf formats.
- The coverage threshold cannot be weakened at runtime:
COV_FAIL_UNDER,COVERAGE_SOURCE, andPYTEST_ADDOPTSset in the environment have no effect oncoverage/test— each is either baked in as a generation-time literal or explicitly cleared before pytest runs, with a stderr notice either way.
4. Failure handling
- A missing/malformed
pyproject.tomldegrades to safe defaults. A project with no detectable checks yields a valid no-op gate and a stderr warning (rather than a fabricated command). --checkis advisory (see §5), never a hard gate.
5. --check is advisory, not a gate
--check exits 1 when the committed script's generator-owned prefix (everything above the
hand-extension marker) differs from a fresh render — an optional drift signal. Hand-maintained
content below the marker is never compared and is preserved by regeneration, so extending the
script does not create permanent --check noise. Do not wire --check into CI as a blocking
gate by default. (Wiring quality-gate.sh itself into CI is the point — that is what
--print-ci is for.)
6. Validation gate (before declaring success)
You are not done until this exits 0:
python scripts/validate_skill.py --skill . --tier structural,behavioral7. Examples
Example 1 — full toolchain
Input: a project with ruff, mypy, pytest and [tool.coverage] fail_under = 85.
Output: a quality-gate.sh whose all target runs ruff (check + format), mypy, then
pytest --cov=... --cov-fail-under=85, printing PASS only if every step succeeds.
Example 2 — CI parity
python scripts/gen_gate.py --print-ci prints a GitHub Actions step whose run: is
./scripts/quality-gate.sh all — the identical script developers run locally.
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.

