← ClaudeAtlas

power-of-tenlisted

Write, review, and refactor safety-critical C and C++ code with Gerard Holzmann's "Power of Ten" rules (NASA/JPL) - no recursion or goto, statically bounded loops, no heap allocation after initialization, short functions, recoverable assertions, checked return values, a restricted preprocessor, restricted pointers and no function pointers, and zero warnings at pedantic settings. Use whenever the user mentions safety-critical, mission-critical, flight, spacecraft, avionics, automotive ECU, medical-device, or similar high-assurance embedded code, the Power of Ten or JPL coding rules, or asks to make C/C++ code statically analyzable or to review it against these rules, even if the user does not name the rules. Not for ordinary application C/C++ where the user has not asked for these constraints.
ipapadop/plugins · ★ 0 · Code & Development · score 70
Install: claude install-skill ipapadop/plugins
# Power of Ten: safety-critical C and C++ Gerard J. Holzmann (NASA/JPL Laboratory for Reliable Software) proposed ten rules for safety-critical code. The rules are strict on purpose. Each one makes a property of the code provable by a tool: termination, bounded stack and memory, a known call graph, and a known data flow. Code that follows them can be checked mechanically, not only reviewed by hand. Apply them as written. When code can't comply, state the deviation and the reason in a comment at the site, so that a checker flags it and a reviewer can judge it. The paper targets C. For C++, read [references/cpp.md](references/cpp.md) before you write or review code. It maps each rule to C++ features (exceptions, `new`, standard containers, virtual functions, `std::function`, templates). Those mappings are interpretations of this skill, not text from the paper; say so when you cite them. ## The rules ### 1. Simple control flow Do not use `goto`, `setjmp`, `longjmp`, or direct or indirect recursion. Without recursion the call graph is acyclic, so a tool can prove that execution is bounded and can compute the maximum stack depth. Early `return` for errors is allowed; the rule does not require a single exit point. To remove recursion, use an explicit stack with a fixed capacity in static or caller-provided storage. When the stack is full, return an error. Do not grow it. Look for indirect recursion too: `a()` calls `b()`, which calls `a()`. A function pointer or a callback