[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EKCVJ2RBJ72MSFZ87DV801":3,"skill-same:01M7EKCVJ2RBJ72MSFZ87DV801":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7EKCVJ2RBJ72MSFZ87DV801","typescript",null,"Guides TypeScript best practices for strict-mode projects, covering discriminated unions, interface contracts, nullability, type guards, utility types, async return types, const assertions, and a review checklist of common anti-patterns. Use when writing, reviewing, or debugging TypeScript code or type definitions.","razorvision\u002Fclara-skills","razorvision","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11950812?v=4","01M7EKAE3CT4VN0CGC4GR8ZFAP","Razorvision Consulting","01M7EKAE3Z8WT4D2X0K2488E9V",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript\ndescription: Guides TypeScript best practices for strict-mode projects, covering discriminated unions, interface contracts, nullability, type guards, utility types, async return types, const assertions, and a review checklist of common anti-patterns. Use when writing, reviewing, or debugging TypeScript code or type definitions.\nlicense: Apache-2.0\nmetadata:\n  version: \"0.1.0\" # x-release-please-version\n  owner: razorvision\n---\n\n# TypeScript Skill\n\nApply this skill when writing, reviewing, or debugging TypeScript code.\n\n## Configuration\n\nRead the project's `tsconfig.json` first and match it. This guidance assumes strict TypeScript:\n- `strict: true`: all strict checks enabled\n- `noEmit: true`: type checking only (a bundler or framework emits the JS)\n- Path alias: if the project uses path aliases (commonly `@\u002F*` mapping to `.\u002Fsrc\u002F*`), use them\n  consistently\n\n## Core Patterns\n\n### 1. Discriminated Unions\n\nUse literal types for exhaustive checking:\n\n```typescript\n\u002F\u002F Define the discriminant\ntype OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled'\n\ninterface Order {\n  id: string\n  status: OrderStatus  \u002F\u002F Discriminant\n  customerId: string\n  total: number\n}\n\n\u002F\u002F Exhaustive switch\nfunction getStatusLabel(status: OrderStatus): string {\n  switch (status) {\n    case 'pending': return 'Awaiting payment'\n    case 'paid': return 'Payment received'\n    case 'shipped': return 'On its way'\n    case 'delivered': return 'Delivered'\n    case 'cancelled': return 'Cancelled'\n    \u002F\u002F TypeScript errors if a case is missing\n  }\n}\n```\n\n### 2. Interface-Based Polymorphism\n\nDefine contracts with interfaces:\n\n```typescript\n\u002F\u002F Contract\ninterface PaymentProvider {\n  readonly name: ProviderName\n  readonly enabled: boolean\n  charge(amountCents: number, token: string): Promise\u003CChargeResult>\n  refund(chargeId: string): Promise\u003CRefundResult>\n  buildReceiptUrl(chargeId: string): string\n}\n\n\u002F\u002F Implementation\nclass CardProvider implements PaymentProvider {\n  readonly name = 'card' as const\n  readonly enabled = true\n\n  async charge(amountCents: number, token: string): Promise\u003CChargeResult> {\n    \u002F\u002F Implementation\n  }\n  \u002F\u002F ...\n}\n```\n\n### 3. React Component Props\n\nExtend native HTML attributes:\n\n```typescript\n\u002F\u002F Extend native button props\ninterface ButtonProps\n  extends React.ComponentProps\u003C\"button\">,\n    VariantProps\u003Ctypeof buttonVariants> {\n  asChild?: boolean\n}\n\n\u002F\u002F With children\ninterface CardProps extends React.ComponentProps\u003C\"div\"> {\n  children: React.ReactNode\n}\n\n\u002F\u002F Callback props\ninterface FormProps {\n  onSubmit: (data: FormData) => Promise\u003Cvoid>\n  isLoading?: boolean\n}\n```\n\n### 4. Nullable Types\n\nBe explicit about nullability:\n\n```typescript\ninterface Analysis {\n  score: number\n  recommendation: string | null  \u002F\u002F Explicitly nullable\n  details?: string              \u002F\u002F Optional (may be undefined)\n}\n\n\u002F\u002F Handle nulls explicitly\nfunction formatRecommendation(rec: string | null): string {\n  if (rec === null) {\n    return 'No recommendation available'\n  }\n  return rec\n}\n```\n\n### 5. Type Guards\n\nCreate type-safe narrowing:\n\n```typescript\n\u002F\u002F Type predicate\nfunction isShipped(order: Order): order is Order & { status: 'shipped' } {\n  return order.status === 'shipped'\n}\n\n\u002F\u002F Usage\nif (isShipped(order)) {\n  \u002F\u002F order.status is now 'shipped'\n}\n\n\u002F\u002F Assertion function\nfunction assertDefined\u003CT>(value: T | undefined, message: string): asserts value is T {\n  if (value === undefined) {\n    throw new Error(message)\n  }\n}\n```\n\n### 6. Generic Utilities\n\n```typescript\n\u002F\u002F Pick specific keys\ntype OrderSummary = Pick\u003COrder, 'id' | 'status' | 'total'>\n\n\u002F\u002F Omit keys\ntype CreateOrderInput = Omit\u003COrder, 'id' | 'status'>\n\n\u002F\u002F Partial for updates\ntype UpdateOrderInput = Partial\u003COrder>\n\n\u002F\u002F Record for maps\ntype StatusCounts = Record\u003COrderStatus, number>\n```\n\n### 7. Async Return Types\n\nBe explicit with Promise types:\n\n```typescript\n\u002F\u002F Function returns\nasync function fetchOrder(id: string): Promise\u003COrder | null> {\n  const rows = await db.query\u003COrder>('SELECT * FROM orders WHERE id = $1', [id])\n  return rows[0] ?? null\n}\n\n\u002F\u002F Error handling\ninterface ApiResult\u003CT> {\n  data: T | null\n  error: string | null\n}\n\nasync function safeFetch\u003CT>(url: string): Promise\u003CApiResult\u003CT>> {\n  try {\n    const data = await fetch(url).then(r => r.json())\n    return { data, error: null }\n  } catch (e) {\n    return { data: null, error: e instanceof Error ? e.message : 'Unknown error' }\n  }\n}\n```\n\n### 8. const Assertions\n\nLock down literal types:\n\n```typescript\n\u002F\u002F Mutable (type: string[])\nconst STATUSES = ['pending', 'paid', 'shipped']\n\n\u002F\u002F Immutable (type: readonly ['pending', 'paid', 'shipped'])\nconst STATUSES = ['pending', 'paid', 'shipped'] as const\n\n\u002F\u002F Extract type from const\ntype Status = typeof STATUSES[number]  \u002F\u002F 'pending' | 'paid' | 'shipped'\n```\n\n## Type File Organization\n\n```\nsrc\u002Ftypes\u002F\n├── api.ts         # Request\u002Fresponse types\n├── billing.ts     # Payment and invoice types\n├── index.ts       # Re-exports\n└── orders.ts      # Order domain types\n```\n\n## Review Checklist\n\nWhen reviewing TypeScript:\n\n- [ ] No `any` types (use `unknown` if truly unknown)\n- [ ] Explicit return types on public functions\n- [ ] Discriminated unions for variants\n- [ ] `readonly` on immutable properties\n- [ ] Nullability explicitly handled (`| null` or `?`)\n- [ ] Interfaces for contracts, types for unions\n- [ ] Generic constraints where applicable\n- [ ] Path aliases (if the project uses them) used consistently\n\n## Anti-Patterns\n\n```typescript\n\u002F\u002F Don't use any\nfunction process(data: any) { ... }  \u002F\u002F Use unknown or a specific type\n\n\u002F\u002F Don't use non-null assertion without checks\nconst value = data!.property  \u002F\u002F Check first or use optional chaining\n\n\u002F\u002F Don't ignore errors\n} catch (e) {  \u002F\u002F Type e properly\n  console.log(e.message)  \u002F\u002F e is unknown, not Error\n}\n\n\u002F\u002F Correct error handling\n} catch (e) {\n  const message = e instanceof Error ? e.message : 'Unknown error'\n}\n\n\u002F\u002F Don't use object\nfunction process(data: object) { ... }  \u002F\u002F Use Record\u003Cstring, unknown>\n```\n","# TypeScript Skill\n\nApply this skill when writing, reviewing, or debugging TypeScript code.\n\n## Configuration\n\nRead the project's `tsconfig.json` first and match it. This guidance assumes strict TypeScript:\n- `strict: true`: all strict checks enabled\n- `noEmit: true`: type checking only (a bundler or framework emits the JS)\n- Path alias: if the project uses path aliases (commonly `@\u002F*` mapping to `.\u002Fsrc\u002F*`), use them\n  consistently\n\n## Core Patterns\n\n### 1. Discriminated Unions\n\nUse literal types for exhaustive checking:\n\n```typescript\n\u002F\u002F Define the discriminant\ntype OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled'\n\ninterface Order {\n  id: string\n  status: OrderStatus  \u002F\u002F Discriminant\n  customerId: string\n  total: number\n}\n\n\u002F\u002F Exhaustive switch\nfunction getStatusLabel(status: OrderStatus): string {\n  switch (status) {\n    case 'pending': return 'Awaiting payment'\n    case 'paid': return 'Payment received'\n    case 'shipped': return 'On its way'\n    case 'delivered': return 'Delivered'\n    case 'cancelled': return 'Cancelled'\n    \u002F\u002F TypeScript errors if a case is missing\n  }\n}\n```\n\n### 2. Interface-Based Polymorphism\n\nDefine contracts with interfaces:\n\n```typescript\n\u002F\u002F Contract\ninterface PaymentProvider {\n  readonly name: ProviderName\n  readonly enabled: boolean\n  charge(amountCents: number, token: string): Promise\u003CChargeResult>\n  refund(chargeId: string): Promise\u003CRefundResult>\n  buildReceiptUrl(chargeId: string): string\n}\n\n\u002F\u002F Implementation\nclass CardProvider implements PaymentProvider {\n  readonly name = 'card' as const\n  readonly enabled = true\n\n  async charge(amountCents: number, token: string): Promise\u003CChargeResult> {\n    \u002F\u002F Implementation\n  }\n  \u002F\u002F ...\n}\n```\n\n### 3. React Component Props\n\nExtend native HTML attributes:\n\n```typescript\n\u002F\u002F Extend native button props\ninterface ButtonProps\n  extends React.ComponentProps\u003C\"button\">,\n    VariantProps\u003Ctypeof buttonVariants> {\n  asChild?: boolean\n}\n\n\u002F\u002F With children\ninterface CardProps extends React.ComponentProps\u003C\"div\"> {\n  children: React.ReactNode\n}\n\n\u002F\u002F Callback props\ninterface FormProps {\n  onSubmit: (data: FormData) => Promise\u003Cvoid>\n  isLoading?: boolean\n}\n```\n\n### 4. Nullable Types\n\nBe explicit about nullability:\n\n```typescript\ninterface Analysis {\n  score: number\n  recommendation: string | null  \u002F\u002F Explicitly nullable\n  details?: string              \u002F\u002F Optional (may be undefined)\n}\n\n\u002F\u002F Handle nulls explicitly\nfunction formatRecommendation(rec: string | null): string {\n  if (rec === null) {\n    return 'No recommendation available'\n  }\n  return rec\n}\n```\n\n### 5. Type Guards\n\nCreate type-safe narrowing:\n\n```typescript\n\u002F\u002F Type predicate\nfunction isShipped(order: Order): order is Order & { status: 'shipped' } {\n  return order.status === 'shipped'\n}\n\n\u002F\u002F Usage\nif (isShipped(order)) {\n  \u002F\u002F order.status is now 'shipped'\n}\n\n\u002F\u002F Assertion function\nfunction assertDefined\u003CT>(value: T | undefined, message: string): asserts value is T {\n  if (value === undefined) {\n    throw new Error(message)\n  }\n}\n```\n\n### 6. Generic Utilities\n\n```typescript\n\u002F\u002F Pick specific keys\ntype OrderSummary = Pick\u003COrder, 'id' | 'status' | 'total'>\n\n\u002F\u002F Omit keys\ntype CreateOrderInput = Omit\u003COrder, 'id' | 'status'>\n\n\u002F\u002F Partial for updates\ntype UpdateOrderInput = Partial\u003COrder>\n\n\u002F\u002F Record for maps\ntype StatusCounts = Record\u003COrderStatus, number>\n```\n\n### 7. Async Return Types\n\nBe explicit with Promise types:\n\n```typescript\n\u002F\u002F Function returns\nasync function fetchOrder(id: string): Promise\u003COrder | null> {\n  const rows = await db.query\u003COrder>('SELECT * FROM orders WHERE id = $1', [id])\n  return rows[0] ?? null\n}\n\n\u002F\u002F Error handling\ninterface ApiResult\u003CT> {\n  data: T | null\n  error: string | null\n}\n\nasync function safeFetch\u003CT>(url: string): Promise\u003CApiResult\u003CT>> {\n  try {\n    const data = await fetch(url).then(r => r.json())\n    return { data, error: null }\n  } catch (e) {\n    return { data: null, error: e instanceof Error ? e.message : 'Unknown error' }\n  }\n}\n```\n\n### 8. const Assertions\n\nLock down literal types:\n\n```typescript\n\u002F\u002F Mutable (type: string[])\nconst STATUSES = ['pending', 'paid', 'shipped']\n\n\u002F\u002F Immutable (type: readonly ['pending', 'paid', 'shipped'])\nconst STATUSES = ['pending', 'paid', 'shipped'] as const\n\n\u002F\u002F Extract type from const\ntype Status = typeof STATUSES[number]  \u002F\u002F 'pending' | 'paid' | 'shipped'\n```\n\n## Type File Organization\n\n```\nsrc\u002Ftypes\u002F\n├── api.ts         # Request\u002Fresponse types\n├── billing.ts     # Payment and invoice types\n├── index.ts       # Re-exports\n└── orders.ts      # Order domain types\n```\n\n## Review Checklist\n\nWhen reviewing TypeScript:\n\n- [ ] No `any` types (use `unknown` if truly unknown)\n- [ ] Explicit return types on public functions\n- [ ] Discriminated unions for variants\n- [ ] `readonly` on immutable properties\n- [ ] Nullability explicitly handled (`| null` or `?`)\n- [ ] Interfaces for contracts, types for unions\n- [ ] Generic constraints where applicable\n- [ ] Path aliases (if the project uses them) used consistently\n\n## Anti-Patterns\n\n```typescript\n\u002F\u002F Don't use any\nfunction process(data: any) { ... }  \u002F\u002F Use unknown or a specific type\n\n\u002F\u002F Don't use non-null assertion without checks\nconst value = data!.property  \u002F\u002F Check first or use optional chaining\n\n\u002F\u002F Don't ignore errors\n} catch (e) {  \u002F\u002F Type e properly\n  console.log(e.message)  \u002F\u002F e is unknown, not Error\n}\n\n\u002F\u002F Correct error handling\n} catch (e) {\n  const message = e instanceof Error ? e.message : 'Unknown error'\n}\n\n\u002F\u002F Don't use object\nfunction process(data: object) { ... }  \u002F\u002F Use Record\u003Cstring, unknown>\n```\n",{"name":5,"license":15,"metadata":24,"description":7},{"owner":9,"version":25},"0.1.0","main","0e72138c24cb36f409dcf3abe74fd283ebdfe998","skills\u002Ftypescript","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills","https:\u002F\u002Fgithub.com\u002Frazorvision","http:\u002F\u002Fwww.razorvision.net","Software services firm with a focus in the finance industry.","2026-11-08 06:34:17",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add razorvision\u002Fclara-skills --skill typescript",{"tool":40,"command":41},"bunx","bunx skills add razorvision\u002Fclara-skills --skill typescript",{"tool":43,"command":44},"pnpm","pnpm dlx skills add razorvision\u002Fclara-skills --skill typescript","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript\u002FSKILL.md",true,[],[49,56,62,69,76,83],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7EKD05TFNCAT51YJ7VV486B","\u003Cfolder-name-lowercase-hyphens>","\u003CWhat it does. Use when the user asks for \u003CX> or mentions \u003CY>.>","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Ftemplates\u002Fminimal-skill\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7EKCZ8AM1YBKFSH7JNK097P","full-skill","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Ftemplates\u002Ffull-skill\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7EKCPAS3BDDTPZP8GZE4CR8","testing","Guides writing, reviewing, and debugging Vitest tests for JavaScript and TypeScript projects, covering test structure, async handling, mocking, error cases, setup and teardown, and a review checklist of common anti-patterns. Use when writing new tests, reviewing a test file, or debugging a failing or flaky Vitest suite. Not for Python test suites.","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Ftesting\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7EKCHY6AN7HRM7DV6DD7MST","staleness-check","Sweeps the repo and related sources for artifacts that a just-completed body of work should have updated but did not, such as stale doc indexes, READMEs, ADRs, registries, agent instruction files, agent memory files, issue status, and cross-references, then reports each stale item with a proposed fix. Use at the end of an epic, feature, or executed plan, or when the user says \"staleness check\", \"did we miss anything\", \"are we done\", or \"anything stale\".","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstaleness-check\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7EKCDGZQCRDC6DRXYEJMR66","software-architecture","Guides architectural decisions using Clean Architecture, separation of concerns, and SOLID principles, covering where new code should live, how modules depend on each other, and which anti-patterns to avoid, with a review checklist. Use when designing a new module or feature structure, refactoring code organization, deciding where code belongs, or reviewing a codebase's architecture.","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-architecture\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7EKCA3JSAKDVP8TA2BN60DC","root-cause","Traces a bug backward through the call chain to the original trigger instead of patching where the error surfaces, then fixes it at the source and adds defensive validation at intermediate layers. Use when debugging an error, a failing test, or unexpected behavior where the symptom appears far from its cause.","https:\u002F\u002Fgithub.com\u002Frazorvision\u002Fclara-skills\u002Fblob\u002Fmain\u002Fskills\u002Froot-cause\u002FSKILL.md",[],[]]