Skip to content
Back to skills

Typescript 2026 Physic

ASecurity

Enforce standards for high-density, type-safe development. This skill focuses on advanced TS patterns (Generics, Discriminated Unions, Branding) and the elimination of `any` to ensure the runtime stability and developer-velocity of the Sovereign Factory.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
developmenttypescriptapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add iDorgham/Workspace-Factory --skill typescript-2026-physic --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Typescript 2026 Physic?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Typescript 2026 Physic
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/idorgham-typescript-2026-physic/badge)](https://www.skillsdirectory.com/skills/idorgham-typescript-2026-physic)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
type: Skill
subagents: [core-validator, integrity-bot]
agents: [master-guide, swarm-router]
dependencies: [core-orchestration, global-sync]
version: 1.0.0
---



# πŸ”· TypeScript 2026 Type-Safety Physics

## Purpose
Enforce standards for high-density, type-safe development. This skill focuses on advanced TS patterns (Generics, Discriminated Unions, Branding) and the elimination of `any` to ensure the runtime stability and developer-velocity of the Sovereign Factory.

---

## Technique 1 β€” Discriminated Unions for State Management
- **Rule**: Never use broad types for complex state; use Discriminated Unions to ensure logic completeness.
- **Protocol**: 
    1. Define a literal `status` field (e.g., `'idle' | 'loading' | 'success' | 'error'`).
    2. Define unique payloads for each status.
    3. Use exhaustive `switch` statements to handle every state, preventing unhandled edge cases.

---

## Technique 2 β€” Branded Types (Nominal Typing)
- **Rule**: Use branding to prevent "Primitive Obsession" and ensure domain-specific strings (IDs, Emails) aren't mixed.
- **Protocol**: 
    1. Define a unique symbol or property (e.g., `_brand: 'UserId'`).
    2. Cast primitive values to the branded type through a validation function.
    3. Ensure APIs strictly require the branded type, preventing accidental use of a standard String.

---

## πŸ›‘οΈ Critical Failure Modes (Anti-Patterns)

| Anti-Pattern | Result | Correction |
| :--- | :--- | :--- |
| **"any" or "unknown" abuse** | Silent runtime crashes | Use `zod` for parsing unknown inputs; use `Satisfies` or `Infers` for structural typing. |
| **Treated types as Documentation** | Lying to the compiler | Ensure types reflect reality; if a field can be nullable, mark it `?` properly. |
| **Monolithic interface definitions** | Rigidity / Bloat | Decompose large interfaces into functional "Mixins" or small atomic pieces. |

---

## Success Criteria (TypeScript QA)
- [ ] `strict: true` is enabled in all `tsconfig.json` files.
- [ ] 0% usage of `any` across the production codebase.
- [ ] 100% classification of external API responses via Zod schemas.
- [ ] Complex generics are documented with usage examples.

Files in this skill

  • SKILL.md2.1 KB
  • core.py374 B
  • manifest.yaml192 B
  • tests/test_core.py314 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development β†’

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.