python-quality-gates
Skill2 starsChanged 2 months agoMITView on GitHub
Quality gates for Python code — type checking, lint, tests, security, build, structure, config.
- Installs packages
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- journal-management-genericSkill
- simplified-technical-englishSkill
- code-implementationSkill
- journal-managementSkill
- plan-trackingSkill
- project-notesSkill
- task-routingSkill
- herdrSkill
- plan-output-templateSkill
- risk-and-dependency-identificationSkill
- task-decompositionSkill
- source-selectionSkill
- code-review-checklistSkill
- production-issue-flaggingSkill
- regression-identificationSkill
- test-case-structureSkill
- test-strategy-selectionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Every Python implementation must pass these gates before delivery.
- Distinctive: line 17
If the project uses Pyright or Pyrefly, use the project's configured tool.
- Very specific: line 25
Default rulesets: E, F, I, B, UP, SIM, COM (respect project overrides).
- Distinctive: line 31
Write tests for all new functionality covering: happy path, failure cases, edge cases, error messages.
- Distinctive: line 32
Use Hypothesis for property-based testing on parsers, serializers, authentication logic, and any input-processing modules.
- Very specific: line 34
Test names describe behavior: test_create_order_returns_400_when_inventory_empty ✅.
- Distinctive: line 40
Never hardcode secrets; validate ALL inputs at trust boundaries.
- Very specific: line 49
Default to src/ layout for new packages: src/my_package/ with tests in tests/ at project root.
- Distinctive: line 56
Every docstring includes: what the function does, Args, Returns, Raises (if applicable).
- Distinctive: line 57
Use type hints alongside docstrings — the type checker validates them.
- Very specific: line 58
If the project has a docs/ directory or uses Sphinx/MkDocs, update relevant docs.
- Very specific: line 62
If setting up a new project or the project lacks quality gates, recommend: ruff check + ruff format, mypy (or the project's type checker), …
- Very specific: line 63
If pre-commit hooks already exist in .pre-commit-config.yaml, respect them — do not modify unrequested.
- Very specific: line 67
Always check pyproject.toml first for project tool configurations (mypy, ruff, pytest, etc.).
- Very specific: line 69
If pyproject.toml does not exist, check for setup.cfg or tox.ini for legacy config.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.
Files
Python Quality Gates
Every Python implementation must pass these gates before delivery. Run them in this exact order — fix all issues in one gate before advancing to the next.
1. Type Check → 2. Lint & Format → 3. Tests & Coverage → 4. Security Scan → 5. Build Verification1. Type Check — MUST HAVE
mypy --strict(or the project's[tool.mypy]config) — zero errors required.- If the project uses Pyright or Pyrefly, use the project's configured tool.
- Type hints required on ALL public functions — parameters, return values, and internal helpers.
- No
Anyunless absolutely unavoidable — document why with# type: ignore[no-any-...].
2. Lint & Format — MUST HAVE
ruff check --fix— zero warnings (respect[tool.ruff]in pyproject.toml).ruff format— formatting must be clean.- Default rulesets:
E,F,I,B,UP,SIM,COM(respect project overrides). - Replace legacy tools (flake8, black, isort) with Ruff unless the project explicitly uses them.
3. Tests & Coverage — MUST HAVE
pytest --cov— all tests pass; coverage threshold of 80%+.- Write tests for all new functionality covering: happy path, failure cases, edge cases, error messages.
- Use Hypothesis for property-based testing on parsers, serializers, authentication logic, and any input-processing modules.
- For async code, use
pytest-asynciowithautomode. - Test names describe behavior:
test_create_order_returns_400_when_inventory_empty✅.
4. Security Scan — MUST HAVE
pip-audit --strict— no known CVEs in project dependencies.bandit -r— no SAST findings at MEDIUM severity or higher.- Never hardcode secrets; validate ALL inputs at trust boundaries; parameterize ALL queries — no string concatenation in SQL or shell.
5. Build Verification — MUST HAVE
uv build(orpip install .if uv unavailable) — the package must install cleanly.- No
pyproject.toml→ flag to orchestrator; do not create it unrequested.
Project Structure — RECOMMENDED
- Default to
src/layout for new packages:src/my_package/with tests intests/at project root. pyproject.tomlis the single source of truth for all tool configs.__init__.pydeclares__all__explicitly (public API surface) — no logic in__init__.py.
Documentation — RECOMMENDED
- Google-style docstrings (general projects) or NumPy-style (scientific/data projects) on all public functions.
- Every docstring includes: what the function does, Args, Returns, Raises (if applicable).
- Use type hints alongside docstrings — the type checker validates them.
- If the project has a
docs/directory or uses Sphinx/MkDocs, update relevant docs.
Pre-commit Hooks — RECOMMENDED
- If setting up a new project or the project lacks quality gates, recommend:
ruff check+ruff format,mypy(or the project's type checker),trailing-whitespace,end-of-file-fixer,check-merge-conflict,detect-private-key. - If pre-commit hooks already exist in
.pre-commit-config.yaml, respect them — do not modify unrequested.
Config Discovery — IMPORTANT
- Always check
pyproject.tomlfirst for project tool configurations (mypy, ruff, pytest, etc.). - Respect the project's existing tool configs — never override them with your own opinionated settings.
- If
pyproject.tomldoes not exist, check forsetup.cfgortox.inifor legacy config.
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.

