python-best-practices
Skill2 starsChanged 4 months agoMITView on GitHub
Write idiomatic, typed Python with clear packaging, ruff/pytest defaults, and practical error handling. Use when writing or refactoring Python code, modules, scripts, packages, or APIs, or when the user mentions Python style, typing, or project layout.
20 other projects use a version of this.
Adopted by
Most recently taken up by
- iyazerski/dev-flows-plugintheir own version, first seen Nov 29, 2026
- baekenough/oh-my-customcodetheir own version, first seen Nov 23, 2026
- The-AIOS/aiostheir own version, first seen Nov 17, 2026
- mahdy-gribkov/arcanatheir own version, first seen Nov 8, 2026
- medy-gribkov/arcanatheir own version, first seen Nov 1, 2026
- jkitchin/knowhowtheir own version, first seen Nov 1, 2026
Used with
Projects with it also use frontend-design, skill-creator and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
BlockSkillfrontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Also in 4 projects that use this
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 4 projects that use this
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- The-AIOS/aios★ 130same name
- baekenough/oh-my-customcode★ 47same name
- jkitchin/knowhow★ 45same name
- jefflester/claude-skills-supercharged★ 44same name
- excatt/superclaude-plusplus★ 14same name
- arnabdeypolimi/claude_code_setup★ 4same name
- I-Onlabs/claude-code-skills★ 4same name
- OpenxIntelligence/Coding-Agent-Skills★ 4same name
- Sanskar015/claude-skills-supercharged★ 3same name
- b12consulting/skills★ 2same name
10 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-reviewSkill
- debuggingSkill
- javascript-best-practicesSkill
- nextjs-app-routerSkill
- nextjs-data-fetchingSkill
- python-testingSkill
- react-best-practicesSkill
- tagged-code-commentsSkill
- typescript-best-practicesSkill
- create-skillSkill
- revise-skillSkill
- academic-paperSkill
- latex-scientific-writingSkill
- paper-abstractSkill
- paper-conclusionSkill
- paper-discussionSkill
- paper-introductionSkill
- paper-literature-reviewSkill
- paper-methodsSkill
- paper-peer-reviewSkill
- paper-related-workSkill
- paper-resultsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
3
Distinctive
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
- Distinctive: line 29
Match the repo first: Follow existing layout, tooling, and import style before introducing new conventions.
- Very specific: line 33
Use pathlib and context managers: Prefer pathlib.Path over string paths.
- Distinctive: line 34
Dependencies: Prefer the stdlib. Add third-party libs only when they clearly reduce complexity.
- Distinctive: line 35
Do not over-abstract: Wait for a second real use before extracting shared helpers or base classes.
- Very specific: line 36
Tag unfinished or risky work: Use the global tagged-code-comments convention (🔴 FIXME(P0):, 🟠 TODO(P1):, …).
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Best Practices
Defaults
| Concern | Default |
| Style / lint | Ruff (format + lint) |
| Types | Type hints on public APIs; mypy or pyright in CI when the project already uses them |
| Tests | pytest (see python-testing skill) |
| Package layout | src/<package>/ for libraries; flat modules OK for small scripts |
| Python version | Match requires-python / .python-version; prefer 3.11+ |
Instructions
- Match the repo first. Follow existing layout, tooling, and import style before introducing new conventions.
- Prefer clarity over cleverness. Explicit names, small functions, early returns. Avoid deep nesting and clever one-liners.
- Type public surfaces. Annotate function parameters and return types for APIs, shared helpers, and data models. Use
TypedDict/ dataclasses / Pydantic when the project already does. - Handle errors at the boundary. Catch specific exceptions; convert to domain errors or HTTP responses at edges. Do not bare
except:or swallow errors silently. - Use pathlib and context managers. Prefer
pathlib.Pathover string paths; always close resources withwith. - Dependencies. Prefer the stdlib. Add third-party libs only when they clearly reduce complexity; pin in the project's lockfile/tooling.
- Do not over-abstract. Wait for a second real use before extracting shared helpers or base classes.
- Tag unfinished or risky work. Use the global
tagged-code-commentsconvention (🔴 FIXME(P0):,🟠 TODO(P1):, …). Never leave silent stubs. End with an Open follow-ups table so the developer must check P0/P1 before ship.
Project layout (libraries)
src/mypkg/
__init__.py
api.py
models.py
tests/
test_api.py
pyproject.tomlAnti-patterns
- Untyped public APIs in typed codebases
- Mutable default arguments (
def f(x=[])) - Broad
except Exceptionwithout re-raise or logging - Circular imports fixed by hacks instead of restructuring
- Mixing business logic into CLI/
__main__without a callable core
Checklist
See references/checklist.md.
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.

