agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/python-linter/SKILL.md

python-linter

Skill1 starsChanged 8 months agoMITView on GitHub

Use when the user asks to "lint python", "run the linter", "fix linting errors", "check python code style", "run ruff", "format python code", "fix imports", "check types", "run mypy", or wants to find and fix Python code quality issues using ruff and mypy.

  • Installs packages

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run ruff (lint + format) and optionally mypy (type checking) on Python code.

    line 9
  2. Very specific:

    Always use .venv — create it if it doesn't exist:

    line 19
  3. Very specific:

    Check for an existing pyproject.toml or ruff.toml config.

    line 38
  4. Distinctive:

    If the user wants to see all issues first without fixing:

    line 48
  5. Distinctive:

    Ask the user if they want type checking.

    line 67
  6. Distinctive:

    If issues remain, explain each one clearly and offer to fix them.

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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 Linter

Run ruff (lint + format) and optionally mypy (type checking) on Python code. Auto-fixes what it can and reports what needs manual attention.

Prerequisites

  • Python project with .py files

Workflow

Step 1 — Set Up .venv

Always use .venv — create it if it doesn't exist:

[ -d .venv ] || python -m venv .venv
PYTHON=$(if [ -f .venv/Scripts/python ]; then echo .venv/Scripts/python; else echo .venv/bin/python; fi)

Install ruff into the venv if not already present:

$PYTHON -m ruff --version 2>/dev/null || $PYTHON -m pip install ruff

Optionally install mypy for type checking:

$PYTHON -m mypy --version 2>/dev/null || $PYTHON -m pip install mypy

Check for an existing pyproject.toml or ruff.toml config. If neither exists, offer to create a sensible default (see references/python-linter-reference.md for the recommended config).

Step 2 — Run Ruff Lint (with auto-fix)

$PYTHON -m ruff check --fix .
  • --fix auto-corrects safe issues (unused imports, style violations, etc.)
  • Note any remaining violations that require manual fixes
  • If the user wants to see all issues first without fixing:
    $PYTHON -m ruff check .

Step 3 — Run Ruff Format

$PYTHON -m ruff format .
  • Formats all .py files in place (replaces black + isort)
  • To preview changes without applying:
    $PYTHON -m ruff format --diff .

Step 4 — Run Type Checking (optional)

Ask the user if they want type checking. If yes:

$PYTHON -m mypy .

Or for stricter checking:

$PYTHON -m mypy --strict .

See references/python-linter-reference.md for mypy configuration options.

Step 5 — Report Results

Summarise:

  • How many lint issues were auto-fixed
  • Any remaining issues that need manual attention (with file + line references)
  • Formatting changes applied
  • Type errors found (if mypy was run)

If issues remain, explain each one clearly and offer to fix them.

Additional Resources

  • references/python-linter-reference.md — Recommended ruff/mypy configs, rule sets, pyproject.toml templates, CI integration

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.