typescript-guidelines

Enforce strict TypeScript guidelines for type safety across codebases.

Updated Mar 28, 2025
One-click install
npx skills add https://github.com/gileck/app-template-ai --skill typescript-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-guidelines
Source: https://github.com/gileck/app-template-ai/tree/main/.ai/skills/template/typescript-guidelines
Command: npx skills add https://github.com/gileck/app-template-ai --skill typescript-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a concise, prescriptive set of TypeScript guidelines to improve type safety, consistency, and maintainability across a codebase.

Core Features & Use Cases

  • Strict type safety: Enforces no usage of any and encourages explicit types, parameters, and return types.
  • Generics and typing patterns: Recommends descriptive generic types, union types over enums, and proper use of interfaces vs types.
  • Project-wide configuration: Encourages enabling strict mode in tsconfig.json and maintaining cohesive type-naming conventions.
  • Use Case: Ideal when starting a new TypeScript project or auditing an existing one to improve reliability and developer happiness.

Quick Start

Review the TypeScript guidelines when writing or reviewing code. Apply the rules to a sample module by annotating parameters and return types, removing any usage of any, and replacing enums with union types where appropriate. For the AI assistant, prompt: "Apply the TypeScript guidelines to the following codebase to improve type safety and consistency."

Frequently Asked Questions about typescript-guidelines

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

FAQPage Schema
How do I enforce strict TypeScript guidelines to improve type safety in my codebase?

To enforce strict TypeScript guidelines, enable strict mode in tsconfig.json, avoid using any, define explicit parameter and return types, and prefer union types over enums. This ensures consistent type safety across frontend, backend, library, and Next.js projects.

Why should I use union types instead of enums in TypeScript?

Union types are preferred over enums in TypeScript because they enhance type safety and consistency without the runtime overhead enums introduce. Using union types aligns with strict TypeScript guidelines to improve codebase maintainability and reliability.

What's the best way to configure tsconfig.json for maximum type safety?

The best way to configure tsconfig.json for type safety is to enable strict mode. This enforces strict TypeScript guidelines across your project, requiring explicit types and eliminating unsafe type usage like any to improve overall codebase reliability.

Can I apply these TypeScript coding standards to existing Next.js and backend projects?

Yes, you can apply these TypeScript coding standards to existing Next.js, backend, and library projects. The guidelines are designed to guide developers during code authoring, reviews, and migrations to enhance type safety and consistency across various project types.

How do I document complex generics in TypeScript?

To document complex generics in TypeScript, provide descriptive names for generic types and add clear documentation explaining their constraints and usage. This is a core guideline for maintaining type safety and code clarity when working with advanced typing patterns.

When should I use interfaces versus types in TypeScript?

TypeScript guidelines recommend proper use of interfaces versus types to maintain cohesive type-naming conventions. Choosing the appropriate structure ensures consistent type safety and improves codebase maintainability across frontend and backend projects.