python-development
Skill0 starsChanged 4 months agoMITView on GitHub
Guide Python development with greenfield defaults and brownfield flexibility. Apply when writing, maintaining, or reviewing Python code to ensure consistency with modern tooling (uv, ruff, ty, pytest, pre-commit) and patterns (CLI separation, type safety, error handling).
3 other projects use a version of this.
Adopted by
Most recently taken up by
- ProjAnvil/MindForgetheir own version, first seen Mar 5, 2026
- microsoft/agent-frameworktheir own version, first seen Feb 5, 2026
- carloss765/agent-skillstheir own version, first seen Jan 15, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- microsoft/agent-framework★ 14ksame name
- ProjAnvil/MindForge★ 3same name
- carloss765/agent-skills★ 1same 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 repository13 other files it gives its agents.
- buildkiteSkill
- englogSkill
- githubSkill
- golang-developmentSkill
- jiraSkill
- optimize-workspace-contextSkill
- plan-with-reviewSkill
- pull-requestSkill
- review-claude-configSkill
- review-claude-settingsSkill
- review-pull-requestSkill
- session-learningsSkill
- triage-dependency-prsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 7 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
7
Distinctive
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 40
Use templates from tooling.md verbatim — don't approximate
- Distinctive: line 45
Read existing code first with Read/Grep before writing anything
- Distinctive: line 47
Use the brownfield decision tree at the bottom of this file
- Distinctive: line 52
Every function and module gets a docstring summary (one line is enough.
- Very specific: line 53
Every function gets full type hints using modern syntax (str | None, list[str], not Optional, not Union)
- Very specific: line 58
Always chain exceptions: raise AppError("msg") from e
- Very specific: line 63
Use pathlib.Path for all file operations — never os.path or string concatenation
- Very specific: line 64
Use @dataclass for any domain model with 2+ fields
- Very specific: line 67
Default to typer.echo — don't add Rich or logging unless the user asks for a --verbose flag
- Very specific: line 70
Use tomllib (stdlib) + TOML file — not Pydantic, not env vars
- Distinctive: line 77
Test core logic directly; test CLI only for argument parsing and exit codes
- Distinctive: line 111
When a blocker is found, grep for the same pattern across the codebase and report all instances.
- Distinctive: line 128
No CLI → leave as-is
“Common” is measured: kept by at least 6 in 10 of the 3 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 Development
Apply this skill when writing, maintaining, or reviewing Python code.
Supporting Files
- tooling.md — Copy-paste templates for greenfield project setup (pyproject.toml, Makefile, .pre-commit-config.yaml)
- code-style.md — Style rules and conventions (naming, formatting, type hints, imports)
- patterns.md — Architecture patterns (CLI/core separation, exception hierarchy, error handling)
Mode Detection
Detect the mode from the user's request before acting:
| Signal | Mode |
| "write", "create", "add", "scaffold", "implement", "new" | WRITE |
| "fix", "refactor", "update", "change", "migrate", "improve" | MAINTAIN |
| "review", "check", "audit", "look at", "what do you think" | REVIEW |
WRITE Mode
Step 1: Greenfield or brownfield?
Greenfield (new project or new module in a greenfield project):
- Use templates from tooling.md verbatim — don't approximate
- Apply src/ layout, hatchling build system, full tooling stack
- Apply all rules below from the start
Brownfield (inheriting existing code):
- Read existing code first with Read/Grep before writing anything
- Match existing patterns — don't retrofit greenfield defaults
- Use the brownfield decision tree at the bottom of this file
Step 2: Apply these rules when writing any code
Functions and modules:
- Every function and module gets a docstring summary (one line is enough; add more lines only when behavior is non-obvious)
- Every function gets full type hints using modern syntax (
str | None,list[str], notOptional, notUnion) - See code-style.md for all style rules
Error handling:
- Raise domain exceptions in core logic, catch at the CLI layer — never both
- Always chain exceptions:
raise AppError("msg") from e - See patterns.md for exception hierarchy and CLI/core separation
Structure:
- Separate CLI layer (parse args + display output) from core layer (pure logic, no CLI imports)
- Use
pathlib.Pathfor all file operations — neveros.pathor string concatenation - Use
@dataclassfor any domain model with 2+ fields
Output:
- Default to
typer.echo— don't add Rich or logging unless the user asks for a--verboseflag
Config:
- Use
tomllib(stdlib) + TOML file — not Pydantic, not env vars - Env vars only for secrets or CI overrides
Tests:
- Class-based:
class TestFoo,def test_scenario conftest.pyfor shared fixturestmp_pathfor filesystem,monkeypatchfor env vars- Test core logic directly; test CLI only for argument parsing and exit codes
MAINTAIN Mode
- Read before writing — use Read/Grep to understand the existing code
- Match existing patterns — preserve the style even if it differs from greenfield defaults
- Run checks after editing — ask the user to run
make checkto validate - Don't change tooling unless the user explicitly asks
For brownfield codebases: apply only the brownfield decision tree below.
REVIEW Mode
Go through the code and report findings in two categories:
Blockers (must fix)
- Bare
except:orexcept Exceptionwithout re-raising - Unused imports or dead code
- Secrets or credentials hardcoded in source
Nits (suggest, don't block)
- Missing type hints on function signatures
- Missing docstrings on functions or modules
- Hardcoded values that should be module-level constants or config
- Exception not chained with
from ewhen re-raising os.pathor string paths instead ofpathlib.Path- Mutable default arguments (
def f(x=[])) - Wrong exception type (raising base
Exceptioninstead of domain-specific) - Tests touching real filesystem or env vars without
monkeypatch/tmp_path
When a blocker is found, grep for the same pattern across the codebase and report all instances.
Brownfield Decision Tree
Build system?
- Exists (Poetry, setup.cfg, etc.) → keep it
- Missing → migrate to hatchling
Python version?
- 3.11 or older → keep it, don't force upgrade
- 3.12+ → align with greenfield defaults
CLI framework?
- Click or Typer → already aligned, keep it
- argparse or custom → refactor only if actively developing
- No CLI → leave as-is
Type hints?
- 80%+ coverage → run
ty check --strict - <80% → run
ruff checkonly, skip ty - 0% → run tests only
Test count?
- 50+ tests → consider unit/cli split
- <50 → keep flat
tests/directory
Minimal acceptable setup for any brownfield project:
make install # install deps
make test # run tests
make lint # check style
make check # all of the aboveGreenfield Checklist
.python-versionset to3.12pyproject.tomlwith hatchling,requires-python = ">=3.12",[dependency-groups] devMakefilewith:install,test,test-v,lint,format,fix,typecheck,check,clean.pre-commit-config.yamlwith ruff + ty hookssrc/my_project/withcli.py,commands/,core/tests/withconftest.pymake install && make checkpasses before first commitpre-commit installenabled
See tooling.md for copy-paste templates.
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.

