Jamie-BitFlight/claude_skills/plugins/python-engineering/skills/standards-for-python-development/SKILL.md
standards-for-python-development
Shared Python 3.11+ development standards covering type safety (ty, native generics, Protocol, TypeIs), layered architecture, error handling, performance, identifier naming, UI/CLI patterns (Rich/Typer), testing requirements (pytest, 80% coverage, TDD), and quality gates. Activates when any Python skill or agent needs to apply shared standards for implementation, code review, refactoring, or test authoring.
- Source repository stars
- 64
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-25
- Source checked
- 2026-08-25
Decision brief
What it does: where it fits
This document centralizes the shared Python 3.11+ development standards, quality expectations, and workflows used across all Python agents and skills (including code-reviewer, stinkysnake, snakepolish, and python3-review).
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/Jamie-BitFlight/claude_skills --skill "plugins/python-engineering/skills/standards-for-python-development"Inspect the Agent Skill "standards-for-python-development" from https://github.com/Jamie-BitFlight/claude_skills/blob/b70ba8737e664d9e2482912e3ddbe7ecb77e0539/plugins/python-engineering/skills/standards-for-python-development/SKILL.md at commit b70ba8737e664d9e2482912e3ddbe7ecb77e0539. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
2. Python Development Process Graph
This graph shows the lifecycle of Python development, illustrating exactly where and why each skill/agent is used in the workflow.
Planning Phase:When building something new, python-cli-design-spec creates the architecture and defines the interfaces.When fixing technical debt, stinkysnake analyzes the codebase, finds Any types, and creates a modernization plan. - 02
Workflow Explanations
1. Planning Phase: - When building something new, python-cli-design-spec creates the architecture and defines the interfaces. - When fixing technical debt, stinkysnake analyzes the codebase, finds Any types, and creates a modernization plan. 2. Test-Driven Phase: - python-pytest…
Planning Phase:When building something new, python-cli-design-spec creates the architecture and defines the interfaces.When fixing technical debt, stinkysnake analyzes the codebase, finds Any types, and creates a modernization plan. - 03
Process for Amending Standards
1. Identify the Gap: - Trigger: An agent encounters a recurring failure mode, a new tool is introduced to the ecosystem, or a user explicitly requests a standard update. - Research: Use the WebFetch or WebSearch tools to verify the proposed standard against primary sources (e.g.…
Identify the Gap:Trigger: An agent encounters a recurring failure mode, a new tool is introduced to the ecosystem, or a user explicitly requests a standard update.Research: Use the WebFetch or WebSearch tools to verify the proposed standard against primary sources (e.g., Python PEPs, official library documentation like docs.pytest.org or docs.astral.sh). - 04
1. Shared Development Standards
Understand the complexity vs portability trade-off when creating Python CLI scripts:
Native Types: Use Python 3.11+ native type hints (e.g., list[str], dict[str, int], str | None) instead of legacy typing imports (List, Dict, Optional, Union).Eliminate Any: Replace Any with specific types, TypeVar, Generic, or Protocol.Duck Typing: Use typing.Protocol for structural subtyping instead of ABCs where appropriate. - 05
1.1 Type Safety & Modern Patterns
Native Types: Use Python 3.11+ native type hints (e.g., list[str], dict[str, int], str | None) instead of legacy typing imports (List, Dict, Optional, Union).
Native Types: Use Python 3.11+ native type hints (e.g., list[str], dict[str, int], str | None) instead of legacy typing imports (List, Dict, Optional, Union).Eliminate Any: Replace Any with specific types, TypeVar, Generic, or Protocol.Duck Typing: Use typing.Protocol for structural subtyping instead of ABCs where appropriate.
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 97/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 64 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- Jamie-BitFlight/claude_skills
- Skill path
- plugins/python-engineering/skills/standards-for-python-development/SKILL.md
- Commit
- b70ba8737e664d9e2482912e3ddbe7ecb77e0539
- License
- MIT
- Collected
- 2026-08-25
- Default branch
- main
View the original SKILL.md
Python 3 Development Standards & Workflows
This document centralizes the shared Python 3.11+ development standards, quality expectations, and workflows used across all Python agents and skills (including code-reviewer, stinkysnake, snakepolish, and python3-review).
1. Shared Development Standards
1.1 Type Safety & Modern Patterns
- Native Types: Use Python 3.11+ native type hints (e.g.,
list[str],dict[str, int],str | None) instead of legacytypingimports (List,Dict,Optional,Union). - Eliminate
Any: ReplaceAnywith specific types,TypeVar,Generic, orProtocol. - Duck Typing: Use
typing.Protocolfor structural subtyping instead of ABCs where appropriate. - Data Structures: Use
dataclasses(withslots=True, frozen=Truewhen possible),TypedDict(withNotRequired), orpydanticfor structured data. - Narrowing: Use
TypeIs(PEP 742, Python 3.13+) for bidirectional type narrowing. UseTypeGuardonly when targeting Python < 3.13 withouttyping_extensions. - Modern Operators: Utilize the walrus operator (
:=) andmatch-casestatements where they improve readability. - Type Checking (default): Use ty (Astral) as the primary type checker for new work and greenfield setup. Run
uv run ty check(paths per project). See thepython-engineering:tyskill for configuration and CLI reference. - Type Checking (existing projects on mypy): If pre-commit, CI, or documented project commands actually run
mypy, do not force a migration to ty. Runuv run mypypermypy.ini/[tool.mypy]when mypy is the active checker. Do not infer mypy from[tool.mypy]alone — repos may keep that table for IDE or legacy reasons while ty is what hooks run. - Migrating to ty (IDE coexistence): When hooks/CI use ty as the real gate, keep stub config so built-in IDE checkers stay quiet instead of duplicating ty:
[tool.mypy]withexclude = [".*"];[tool.basedpyright]withtypeCheckingMode = "off";[tool.pyright]/pyrightconfig.jsonset to disable analysis where the editor respects it. Do not delete those tables to "clean up" — detection of which checker automation runs follows hooks/CI, never the mere presence of stub sections. See thepython-engineering:tyskill for more. - Other checkers: When pre-commit or CI actually runs basedpyright or pyright (not merely stub config for the IDE), follow that project's configuration.
- TOML: Use
tomlkitfor TOML read and write (preserves formatting, comments). Usetomllib(stdlib) only for stdlib-only scripts. - Type Safety Reference: For Generics, Protocols, TypedDict, Type Narrowing, attrs/dataclasses/pydantic comparison, see
type-safety-mypy.mdin thepython-engineering:python3-typingskill. (Filename references mypy docs; patterns apply to ty and other checkers unless a rule is mypy-specific.) - Version-Specific Features: Check the project's
requires-pythonfloor against the per-version supplements (python311-features.mdthroughpython314-features.md) in thepython-engineering:python3-coreskill. - Version Lifecycle (SOURCE: https://devguide.python.org/versions, accessed 2026-03-23): 3.10 EOL 2026-10, 3.11 security-only until 2027-10, 3.12 security-only until 2028-10, 3.13 bugfix until 2029-10, 3.14 bugfix until 2030-10. When choosing a
requires-pythonfloor, prefer versions still in bugfix status.
1.2 Architecture & Structure
- Layered Architecture: Separate concerns into clear boundaries: CLI → Core Logic → Services → Display/UI.
- Shared Models: Define data models, constants, and exceptions in a
shared/ormodels/directory. - Dependency Injection: Use
Protocolclasses to define expected interfaces for external services, allowing easy mocking. - Module Hygiene: Keep functions under 50 lines, avoid deep nesting (>3 levels), prevent circular imports, and define
__all__in public modules.
1.3 Error Handling & Security
- Fail-Fast: Catch specific exceptions only when you can recover or add context. Never use bare
except:or swallow exceptions silently. - Contextualize: Use
e.add_note()orraise ... from eto add context to re-raised exceptions. - Security:
- Prevent SQL injection (use parameterized queries).
- Prevent command injection (never use
shell=Truewith user input). - Validate all external inputs.
- Never hardcode secrets.
1.4 Performance
- O(1) Lookups: Use
setfor membership testing instead oflist. - I/O: Use async patterns (
asyncio,httpx) for I/O-bound operations. Avoid synchronous I/O in async contexts. - Caching: Cache repeated expensive function calls.
- String Building: Avoid string concatenation in loops; use
.join()or list comprehensions.
1.5 Identifier Naming
- Expand Acronyms: Expand acronyms in public function names, method names, and class
names.
gcd()is opaque;greatest_common_divisor()is self-documenting. SOURCE:research/learning-resources/TheAlgorithms-Python.mdline 150 (accessed 2026-04-27, citing TheAlgorithms/Python CONTRIBUTING.md) — "Expand acronyms becausegcd()is hard to understand butgreatest_common_divisor()is not." - Contrast Example: Prefer
greatest_common_divisor(a, b)overgcd(a, b)for any public API. - Domain Acronym Exceptions: Established domain acronyms that are the standard term
in their field may remain abbreviated. Per PEP 8, they appear lowercase in
snake_caseidentifiers:url,api,sql,http,json,xml. Example:parse_url(),fetch_api_response(),run_sql_query(). - Local Variable Scope: Short names are acceptable for local variables with a lifetime under 5 lines (loop indices, comprehension variables, short closures). Expand acronyms when the variable is referenced beyond 5 lines of its definition.
1.6 Script Dependency Trade-offs
Understand the complexity vs portability trade-off when creating Python CLI scripts:
Scripts with dependencies (Typer + Rich via PEP 723):
- Benefits: Less development complexity, less code to write, better UX (colors, progress bars), simple to execute (PEP 723 makes it a single-file executable; uv handles dependencies).
- Trade-off: Requires network access on first run (to fetch packages).
- Default recommendation: Use Typer + Rich with PEP 723 unless you have specific portability requirements that prevent network access.
stdlib-only scripts:
- Benefits: Maximum portability - Runs on ANY Python installation without network access. Best for air-gapped systems or restricted corporate environments.
- Trade-offs: More development complexity (manual argparse, formatting), more code to write and test, basic UX.
1.7 UI & CLI (Rich / Typer)
- Rich Emoji Usage: In Rich console output, always use Rich emoji tokens (e.g.,
:white_check_mark:) instead of literal Unicode emojis. This ensures cross-platform compatibility, consistent rendering, and markdown-safe alignment. - Width Handling: For Rich table and panel width patterns, use
Measurement.get(console, console.options, renderable). Seetyper-rich-non-tty-patterns.mdin thepython3-cliskill for examples.
1.8 Exception Handling Pattern
Catch exceptions only when you have a specific recovery action. Let all other errors propagate to the caller.
def get_user_with_handling(id):
try:
return db.query(User, id)
except ConnectionError:
logger.warning("DB unavailable, using cache")
return cache.get(f"user:{id}") # Specific recovery action
- Test-First (TDD): Write failing tests against defined interfaces before implementing logic.
- Framework: Use
pytestwithpytest-mock(avoidunittest.mock). - Coverage: Maintain a minimum of 80% test coverage, ensuring edge cases are handled. Critical paths require 95%+ coverage and mutation testing.
- Test Quality:
- Follow the AAA (Arrange-Act-Assert) pattern.
- Test names must describe behavior, not implementation (e.g.,
test_process_payment_when_insufficient_funds_returns_declined). - Tests must be isolated and independent.
- Test Failure Mindset: Treat every test failure as a potential bug discovery, not an annoyance. Use a dual-hypothesis approach (Test is wrong vs. Implementation is wrong). Never automatically change a test to match the implementation.
- Docstrings: Use Google-style docstrings (Args/Returns/Raises) for all public functions and classes.
- Sync Docs: Ensure
CLAUDE.mdand architecture documents are updated when adding new commands or modules.
2. Python Development Process Graph
This graph shows the lifecycle of Python development, illustrating exactly where and why each skill/agent is used in the workflow.
flowchart TD
%% Define Styles
classDef trigger fill:#e1f5fe,stroke:#3b82f6,stroke-width:2px;
classDef plan fill:#fff3e0,stroke:#ff9800,stroke-width:2px;
classDef implement fill:#e8f5e9,stroke:#4caf50,stroke-width:2px;
classDef verify fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px;
%% Nodes
Start([Feature Request / Tech Debt])
subgraph Planning Phase
DesignSpec[python-cli-design-spec<br/>Create Architecture & Interfaces]
StinkySnake[stinkysnake<br/>Analyze & Plan Refactoring]
end
subgraph Test-Driven Phase
TestArch[python-pytest-architect<br/>Write Failing Tests]
end
subgraph Implementation Phase
CliArch[python-cli-architect<br/>Implement Core Logic]
SnakePolish[snakepolish<br/>Iterative Implement & Test Loop]
end
subgraph Verification Phase
StaticAnalysis[Ruff + type checker<br/>ty default; mypy if configured]
Review[code-reviewer / python3-review<br/>Holistic Quality & Pattern Check]
end
Done([Ready for Merge])
%% Class assignments
class Start,Done trigger
class DesignSpec,StinkySnake plan
class TestArch,CliArch,SnakePolish implement
class StaticAnalysis,Review verify
%% Edges
Start -->|New Feature| DesignSpec
Start -->|Refactor Legacy| StinkySnake
DesignSpec --> TestArch
StinkySnake --> TestArch
TestArch -->|Tests Fail| CliArch
TestArch -->|Tests Fail| SnakePolish
CliArch --> StaticAnalysis
SnakePolish --> StaticAnalysis
StaticAnalysis -->|Pass| Review
StaticAnalysis -->|Fail| CliArch
Review -->|Issues Found| CliArch
Review -->|Approved| Done
Workflow Explanations
- Planning Phase:
- When building something new,
python-cli-design-speccreates the architecture and defines the interfaces. - When fixing technical debt,
stinkysnakeanalyzes the codebase, findsAnytypes, and creates a modernization plan.
- When building something new,
- Test-Driven Phase:
python-pytest-architectreads the interfaces/plans and writes tests first. These tests will initially fail.
- Implementation Phase:
python-cli-architectwrites the actual code.snakepolishis an automated loop that implements code and runs tests iteratively until the tests pass.
- Verification Phase:
- Automated static analysis:
ruffplus the project's type checker — ty by default;mypywhen the repo already configures it (never force migration off mypy). code-reviewer(orpython3-review) performs a holistic, human-like review to ensure the code follows the standards defined in Section 1 (Architecture, Security, Modern Patterns). If it finds issues, it kicks the process back to implementation.
- Automated static analysis:
3. Reviewing and Amending Standards
The standards and graphs in this document are living artifacts. If you discover new best practices, identify missing ecosystem tools, or find that the current standards contradict official Python documentation (PEPs), you MUST update this document.
Process for Amending Standards
- Identify the Gap:
- Trigger: An agent encounters a recurring failure mode, a new tool is introduced to the ecosystem, or a user explicitly requests a standard update.
- Research: Use the
WebFetchorWebSearchtools to verify the proposed standard against primary sources (e.g., Python PEPs, official library documentation likedocs.pytest.orgordocs.astral.sh). - Compare: Compare the verified best practice against Section 1's rules. If the concept is missing or the existing rule is anti-pattern, a gap is identified.
- Update the Text: Add or modify the relevant bullet points in
Section 1. Shared Development Standards. Ensure the new rule is concise and actionable. - Update the Process Graph: If adding a new agent or altering the development workflow, update the Mermaid flowchart in
Section 2. Python Development Process Graphto show exactly where the new step fits into the lifecycle. - Validate: Ensure that the changes do not introduce contradictions with other rules in this document.
Frequently asked questions
What to verify before installation and use
What does the standards-for-python-development source document cover?
This document centralizes the shared Python 3.11+ development standards, quality expectations, and workflows used across all Python agents and skills (including code-reviewer, stinkysnake, snakepolish, and python3-review).
How do I install standards-for-python-development?
The source record exposes this install command: npx skills add https://github.com/Jamie-BitFlight/claude_skills --skill "plugins/python-engineering/skills/standards-for-python-development". Inspect the command and pinned source before running it.
Alternatives
Compare before choosing
oaslananka/kicad-mcp-pro
code-review
Use this skill for GitHub Copilot pull request and code reviews in oaslananka/kicad-mcp-pro. Review Python MCP server changes, KiCad adapter and tool-contract changes, tests, npm/package wrappers, Tauri/Rust desktop code, GitHub Actions, security controls, documentation, generated metadata, and compatibility/release surfaces. Use it whenever reviewing a PR or diff in this repository, especially changes under src/, tests/, packages/, src-tauri/, .github/workflows/, or public MCP metadata/configur
ArabelaTso/Skills-4-SE
code-change-summarizer
Generates clear and structured pull request descriptions from code changes. Use when Claude needs to: (1) Create PR descriptions from git diffs or code changes, (2) Summarize what changed and why, (3) Document breaking changes with migration guides, (4) Add technical details and design decisions, (5) Provide testing instructions, (6) Enhance descriptions with security, performance, and architecture notes, (7) Document dependency changes. Takes code changes as input, outputs comprehensive PR desc
Jamie-BitFlight/claude_skills
python3-development
Use when building Python 3.11+ CLI apps (Typer/Rich), writing pytest test suites, fixing ruff linting or ty/mypy type errors, configuring pyproject.toml, creating portable scripts, or reviewing Python code. Activates on all Python implementation tasks — routes to specialist agents for CLI architecture, test design, packaging, and code review. Authoritative reference for modern Python 3.11-3.14 patterns and TDD workflows.
dotnet/skills
grade-tests
Grades a specified set of test methods individually and produces a concise table mapping each test (fully-qualified name) to a letter grade (A–F), a score band, and a one-line note — designed to be posted as a PR comment. Use when the caller wants per-test feedback on a curated list of methods (for example, the new or modified tests in a pull request), not a suite-wide audit. Polyglot: .NET, Python, TS/JS, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, C++. Input is a list of test methods (or