# Python Linter

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

- **Type:** Skill
- **Install:** `agentstack add skill-nainishshafi-developer-productivity-skills-python-linter`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [nainishshafi](https://agentstack.voostack.com/s/nainishshafi)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [nainishshafi](https://github.com/nainishshafi)
- **Source:** https://github.com/nainishshafi/developer-productivity-skills/tree/master/.github/skills/python-linter

## Install

```sh
agentstack add skill-nainishshafi-developer-productivity-skills-python-linter
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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:

```bash
[ -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:

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

Optionally install mypy for type checking:

```bash
$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)

```bash
$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:
  ```bash
  $PYTHON -m ruff check .
  ```

### Step 3 — Run Ruff Format

```bash
$PYTHON -m ruff format .
```

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

### Step 4 — Run Type Checking (optional)

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

```bash
$PYTHON -m mypy .
```

Or for stricter checking:

```bash
$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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [nainishshafi](https://github.com/nainishshafi)
- **Source:** [nainishshafi/developer-productivity-skills](https://github.com/nainishshafi/developer-productivity-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-nainishshafi-developer-productivity-skills-python-linter
- Seller: https://agentstack.voostack.com/s/nainishshafi
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
