using-power-of-ten
Skill1 starsChanged 2 months agoMITView on GitHub
Apply NASA/JPL's Power of Ten rules and the Refactoring.Guru code-smell catalog while writing, changing, reviewing, or refactoring Python. Use for any Python implementation task in a project that has adopted strict reliability or maintainability guardrails.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- applying-solid-principlesSkill
- bounded-loopsSkill
- limiting-nestingSkill
- review-code-qualitySkill
- writing-docstringsSkill
- writing-maintainable-pythonSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 10 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Treat these rules as constraints while designing and editing code, then verify the finished diff.
- Distinctive: line 20
Treat a code smell as a design signal, not an automatic defect.
- Very specific: line 27
Keep control flow simple. Do not use direct or indirect recursion.
- Distinctive: line 34
Keep each function at about 60 physical lines or fewer.
- Very specific: line 43
Avoid behavior hidden from static analysis: eval, exec, dynamic imports, runtime code generation, and unjustified attribute magic.
- Distinctive: line 45
Keep indirection shallow. Replace long message chains and opaque callback dispatch with named, typed boundaries.
- Distinctive: line 47
Run the project's strictest compiler, linter, type checker, and tests.
- Very specific: line 63
Before editing, inspect repository guidance and existing validation commands.
- Distinctive: line 73
Prefer the smallest design that satisfies the requirement.
- Distinctive: line 77
Never hide a violation. If compliance is infeasible, explain the tradeoff and obtain an explicit decision.
- Distinctive: line 85
Run its bundled Python checker on changed Python files.
- Distinctive: line 86
Run the repository's relevant lint, type-check, and test commands.
- Distinctive: line 90
Use a narrow suppression only for a confirmed false positive:
≈ “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
Reliable Python
Treat these rules as constraints while designing and editing code, then verify the finished diff. Optimize for code whose resource use, control flow, and failure modes a reviewer can enumerate.
Scope and honesty
Apply an intent-preserving Python profile of Gerard Holzmann's C-oriented Power of Ten rules. Do not describe the result as literal C compliance, NASA certification, or proof of safety. Rules 3, 8, and 9 require language-specific translation; read the rule mapping whenever they are relevant.
Treat a code smell as a design signal, not an automatic defect. Confirm a concrete cost—harder change, hidden failure, duplication, or excess coupling— before refactoring. Read the smell catalog for any structural change or review.
Working rules
- Keep control flow simple. Do not use direct or indirect recursion. Do not
use exceptions for ordinary branching. Keep block nesting at four levels or
fewer; load
limiting-nestingwhen a function goes deeper. - Give every terminating loop a preset upper bound. Make an intentionally non-terminating service loop explicit and keep bounded work inside it.
- Bound runtime growth. Put ceilings on collections, queues, caches, input sizes, retries, concurrency, and other resources.
- Keep each function at about 60 physical lines or fewer. Extract coherent units instead of compressing statements.
- Maintain at least two meaningful, side-effect-free defensive checks per
function on average. Prefer explicit guard-and-raise logic for production
invariants because Python can remove
assertstatements with-O. - Declare and mutate data in the narrowest useful scope. Avoid mutable
globals,
global, and mutable default arguments. - Validate public-boundary parameters and handle fallible results. Never
swallow an error with
except: passor discard a status accidentally. - Avoid behavior hidden from static analysis:
eval,exec, dynamic imports, runtime code generation, and unjustified attribute magic. - Keep indirection shallow. Replace long message chains and opaque callback dispatch with named, typed boundaries.
- Run the project's strictest compiler, linter, type checker, and tests. End with zero warnings in the changed scope; fix confusing code instead of silencing tools without a written reason.
Documentation convention
This is a project convention, not one of Holzmann's ten rules. Document every
public module, class, and function in this project's configured convention,
which defaults to NumPy style; it carries per-parameter types, defaults, and
constraints that a reader needs to enumerate a function's inputs. Google and
reST are supported alternates, set per project. The active convention is stated
at the end of this policy. Load writing-docstrings before writing or
restructuring a docstring.
Workflow
Before editing, inspect repository guidance and existing validation commands.
Load bounded-loops before implementing retry, polling, pagination,
convergence, stream-consumption, or other variable-length loops.
Load writing-maintainable-python for entry points, public type contracts,
function decomposition, or comprehension choices. Load
applying-solid-principles for class hierarchies, protocols, interfaces, or
dependency boundaries.
While editing:
- Prefer the smallest design that satisfies the requirement.
- Preserve behavior unless the user requests a behavior change.
- Address smells in touched code when the benefit is concrete and the change stays in scope; do not launch unrelated cleanup.
- Never hide a violation. If compliance is infeasible, explain the tradeoff and obtain an explicit decision.
Before finishing:
- Inspect the complete diff and trace affected callers, tests, and failure paths.
- Invoke
review-code-qualityfor a structured semantic review. - Run its bundled Python checker on changed Python files.
- Run the repository's relevant lint, type-check, and test commands.
- Fix confirmed findings. Report remaining exceptions with rule or smell ID, evidence, impact, and rationale.
Use a narrow suppression only for a confirmed false positive:
# quality: ignore[POT02] - process scheduler is intentionally non-terminating
while True:
run_one_bounded_cycle()Require a specific rationale after the marker. Never add a suppression merely to make the checker pass.
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.

