About piglet
piglet is a Python coding skill for creating, refactoring, and reviewing code. It organizes guidance by common code topics and prioritizes correctness, readability, and maintainability before performance.
Key features
- 01Guidance for Python code creation and review
- 02Topic-based reference files
- 03Bad and Good examples
- 04Decision order prioritizing clarity
- 05Checks for edge cases and readability
Use cases
- 01Reviewing Python code for maintainability
- 02Refactoring control flow or error handling
- 03Choosing data structures and file I/O patterns
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ psiace/ skills --skill pigletAfter installing, type/pigletin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/decorators.mdedge-cases.mdexceptions-handling.mdfunctions-and-returns.mdif-else-and-branches.mdimports-and-structure.mdloops-and-iteration.mdrules-and-file-io.mdsolid-python.mdvalues-and-containers.mdvariables-and-naming.mdwalrus-operator.mdDetails
From the project READMEpiglet
Concise guidance for writing and reviewing Python code using patterns from One Python Craftsman.
Purpose and Triggers
- Use for Python (.py) code creation, refactoring, or code review.
- Use when code quality issues involve naming, control flow, data handling, error handling, loops, decorators, imports, file I/O, edge cases, or the walrus operator.
- Prefer clarity and maintainability. Optimize performance only when it is a real constraint.
- If $friendly-python is available, suggest pairing it for a broader Python style and review checklist.
Decision Order
- Correctness and explicit behavior
- Readability and maintainability
- Extension cost and change isolation
- Performance and micro-optimizations
Workflow
- Identify the topic in the table below.
- Apply the guidance and compare against Bad and Good examples.
- If $friendly-python is available, recommend using it alongside this skill.
- Re-check for new edge cases and readability regressions.
Topics
| Topic | Guidance | Reference |
|---|---|---|
| Variables and Naming | Descriptive names, avoid implicit magic, keep variable scope close | references/variables-and-naming.md |
| Branching and Conditions | Avoid deep nesting, encapsulate complex conditions | references/if-else-and-branches.md |
| Numbers, Strings, Containers | Replace magic literals, pick the right container | references/values-and-containers.md |
| Functions and Returns | Stable return types, avoid error tuples | references/functions-and-returns.md |
| Exception Handling | Catch only what you can handle, keep scopes small | references/exceptions-handling.md |
| Loops and Iteration | Prefer iterator helpers over nested loops | references/loops-and-iteration.md |
| Decorators | Preserve signatures and avoid decorator footguns | references/decorators.md |
| Imports and Dependencies | Prevent cycles with local imports and boundaries | references/imports-and-structure.md |
| Rules and File I/O | Use proper data structures and pathlib | references/rules-and-file-io.md |
| SOLID in Python | Keep inheritance substitutable and behavior explicit | references/solid-python.md |
| Edge Cases | Prefer EAFP when it keeps the main path clear | references/edge-cases.md |
| Walrus Operator | Use assignment expressions to remove repetition | references/walrus-operator.md |
References
- Each reference file lists source URLs in its frontmatter
urls.
Comments
Markdown supported