nasa_typescript_safety
Installation
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
Related skills
More from cityfish91159/maihouses
agentic_architecture
Enforces high-level architectural thinking, separation of concerns, and scalability checks before coding.
19code-review-excellence
程式碼審查最佳實踐指南。當進行 PR review、代碼審查或用戶提到「review」、「審查」時使用。
19frontend_mastery
Advanced React patterns, performance optimization, and state management rules.
18code-simplifier
|
18type-checker
執行 TypeScript 類型檢查並修復類型錯誤。當遇到類型錯誤、需要類型定義、或用戶提到「type」、「類型」時使用。
18rigorous_testing
|
18