typescript

Enforce strict typing and modern async patterns in TypeScript code.

37|5|Updated Jul 9, 2024
One-click install
npx skills add https://github.com/focusreactive/cms-kit --skill typescript-focusreactive
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/focusreactive/cms-kit/tree/main/apps/payload/.claude/skills/typescript
Command: npx skills add https://github.com/focusreactive/cms-kit --skill typescript-focusreactive

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidelines and best practices for writing clean, efficient, and type-safe TypeScript code, improving maintainability and reducing bugs.

Core Features & Use Cases

  • Type Safety: Enforces strict typing, avoiding any and promoting accurate type definitions.
  • Async Patterns: Recommends modern async/await and Promise-based APIs.
  • Code Structure: Advocates for destructuring, constants, and consistent naming.
  • UI & Theming: Guides the use of component libraries and design systems.
  • Performance: Offers tips for optimizing loops and database queries.
  • Logging: Establishes safe logging practices.
  • Use Case: When developing a new feature in a TypeScript project, consult this Skill to ensure your code adheres to established quality and performance standards.

Quick Start

Apply the typescript skill to refactor the provided JavaScript code into idiomatic TypeScript.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I refactor JavaScript code into safe and idiomatic TypeScript?

TypeScript best practices for type safety involve enforcing strict typing and avoiding the `any` type entirely. Promote accurate type definitions, utilize destructuring, and define constants to ensure high-quality, maintainable code with fewer runtime bugs.

What is the best way to handle async patterns and Promises in TypeScript?

The best way to handle async patterns in TypeScript is using modern `async`/`await` syntax and Promise-based APIs. This approach enforces strict typing on asynchronous operations and integrates cleanly with safe logging practices for better error handling.

How do I optimize TypeScript performance for loops and database queries?

Optimize TypeScript performance by refining loop structures and streamlining database queries. Apply type-safe definitions to query inputs and outputs, and follow established performance guidelines to reduce execution bottlenecks during feature development.

Can I use design tokens and component libraries for UI development in TypeScript?

Yes, TypeScript UI development heavily benefits from using component libraries and design systems. Enforcing strict typing on design tokens and UI components ensures type safety across your application while maintaining a consistent visual structure.

What are the limitations of using `any` in TypeScript code reviews?

Using `any` in TypeScript bypasses type safety, negates the benefits of strict typing, and increases the likelihood of runtime bugs. During code reviews, it should be avoided in favor of accurate type definitions and modern async patterns to enforce code quality.