py-lint-and-typecheck
Skill0 starsChanged 2 months agoMITView on GitHub
Guides agents through resolving Python linter (Ruff, Flake8) and static type checker (Mypy, Pyright) errors without suppression comments.
In this repository49 other files it gives its agents.
- bug-reproducerSkill
- claim-checkerSkill
- command-failure-diagnoserSkill
- config-risk-reviewerSkill
- csv-validatorSkill
- deployment-checklist-makerSkill
- diff-reviewerSkill
- factual-summarizerSkill
- field-extractorSkill
- api-contract-testerSkill
- database-migration-helperSkill
- security-vulnerability-fixerSkill
- git-commit-stagerSkill
- git-conflict-resolverSkill
- github-actions-debuggerSkill
- github-issue-triagerSkill
- github-pr-creatorSkill
- github-pr-reviewerSkill
- go-code-qualitySkill
- go-lint-and-vetSkill
- go-testingSkill
- json-schema-converterSkill
- lint-and-typecheckSkill
- meaning-preserving-editorSkill
- meeting-notes-to-actionsSkill
- minimal-bug-fixSkill
- option-comparatorSkill
- py-code-qualitySkill
- py-testingSkill
- readme-writerSkill
- regression-test-writerSkill
- release-notes-drafterSkill
- repo-inspectorSkill
- research-briefSkill
- reversible-cleanup-plannerSkill
- rust-clippy-checkSkill
- rust-code-qualitySkill
- rust-testingSkill
- small-refactorSkill
- status-updateSkill
- step-by-step-tutorialSkill
- step-decomposerSkill
- tabular-analyzerSkill
- task-briefSkill
- test-runner-debuggerSkill
- ts-code-qualitySkill
- ts-lint-and-typecheckSkill
- ts-testingSkill
- skill-templateSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 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.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use for JavaScript/TypeScript.
- Very specific: line 21
Do not use for running tests.
- Very specific: line 27
If no file is specified: run ruff check .
- Very specific: line 28
Absolute Ban: Never add # noqa or # type: ignore comments.
- Distinctive: line 31
Follow these numbered actions:
- Very specific: line 35
Add proper Optional[T], Union, or return type hints.
- Very specific: line 45
If a function returns None on failure: type return as Optional[ReturnType] or ReturnType | None.
- Distinctive: line 46
If an import is unused (F401): delete the import line.
- Distinctive: line 77
Stop and ask the user when:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 Lint and Type-Check (Ruff & Mypy)
Executes and resolves Python static analysis diagnostics using ruff and mypy. Enforces type annotations and forbids # noqa or # type: ignore.
1. Purpose
Catch bugs, unused code, and type incompatibilities statically in Python. "Type Annotations" declare function signatures using typing (or native Python 3.10+ types int | None).
2. When to Use
Use this skill when:
- Checking Python code before committing.
- Resolving Mypy errors (
arg-type,return-value,assignment). - Formatting code per PEP 8 using
ruff format.
3. When Not to Use
- Do not use for JavaScript/TypeScript; use
ts-lint-and-typecheck. - Do not use for running tests; use
py-testing.
4. Required Inputs
target_file: Path to Python file or directory.
5. Missing-Input Behavior
- If no file is specified: run
ruff check .andmypy .to locate issues across the repository. - Absolute Ban: Never add
# noqaor# type: ignorecomments.
6. Procedure
Follow these numbered actions:
- Action 1: Run Mypy Type Checker
- Execute:
mypy --show-error-codes <target_file>
- Execute:
- Action 2: Fix Type Mismatches at Root Cause
- Add proper
Optional[T],Union, or return type hints.
- Add proper
- Action 3: Run Ruff Linter
- Execute:
ruff check <target_file> - Auto-fix safe issues:
ruff check <target_file> --fix
- Execute:
- Action 4: Format Code
- Execute:
ruff format <target_file>
- Execute:
- Action 5: Verify Clean Exit
- Confirm exit code 0 on both
mypyandruff check.
- Confirm exit code 0 on both
7. Decision Rules
- If a function returns
Noneon failure: type return asOptional[ReturnType]orReturnType | None. - If an import is unused (F401): delete the import line.
8. Output Format
Emit the report using this template:
### Python Lint & Type-Check Report: [File]
- **Type Checker**: `mypy [file]` -> PASS
- **Linter**: `ruff check [file]` -> PASS
- **Issues Resolved**: [Count]
#### Resolved Diagnostics
| Line | Tool | Code | Root Cause Fix |
| :--- | :--- | :--- | :--- |
| `[Line]` | Mypy | `arg-type` | Corrected argument type from str to int |
#### Verification Status
- Clean exit code 0 confirmed with zero `# noqa` comments.9. Verification Checklist
mypyexits with code 0.ruff checkexits with code 0.- Zero
# noqaor# type: ignoreadded.
10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
Incompatible return value type | Returning None without Optional | Update return type to Optional[T]. |
11. Stop or Escalation Conditions
Stop and ask the user when:
- Mypy configuration requires whole-codebase architecture migration.
12. Examples
Example 1: Successful Execution
Input:
File: src/utils.py
Error: F401 'sys' imported but unusedOutput:
### Python Lint & Type-Check Report: src/utils.py
- **Type Checker**: `mypy src/utils.py` -> PASS
- **Linter**: `ruff check src/utils.py` -> PASS
- **Issues Resolved**: 1
#### Resolved Diagnostics
| Line | Tool | Code | Root Cause Fix |
| :--- | :--- | :--- | :--- |
| 3 | Ruff | `F401` | Removed unused `import sys` |
#### Verification Status
- Clean exit code 0 confirmed with zero `# noqa` comments.Example 2: Ambiguous or Missing Input
Input:
Lint python.Output:
### Python Lint & Type-Check Report: Halted - No Target
- **Status**: Halted
Please specify the Python file or directory to lint.Example 3: Expected Final Output
Output:
### Python Lint & Type-Check Report: src/models.py
- **Type Checker**: `mypy src/models.py` -> PASS
- **Linter**: `ruff check src/models.py` -> PASS
- **Issues Resolved**: 2Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

