skills/typescript-clean/SKILL.md
# Skill: TypeScript Clean Code (Staff Engineer) # Usage: Use for any TypeScript-based project to ensure enterprise-grade type safety and readability. ## Core Rules: - **Strict Typing:** Never use `any`. Use `unknown` with type guards if the type is truly uncertain. - **Interfaces vs Types:** Use `interface` for public APIs (extendability) and `type` for unions, intersections, and primitives. - **Functional Patterns:** Prioritize immutability. Use `readonly` for arrays and objects where possible
npx skillsauth add shalin-rahman/Synapticity skills/typescript-cleanInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
any. Use unknown with type guards if the type is truly uncertain.interface for public APIs (extendability) and type for unions, intersections, and primitives.readonly for arrays and objects where possible.Error classes or the Result pattern (e.g., { success: true, data: T } | { success: false, error: E }) for predictable logic.PascalCase for classes/interfaces, camelCase for variables/functions, and UPPER_SNAKE_CASE for constants.type ApiResponse<T> =
| { status: 'success'; data: T }
| { status: 'error'; message: string; code: number };
function handle(res: ApiResponse<User>) {
if (res.status === 'success') {
return res.data.name; // Type is narrowed
}
}
Record<K, V> over index signatures.tools
# Skill: Zero-Defect Software Engineering # Focus: Writing immortal, self-documenting, and resilient source code. ## Playbook Strategy: 1. **SOLID Foundations**: - **Single Responsibility**: Every class/function does ONE thing perfectly. - **Open/Closed**: Design for extension without modification. 2. **DRY (Don't Repeat Yourself)**: If logic appears twice, abstract it into a utility or base class. 3. **Defensive Programming**: - Validate every input. - Handle every exception specif
development
# Skill: Advanced Testing Strategies (TDD / BDD) # Usage: Use to enforce high code quality, prevent regressions, and ensure requirements are met implicitly. ## 🧪 The Testing Pyramid - **Unit Tests (70%)**: Fast, isolated tests for individual functions and classes. Mock all external dependencies. - **Integration Tests (20%)**: Test the interaction between several units or external systems (e.g., Database, APIs). - **End-to-End (E2E) Tests (10%)**: Slow, brittle tests that verify the system as a
development
# Skill: Technical Hand-off & Clarity # Focus: Professional documentation for human and machine consumption. ## Playbook Strategy: 1. **The "ReadMe First" Rule**: Use structured, hierarchical markdown. High-level summary first, deep-dive implementation second. 2. **Contextual Grounding**: Explain the "Why" and the "How" for every project. 3. **Semantic Clarity**: Use industry-standard terminology. Avoid jargon where simple language suffices. 4. **Machine-Readable Annotations**: Include clear co
development
# Skill: SQLAlchemy Expert (Performance & Safety) # Usage: Use for backend services involving SQL databases and SQLAlchemy ORM (v2.0+). ## Best Practices: - **Async Engine:** Use `AsyncSession` and `create_async_engine` for modern FastAPI backends. - **Declarative Mapping:** Use `Mapped` and `mapped_column` for modern v2.0 type hinting. - **Relationship Management:** Always specify `lazy="selectin"` for collections or `joinedload` for many-to-one to avoid N+1 query problems. - **Transaction Saf