typescript

Provide TypeScript coding guidelines for type safety, async patterns, and code structure.

120|6|Updated Dec 27, 2024
One-click install
npx skills add https://github.com/husamql3/pstrack --skill typescript-husamql3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/husamql3/pstrack/tree/main/.agents/skills/typescript
Command: npx skills add https://github.com/husamql3/pstrack --skill typescript-husamql3

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidelines for writing clean, efficient, and type-safe TypeScript code, improving code quality and maintainability.

Core Features & Use Cases

  • Type Safety: Enforces best practices for type annotations, inference, and avoiding any.
  • Async Patterns: Guides on using modern asynchronous programming constructs like async/await and Promise APIs.
  • Code Structure: Recommends clear naming conventions, destructuring, and constants.
  • Performance: Offers tips for optimizing loops and database queries.
  • Use Case: When you need to ensure your React component props are strictly typed or when refactoring callback-heavy asynchronous code to use async/await.

Quick Start

Apply the typescript skill to review the code quality of the file 'src/utils.ts'.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I ensure type safety and avoid using any in TypeScript?

To ensure type safety in TypeScript, enforce explicit type annotations and rely on type inference instead of using any. This prevents runtime errors and improves code maintainability by strictly validating variable structures during development.

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

The best way to handle async patterns in TypeScript is using modern async/await constructs and Promise APIs. This refactors callback-heavy asynchronous code into readable formats while maintaining strict typing for resolved values.

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

Optimize TypeScript performance by applying best practices for loops and database queries. This involves structuring efficient code organization and using modern async operations to reduce execution bottlenecks and improve responsiveness.

Can I use this TypeScript skill to review React component props?

Yes, you can apply this TypeScript skill to review React component props. It ensures props are strictly typed, enforces clear naming conventions, and validates type-safe patterns within .tsx files.

What are the recommended code structure and naming conventions for TypeScript?

Recommended TypeScript code structure includes using clear naming conventions, destructuring, and constants. These guidelines improve code organization and maintainability across applicable file types like .ts and .mts.