python-anti-patterns
by wshobsonpython-anti-patterns is a Python code review checklist for spotting fragile patterns like scattered retries, timeout duplication, and hidden complexity before merge, during refactoring, or while debugging.
This skill scores 68/100, which means it is acceptable to list for directory users who want a Python code-review checklist, but they should expect a reference-style guide rather than an executable workflow. The repository gives a clear trigger and substantial content, yet most value comes from examples of what to avoid rather than step-by-step operational guidance an agent can reliably execute.
- Clear trigger in frontmatter and usage section: review Python code for common anti-patterns before merge, during debugging, or while refactoring.
- Substantial body content with many categorized anti-patterns and BAD/GOOD code examples, which helps agents spot issues faster than a generic prompt.
- Positioned as a checklist and explicitly scoped to 'what to avoid,' which makes its purpose easy to understand quickly.
- Mostly reference material: there are no scripts, rules, support files, or concrete review procedure beyond the checklist framing.
- Install/adoption context is thin: no install command, linked resources, or repo/file-specific guidance to show how an agent should apply findings in practice.
Overview of python-anti-patterns skill
What the python-anti-patterns skill does
The python-anti-patterns skill is a review checklist for finding Python mistakes that create fragility, hidden complexity, and hard-to-debug behavior. It is most useful when you already have code, a pull request, or a design direction and want targeted “what should we stop doing?” feedback rather than broad style advice.
Who should install it
This skill fits:
- reviewers doing Python PR checks
- engineers refactoring older services
- teams creating lightweight code review standards
- learners who want concrete examples of bad patterns and safer alternatives
It is especially practical for python-anti-patterns for Code Review, where fast detection of repeat offenders matters more than deep architecture theory.
Real job-to-be-done
Users typically want to answer one of these questions:
- “What risky Python patterns are hiding in this code?”
- “Why does this implementation feel brittle even though it works?”
- “What should I check before merge?”
- “Which issues should I fix first during refactoring?”
The python-anti-patterns skill helps turn those vague concerns into a structured review pass.
What makes it different from a generic prompt
A normal prompt may produce generic advice like “write tests” or “use clean code.” This skill is narrower and more actionable: it centers recurring anti-patterns, shows bad-vs-better examples, and frames review around concrete failure modes such as duplicated retry logic and layered retries. That makes it better for code review triage than a broad “improve my Python” request.
Important limits before you install
The skill is a checklist, not an automated linter, fixer, or architecture generator. It does not replace:
- static analysis
- test execution
- security scanning
- domain-specific design review
It also focuses on what to avoid, not a full positive-pattern playbook. If your team needs recommended architectures, pair it with a design-oriented Python skill instead of expecting this one to cover both.
How to Use python-anti-patterns skill
Install context for python-anti-patterns
The repository does not expose a special installer inside SKILL.md, so the common directory pattern is to add it from the source repository:
npx skills add https://github.com/wshobson/agents --skill python-anti-patterns
After installation, confirm the skill is available in your skill runner or agent environment, then invoke it during review-oriented tasks rather than as a general coding assistant default.
Read this file first
Start with:
plugins/python-development/skills/python-anti-patterns/SKILL.md
This skill has no visible helper scripts, references, or metadata files in the published tree preview, so almost all of the value is in the checklist itself. Read it once end-to-end before relying on it in reviews.
Best times to invoke the skill
Use the python-anti-patterns skill at these points:
- before merging a Python PR
- while debugging flaky production behavior
- during legacy cleanup
- when standardizing team review comments
- when coaching less experienced Python contributors
It is less useful when the codebase is still at the whiteboard stage and there is no concrete implementation to inspect.
What input the skill needs
To get high-quality output, provide actual code and review context, not just “check for anti-patterns.” The minimum useful input is:
- the relevant Python file or diff
- what the code is supposed to do
- constraints such as framework, runtime, or reliability needs
- whether you want detection only or rewrite suggestions
Good inputs often include surrounding call chains, because anti-patterns like retry duplication only become obvious across layers.
Turn a rough goal into a strong prompt
Weak prompt:
- “Review this Python code.”
Stronger prompt:
- “Use the
python-anti-patternsskill to review this Python service code for reliability and maintainability issues. Focus on duplicated timeout/retry logic, hidden error handling, and patterns that will cause production debugging pain. For each issue, quote the code, explain why it is an anti-pattern, rank severity, and suggest a safer refactor.”
That prompt works better because it asks for:
- checklist-based review
- concrete evidence
- prioritization
- fixes tied to the anti-pattern, not generic cleanup
Example prompt for PR review
“Use the python-anti-patterns skill on this diff as a pre-merge review. Identify anti-patterns only if they materially affect correctness, observability, retries, exception handling, or maintainability. Group findings into ‘must fix before merge’ and ‘can follow up later.’ Avoid style-only comments.”
This keeps the review high-signal and prevents the skill from drifting into cosmetic feedback.
Example prompt for legacy refactoring
“Apply the python-anti-patterns skill to this legacy module. Find repeated patterns that should be centralized, especially network calls, retries, timeouts, and exception handling. Suggest the smallest safe refactor sequence that reduces risk without rewriting the whole module.”
This is a better python-anti-patterns usage pattern for older code because it asks for incremental change, not idealized redesign.
Suggested workflow in practice
- Read
SKILL.mdonce to understand the anti-pattern categories. - Run the skill against a specific file, diff, or subsystem.
- Ask for findings with severity and code quotes.
- Convert the top issues into refactor tasks.
- Re-run the skill on the changed code to verify the anti-pattern was actually removed rather than moved.
This loop makes the skill operational for code review instead of leaving it as a passive reference.
What to look for first in the checklist
Based on the visible source, one high-value category is infrastructure-related anti-patterns, including:
- scattered timeout logic
- scattered retry logic
- double retry across multiple layers
These are strong early review targets because they often pass tests yet still create production instability, noisy logs, and hard-to-reason failure behavior.
Practical tips that improve output quality
Ask the skill to:
- distinguish anti-patterns from legitimate tradeoffs
- point to exact lines
- explain runtime consequences
- suggest one minimal fix and one stronger long-term fix
- avoid flagging code that is framework-required or intentionally layered
Without that guidance, reviews can become too broad or too theoretical.
Misuse patterns to avoid
Do not use python-anti-patterns install as if installing the skill alone gives automatic repository scanning. You still need to provide code or a diff. Also avoid asking it to “rewrite everything better”; that usually dilutes the checklist value. This skill is strongest when you narrow scope and ask for anti-pattern detection with evidence.
python-anti-patterns skill FAQ
Is python-anti-patterns good for beginners?
Yes, if beginners already have code examples to review. The checklist format and bad-vs-better examples make it easier to learn what not to do. It is less effective as a first introduction to Python fundamentals.
Is this better than a normal code review prompt?
Usually yes for anti-pattern hunting. A generic prompt often misses recurring operational issues or gives vague cleanup advice. The python-anti-patterns skill is better when you want a repeatable review lens centered on common failure-inducing patterns.
Does it replace linters or type checkers?
No. Linters and type checkers catch different classes of issues. python-anti-patterns complements them by surfacing design and implementation habits that may still pass tooling.
When should I not use python-anti-patterns?
Skip it when:
- you need framework-specific best practices more than anti-pattern detection
- there is no concrete code yet
- you want security auditing
- you want full architecture guidance instead of a “what to avoid” checklist
Is python-anti-patterns only for production services?
No. It is also useful for scripts, internal tools, and educational code, but the payoff is highest in long-lived code where reliability and maintainability matter.
How does python-anti-patterns compare with python-design-patterns?
python-anti-patterns tells you what risky patterns to remove or avoid. A design-pattern skill is a better fit when you need recommended structures, abstractions, or architectural options. Many teams will use both: anti-patterns for review, design patterns for planning.
How to Improve python-anti-patterns skill
Give code plus intent, not code alone
The biggest upgrade is adding intent. Instead of pasting a file with no context, say what reliability, latency, or maintainability requirements matter. The same pattern may be acceptable in a throwaway script but a serious anti-pattern in a service boundary.
Ask for prioritization
Not every anti-pattern deserves immediate action. Request:
- severity
- likely runtime impact
- confidence
- smallest safe remediation
This turns the python-anti-patterns guide into an actionable review report rather than a long complaint list.
Include cross-layer context for retry issues
The visible checklist emphasizes centralized timeout and retry behavior. To catch those well, include:
- the HTTP/database wrapper
- the service method calling it
- any outer task/job retry mechanism
Without cross-layer context, the skill may miss double retry or misjudge where policy should live.
Ask for evidence-backed findings only
A useful constraint is:
- “Only report anti-patterns you can support with quoted code and a clear consequence.”
This reduces speculative review comments and improves trust in the output.
Request minimal and long-term fixes separately
For each finding, ask for:
- a low-risk immediate fix
- a cleaner long-term refactor
That matters because teams often reject good feedback when the proposed remediation is too large for the current PR.
Common failure mode: style drift
A frequent failure mode is the review turning into naming, formatting, or personal preference commentary. Keep the skill focused with instructions like:
- “Ignore formatting and naming unless they create a real anti-pattern.”
- “Prioritize behavior, failure handling, duplication, and maintainability.”
Common failure mode: over-flagging intentional patterns
Some code intentionally duplicates logic because of framework boundaries or migration constraints. Tell the skill about those constraints up front so python-anti-patterns does not recommend cleanup that breaks the rollout plan.
Iterate after the first pass
After the first output, follow up with:
- “Which two findings matter most before merge?”
- “Show the exact refactor shape for the top issue.”
- “Re-check the revised code and confirm whether the anti-pattern is gone.”
This second pass is often where the python-anti-patterns for Code Review workflow becomes genuinely useful rather than just informative.
