python-conventions
Skill1 starsChanged 2 months agoMITView on GitHub
Use when writing or reviewing Python code — naming conventions, type hints, common pitfalls (mutable defaults, bare except, is-vs-==), and testing structure.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- NicoGenti/opencode-orchestrator-kittheir own version, first seen Nov 8, 2026
- leroyguillaume/claudetheir own version, first seen Oct 30, 2026
- ek33450505/claude-agent-teamtheir own version, first seen Oct 25, 2026
- wtsi-hgi/agentskillstheir own version, first seen Oct 4, 2026
- techmefr/mentistheir own version, first seen Sep 11, 2026
- HermeticOrmus/python-conventions-skillstheir own version, first seen May 23, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- tae0y/python-project-template★ 14same name
- NicoGenti/opencode-orchestrator-kit★ 9same name
- ek33450505/claude-agent-team★ 8same name
- leroyguillaume/claude★ 7same name
- HermeticOrmus/python-conventions-skills★ 2same name
- wtsi-hgi/agentskills★ 1same name
- techmefr/mentis★ 0same name
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 repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/agentharness-router.mdcCursor rule
- .cursor/rules/agentic-loops.mdcCursor rule
- .cursor/rules/api-design.mdcCursor rule
- .cursor/rules/audit-review-followup.mdcCursor rule
- .cursor/rules/big-work-plan-review.mdcCursor rule
- .cursor/rules/branching.mdcCursor rule
- .cursor/rules/clean-architecture.mdcCursor rule
- .cursor/rules/code-review-api.mdcCursor rule
- .cursor/rules/code-review-db.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/code-review-ui.mdcCursor rule
- .cursor/rules/committing.mdcCursor rule
- .cursor/rules/database-conventions.mdcCursor rule
- .cursor/rules/dependency-audit.mdcCursor rule
- .cursor/rules/dependency-injection.mdcCursor rule
- .cursor/rules/design-patterns.mdcCursor rule
- .cursor/rules/docker-conventions.mdcCursor rule
- .cursor/rules/error-handling.mdcCursor rule
- .cursor/rules/file-placement-policy.mdcCursor rule
- .cursor/rules/github-issue-triage.mdcCursor rule
- .cursor/rules/go-conventions.mdcCursor rule
- .cursor/rules/harness-feedback.mdcCursor rule
- .cursor/rules/logging.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/mutation-testing.mdcCursor rule
- .cursor/rules/performance-profiling.mdcCursor rule
- .cursor/rules/planning-with-files.mdcCursor rule
- .cursor/rules/port-agent-config.mdcCursor rule
- .cursor/rules/project-bootstrap.mdcCursor rule
- .cursor/rules/python-conventions.mdcCursor rule
- .cursor/rules/react-best-practices.mdcCursor rule
- .cursor/rules/refactoring.mdcCursor rule
- .cursor/rules/requirements-clarification.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/solid-principles.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/typescript-conventions.mdcCursor rule
- accessibilitySkill
- agentic-loopsSkill
- api-designSkill
- audit-review-followupSkill
- big-work-plan-reviewSkill
- branchingSkill
- clean-architectureSkill
- code-review-apiSkill
- code-review-dbSkill
- code-reviewSkill
- code-review-uiSkill
- committingSkill
- database-conventionsSkill
- dependency-auditSkill
- dependency-injectionSkill
- design-patternsSkill
- docker-conventionsSkill
- error-handlingSkill
- file-placement-policySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Use them on function parameters and returns.
“Common” is measured: kept by at least 6 in 10 of the 7 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 Conventions
This file is self-contained for day-to-day use. Deeper reference (needs
the full harness checkout, not just this skill — these aren't bundled
here since they're documentation, not something this skill runs):
languages/python/CONVENTIONS.md (complete examples) and
languages/python/COPILOT_INSTRUCTIONS.md (general agent operating
principles for Python repos — inspect before changing, scope discipline,
never claim a command passed without running it).
Naming
snake_case— functions, variables.PascalCase— classes.UPPER_SNAKE_CASE— module-level constants.- Single underscore prefix for private (
_internal); avoid double underscore except for genuine name-mangling needs. - Exceptions:
PascalCase+Error/Exceptionsuffix, specific not generic (ValidationError, notBadThing).
Imports & structure
Standard library → third-party → local, each group separated by a blank
line. Absolute imports over relative. No from module import *.
Type hints
Use them on function parameters and returns. Match syntax to the
project's minimum Python version — check requires-python in
pyproject.toml before using list[str] (3.9+), X | None (3.10+), or
match/case (3.10+). Don't silently raise the minimum version.
Pitfalls to catch in review
# Mutable default argument — persists across calls, shared state bug
def f(item, container=[]): # WRONG
def f(item, container=None): # RIGHT — default to None, create inside
# Bare/broad except — swallows KeyboardInterrupt, hides real errors
except: # WRONG
except Exception: # still too broad, usually
except ValueError as e: # RIGHT — catch what you expect
# `is` for value comparison — checks identity, not equality
if user_id is 5: # WRONG
if user_id == 5: # RIGHT (== for values, `is` only for None/True/False)Testing
tests/ directory, test_*.py files, test_* functions, pytest
fixtures for setup. See patterns/testing/TDD.md for the broader
methodology — this skill covers Python-specific structure only.
Formatting & tooling
Defer to the project's pyproject.toml — don't impose Black/Ruff
defaults over an existing configured formatter/linter. If unconfigured:
Black or ruff format (88-char lines), ruff check, mypy for typing,
pytest for tests.
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.

