agentleFS
las-pinterlas-pinter/persona-agents/skills/implementer/python-quality-gates/SKILL.md

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

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
  1. Distinctive:

    Every Python implementation must pass these gates before delivery.

    line 8
  2. Distinctive:

    If the project uses Pyright or Pyrefly, use the project's configured tool.

    line 17
  3. Very specific:

    Default rulesets: E, F, I, B, UP, SIM, COM (respect project overrides).

    line 25
  4. Distinctive:

    Write tests for all new functionality covering: happy path, failure cases, edge cases, error messages.

    line 31
  5. Distinctive:

    Use Hypothesis for property-based testing on parsers, serializers, authentication logic, and any input-processing modules.

    line 32
  6. Very specific:

    Test names describe behavior: test_create_order_returns_400_when_inventory_empty ✅.

    line 34
  7. Distinctive:

    Never hardcode secrets; validate ALL inputs at trust boundaries.

    line 40
  8. Very specific:

    Default to src/ layout for new packages: src/my_package/ with tests in tests/ at project root.

    line 49
  9. Distinctive:

    Every docstring includes: what the function does, Args, Returns, Raises (if applicable).

    line 56
  10. Distinctive:

    Use type hints alongside docstrings — the type checker validates them.

    line 57
  11. Very specific:

    If the project has a docs/ directory or uses Sphinx/MkDocs, update relevant docs.

    line 58
  12. Very specific:

    If setting up a new project or the project lacks quality gates, recommend: ruff check + ruff format, mypy (or the project's type checker), …

    line 62
  13. Very specific:

    If pre-commit hooks already exist in .pre-commit-config.yaml, respect them — do not modify unrequested.

    line 63
  14. Very specific:

    Always check pyproject.toml first for project tool configurations (mypy, ruff, pytest, etc.).

    line 67
  15. Very specific:

    If pyproject.toml does not exist, check for setup.cfg or tox.ini for legacy config.

    line 69

≈ “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.

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

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 Verification

1. 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 Any unless 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-asyncio with auto mode.
  • 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 (or pip 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 in tests/ at project root.
  • pyproject.toml is the single source of truth for all tool configs.
  • __init__.py declares __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.toml first 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.toml does not exist, check for setup.cfg or tox.ini for legacy config.

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.