Skip to content

anxplore/power-of-ten-coding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

power-of-ten-coding

Agents skill that applies NASA JPL's Power of Ten safety-critical coding rules to any programming language.

When this skill is active, AI agent reviews and writes code against all ten rules — flagging violations, explaining why each rule matters, and showing corrected versions.

Installation

Download power-of-ten-coding.skill for Claude or power-of-ten-coding/SKILL.md for most AI agents.

Once installed, AI agent will apply the Power of Ten rules whenever you ask for a code review, request help writing safe or robust code, or mention coding standards, static analysis, or defensive programming.

What It Does

Given any code in any language, AI agent will check each rule in order and produce a structured report:

Rule 1 — Control Flow: PASS
Rule 2 — Bounded Loops: FAIL
  → Line 42: while loop has no upper bound. Add an explicit counter
    with an assertion that it does not reach the ceiling.
Rule 3 — No Dynamic Allocation: PASS
...

It also applies these rules when writing new code from scratch — checking each constraint before and after writing a function.

The Ten Rules

# Rule Core Constraint
1 Simple control flow Acyclic call graph; no recursion
2 Bounded loops Every loop has a provable maximum
3 No runtime allocation Acquire all resources at initialization
4 Short functions ≤ 60 lines; one responsibility
5 Assertion density ≥ 2 assertions per function; side-effect free
6 Minimal scope Declare at point of use; no mutable globals
7 Check return values No silent failures; validate all inputs
8 Limit metaprogramming No hidden code paths; no dynamic evaluation
9 Limit indirection At most one level; no hidden aliases
10 Zero warnings Strict analysis from day one; no suppressions

The rules are language-agnostic — they describe structural and behavioral constraints, not syntax. AI agent translates them into whatever language the code is written in.

Background

The Power of Ten was written by Gerard J. Holzmann at NASA's Jet Propulsion Laboratory as a minimal, enforceable set of coding rules for mission-critical software. The original paper targets C, but the underlying principles apply to any language:

"To be effective, the set of rules has to be small, and must be clear enough that it can easily be understood and remembered."

This skill adapts those principles into a form AI agent can apply consistently during code review and code generation.

Original paper: The Power of Ten – Rules for Developing Safety Critical Code, Gerard J. Holzmann, NASA/JPL.

Skill Source

The skill definition is in skill/SKILL.md. It is plain Markdown — readable without any tooling.

License

MIT — use freely, adapt as needed.

About

Agents skill that enforces NASA JPL's Power of Ten safety-critical coding rules across any programming language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors