agentleFS
mikejhillmikejhill/agent-skills/skills/python-development/SKILL.md

python-development

Skill0 starsChanged 8 months agoMITView on GitHub

Use when creating, modifying, refactoring, or reviewing Python code — one-off snippets, single-file uv scripts, or packaged projects. Enforces the Astral toolchain (uv, ruff, ty with strict type checking), poe task runners, src/<package>/ layout, class-based OOP design, file/class/method docstrings, concise comments, structured logging, and pytest testing.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use javascript-typescript, golang-development and 7 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.
  • pepebot-spaceSkill

    javascript-typescript

    JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript/TypeScript projects.

    Also in 4 projects that use this

  • kinhluanSkill

    golang-development

    Implement, review, debug, or modernize Go code and modules with idiomatic APIs, concurrency, error handling, testing, profiling, and tooling. Use for Go services, libraries, CLIs, goroutine/channel issues, module management, or performance work.

    Also in 3 projects that use this

  • carloss765Skill

    rust-development

    Comprehensive guidelines for writing safe, concurrent, and performant Rust code. Use when working with .rs files, building systems software, or high-performance applications.

    Also in 3 projects that use this

  • harrissohail6Skill

    database-design

    Database schema design and SQL best practices. Use when designing tables, writing queries, or optimizing database performance.

    Also in 3 projects that use this

  • NVIDIASkill

    github

    Interact with GitHub using the gh CLI restricted to REST API only (no GraphQL). Use when the user wants to work with GitHub issues, pull requests, repos, releases, or Actions — especially in sandboxed environments where the GraphQL endpoint may be blocked. Trigger keywords - github, gh, pull request, PR, github issue, github actions, workflow, release, gh api.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default to FullProject when ambiguous.

    line 18
  2. Very specific:

    All tool config lives in pyproject.toml.

    line 27
  3. Very specific:

    All FullProject source code lives in src/<package>/ — no flat layouts, no main.py at the root.

    line 31
  4. Very specific:

    No module-level mutable state.

    line 39
  5. Distinctive:

    Every file starts with a docstring stating what the file is for.

    line 50
  6. Very specific:

    Every class, method, and function has a docstring — one line by default.

    line 51
  7. Very specific:

    Use short comments as logical headers for blocks of code (# Validate inputs, # Build report).

    line 52
  8. Distinctive:

    No inline commentary on obvious code.

    line 53
  9. Very specific:

    Never bare except: or silent suppression.

    line 58
  10. Very specific:

    Script: create the file with uv init --script <file>.py and add dependencies with uv add --script <file>.py <dep>.

    line 65
  11. Distinctive:

    Write code following code-standards.md.

    line 66
  12. Distinctive:

    Write tests following testing.md.

    line 67
  13. Very specific:

    Verify: uv run poe fix then uv run poe check (FullProject), or the script commands in modes.md.

    line 68
  14. Distinctive:

    Read only what the task needs:

    line 72
  15. Distinctive:

    When ambiguous, choose the left side:

    line 94

“Common” is measured: kept by at least 6 in 10 of the 11 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Development

Produce Python in one of three modes. This file holds the rules that always apply; load the reference files listed under Progressive Discovery only when the task needs them.

Modes

ModeUse whenOutput
OneOffSnippet, REPL expression, quick inline answer1–5 lines (max 10), no file
ScriptSingle reusable file, no package neededOne .py file with PEP 723 inline metadata, run with uv run
FullProjectPackage, reusable tool, CLI, or multi-file codesrc/<package>/ project managed by uv

Default to FullProject when ambiguous. Details and guardrails: references/modes.md.

Core Rules (Script and FullProject)

Toolchain

  • uv for Python versions, environments, dependencies, locking, and running (uv add, uv sync, uv run). Never pip, venv, poetry, or requirements.txt.
  • ruff for linting and formatting; ty for type checking with every rule set to error ([tool.ty.rules] all = "error").
  • poe (poethepoet) for project tasks: uv run poe check must pass before delivery.
  • All tool config lives in pyproject.toml; no separate config files.

Layout

  • All FullProject source code lives in src/<package>/ — no flat layouts, no main.py at the root.
  • Tests live in tests/, mirroring the source modules.

Design

  • STRONGLY prefer classes. Put behaviour in methods; avoid module-level functions.
  • The only accepted module-level functions are pytest fixtures in conftest.py. Entry points are classmethods (package.__main__:Application.main).
  • @dataclass(frozen=True, slots=True) for configuration and value objects; regular classes for stateful services.
  • No module-level mutable state; module level holds only imports, constants, logger, and class definitions.
  • Guard clauses at method entry; max 3 levels of nesting.

Typing

  • Annotate every parameter and return type; from __future__ import annotations in every module.
  • No Any, no bare # type: ignore, no unexplained cast().
  • Convert untyped boundaries (argparse Namespace, JSON, env vars) to typed dataclasses immediately.

Documentation and comments

  • Every file starts with a docstring stating what the file is for.
  • Every class, method, and function has a docstring — one line by default; add Google-style Args:/Returns:/Raises: only when they say something the signature doesn't.
  • Use short comments as logical headers for blocks of code (# Validate inputs, # Build report).
  • No inline commentary on obvious code. Inline comments only for niche behaviour, workarounds, or surprising exceptions.

Errors and output

  • Specific exceptions only; custom hierarchy rooted at AppError in exceptions.py; chain with raise ... from err.
  • Never bare except: or silent suppression.
  • Diagnostics go through logging (stderr); program output goes to stdout via sys.stdout.write. No print() outside OneOff.

Procedure

  1. Pick the mode (modes.md).
  2. FullProject: scaffold with uv init --package --build-backend uv <name>, add dev tools with uv add --dev ruff ty pytest pytest-cov poethepoet, then apply the pyproject.toml settings from project-setup.md.
  3. Script: create the file with uv init --script <file>.py and add dependencies with uv add --script <file>.py <dep>.
  4. Write code following code-standards.md; copy file skeletons from templates.md.
  5. Write tests following testing.md.
  6. Verify: uv run poe fix then uv run poe check (FullProject), or the script commands in modes.md. Fix every finding before delivering; never weaken tool config to make it pass.

Progressive Discovery

Read only what the task needs:

ReadWhen
references/modes.mdChoosing a mode; writing a OneOff or a PEP 723 script
references/project-setup.mdCreating or reconfiguring a project: uv, layout, pyproject.toml, ruff, strict ty, poe tasks, verification
references/code-standards.mdWriting or reviewing code: OOP rules, docstrings, comments, typing, errors, logging, naming
references/cli.mdBuilding a command-line interface or entry point
references/testing.mdWriting or reviewing tests, fixtures, coverage
references/templates.mdCopy-paste skeletons for every FullProject file
references/examples.mdWorked OneOff, Script, and procedural-to-OOP refactor examples

Scope

In scope: Python scripts, CLI tools, libraries, and automation; refactors; packaging; testing.

Out of scope unless requested: web frameworks (Django, Flask, FastAPI), notebooks, ML pipelines, GUIs, C extensions, Docker or deployment. Async code is in scope only when the task needs concurrency.

User requirements override these defaults unless they break a core rule above; when they do, say so and ask.

Trade-offs

When ambiguous, choose the left side:

  • Maintainability over brevity
  • Explicit types over inference
  • Classes over procedural convenience
  • Tooling-enforced rules over instruction-only rules
  • Failing loudly over guessing

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.