python-best-practices
Write maintainable Python with small functions, explicit boundaries, guard clauses, and readable state flow. Use when refactoring Python services, helpers…
by HoangNguyen0403★ 598 GitHub stars
Install python-best-practices in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Python Best Practices
Priority: P1 (HIGH)
Rules
- Prefer small focused functions over long stateful procedures.
- Push parsing, formatting, transport, and persistence into separate helpers.
- Return early on invalid or terminal states.
- Pass collaborators in; do not hide them behind globals or import-time singletons.
- Keep naming literal and domain-specific.
Recipe
- Split orchestration from transformation.
- Extract repeated shape cleanup into one helper.
- Keep side effects at edges and pure decisions in the middle.
- Use fakes in tests instead of patching deep internal chains when possible.
Anti-Patterns
- No god functions: break report builders and workflow loops into tested slices.
- No boolean soup: name decision helpers instead of stacking flags inline.
- No hidden retries: surface retry policy near the call site.
- No print-debugging in shared runtime code: use structured logging or test assertions.
References
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- evals/evals.json
FAQ
What does the python-best-practices skill do?
Write maintainable Python with small functions, explicit boundaries, guard clauses, and readable state flow. Use when refactoring Python services, helpers, modules, or async logic for clarity—not generic test writing, tooling setup, or database transaction implementation.
How do I install the python-best-practices skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the python-best-practices skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…