simplify-python
Skill10 starsChanged 19 days agoMITView on GitHub
Simplify recently written or edited Python for readability without changing behavior. Use for cleanup, idiomatic rewrites, flatter control flow, and trimming redundant code or docstrings. Not for performance tuning or behavior-changing redesign.
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agents-md-improverSkill
- ai-tutorialSkill
- deassembleSkill
- excalidraw-diagramSkill
- find-overlapping-skillsSkill
- first-principlesSkill
- humanizerSkill
- improve-skillsSkill
- local-artifactSkill
- loom-transcriptSkill
- manage-contextSkill
- organize-skill-mcpSkill
- pair-consultSkill
- pair-optimizeSkill
- pair-ratchetSkill
- pr-classifySkill
- pr-reportSkill
- scan-sessions-and-learnSkill
- skill-flowSkill
- slack-commSkill
- socratesSkill
- step-by-stepSkill
- sub-consultSkill
- to-dbmlSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Use guard clauses for preconditions and continue for rejected loop items.
- Distinctive: line 19
Remove dead code, redundant state, and intermediates that add no meaning.
- Distinctive: line 20
Keep related calculations, explanations, and uses close without changing evaluation order, timing, lifetime, or scope.
- Distinctive: line 23
Don't Repeat Yourself (DRY): deduplicate shared knowledge that changes together, not merely similar-looking code.
- Distinctive: line 29
Use these when clearer and equivalent for the actual code.
- Very specific: line 31
Prefer enumerate, zip, and unpacking over manual indexing and temporary swaps.
- Very specific: line 32
Use comprehensions for simple collection building.
- Very specific: line 33
Prefer named builtins and standard-library tools (sum, Counter, defaultdict, pathlib) when they remove bookkeeping.
- Very specific: line 34
Consider f-strings for formatting.
- Very specific: line 35
Consider dataclass for plain data containers after checking generated methods against the existing contract.
- Distinctive: line 36
Use walrus expressions, structural matching, and iterator chains selectively.
- Very specific: line 42
Do not add missing docstrings during cleanup unless asked.
- Distinctive: line 48
Run relevant existing tests and applicable lint/type checks, plus required repository checks.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
simplify-python
Optimize for reader effort, not line count. Work on recently modified code unless asked otherwise; follow repository conventions and the supported Python version.
Contract
Preserve return values, exception types and timing, side effects and their order, and observable laziness/short-circuiting. Base equivalence on actual types, callers, and contracts; skip unresolved uncertainty. A zero-change pass is valid.
Readability rules
Tiebreaker (Reversibility): when two forms read equally well, prefer the one that is easier to change; cleanup should not lock in choices that are currently cheap to revisit.
- Use guard clauses for preconditions and
continuefor rejected loop items. Keep peer branches together when that reads better. - Remove dead code, redundant state, and intermediates that add no meaning. Keep explaining variables and names that express domain meaning or units.
- Keep related calculations, explanations, and uses close without changing evaluation order, timing, lifetime, or scope.
- Extract a helper when its name exposes a meaningful step and saves more effort than the indirection costs. Avoid helpers requiring tangled state or vague names.
- Inline thin, single-use helpers only when they provide no domain meaning, public interface, test seam, or extension point.
- Don't Repeat Yourself (DRY): deduplicate shared knowledge that changes together, not merely similar-looking code. Counts and nesting depth are review signals, not targets.
- Orthogonality: do not couple independent parts through a shared helper, flag, or state, so a change to one does not ripple into the others. When DRY and Orthogonality conflict, keep unrelated code separate.
- Simplify boolean expressions only when easier to read; do not mechanically push negations inward.
Python idioms
Use these when clearer and equivalent for the actual code. Read the relevant entries in Python gotchas when a candidate touches iteration, comparisons, cleanup, mappings, or implicit behavior.
- Prefer
enumerate,zip, and unpacking over manual indexing and temporary swaps. - Use comprehensions for simple collection building; keep explicit loops for complex control flow. Consider
any/allfor short-circuit searches. - Prefer named builtins and standard-library tools (
sum,Counter,defaultdict,pathlib) when they remove bookkeeping. - Consider f-strings for formatting; retain lazy logging arguments such as
logger.info("got %s", x). - Consider
dataclassfor plain data containers after checking generated methods against the existing contract. - Use walrus expressions, structural matching, and iterator chains selectively; saving lines alone is not a reason.
Docstrings
Trim prose that repeats the signature or implementation. Keep contracts, units, ranges, exceptions, mutation, and rationale. Use a short imperative summary; add detail only when useful to callers. Follow repository formatting conventions.
Do not add missing docstrings during cleanup unless asked. Preserve doctests and any runtime use of __doc__.
Workflow
- Inspect the changed region and relevant callers; choose useful simplifications.
- Batch related tidyings and keep unrelated changes separable.
- Run relevant existing tests and applicable lint/type checks, plus required repository checks. Broaden for scope, failures, or uncertainty; green tests alone do not establish equivalence.
- Report changes and verification, including material baseline failures or limitations. Explain non-obvious equivalence and mention skipped candidates only when material to the result.
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
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.

