Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
athola avatar

Safety Critical Patterns

  • 100 installs
  • 325 repo stars
  • Updated August 2, 2026
  • athola/claude-night-market

Safety-Critical Patterns is an agent skill that applies NASA-adapted Power of 10 rules for verifiable, defensive code.

About

Safety-Critical Patterns is a code-quality skill that brings NASA JPL Power of 10 discipline into agent-assisted reviews for solo builders shipping money-moving, health-adjacent, or reliability-sensitive logic. It is not a blanket style guide: you match rigor to consequence—full rule sets on integrity-critical modules, selective checks on business logic and handlers, and a lighter pass only on throwaway scripts. The skill encodes verifiable habits such as acyclic control preferences, bounded loops, and assertion-friendly structure so static reasoning and human review agree. Invoke it during Ship before merge, or during Build when hardening core algorithms you already know will face audits. It pairs conceptually with structured review skills in the same night-market stack. It will not replace domain certifications or penetration tests; it tightens implementation patterns so catastrophic surprises are less likely.

  • Applies 10 NASA Power of 10 rules adapted for modern languages (control flow, loops, assertions)
  • Tiered rigor: full for safety-critical/financial/medical, selective for APIs, light touch for scripts
  • Restricts risky control flow (goto, unbounded recursion) with documented termination expectations
  • Demands fixed or documented loop upper bounds with safety limits
  • Integrates with review-core and code-refinement dependencies for structured audit output

Safety Critical Patterns by the numbers

  • 100 all-time installs (skills.sh)
  • Ranked #444 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/athola/claude-night-market --skill safety-critical-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs100
repo stars325
Security audit3 / 3 scanners passed
Last updatedAugust 2, 2026
Repositoryathola/claude-night-market

What it does

Audit or harden code paths where bugs have high consequence using NASA Power of 10–style verifiable patterns.

Who is it for?

Best when you're auditing payment rails, medical-adjacent features, authz, or core algorithms before release.

Skip if: Pure UI polish, marketing copy, or prototypes explicitly marked disposable where formal verification would slow learning without benefit.

When should I use this skill?

Auditing financial, medical, or high-reliability system code, or selectively hardening business logic and API handlers.

What you get

Review output maps your code against bounded-loop, control-flow, and assertion expectations with rigor scaled to the module’s consequence class.

  • Structured review findings aligned to Power of 10 rule categories
  • Rigor-tier recommendations (full, selective, light touch)

By the numbers

  • 10 NASA Power of 10 rules adapted for modern development

Files

SKILL.mdMarkdownGitHub ↗

Safety-Critical Coding Patterns

Guidelines adapted from NASA's Power of 10 rules for safety-critical software.

When to Apply

Full rigor: Safety-critical systems, financial transactions, data integrity code Selective application: Business logic, API handlers, core algorithms Light touch: Scripts, prototypes, non-critical utilities

"Match rigor to consequence" - The real engineering principle

The 10 Rules (Adapted)

1. Restrict Control Flow

Avoid goto, setjmp/longjmp, and limit recursion.

Why: Ensures acyclic call graphs that tools can verify. Adaptation: Recursion acceptable with provable termination (tail recursion, bounded depth).

2. Fixed Loop Bounds

All loops should have verifiable upper bounds.

# Good - bound is clear
for i in range(min(len(items), MAX_ITEMS)):
    process(item)

# Risky - unbounded
while not_done:  # When does this end?
    process_next()

Adaptation: Document expected bounds; add safety limits on potentially unbounded loops.

3. No Dynamic Memory After Initialization

Avoid heap allocation in critical paths after startup.

Why: Prevents allocation failures at runtime. Adaptation: Pre-allocate pools; use object reuse patterns in hot paths.

4. Function Length ~60 Lines

Functions should fit on one screen/page.

Why: Cognitive limits on comprehension remain valid. Adaptation: Flexible for declarative code; strict for complex logic.

5. Assertion Density

Include defensive assertions documenting expectations.

def transfer_funds(from_acct, to_acct, amount):
    assert from_acct != to_acct, "Cannot transfer to same account"
    assert amount > 0, "Transfer amount must be positive"
    assert from_acct.balance >= amount, "Insufficient funds"
    # ... implementation

Adaptation: Focus on boundary conditions and invariants, not arbitrary quotas.

6. Minimal Variable Scope

Declare variables at narrowest possible scope.

# Good - scoped tightly
for item in items:
    total = calculate(item)  # Only exists in loop
    results.append(total)

# Avoid - unnecessarily broad
total = 0  # Why is this outside?
for item in items:
    total = calculate(item)
    results.append(total)

7. Check Return Values and Parameters

Validate inputs; never ignore return values.

# Good
result = parse_config(path)
if result is None:
    raise ConfigError(f"Failed to parse {path}")

# Bad
parse_config(path)  # Ignored return

8. Limited Preprocessor/Metaprogramming

Restrict macros, decorators, and code generation.

Why: Makes static analysis possible. Adaptation: Document metaprogramming thoroughly; prefer explicit over magic.

9. Pointer/Reference Discipline

Limit indirection levels; be explicit about ownership.

Adaptation: Use type hints, avoid deep nesting of optionals, prefer immutable data.

10. Enable All Warnings

Compile/lint with strictest settings from day one.

# Python
ruff check --select=ALL
mypy --strict

# TypeScript
tsc --strict --noImplicitAny

Rules That May Not Apply

RuleWhen to Relax
No recursionTree traversal, parser combinators with bounded depth
No dynamic memoryGC languages, short-lived processes
60-line functionsDeclarative configs, state machines
No function pointersCallbacks, event handlers, strategies

Integration

Reference this skill from:

  • pensive:code-refinement - Clean code and quality dimension
  • sanctum:pr-review - Code quality phase
  • /harden - composed in the hardening pipeline
  • /full-review safety-critical - focused entry point, and an

auto-detection row when assertion density is low, loops are unbounded, or recursion lacks a termination proof

Violation Output Format

For each rule violation, report:

Rule N: <rule name>
Location: file.py:42
Anchor: `<verbatim source text at line 42>`
Issue: <what violates the rule>
Fix: <concrete remediation>

Verify Findings Are Grounded (safety-critical:findings-verified)

Every finding must cite a real location and a verbatim anchor. Write findings to .review/findings.json and confirm each citation resolves:

python plugins/imbue/scripts/citation_verifier.py \
  --findings .review/findings.json --repo-root .

Drop or label UNVERIFIED any finding the verifier fails (exit 1); only verified findings enter the report. See Skill(imbue:review-core) Step 5 and Skill(imbue:structured-output) for the schema.

Exit Criteria

  • [ ] Each of the 10 rules has an explicit verdict for the target

(applies / violated / not applicable), not a silent skip

  • [ ] Every reported violation cites a concrete file:line and the

rule number it breaks

  • [ ] Rules deemed not applicable name the reason (e.g. "no dynamic

allocation in this module") rather than being omitted

  • [ ] Loops flagged under Rule 2 are checked for a statically

provable upper bound; unbounded loops are reported

  • [ ] Recursion flagged under Rule 1 is reported when it lacks a

termination argument

  • [ ] A summary states whether the target is suitable for

safety-critical use, or which rules block that judgment

  • [ ] Every reported violation carries a Location + verbatim Anchor

confirmed by citation_verifier.py (exit 0), or unverified violations were dropped or labeled UNVERIFIED.

Sources

  • NASA JPL Power of 10 Rules (Gerard Holzmann, 2006)
  • MISRA C Guidelines
  • HN discussion insights on practical application

Related skills

How it compares

Use for consequence-scaled defensive coding audits, not for generic lint autofix or dependency CVE scanning alone.

FAQ

Who is safety-critical-patterns for?

Developers and agent users working on high-reliability or regulated-adjacent code who want NASA-inspired verifiable patterns during review.

When should I use safety-critical-patterns?

In Ship review before merging risky modules, in Build backend while shaping core algorithms, and in Ship security passes on integrity-critical paths—not on every stylesheet tweak.

Is safety-critical-patterns safe to install?

Check the Security Audits panel on this page; the skill reads and critiques your codebase and may chain to other review skills in the same repo.

Code Review & Qualityappseccompliance

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.