Agent skill
nasa_typescript_safety
Adapts NASA's "Power of 10" safety rules for high-reliability TypeScript code.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/nasa-typescript-safety-cityfish91159-maihouses
SKILL.md
NASA TypeScript Safety Protocol
1. Simple Control Flow
- Rule: Avoid complex recursion. Use simple iteration.
- Limit: functions should be perceivable on a single screen (approx 50-60 lines). If longer, Refactor.
2. Strict Scope & Initialization
- Rule: Variables must be declared in the smallest possible scope (
const>let>var). - Initialization: Objects should be fully initialized. Avoid "build-up" patterns where properties are added later (forces consistent Shapes/Hidden Classes).
3. The "No Magic" Rule (Type Safety)
- Strict Ban:
as unknown as Type. If you need this, your types are wrong. - Strict Ban:
any. Useunknownwith Type Guards if data is truly dynamic. - Validation: Input data (from API/User) MUST be validated (Zod) at the boundary. Never trust external input.
4. Robust Error Handling
- Rule: Check return values. Promises must be caught.
- Crash Proof: Critical flows (Payment, Data Save) must have
try/catchand recovery logic, not just "log and crash".
5. Safety Checklist
- Is the function small enough?
- Did I remove all
anyuses? - Is there any unhandled Promise rejection?
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?