typescript-patterns

Provide TypeScript/ESM patterns for code optimization in Night-Orch.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/shllg/night-orch --skill typescript-patterns-shllg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-patterns
Source: https://github.com/shllg/night-orch/tree/main/.claude/skills/typescript-patterns
Command: npx skills add https://github.com/shllg/night-orch --skill typescript-patterns-shllg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a set of TypeScript/ESM patterns for Night-Orch, improving code quality, maintainability, and efficiency.

Core Features & Use Cases

  • ESM Imports: Ensures correct import syntax for TypeScript/ESM modules.
  • Zod Schema Patterns: Utilizes Zod for robust data validation and type safety.
  • Handling noUncheckedIndexedAccess: Guides safe access to object and array properties.
  • Readonly Types: Ensures immutability for function parameters and object fields.
  • Discriminated Unions: Facilitates clear and exhaustive type handling.
  • Vitest Patterns: Implements unit testing with Vitest.
  • Error Types: Standardizes error handling across the Night-Orch codebase.

Quick Start

Apply TypeScript patterns to your Night-Orch scripts for improved performance and reliability.

Frequently Asked Questions about typescript-patterns

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

FAQPage Schema
How do I handle noUncheckedIndexedAccess safely in TypeScript?

To handle noUncheckedIndexedAccess safely in TypeScript, you must perform explicit undefined checks when accessing object and array properties to ensure type safety. This pattern prevents runtime errors by validating that indexed values exist before use.

What's the best way to structure ESM imports in a TypeScript project?

The best way to structure ESM imports in a TypeScript project is to use correct ESM import syntax for module-based architecture. This ensures proper module resolution and enhances code maintainability across the codebase.

How do I use Zod for data validation and type safety in TypeScript?

To use Zod for data validation and type safety in TypeScript, implement Zod schema patterns to validate runtime data structures. This approach guarantees that incoming data matches expected types, reducing runtime errors and improving reliability.

Do I need TypeScript and ESM support to use these code patterns?

Yes, you need TypeScript and ESM support to apply these code patterns, as they require a module-based architecture. This environment is necessary to ensure correct import syntax and robust type handling for optimized performance.

When should I use discriminated unions for type handling in TypeScript?

You should use discriminated unions for type handling in TypeScript when you need clear and exhaustive type checking. This pattern facilitates managing complex data states by ensuring all possible variations are safely handled.

How do I standardize error handling across a TypeScript codebase?

To standardize error handling across a TypeScript codebase, implement standardized error types to manage exceptions consistently. This method ensures predictable error propagation and improves overall code maintainability and reliability.