Agent-skills-standard react-typescript
Type React components and hooks with TypeScript patterns. Use when typing React props, hooks, event handlers, or component generics in TypeScript. (triggers: **/*.tsx, ReactNode, FC, PropsWithChildren, ComponentProps)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/react/react-typescript" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-react-typescript && rm -rf "$T"
manifest:
skills/react/react-typescript/SKILL.mdsource content
React TypeScript
Priority: P1 (OPERATIONAL)
Implementation Guidelines
- Components: Prefer interface/type (
) overProps
(which implicit children). UseReact.FC
orJSX.Element
as return type.ReactNode - Children: For components that accept children, use
or explicitly type them asPropsWithChildren<T>
.React.ReactNode - Events: Always type event handlers using specific React events, such as
orReact.ChangeEvent<HTMLInputElement>
.React.FormEvent<HTMLFormElement> - Hooks: For
, avoiduseRef
; useany
. ForuseRef<HTMLDivElement>(null)
, use generics for complex types:useState
.useState<User | null>(null) - Native Elements: Use
orComponentPropsWithoutRef<'button'>
to extend native attributes safely.ComponentPropsWithRef - Generics: Implement generic components for reusable UI like lists using
.<T,>(props: ListProps<T>) - Discriminated Unions: Use Discriminated Unions for mutually exclusive props (e.g.,
vssuccess
states).error - Utility Types: Leverage
,Omit
, andPick
to transform prop interfaces and avoid redundancy.Partial
Anti-Patterns
- No
: Useany
.unknown - No
: Implicit children deprecated/bad practice.React.FC - No
: UseFunction
.(args: T) => void
References
See references/example.md for typed props, generic components, and hook ref patterns.