[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AERZGJY6ET6D0JDH1Z1G3F":3,"skill-same:01M6AERZGJY6ET6D0JDH1Z1G3F":118},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":54,"linkOnly":55,"markdownContent":56,"markdownBody":57,"frontMatter":58,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":65,"ownerHtmlUrl":66,"ownerBlogUrl":67,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6AERZGJY6ET6D0JDH1Z1G3F","react-dev","React TypeScript 组件开发","This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing integration (TanStack Router, React Router).","在使用 TypeScript 构建 React 组件、为 Hook 标注类型、处理事件，或提到 React TypeScript、React 19、Server Components 时应使用本技能。涵盖 React 18-19 的类型安全模式，包括泛型组件、正确的事件类型标注以及路由集成（TanStack Router、React Router）。","davila7\u002Fclaude-code-templates","davila7","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6216945?v=4","01M6ADEWWFPS191NFM0Y1EX1JH","Daniel Avila","01M6ADJHGM78PHQRD3XZTFDVKK",33602,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRASNPVNJVQQJ4KZX8XM5D","前端开发与界面实现","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],"react","dev","react dev","hooks","when","generic","for","Server Components","with","event","typing","react typescript","react 19","type","tanstack router","safe","router","server","integration","routing","react components","components","typescript","2026-11-10 10:12:30",false,"---\nname: react-dev\nversion: 1.0.0\ndescription: This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing integration (TanStack Router, React Router).\n---\n\n# React TypeScript\n\nType-safe React = compile-time guarantees = confident refactoring.\n\n\u003Cwhen_to_use>\n\n- Building typed React components\n- Implementing generic components\n- Typing event handlers, forms, refs\n- Using React 19 features (Actions, Server Components, use())\n- Router integration (TanStack Router, React Router)\n- Custom hooks with proper typing\n\nNOT for: non-React TypeScript, vanilla JS React\n\n\u003C\u002Fwhen_to_use>\n\n\u003Creact_19_changes>\n\nReact 19 breaking changes require migration. Key patterns:\n\n**ref as prop** - forwardRef deprecated:\n\n```typescript\n\u002F\u002F React 19 - ref as regular prop\ntype ButtonProps = {\n  ref?: React.Ref\u003CHTMLButtonElement>;\n} & React.ComponentPropsWithoutRef\u003C'button'>;\n\nfunction Button({ ref, children, ...props }: ButtonProps) {\n  return \u003Cbutton ref={ref} {...props}>{children}\u003C\u002Fbutton>;\n}\n```\n\n**useActionState** - replaces useFormState:\n\n```typescript\nimport { useActionState } from 'react';\n\ntype FormState = { errors?: string[]; success?: boolean };\n\nfunction Form() {\n  const [state, formAction, isPending] = useActionState(submitAction, {});\n  return \u003Cform action={formAction}>...\u003C\u002Fform>;\n}\n```\n\n**use()** - unwraps promises\u002Fcontext:\n\n```typescript\nfunction UserProfile({ userPromise }: { userPromise: Promise\u003CUser> }) {\n  const user = use(userPromise); \u002F\u002F Suspends until resolved\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\nSee [react-19-patterns.md](references\u002Freact-19-patterns.md) for useOptimistic, useTransition, migration checklist.\n\n\u003C\u002Freact_19_changes>\n\n\u003Ccomponent_patterns>\n\n**Props** - extend native elements:\n\n```typescript\ntype ButtonProps = {\n  variant: 'primary' | 'secondary';\n} & React.ComponentPropsWithoutRef\u003C'button'>;\n\nfunction Button({ variant, children, ...props }: ButtonProps) {\n  return \u003Cbutton className={variant} {...props}>{children}\u003C\u002Fbutton>;\n}\n```\n\n**Children typing**:\n\n```typescript\ntype Props = {\n  children: React.ReactNode;          \u002F\u002F Anything renderable\n  icon: React.ReactElement;           \u002F\u002F Single element\n  render: (data: T) => React.ReactNode;  \u002F\u002F Render prop\n};\n```\n\n**Discriminated unions** for variant props:\n\n```typescript\ntype ButtonProps =\n  | { variant: 'link'; href: string }\n  | { variant: 'button'; onClick: () => void };\n\nfunction Button(props: ButtonProps) {\n  if (props.variant === 'link') {\n    return \u003Ca href={props.href}>Link\u003C\u002Fa>;\n  }\n  return \u003Cbutton onClick={props.onClick}>Button\u003C\u002Fbutton>;\n}\n```\n\n\u003C\u002Fcomponent_patterns>\n\n\u003Cevent_handlers>\n\nUse specific event types for accurate target typing:\n\n```typescript\n\u002F\u002F Mouse\nfunction handleClick(e: React.MouseEvent\u003CHTMLButtonElement>) {\n  e.currentTarget.disabled = true;\n}\n\n\u002F\u002F Form\nfunction handleSubmit(e: React.FormEvent\u003CHTMLFormElement>) {\n  e.preventDefault();\n  const formData = new FormData(e.currentTarget);\n}\n\n\u002F\u002F Input\nfunction handleChange(e: React.ChangeEvent\u003CHTMLInputElement>) {\n  console.log(e.target.value);\n}\n\n\u002F\u002F Keyboard\nfunction handleKeyDown(e: React.KeyboardEvent\u003CHTMLInputElement>) {\n  if (e.key === 'Enter') e.currentTarget.blur();\n}\n```\n\nSee [event-handlers.md](references\u002Fevent-handlers.md) for focus, drag, clipboard, touch, wheel events.\n\n\u003C\u002Fevent_handlers>\n\n\u003Chooks_typing>\n\n**useState** - explicit for unions\u002Fnull:\n\n```typescript\nconst [user, setUser] = useState\u003CUser | null>(null);\nconst [status, setStatus] = useState\u003C'idle' | 'loading'>('idle');\n```\n\n**useRef** - null for DOM, value for mutable:\n\n```typescript\nconst inputRef = useRef\u003CHTMLInputElement>(null);  \u002F\u002F DOM - use ?.\nconst countRef = useRef\u003Cnumber>(0);               \u002F\u002F Mutable - direct access\n```\n\n**useReducer** - discriminated unions for actions:\n\n```typescript\ntype Action =\n  | { type: 'increment' }\n  | { type: 'set'; payload: number };\n\nfunction reducer(state: State, action: Action): State {\n  switch (action.type) {\n    case 'set': return { ...state, count: action.payload };\n    default: return state;\n  }\n}\n```\n\n**Custom hooks** - tuple returns with as const:\n\n```typescript\nfunction useToggle(initial = false) {\n  const [value, setValue] = useState(initial);\n  const toggle = () => setValue(v => !v);\n  return [value, toggle] as const;\n}\n```\n\n**useContext** - null guard pattern:\n\n```typescript\nconst UserContext = createContext\u003CUser | null>(null);\n\nfunction useUser() {\n  const user = useContext(UserContext);\n  if (!user) throw new Error('useUser outside UserProvider');\n  return user;\n}\n```\n\nSee [hooks.md](references\u002Fhooks.md) for useCallback, useMemo, useImperativeHandle, useSyncExternalStore.\n\n\u003C\u002Fhooks_typing>\n\n\u003Cgeneric_components>\n\nGeneric components infer types from props - no manual annotations at call site.\n\n**Pattern** - keyof T for column keys, render props for custom rendering:\n\n```typescript\ntype Column\u003CT> = {\n  key: keyof T;\n  header: string;\n  render?: (value: T[keyof T], item: T) => React.ReactNode;\n};\n\ntype TableProps\u003CT> = {\n  data: T[];\n  columns: Column\u003CT>[];\n  keyExtractor: (item: T) => string | number;\n};\n\nfunction Table\u003CT>({ data, columns, keyExtractor }: TableProps\u003CT>) {\n  return (\n    \u003Ctable>\n      \u003Cthead>\n        \u003Ctr>{columns.map(col => \u003Cth key={String(col.key)}>{col.header}\u003C\u002Fth>)}\u003C\u002Ftr>\n      \u003C\u002Fthead>\n      \u003Ctbody>\n        {data.map(item => (\n          \u003Ctr key={keyExtractor(item)}>\n            {columns.map(col => (\n              \u003Ctd key={String(col.key)}>\n                {col.render ? col.render(item[col.key], item) : String(item[col.key])}\n              \u003C\u002Ftd>\n            ))}\n          \u003C\u002Ftr>\n        ))}\n      \u003C\u002Ftbody>\n    \u003C\u002Ftable>\n  );\n}\n```\n\n**Constrained generics** for required properties:\n\n```typescript\ntype HasId = { id: string | number };\n\nfunction List\u003CT extends HasId>({ items }: { items: T[] }) {\n  return \u003Cul>{items.map(item => \u003Cli key={item.id}>...\u003C\u002Fli>)}\u003C\u002Ful>;\n}\n```\n\nSee [generic-components.md](examples\u002Fgeneric-components.md) for Select, List, Modal, FormField patterns.\n\n\u003C\u002Fgeneric_components>\n\n\u003Cserver_components>\n\nReact 19 Server Components run on server, can be async.\n\n**Async data fetching**:\n\n```typescript\nexport default async function UserPage({ params }: { params: { id: string } }) {\n  const user = await fetchUser(params.id);\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\n**Server Actions** - 'use server' for mutations:\n\n```typescript\n'use server';\n\nexport async function updateUser(userId: string, formData: FormData) {\n  await db.user.update({ where: { id: userId }, data: { ... } });\n  revalidatePath(`\u002Fusers\u002F${userId}`);\n}\n```\n\n**Client + Server Action**:\n\n```typescript\n'use client';\n\nimport { useActionState } from 'react';\nimport { updateUser } from '@\u002Factions\u002Fuser';\n\nfunction UserForm({ userId }: { userId: string }) {\n  const [state, formAction, isPending] = useActionState(\n    (prev, formData) => updateUser(userId, formData), {}\n  );\n  return \u003Cform action={formAction}>...\u003C\u002Fform>;\n}\n```\n\n**use() for promise handoff**:\n\n```typescript\n\u002F\u002F Server: pass promise without await\nasync function Page() {\n  const userPromise = fetchUser('123');\n  return \u003CUserProfile userPromise={userPromise} \u002F>;\n}\n\n\u002F\u002F Client: unwrap with use()\n'use client';\nfunction UserProfile({ userPromise }: { userPromise: Promise\u003CUser> }) {\n  const user = use(userPromise);\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\nSee [server-components.md](examples\u002Fserver-components.md) for parallel fetching, streaming, error boundaries.\n\n\u003C\u002Fserver_components>\n\n\u003Crouting>\n\nBoth TanStack Router and React Router v7 provide type-safe routing solutions.\n\n**TanStack Router** - Compile-time type safety with Zod validation:\n\n```typescript\nimport { createRoute } from '@tanstack\u002Freact-router';\nimport { z } from 'zod';\n\nconst userRoute = createRoute({\n  path: '\u002Fusers\u002F$userId',\n  component: UserPage,\n  loader: async ({ params }) => ({ user: await fetchUser(params.userId) }),\n  validateSearch: z.object({\n    tab: z.enum(['profile', 'settings']).optional(),\n    page: z.number().int().positive().default(1),\n  }),\n});\n\nfunction UserPage() {\n  const { user } = useLoaderData({ from: userRoute.id });\n  const { tab, page } = useSearch({ from: userRoute.id });\n  const { userId } = useParams({ from: userRoute.id });\n}\n```\n\n**React Router v7** - Automatic type generation with Framework Mode:\n\n```typescript\nimport type { Route } from \".\u002F+types\u002Fuser\";\n\nexport async function loader({ params }: Route.LoaderArgs) {\n  return { user: await fetchUser(params.userId) };\n}\n\nexport default function UserPage({ loaderData }: Route.ComponentProps) {\n  const { user } = loaderData; \u002F\u002F Typed from loader\n  return \u003Ch1>{user.name}\u003C\u002Fh1>;\n}\n```\n\nSee [tanstack-router.md](references\u002Ftanstack-router.md) for TanStack patterns and [react-router.md](references\u002Freact-router.md) for React Router patterns.\n\n\u003C\u002Frouting>\n\n\u003Crules>\n\nALWAYS:\n- Specific event types (MouseEvent, ChangeEvent, etc)\n- Explicit useState for unions\u002Fnull\n- ComponentPropsWithoutRef for native element extension\n- Discriminated unions for variant props\n- as const for tuple returns\n- ref as prop in React 19 (no forwardRef)\n- useActionState for form actions\n- Type-safe routing patterns (see routing section)\n\nNEVER:\n- any for event handlers\n- JSX.Element for children (use ReactNode)\n- forwardRef in React 19+\n- useFormState (deprecated)\n- Forget null handling for DOM refs\n- Mix Server\u002FClient components in same file\n- Await promises when passing to use()\n\n\u003C\u002Frules>\n\n\u003Creferences>\n\n- [hooks.md](references\u002Fhooks.md) - useState, useRef, useReducer, useContext, custom hooks\n- [event-handlers.md](references\u002Fevent-handlers.md) - all event types, generic handlers\n- [react-19-patterns.md](references\u002Freact-19-patterns.md) - useActionState, use(), useOptimistic, migration\n- [generic-components.md](examples\u002Fgeneric-components.md) - Table, Select, List, Modal patterns\n- [server-components.md](examples\u002Fserver-components.md) - async components, Server Actions, streaming\n- [tanstack-router.md](references\u002Ftanstack-router.md) - TanStack Router typed routes, search params, navigation\n- [react-router.md](references\u002Freact-router.md) - React Router v7 loaders, actions, type generation, forms\n\n\u003C\u002Freferences>\n","# React TypeScript\n\nType-safe React = compile-time guarantees = confident refactoring.\n\n\u003Cwhen_to_use>\n\n- Building typed React components\n- Implementing generic components\n- Typing event handlers, forms, refs\n- Using React 19 features (Actions, Server Components, use())\n- Router integration (TanStack Router, React Router)\n- Custom hooks with proper typing\n\nNOT for: non-React TypeScript, vanilla JS React\n\n\u003C\u002Fwhen_to_use>\n\n\u003Creact_19_changes>\n\nReact 19 breaking changes require migration. Key patterns:\n\n**ref as prop** - forwardRef deprecated:\n\n```typescript\n\u002F\u002F React 19 - ref as regular prop\ntype ButtonProps = {\n  ref?: React.Ref\u003CHTMLButtonElement>;\n} & React.ComponentPropsWithoutRef\u003C'button'>;\n\nfunction Button({ ref, children, ...props }: ButtonProps) {\n  return \u003Cbutton ref={ref} {...props}>{children}\u003C\u002Fbutton>;\n}\n```\n\n**useActionState** - replaces useFormState:\n\n```typescript\nimport { useActionState } from 'react';\n\ntype FormState = { errors?: string[]; success?: boolean };\n\nfunction Form() {\n  const [state, formAction, isPending] = useActionState(submitAction, {});\n  return \u003Cform action={formAction}>...\u003C\u002Fform>;\n}\n```\n\n**use()** - unwraps promises\u002Fcontext:\n\n```typescript\nfunction UserProfile({ userPromise }: { userPromise: Promise\u003CUser> }) {\n  const user = use(userPromise); \u002F\u002F Suspends until resolved\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\nSee [react-19-patterns.md](references\u002Freact-19-patterns.md) for useOptimistic, useTransition, migration checklist.\n\n\u003C\u002Freact_19_changes>\n\n\u003Ccomponent_patterns>\n\n**Props** - extend native elements:\n\n```typescript\ntype ButtonProps = {\n  variant: 'primary' | 'secondary';\n} & React.ComponentPropsWithoutRef\u003C'button'>;\n\nfunction Button({ variant, children, ...props }: ButtonProps) {\n  return \u003Cbutton className={variant} {...props}>{children}\u003C\u002Fbutton>;\n}\n```\n\n**Children typing**:\n\n```typescript\ntype Props = {\n  children: React.ReactNode;          \u002F\u002F Anything renderable\n  icon: React.ReactElement;           \u002F\u002F Single element\n  render: (data: T) => React.ReactNode;  \u002F\u002F Render prop\n};\n```\n\n**Discriminated unions** for variant props:\n\n```typescript\ntype ButtonProps =\n  | { variant: 'link'; href: string }\n  | { variant: 'button'; onClick: () => void };\n\nfunction Button(props: ButtonProps) {\n  if (props.variant === 'link') {\n    return \u003Ca href={props.href}>Link\u003C\u002Fa>;\n  }\n  return \u003Cbutton onClick={props.onClick}>Button\u003C\u002Fbutton>;\n}\n```\n\n\u003C\u002Fcomponent_patterns>\n\n\u003Cevent_handlers>\n\nUse specific event types for accurate target typing:\n\n```typescript\n\u002F\u002F Mouse\nfunction handleClick(e: React.MouseEvent\u003CHTMLButtonElement>) {\n  e.currentTarget.disabled = true;\n}\n\n\u002F\u002F Form\nfunction handleSubmit(e: React.FormEvent\u003CHTMLFormElement>) {\n  e.preventDefault();\n  const formData = new FormData(e.currentTarget);\n}\n\n\u002F\u002F Input\nfunction handleChange(e: React.ChangeEvent\u003CHTMLInputElement>) {\n  console.log(e.target.value);\n}\n\n\u002F\u002F Keyboard\nfunction handleKeyDown(e: React.KeyboardEvent\u003CHTMLInputElement>) {\n  if (e.key === 'Enter') e.currentTarget.blur();\n}\n```\n\nSee [event-handlers.md](references\u002Fevent-handlers.md) for focus, drag, clipboard, touch, wheel events.\n\n\u003C\u002Fevent_handlers>\n\n\u003Chooks_typing>\n\n**useState** - explicit for unions\u002Fnull:\n\n```typescript\nconst [user, setUser] = useState\u003CUser | null>(null);\nconst [status, setStatus] = useState\u003C'idle' | 'loading'>('idle');\n```\n\n**useRef** - null for DOM, value for mutable:\n\n```typescript\nconst inputRef = useRef\u003CHTMLInputElement>(null);  \u002F\u002F DOM - use ?.\nconst countRef = useRef\u003Cnumber>(0);               \u002F\u002F Mutable - direct access\n```\n\n**useReducer** - discriminated unions for actions:\n\n```typescript\ntype Action =\n  | { type: 'increment' }\n  | { type: 'set'; payload: number };\n\nfunction reducer(state: State, action: Action): State {\n  switch (action.type) {\n    case 'set': return { ...state, count: action.payload };\n    default: return state;\n  }\n}\n```\n\n**Custom hooks** - tuple returns with as const:\n\n```typescript\nfunction useToggle(initial = false) {\n  const [value, setValue] = useState(initial);\n  const toggle = () => setValue(v => !v);\n  return [value, toggle] as const;\n}\n```\n\n**useContext** - null guard pattern:\n\n```typescript\nconst UserContext = createContext\u003CUser | null>(null);\n\nfunction useUser() {\n  const user = useContext(UserContext);\n  if (!user) throw new Error('useUser outside UserProvider');\n  return user;\n}\n```\n\nSee [hooks.md](references\u002Fhooks.md) for useCallback, useMemo, useImperativeHandle, useSyncExternalStore.\n\n\u003C\u002Fhooks_typing>\n\n\u003Cgeneric_components>\n\nGeneric components infer types from props - no manual annotations at call site.\n\n**Pattern** - keyof T for column keys, render props for custom rendering:\n\n```typescript\ntype Column\u003CT> = {\n  key: keyof T;\n  header: string;\n  render?: (value: T[keyof T], item: T) => React.ReactNode;\n};\n\ntype TableProps\u003CT> = {\n  data: T[];\n  columns: Column\u003CT>[];\n  keyExtractor: (item: T) => string | number;\n};\n\nfunction Table\u003CT>({ data, columns, keyExtractor }: TableProps\u003CT>) {\n  return (\n    \u003Ctable>\n      \u003Cthead>\n        \u003Ctr>{columns.map(col => \u003Cth key={String(col.key)}>{col.header}\u003C\u002Fth>)}\u003C\u002Ftr>\n      \u003C\u002Fthead>\n      \u003Ctbody>\n        {data.map(item => (\n          \u003Ctr key={keyExtractor(item)}>\n            {columns.map(col => (\n              \u003Ctd key={String(col.key)}>\n                {col.render ? col.render(item[col.key], item) : String(item[col.key])}\n              \u003C\u002Ftd>\n            ))}\n          \u003C\u002Ftr>\n        ))}\n      \u003C\u002Ftbody>\n    \u003C\u002Ftable>\n  );\n}\n```\n\n**Constrained generics** for required properties:\n\n```typescript\ntype HasId = { id: string | number };\n\nfunction List\u003CT extends HasId>({ items }: { items: T[] }) {\n  return \u003Cul>{items.map(item => \u003Cli key={item.id}>...\u003C\u002Fli>)}\u003C\u002Ful>;\n}\n```\n\nSee [generic-components.md](examples\u002Fgeneric-components.md) for Select, List, Modal, FormField patterns.\n\n\u003C\u002Fgeneric_components>\n\n\u003Cserver_components>\n\nReact 19 Server Components run on server, can be async.\n\n**Async data fetching**:\n\n```typescript\nexport default async function UserPage({ params }: { params: { id: string } }) {\n  const user = await fetchUser(params.id);\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\n**Server Actions** - 'use server' for mutations:\n\n```typescript\n'use server';\n\nexport async function updateUser(userId: string, formData: FormData) {\n  await db.user.update({ where: { id: userId }, data: { ... } });\n  revalidatePath(`\u002Fusers\u002F${userId}`);\n}\n```\n\n**Client + Server Action**:\n\n```typescript\n'use client';\n\nimport { useActionState } from 'react';\nimport { updateUser } from '@\u002Factions\u002Fuser';\n\nfunction UserForm({ userId }: { userId: string }) {\n  const [state, formAction, isPending] = useActionState(\n    (prev, formData) => updateUser(userId, formData), {}\n  );\n  return \u003Cform action={formAction}>...\u003C\u002Fform>;\n}\n```\n\n**use() for promise handoff**:\n\n```typescript\n\u002F\u002F Server: pass promise without await\nasync function Page() {\n  const userPromise = fetchUser('123');\n  return \u003CUserProfile userPromise={userPromise} \u002F>;\n}\n\n\u002F\u002F Client: unwrap with use()\n'use client';\nfunction UserProfile({ userPromise }: { userPromise: Promise\u003CUser> }) {\n  const user = use(userPromise);\n  return \u003Cdiv>{user.name}\u003C\u002Fdiv>;\n}\n```\n\nSee [server-components.md](examples\u002Fserver-components.md) for parallel fetching, streaming, error boundaries.\n\n\u003C\u002Fserver_components>\n\n\u003Crouting>\n\nBoth TanStack Router and React Router v7 provide type-safe routing solutions.\n\n**TanStack Router** - Compile-time type safety with Zod validation:\n\n```typescript\nimport { createRoute } from '@tanstack\u002Freact-router';\nimport { z } from 'zod';\n\nconst userRoute = createRoute({\n  path: '\u002Fusers\u002F$userId',\n  component: UserPage,\n  loader: async ({ params }) => ({ user: await fetchUser(params.userId) }),\n  validateSearch: z.object({\n    tab: z.enum(['profile', 'settings']).optional(),\n    page: z.number().int().positive().default(1),\n  }),\n});\n\nfunction UserPage() {\n  const { user } = useLoaderData({ from: userRoute.id });\n  const { tab, page } = useSearch({ from: userRoute.id });\n  const { userId } = useParams({ from: userRoute.id });\n}\n```\n\n**React Router v7** - Automatic type generation with Framework Mode:\n\n```typescript\nimport type { Route } from \".\u002F+types\u002Fuser\";\n\nexport async function loader({ params }: Route.LoaderArgs) {\n  return { user: await fetchUser(params.userId) };\n}\n\nexport default function UserPage({ loaderData }: Route.ComponentProps) {\n  const { user } = loaderData; \u002F\u002F Typed from loader\n  return \u003Ch1>{user.name}\u003C\u002Fh1>;\n}\n```\n\nSee [tanstack-router.md](references\u002Ftanstack-router.md) for TanStack patterns and [react-router.md](references\u002Freact-router.md) for React Router patterns.\n\n\u003C\u002Frouting>\n\n\u003Crules>\n\nALWAYS:\n- Specific event types (MouseEvent, ChangeEvent, etc)\n- Explicit useState for unions\u002Fnull\n- ComponentPropsWithoutRef for native element extension\n- Discriminated unions for variant props\n- as const for tuple returns\n- ref as prop in React 19 (no forwardRef)\n- useActionState for form actions\n- Type-safe routing patterns (see routing section)\n\nNEVER:\n- any for event handlers\n- JSX.Element for children (use ReactNode)\n- forwardRef in React 19+\n- useFormState (deprecated)\n- Forget null handling for DOM refs\n- Mix Server\u002FClient components in same file\n- Await promises when passing to use()\n\n\u003C\u002Frules>\n\n\u003Creferences>\n\n- [hooks.md](references\u002Fhooks.md) - useState, useRef, useReducer, useContext, custom hooks\n- [event-handlers.md](references\u002Fevent-handlers.md) - all event types, generic handlers\n- [react-19-patterns.md](references\u002Freact-19-patterns.md) - useActionState, use(), useOptimistic, migration\n- [generic-components.md](examples\u002Fgeneric-components.md) - Table, Select, List, Modal patterns\n- [server-components.md](examples\u002Fserver-components.md) - async components, Server Actions, streaming\n- [tanstack-router.md](references\u002Ftanstack-router.md) - TanStack Router typed routes, search params, navigation\n- [react-router.md](references\u002Freact-router.md) - React Router v7 loaders, actions, type generation, forms\n\n\u003C\u002Freferences>\n",{"name":5,"version":59,"description":7},"1.0.0","main","2b749c82b5d11fac39d9a6e021ce3f5b8a541bd1","cli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev",3963,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates","https:\u002F\u002Faitmpl.com","https:\u002F\u002Fgithub.com\u002Fdavila7","https:\u002F\u002Fdanielavila.me","Building AI dev tools with LLMs","2026-11-15 01:32:48",{"source":9,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add davila7\u002Fclaude-code-templates --skill react-dev",{"tool":76,"command":77},"bunx","bunx skills add davila7\u002Fclaude-code-templates --skill react-dev",{"tool":79,"command":80},"pnpm","pnpm dlx skills add davila7\u002Fclaude-code-templates --skill react-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002FSKILL.md",true,[84,90,94,98,102,106,110,114],{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"examples\u002Fgeneric-components.md","REFERENCE","参考文档",12902,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Fexamples\u002Fgeneric-components.md",{"path":91,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":92,"sourceHtmlUrl":93},"examples\u002Fserver-components.md",13227,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Fexamples\u002Fserver-components.md",{"path":95,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":96,"sourceHtmlUrl":97},"README.md",13200,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002FREADME.md",{"path":99,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Fevent-handlers.md",14375,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Freferences\u002Fevent-handlers.md",{"path":103,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":104,"sourceHtmlUrl":105},"references\u002Fhooks.md",10977,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Freferences\u002Fhooks.md",{"path":107,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":108,"sourceHtmlUrl":109},"references\u002Freact-19-patterns.md",14078,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Freferences\u002Freact-19-patterns.md",{"path":111,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":112,"sourceHtmlUrl":113},"references\u002Freact-router.md",20074,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Freferences\u002Freact-router.md",{"path":115,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":116,"sourceHtmlUrl":117},"references\u002Ftanstack-router.md",12253,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Freact-dev\u002Freferences\u002Ftanstack-router.md",[119,143,169,193,226,254],{"skillNo":120,"name":121,"nameZh":17,"description":122,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":54},"01M70NHBTQ8BV0A2SCAZXEPHCX","wealthville-pool-scoring","Score DeFi liquidity pools before providing liquidity. Returns a 0-100 pool score and an Enter\u002FHold\u002FExit\u002FReduce\u002FAvoid verdict with calibrated confidence for ~68,800 Solana pools and 575 EVM pools, plus a public miss-inclusive track record. Use when asked whether a pool is worth LPing into, which pools look best right now, or how accurate the scores have actually been.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fweb-data\u002Fwealthville-pool-scoring\u002FSKILL.md",[],[126,127,128,129,130,37,131,132,133,35,134,39,135,136,137,138,139,140,141,142],"scoring","pool","wealthville pool scoring","liquidity","which","exit","now","use","reduce","record","track","verdict","evm","solana","how","public","look",{"skillNo":144,"name":145,"nameZh":17,"description":146,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":54},"01M70MB6VR8ERJ4EM8D5KHBMEV","technical-debt-auditor","Scans a codebase and produces a quantified technical debt report with a prioritized remediation plan. Analyzes dead code, TODO\u002FFIXME\u002FHACK markers, dependency staleness, complexity hotspots, code duplication signals, test coverage gaps, unused exports, and outdated patterns. Use this skill when the user asks to audit their codebase for tech debt, wants a health check of their code quality, says things like \"where should I focus refactoring\", \"find code smells\", \"audit my codebase\", \"what technical debt do we have\", \"prioritize cleanup work\", or asks about code quality metrics. Also trigger when the user mentions \"code rot\", \"legacy cleanup\", \"refactoring priorities\", or wants to understand the overall health of a project before a major effort. Trigger even if the user doesn't say \"technical debt\" explicitly — any request to systematically assess code quality and identify improvement priorities belongs here.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Ftechnical-debt-auditor\u002FSKILL.md",[],[150,151,152,153,154,155,156,157,158,159,160,35,161,162,163,164,165,166,167,168],"technical debt","debt","technical","technical debt auditor","auditor","coverage","complexity","markers","project","cleanup","unused","code","todo","work","plan","focus","signals","audit","dependency",{"skillNo":170,"name":171,"nameZh":17,"description":172,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":54},"01M70KPYH9QNHCNME5GJQGE22K","readonly-sql-guard","Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production\u002FERP\u002Fanalytics database (a \"query\" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write\u002FDDL\u002Fside-effect\u002Ftransaction-escape risks. Checks what a statement CALLS, not just its shape.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdatabase\u002Freadonly-sql-guard\u002FSKILL.md",[],[176,177,178,179,180,181,182,37,183,184,185,186,187,188,189,133,190,191,35,192],"readonly","guard","sql guard","sql","readonly sql guard","erp","effect","read-only","db","just","tool","calls","only","MCP","access","database","query",{"skillNo":194,"name":195,"nameZh":196,"description":197,"descriptionZh":198,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":199,"licenseFileUrl":200,"sourceHtmlUrl":201,"categories":202,"keywords":205,"publishedAt":54},"01M6AFY6F7CC2BBZP1QD6VTNVC","web-artifacts-builder","Claude 网页 Artifact 构建","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","用于创建精细的、多组件的 claude.ai HTML artifact 的工具套件，采用现代前端 Web 技术（React、Tailwind CSS、shadcn\u002Fui）。适用于需要状态管理、路由或 shadcn\u002Fui 组件的复杂 artifact —— 不适用于简单的单文件 HTML\u002FJSX artifact。","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[203,204],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[206,207,208,209,210,211,50,212,213,214,215,216,217,218,52,219,31,220,221,222,223,224,37,225],"artifacts builder","web","web artifacts builder","artifacts","builder","state","state management","component","css","frontend","ui","Tools","file","shadcn","Tailwind","suite","jsx","html","single-file","ui components",{"skillNo":227,"name":228,"nameZh":229,"description":230,"descriptionZh":231,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":199,"licenseFileUrl":232,"sourceHtmlUrl":233,"categories":234,"keywords":241,"publishedAt":54},"01M6AFWF33SFV9Z3SF4PEEE4BF","webapp-testing","Playwright Web 应用测试","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","使用 Playwright 与本地 Web 应用进行交互和测试的工具包。支持验证前端功能、调试 UI 行为、捕获浏览器截图以及查看浏览器日志。","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[235,238],{"categoryNo":236,"categoryName":237,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":239,"categoryName":240,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[242,243,244,245,246,207,247,215,216,248,249,250,251,37,252,39,253],"webapp testing","testing","webapp","browser","playwright","applications","debugging","toolkit","logs","screenshots","local","behavior",{"skillNo":255,"name":256,"nameZh":257,"description":258,"descriptionZh":259,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":199,"licenseFileUrl":260,"sourceHtmlUrl":261,"categories":262,"keywords":269,"publishedAt":54},"01M6AF67Q67JJJ5V51JR2P52KA","discernment-nudge","回复事实核查追问","After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.","在你给出用户可能据以行动的实质性答案或草稿之后——建议或推荐、起草的工件（如目标、计划、推介、提案或电子邮件）、估计或预测、数据分析或解读、他们可能依赖的事实声明，或多步骤论证——在最终确定回复之前调用本技能，然后，如适用，附加 2-3 个简短的后续问题，每个问题都与你刚刚产出的具体内容相关，帮助用户核查关键事实、探究推理或假设，并注意到缺失的上下文。每次对话最多执行一次。当用户询问琐碎的操作方法或简单查找、想要纯教育性解释、仅要求根据提供的内容格式化\u002F转换\u002F组装文件、正在编写将要运行的代码、正在进行创意写作或休闲聊天，或已经要求你复核、引用或审查时跳过——技能文件解释了这些边界和确切的输出格式。","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FSKILL.md",[263,266],{"categoryNo":264,"categoryName":265,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TMSBZZX4V1THHNVC815","回答复核",{"categoryNo":267,"categoryName":268,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BS5011KJDVSRXG1DC4P666","普通用户",[270,271,272,273,274,275,276,277,209,278,218,161,279,280,281,282,283,188,284,35,285,286,287,288,289,140,290],"discernment nudge","nudge","interpretation","help","run","reasoning","data","writing","lookup","content","review","conversation","short","up","invoke","you","analysis","claims","argument","assemble","recommendations"]