python-failure-modes
Skill0 starsChanged 6 months agoMITView on GitHub
Rules for writing or editing Python code. Forbids bare "# type: ignore", "except Exception: pass", mutable default args, time.sleep in async code, Any past data boundaries. Auto-loads on .py file edits.
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- audit-docs-semanticSkill
- audit-docsSkill
- audit-harness-coverageSkill
- budget-statusSkill
- cavemanSkill
- configurationSkill
- critic-reviewSkill
- doc-patternSkill
- error-taxonomySkill
- grill-meSkill
- grill-with-docsSkill
- new-docSkill
- review-changesSkill
- review-docSkill
- rust-failure-modesSkill
- verification-before-completionSkill
- zoom-outSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
No bare
# type: ignore: Use # type: ignore[specific-code] with a # reason: comment. - Very specific: line 13
No
Anypast boundaries: Use TypedDict, Protocol, or dataclass. - Very specific: line 14
No
assertfor runtime validation in prod code: Use if … raise ValueError(...). - Very specific: line 16
No
time.sleepto wait for async/external state: Use await asyncio.sleep, real sync primitives, or deterministic mocks in tests. - Distinctive: line 18
If tempted to break any rule, stop and ask the user.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Apply these rules when touching .py files. Full rationale: .claude/rules/python-llm-failures.md.
- No bare
# type: ignore. Use# type: ignore[specific-code]with a# reason:comment. - No
except Exception: passor bareexcept:. Catch the specific exception you handle, or escalate. Top-level supervisors log and re-raise — never silent. - No global warning suppression. Narrow only —
# noqa: <code>with comment, orfilterwarnings(category=, module=). - No
Anypast boundaries. UseTypedDict,Protocol, ordataclass.Anyis acceptable only at unstructured-data ingress (raw JSON before parsing). - No
assertfor runtime validation in prod code. Useif … raise ValueError(...).assertdisappears under-O. - No mutable default args (
def f(xs=[]): ...). UseNonesentinel and create inside the function. - No
time.sleepto wait for async/external state. Useawait asyncio.sleep, real sync primitives, or deterministic mocks in tests.
If tempted to break any rule, stop and ask the user.
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.

