bp-typescript

Enforce TypeScript best practices with strict compiler settings and Zod validation.

9|4|Updated May 30, 2025
One-click install
npx skills add https://github.com/Kaikei-e/Alt --skill bp-typescript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bp-typescript
Source: https://github.com/Kaikei-e/Alt/tree/main/.claude/skills/bp-typescript
Command: npx skills add https://github.com/Kaikei-e/Alt --skill bp-typescript

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a clear, enforceable set of TypeScript conventions to prevent runtime type errors, preserve literal typing, and ensure consistent validation at API boundaries so teams maintain high code quality and avoid subtle type-related bugs.

Core Features & Use Cases

  • Compiler Configuration: Enforces strict compiler flags including strict and noUncheckedIndexedAccess to reduce accidental runtime failures.
  • Boundary Safety & Validation: Treat external inputs as unknown, prefer Zod schemas for runtime validation, and centralize API boundary checks.
  • Type Discipline: Prefer type guards and discriminated unions, use satisfies to preserve literal inference, avoid non-null assertions, and import types explicitly.
  • Use Case: Use these guidelines when implementing frontend services or shared libraries (for example alt-frontend-sv, auth-token-manager, or alt-perf) to ensure predictable behavior and robust typing across modules.

Quick Start

Run a best-practices audit on any modified .ts or .tsx file and apply strict compiler settings, unknown-based boundaries, type guards, and Zod validation where external data is consumed.

Frequently Asked Questions about bp-typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce TypeScript strict mode and prevent runtime type errors?

You can prevent runtime type errors by enforcing TypeScript strict mode with strict and noUncheckedIndexedAccess compiler flags, treating external inputs as unknown, and applying Zod schemas for runtime validation at API boundaries.

What is the best way to validate unknown API responses in TypeScript?

The best way to validate unknown API responses in TypeScript is to treat external inputs as unknown, prefer Zod schemas for runtime validation, and centralize API boundary checks to ensure predictable behavior and robust typing across modules.

How do I use discriminated unions and type guards for exhaustive type checking?

Use discriminated unions and type guards for exhaustive type checking by applying the satisfies operator to preserve literal inference, avoiding non-null assertions, and explicitly importing types to maintain strict type discipline across your codebase.

Do I need Zod to handle type safety for external data in .ts and .tsx files?

Yes, you need Zod to handle type safety for external data in .ts and .tsx files, as it provides runtime validation schemas that complement strict compiler settings by ensuring reliable parsing of unknown inputs at API boundaries.

How do I audit a TypeScript codebase for best practices and type safety?

Audit a TypeScript codebase for best practices by checking modified .ts and .tsx files for strict compiler settings, unknown-based external boundaries, discriminated union exhaustiveness, use of type guards, and Zod validation where external data is consumed.