jwynia avatar

Typescript Best Practices

This is a comprehensive reference for writing TypeScript the right way. It pushes type safety over convenience (unknown instead of any, explicit return types, readonly by default), includes a Result type pattern for error handling, and comes with Deno scripts to analyze code quality and generate types from JSON. The quick reference table is genuinely useful when you're in the middle of code and need to remember whether to use a type guard or an assertion. It won't teach you TypeScript from scratch, but if you're already writing it and want to stop cutting corners, this codifies the discipline.

skills.sh installs
616
GitHub stars
182
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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);
}

Sponsors

Details

Repository
github.com/jwynia/agent-skills
Categories
Documentation, Code Review & Quality, AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from jwynia/agent-skills

All 118
1moizibnyousaf avatardatabase-designmoizibnyousaf/ai-agent-skillsDatabase schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases. Use for designing schemas, writing migrations, or optim615skills.sh installs
2aliyun avataralibabacloud-cli-guidancealiyun/alibabacloud-aiops-skillsGuide users to manage Alibaba Cloud resources using the Aliyun CLI command-line tool. Covers CLI installation, credential configuration, plugin management, comm604skills.sh installs
3ncklrs avatarproposal-writerncklrs/startup-os-skillsExpert sales proposal and pricing presentation strategist. Use when writing proposals, executive summaries, ROI business cases, pricing presentations, SOWs (Sta600skills.sh installs
4withastro avatarastro-developerwithastro/astroComprehensive guide for developing in the Astro monorepo. Covers architecture, debugging, testing, and critical constraints. Use when working on features, fixes596skills.sh installs
5manutej avataraws-cloud-architecturemanutej/luxor-claude-marketplaceComprehensive guide to AWS cloud architecture covering compute, storage, databases, networking, security, serverless, and cost optimization with production-read595skills.sh installs
6makenotion avatarnotion-knowledge-capturemakenotion/claude-code-notion-pluginTransforms conversations and discussions into structured documentation pages in Notion. Captures insights, decisions, and knowledge from chat context, formats a590skills.sh installs