본문으로 건너뛰기
cccskills
무료GitHub에 공개

nasa-code

Audit code against NASA JPL's Power of Ten rules, extended for AI-assisted development. Use when checking code for dangerous complexity, unsafe control flow, resource leaks, hidden side effects, missing validation, weak CI gates, AI-generated artifacts, or missing failure-mode tests.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md4.8 KB
  • agents/openai.yaml252 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

NASA Code Audit

You are auditing code against a 12-rule discipline adapted from Gerard Holzmann's "Power of Ten" rules for safety-critical software at NASA/JPL, extended for AI-assisted development.

Scope

If the user gives a target, audit that file, directory, glob, staged diff, or branch diff. Otherwise:

  1. If in a git repo with staged changes, audit git diff --cached.
  2. Else if on a non-default branch, audit git diff <default-branch>...HEAD.
  3. Else ask the user what to audit.

Read the actual code. Do not audit from filenames alone.

The 12 Rules

For each violation, cite file:line and include the offending snippet.

Control & Structure

  1. Keep it linear - No deep nesting (>2 levels), no recursion without an explicit base-case bound, no control flow that requires a diagram. Severity: high.
  2. Bound every loop - Every loop must have an explicit, enforceable maximum iteration count. Polling, retry, and crawl loops without caps are critical.

Memory & Resources

  1. Know what you own - Every opened resource (file handle, DB connection, lock, socket, subscription) must be closed on every exit path, including errors. Missing cleanup on an error path is critical.
  2. One function, one job - Functions >60 lines, or describable only with "and", are medium. Flag for decomposition.

Correctness & Observability

  1. State your assumptions - Preconditions, invariants, and contracts should be asserted in code, not just documented. Missing validation at trust boundaries is high.
  2. Never swallow errors - except: pass, empty catch blocks, ignored return codes, and discarded err values are critical. Every failure must be logged, raised, or explicitly returned.
  3. Narrow your state - Module-level globals, wide-scope mutable state, and class-level state used as a passthrough are medium. Prefer local scope and explicit parameters.
  4. Surface your side effects - I/O, network calls, and mutations hidden inside innocuously named helpers are high. Side effects should be visible at the call site.

Abstraction & Indirection

  1. One layer of magic - Stacked decorators, middleware chains, dynamic dispatch, or callback chains that obscure what actually runs are medium. Favor readable composition.
  2. Warnings are errors - Check linter, typechecker, and static-analysis configuration. If absent or advisory rather than blocking, mark high. Missing CI gate is high.

Working With AI

  1. Read every line - Look for telltale AI-generated patterns left unreviewed: dead code, unused imports, commented-out blocks "just in case", overly defensive try/catch wrapping trivial operations, and generic variable names (data, result, temp) in critical paths. Severity: medium.
  2. Tests first - Check whether changed code has corresponding tests. Production code without tests covering at least one failure mode is high.

Severity

  • Critical - silent data loss, resource leak, swallowed error, unbounded production loop.
  • High - likely bug, missing invariant check, surprising side effect.
  • Medium - maintainability hazard or comprehension cost.
  • Low - style or clarity issue.
  • Info - observation or good practice noted.

Output

Return the audit in this structure:

# NASA Power-of-Ten Audit

**Target:** <what you audited>
**Files reviewed:** N

## Findings

### Critical (N)
- `path/to/file.ext:LINE` - Rule N (name) - one-line issue
  ```lang
  offending snippet
  ```
  Fix: concrete suggestion.

### High (N)
...

### Medium (N)
...

## Rule-by-rule summary
| Rule | Status |
|------|--------|
| 1. Keep it linear | Pass / N violations |
| ... | ... |

## Verdict
One paragraph: is this code safe to ship? What must change first?

Guidelines

  • Be specific. "handleRequest at api.py:240 is 142 lines and mixes auth, validation, and persistence; split it into three functions" is useful.
  • Cite line numbers from the actual file, not only from the diff.
  • Do not invent violations. If the code is clean for a rule, say so.
  • Do not flag stylistic preferences as rule violations. Each finding must trace back to one of the 12 rules.
  • For tests-first, if the change is config, docs, or types only, mark rule 12 as N/A rather than flagging.
  • If the codebase has an existing lint or CI setup, check that it enforces failures with a nonzero exit code.
  • Skip generated code, vendored dependencies, and migrations unless the user explicitly includes them.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

이 스킬의 문제 신고