typescript

Enforce strict TypeScript patterns for const objects, flat interfaces, and safe generics.

2|Updated Jul 29, 2025
One-click install
npx skills add https://github.com/kurojs/ender4-dots --skill typescript-kurojs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/kurojs/ender4-dots/tree/main/.config/opencode/skill/typescript
Command: npx skills add https://github.com/kurojs/ender4-dots --skill typescript-kurojs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforce strict TypeScript patterns to improve code quality and consistency across codebases by preventing common anti-patterns and enabling better tooling support.

Core Features & Use Cases

  • Const Types Pattern: Create a single source of truth with const objects and derive unions for safe runtime values.
  • Flat Interfaces: Define one-level-deep interfaces to keep type references simple and maintainable.
  • Never Use any: Prefer unknown and generics to preserve type safety while handling uncertain inputs.
  • Type Guards & Imports: Use type guards and explicit type imports to ensure correct type narrowing and module boundaries.

Quick Start

Create a strict TypeScript setup and apply the patterns to define const objects, flat interfaces, and safe generics.

Frequently Asked Questions about typescript

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

FAQPage Schema
What's the best way to enforce strict TypeScript patterns for code quality?

The best way to enforce strict TypeScript patterns is by applying const-based patterns, flat interfaces, and unknown over any to ensure consistent type design and improve maintainability across modules.

How do I avoid using `any` while maintaining type safety in TypeScript?

To avoid using `any` in TypeScript, prefer `unknown` and generics to preserve type safety while handling uncertain inputs. This approach enables better tooling support and prevents common anti-patterns.

What is the const types pattern in TypeScript and when do I need it?

The const types pattern in TypeScript creates a single source of truth with const objects and derives unions for safe runtime values. You need it to ensure consistent type design and prevent common anti-patterns.

Why should I use flat interfaces in TypeScript projects?

You should use flat interfaces in TypeScript projects to keep type references simple and maintainable. Defining one-level-deep interfaces ensures consistent type design and improves code quality across modules.

How do I set up type guards and explicit type imports for module boundaries?

To set up type guards and explicit type imports for module boundaries, use them to ensure correct type narrowing and separate module boundaries. This preserves type safety while handling uncertain inputs.

Does this TypeScript best practices approach work with existing projects?

Yes, this TypeScript best practices approach works with existing projects by applying concrete patterns like const objects, flat interfaces, and safe generics to enforce strict typing and improve code quality.