typescript

Enforces TypeScript code style, type safety, and async patterns during development.

1|Updated May 10, 2026
One-click install
npx skills add https://github.com/Tgoldi/claude-skills --skill typescript-tgoldi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/Tgoldi/claude-skills/tree/main/typescript
Command: npx skills add https://github.com/Tgoldi/claude-skills --skill typescript-tgoldi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Inconsistent TypeScript codebases suffer from implicit any types, unsafe type suppressions, callback-style async code, and magic values that erode maintainability. This Skill provides a concrete style guide so generated or reviewed TypeScript code follows strict, consistent conventions. ## Core Features & Use Cases - Type Safety Rules: Enforces inference-first typing, interface vs type usage, const assertions with satisfies, and a suppression hierarchy preferring @ts-expect-error over as any. - Async and Structure Patterns: Promotes async/await, Promise.all concurrency, destructuring, named constants, and tooling-deferred formatting. - UI, Performance, and Logging Guidance: Covers @lobehub/ui and antd-style theming, loop and query optimization, single-timestamp consistency, and safe logging without sensitive data. - Use Case: When writing a new React component in .tsx, the Skill ensures props use interfaces, styling uses antd-style tokens, and async data fetching uses fs/promises-style modern APIs. ## Quick Start Review this TypeScript file and rewrite it to follow strict type safety and modern async patterns.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I write type-safe TypeScript code?

Let TypeScript infer types where possible and annotate only when inference fails. Use interface for object shapes, type for unions and mapped types, and prefer Record<PropertyKey, unknown> over any for flexible objects.

When should I use interface vs type in TypeScript?

Use interface for object shapes such as React props and data structures. Use type for unions, intersections, and mapped types. This keeps declarations extensible where needed and expressive where composition matters.

What is the difference between @ts-expect-error and @ts-ignore?

@ts-expect-error fails the build if the suppressed error disappears, keeping suppressions honest. @ts-ignore always suppresses regardless. Prefer @ts-expect-error, and avoid as any, which is the least safe option.

How do I run concurrent async operations in TypeScript?

Use Promise.all() for independent concurrent operations and Promise.race() when only the first resolved promise matters. Prefer async/await syntax over callbacks or .then() chains, and use promise-based APIs like fs/promises.

Why should I avoid logging with the debug package in production?

The debug package writes directly to console and lacks structured output control. Use console.error in catch blocks and structured logging for production systems, and never log API keys, tokens, passwords, or PII.