Write, refactor, and review Python for clarity, explicit behavior, local reasoning, strong types, constructive domain modeling, and minimal abstraction. Use when creating or changing nontrivial Python, simplifying object-heavy, helper-heavy, or overly procedural code, evaluating whether code is Pythonic, or reviewing Python maintainability in Basic Memory repositories.
70
85%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Write Python that makes domain behavior obvious to human and AI readers. Apply a WWGD lens: choose the simplest correct design that feels native to Python and is easy to verify.
The preferred design method is Constructive Domain Modeling: define the valid values and outcomes a program can construct, then let their types carry obligations to the code that consumes them.
AGENTS.md or CLAUDE.md instructions.docs/ENGINEERING_STYLE.md when present.docs/DOMAIN_MODEL.md when the change touches domain language, ownership, identity,
source-of-truth rules, or lifecycle behavior.Let local project rules override generic style advice.
Constructive Domain Modeling describes what the program supports instead of starting with a broad representation and a growing list of invalid combinations.
type alias.match cases. Use typing.assert_never when it proves
exhaustive handling, and avoid catch-all cases that hide a newly added variant.Before narrowing an ORM model or compatibility schema, trace its writers and serialized forms. Storage may remain broad while a parser constructs a safer domain value for the core workflow.
functools.partial when binding behavior is clearer than creating
another object.functools.singledispatch only when behavior genuinely varies by the first argument's
runtime type and open registration is an intentional extension point.Protocol for genuine replaceable behavior. Do not use property-only protocols to
describe internal result data; return a concrete frozen dataclass unless callers truly require
structural interoperability.Do not replace one class hierarchy with clever functional machinery. Prefer the form with the fewest concepts, hidden rules, and call hops.
_prepare_*, _resolve_*, _apply_*, and _build_* calls as a prompt to
reconsider the data flow or name one meaningful phase object.If extracting a helper makes the reader navigate more but understand no less, keep the logic local.
Any, broad casts,
speculative getattr, or unstructured dictionaries.Establish the valid states, outcomes, and boundary parser first. Implement the direct path, make closed variants exhaustive, then add only the abstractions required by real variation, state, or boundaries.
Preserve observable behavior, keep the diff focused, and add or update a regression test when the behavior is risky. Look for status strings coupled to optional fields, repeated validation, "should never happen" branches, and expected outcomes carried by exceptions. Replace them only when a smaller constructive model removes a real unsupported state. Do not mechanically rewrite already-clear code, convert I/O failures to Result types, or reshape persisted data before tracing its writers.
Report concrete readability, abstraction, typing, lifecycle, and domain-model risks. Explain the smallest practical improvement. Ask which invalid state or unhandled obligation a proposed type actually removes; stronger-looking types without a concrete payoff are not an improvement. Do not edit unless the user asks for fixes.
Run the narrowest command that proves the change, then widen according to risk:
Lead the final response with the outcome and verification. Explain design choices only when they are non-obvious or materially affect future work.
3bf2d52
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.