Skip to content
jwynia avatar

Typescript Best Practices

Practical TypeScript standards covering type safety, error handling, and module structure, with analysis and type-generation scripts.

CCM score
53 of 100
skills.sh installs
638
GitHub stars
195
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers type safety, immutability, Result-based error handling, code organization, and common anti-pattern avoidance
  • Includes analyze.ts for quality checks with --strict, --json, and --fix-hints modes, plus generate-types.ts for JSON-to-type output
  • Enforces unknown over any, readonly collections, explicit return types on exports, and string literal unions over enums
  • Designed for AI agents generating, reviewing, or refactoring TypeScript code in any codebase that uses Deno for its scripts

Install

$ npx -y skills add jwynia/agent-skills --skill typescript-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

TypeScript Best Practices

Guide AI agents in writing high-quality TypeScript code. This skill provides coding standards, architecture patterns, and tools for analysis and scaffolding.

When to Use This Skill

Use this skill when:

  • Generating new TypeScript code
  • Reviewing TypeScript files for quality issues
  • Creating new modules, services, or components
  • Refactoring JavaScript to TypeScript
  • Answering questions about TypeScript patterns or types
  • Designing APIs or interfaces

Do NOT use this skill when:

  • Working with pure JavaScript (no TypeScript)
  • Debugging runtime errors (use debugging tools)
  • Framework-specific patterns (React, Vue, etc. - use framework skills)

Core Principles

1. Type Safety First

Maximize compile-time error detection:

// Prefer unknown over any for unknown types
function processInput(data: unknown): string {
  if (typeof data === "string") return data;
  if (typeof data === "number") return String(data);
  throw new Error("Unsupported type");
}

// Explicit return types for public APIs
export function calculateTotal(items: ReadonlyArray<Item>): number {
  return items.reduce((sum, item) => sum + item.price, 0);
}

Details

Repository
github.com/jwynia/agent-skills
Categories
Frontend & UI Code, Code Review & Quality
First seen
Jun 3, 2026

More from jwynia/agent-skills

All 118

Similar to Typescript Best Practices

More Frontend & UI Code