react

Enforce consistent React and TypeScript patterns for components and hooks.

2|Updated Jun 1, 2017
One-click install
npx skills add https://github.com/carlos-algms/dotfiles --skill react-carlos-algms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react
Source: https://github.com/carlos-algms/dotfiles/tree/main/AI-configs/skills/react
Command: npx skills add https://github.com/carlos-algms/dotfiles --skill react-carlos-algms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents inconsistent React/TypeScript patterns by enforcing a practical set of rules for components and hooks, so your code stays predictable and maintainable.

Core Features & Use Cases

  • Component consistency: Functional components only, no default React import, and no React namespace usage to keep imports and types tidy.
  • Hook best practices: Correct useState generic usage, sensible useCallback rules, and safe async logic patterns inside hooks.
  • TypeScript + readability guardrails: Avoid unnecessary return type annotations for components, prefer named functions for complex async hook logic, and use fragments/accessibility conventions correctly.

Quick Start

Use the react Skill to generate a TypeScript React component that follows the project's import, component, hook, and accessibility rules.

Frequently Asked Questions about react

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

FAQPage Schema
How do I enforce consistent React and TypeScript patterns across my components?

To enforce consistent React and TypeScript patterns, use rules requiring functional components, avoiding default React imports, and restricting the React.* namespace. This keeps component code predictable and maintainable across your project.

What's the best way to write type-safe custom hooks in modern React?

Writing type-safe custom hooks requires correct useState generic usage, sensible useCallback rules, and safe async logic patterns. Named functions should handle complex asynchronous operations for readable, type-safe hook implementations.

Do I need to use forwardRef for every functional component in TypeScript?

You do not need forwardRef for every functional component. Apply forwardRef conventions selectively when components require ref forwarding, while avoiding unnecessary return type annotations to maintain readable code.

How do I avoid unnecessary return type annotations in React components?

Avoid unnecessary return type annotations in React components by letting TypeScript infer return types for functional components. This improves readability while maintaining type safety through proper generic usage and hook patterns.

Can I use default React imports with this React component consistency approach?

Default React imports are not used with this consistency approach. Components must use functional patterns without default imports or the React.* namespace, keeping imports and types tidy throughout the codebase.