python-code-smells
Skill48 starsChanged 17 days agoMITView on GitHub
Finds common Python code smells with the ast module, such as bare except clauses, mutable default arguments, missing docstrings, very long functions and long argument lists. Use when the user asks for a quick review of Python code, a cleanup pass or a pre-commit style check.
In this repository15 other files it gives its agents.
- api-endpoint-testerSkill
- changelog-generatorSkill
- commit-message-writerSkill
- csv-profilerSkill
- dockerfile-linterSkill
- env-file-auditorSkill
- json-diffSkill
- log-analyzerSkill
- meeting-notes-to-actionsSkill
- pr-description-writerSkill
- readme-doctorSkill
- secure-code-reviewSkill
- skill-authorSkill
- sql-query-reviewerSkill
- todo-extractorSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Before a commit or pull request, to catch the obvious problems.
- Distinctive: line 20
When a project has no linter configured yet.
≈ “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 code smells
A fast, dependency-free first pass over Python files. It does not replace a linter, it gives an agent concrete line numbers to start a review from.
When to use
- The user asks to review, clean up or "look over" Python code.
- Before a commit or pull request, to catch the obvious problems.
- When a project has no linter configured yet.
How to run
python scripts/smells.py src/
python scripts/smells.py app.py utils.py --max-lines 40Directories are searched recursively for .py files. Hidden folders and __pycache__ are skipped.
Rules
| Rule | Meaning |
bare-except | except: without an exception type hides real errors |
mutable-default | a list, dict or set used as a default argument value is shared between calls |
missing-docstring | a public function or class (no leading underscore) has no docstring |
long-function | a function is longer than --max-lines (default 50) |
too-many-args | a function takes more than --max-args parameters (default 6) |
syntax-error | the file could not be parsed |
Output
JSON with files (number of files checked) and findings, a list of
{"file", "line", "rule", "message"}. The exit code is 1 when there are findings and 0 otherwise.
After running
Group the findings by rule, fix the bugs first (bare-except, mutable-default), then the readability
items. Do not add docstrings that only repeat the function name.
Errors
A path that does not exist exits with code 2.
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.

