[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70K6JCV0Q04N847EERT0K9F":3,"skill-same:01M70K6JCV0Q04N847EERT0K9F":68},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M70K6JCV0Q04N847EERT0K9F","typescript-advanced-types",null,"Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.","shengdabai\u002FTony-Claude-Code-Skills","shengdabai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F116417419?v=4","01M70F6D2WY5PQV5A92BKYJQEW","Tony Sheng","01M70F6D3GAAAYZ5H4CC1G8VXM",3,"MIT","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fwshobson-agents\u002Fplugins\u002Fjavascript-typescript\u002Fskills\u002Ftypescript-advanced-types\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"advanced","typescript advanced types","typescript advanced","typescript","types","system","compile","for","Utilities","master","Safety","safe","Type Safety","template","when","utility","type system","implementing","time","projects","2026-11-10 10:12:30",false,"---\nname: typescript-advanced-types\ndescription: Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.\n---\n\n# TypeScript Advanced Types\n\nComprehensive guidance for mastering TypeScript's advanced type system including generics, conditional types, mapped types, template literal types, and utility types for building robust, type-safe applications.\n\n## When to Use This Skill\n\n- Building type-safe libraries or frameworks\n- Creating reusable generic components\n- Implementing complex type inference logic\n- Designing type-safe API clients\n- Building form validation systems\n- Creating strongly-typed configuration objects\n- Implementing type-safe state management\n- Migrating JavaScript codebases to TypeScript\n\n## Core Concepts\n\n### 1. Generics\n\n**Purpose:** Create reusable, type-flexible components while maintaining type safety.\n\n**Basic Generic Function:**\n```typescript\nfunction identity\u003CT>(value: T): T {\n  return value;\n}\n\nconst num = identity\u003Cnumber>(42);        \u002F\u002F Type: number\nconst str = identity\u003Cstring>(\"hello\");    \u002F\u002F Type: string\nconst auto = identity(true);              \u002F\u002F Type inferred: boolean\n```\n\n**Generic Constraints:**\n```typescript\ninterface HasLength {\n  length: number;\n}\n\nfunction logLength\u003CT extends HasLength>(item: T): T {\n  console.log(item.length);\n  return item;\n}\n\nlogLength(\"hello\");           \u002F\u002F OK: string has length\nlogLength([1, 2, 3]);         \u002F\u002F OK: array has length\nlogLength({ length: 10 });    \u002F\u002F OK: object has length\n\u002F\u002F logLength(42);             \u002F\u002F Error: number has no length\n```\n\n**Multiple Type Parameters:**\n```typescript\nfunction merge\u003CT, U>(obj1: T, obj2: U): T & U {\n  return { ...obj1, ...obj2 };\n}\n\nconst merged = merge(\n  { name: \"John\" },\n  { age: 30 }\n);\n\u002F\u002F Type: { name: string } & { age: number }\n```\n\n### 2. Conditional Types\n\n**Purpose:** Create types that depend on conditions, enabling sophisticated type logic.\n\n**Basic Conditional Type:**\n```typescript\ntype IsString\u003CT> = T extends string ? true : false;\n\ntype A = IsString\u003Cstring>;    \u002F\u002F true\ntype B = IsString\u003Cnumber>;    \u002F\u002F false\n```\n\n**Extracting Return Types:**\n```typescript\ntype ReturnType\u003CT> = T extends (...args: any[]) => infer R ? R : never;\n\nfunction getUser() {\n  return { id: 1, name: \"John\" };\n}\n\ntype User = ReturnType\u003Ctypeof getUser>;\n\u002F\u002F Type: { id: number; name: string; }\n```\n\n**Distributive Conditional Types:**\n```typescript\ntype ToArray\u003CT> = T extends any ? T[] : never;\n\ntype StrOrNumArray = ToArray\u003Cstring | number>;\n\u002F\u002F Type: string[] | number[]\n```\n\n**Nested Conditions:**\n```typescript\ntype TypeName\u003CT> =\n  T extends string ? \"string\" :\n  T extends number ? \"number\" :\n  T extends boolean ? \"boolean\" :\n  T extends undefined ? \"undefined\" :\n  T extends Function ? \"function\" :\n  \"object\";\n\ntype T1 = TypeName\u003Cstring>;     \u002F\u002F \"string\"\ntype T2 = TypeName\u003C() => void>; \u002F\u002F \"function\"\n```\n\n### 3. Mapped Types\n\n**Purpose:** Transform existing types by iterating over their properties.\n\n**Basic Mapped Type:**\n```typescript\ntype Readonly\u003CT> = {\n  readonly [P in keyof T]: T[P];\n};\n\ninterface User {\n  id: number;\n  name: string;\n}\n\ntype ReadonlyUser = Readonly\u003CUser>;\n\u002F\u002F Type: { readonly id: number; readonly name: string; }\n```\n\n**Optional Properties:**\n```typescript\ntype Partial\u003CT> = {\n  [P in keyof T]?: T[P];\n};\n\ntype PartialUser = Partial\u003CUser>;\n\u002F\u002F Type: { id?: number; name?: string; }\n```\n\n**Key Remapping:**\n```typescript\ntype Getters\u003CT> = {\n  [K in keyof T as `get${Capitalize\u003Cstring & K>}`]: () => T[K]\n};\n\ninterface Person {\n  name: string;\n  age: number;\n}\n\ntype PersonGetters = Getters\u003CPerson>;\n\u002F\u002F Type: { getName: () => string; getAge: () => number; }\n```\n\n**Filtering Properties:**\n```typescript\ntype PickByType\u003CT, U> = {\n  [K in keyof T as T[K] extends U ? K : never]: T[K]\n};\n\ninterface Mixed {\n  id: number;\n  name: string;\n  age: number;\n  active: boolean;\n}\n\ntype OnlyNumbers = PickByType\u003CMixed, number>;\n\u002F\u002F Type: { id: number; age: number; }\n```\n\n### 4. Template Literal Types\n\n**Purpose:** Create string-based types with pattern matching and transformation.\n\n**Basic Template Literal:**\n```typescript\ntype EventName = \"click\" | \"focus\" | \"blur\";\ntype EventHandler = `on${Capitalize\u003CEventName>}`;\n\u002F\u002F Type: \"onClick\" | \"onFocus\" | \"onBlur\"\n```\n\n**String Manipulation:**\n```typescript\ntype UppercaseGreeting = Uppercase\u003C\"hello\">;  \u002F\u002F \"HELLO\"\ntype LowercaseGreeting = Lowercase\u003C\"HELLO\">;  \u002F\u002F \"hello\"\ntype CapitalizedName = Capitalize\u003C\"john\">;    \u002F\u002F \"John\"\ntype UncapitalizedName = Uncapitalize\u003C\"John\">; \u002F\u002F \"john\"\n```\n\n**Path Building:**\n```typescript\ntype Path\u003CT> = T extends object\n  ? { [K in keyof T]: K extends string\n      ? `${K}` | `${K}.${Path\u003CT[K]>}`\n      : never\n    }[keyof T]\n  : never;\n\ninterface Config {\n  server: {\n    host: string;\n    port: number;\n  };\n  database: {\n    url: string;\n  };\n}\n\ntype ConfigPath = Path\u003CConfig>;\n\u002F\u002F Type: \"server\" | \"database\" | \"server.host\" | \"server.port\" | \"database.url\"\n```\n\n### 5. Utility Types\n\n**Built-in Utility Types:**\n\n```typescript\n\u002F\u002F Partial\u003CT> - Make all properties optional\ntype PartialUser = Partial\u003CUser>;\n\n\u002F\u002F Required\u003CT> - Make all properties required\ntype RequiredUser = Required\u003CPartialUser>;\n\n\u002F\u002F Readonly\u003CT> - Make all properties readonly\ntype ReadonlyUser = Readonly\u003CUser>;\n\n\u002F\u002F Pick\u003CT, K> - Select specific properties\ntype UserName = Pick\u003CUser, \"name\" | \"email\">;\n\n\u002F\u002F Omit\u003CT, K> - Remove specific properties\ntype UserWithoutPassword = Omit\u003CUser, \"password\">;\n\n\u002F\u002F Exclude\u003CT, U> - Exclude types from union\ntype T1 = Exclude\u003C\"a\" | \"b\" | \"c\", \"a\">;  \u002F\u002F \"b\" | \"c\"\n\n\u002F\u002F Extract\u003CT, U> - Extract types from union\ntype T2 = Extract\u003C\"a\" | \"b\" | \"c\", \"a\" | \"b\">;  \u002F\u002F \"a\" | \"b\"\n\n\u002F\u002F NonNullable\u003CT> - Exclude null and undefined\ntype T3 = NonNullable\u003Cstring | null | undefined>;  \u002F\u002F string\n\n\u002F\u002F Record\u003CK, T> - Create object type with keys K and values T\ntype PageInfo = Record\u003C\"home\" | \"about\", { title: string }>;\n```\n\n## Advanced Patterns\n\n### Pattern 1: Type-Safe Event Emitter\n\n```typescript\ntype EventMap = {\n  \"user:created\": { id: string; name: string };\n  \"user:updated\": { id: string };\n  \"user:deleted\": { id: string };\n};\n\nclass TypedEventEmitter\u003CT extends Record\u003Cstring, any>> {\n  private listeners: {\n    [K in keyof T]?: Array\u003C(data: T[K]) => void>;\n  } = {};\n\n  on\u003CK extends keyof T>(event: K, callback: (data: T[K]) => void): void {\n    if (!this.listeners[event]) {\n      this.listeners[event] = [];\n    }\n    this.listeners[event]!.push(callback);\n  }\n\n  emit\u003CK extends keyof T>(event: K, data: T[K]): void {\n    const callbacks = this.listeners[event];\n    if (callbacks) {\n      callbacks.forEach(callback => callback(data));\n    }\n  }\n}\n\nconst emitter = new TypedEventEmitter\u003CEventMap>();\n\nemitter.on(\"user:created\", (data) => {\n  console.log(data.id, data.name);  \u002F\u002F Type-safe!\n});\n\nemitter.emit(\"user:created\", { id: \"1\", name: \"John\" });\n\u002F\u002F emitter.emit(\"user:created\", { id: \"1\" });  \u002F\u002F Error: missing 'name'\n```\n\n### Pattern 2: Type-Safe API Client\n\n```typescript\ntype HTTPMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n\ntype EndpointConfig = {\n  \"\u002Fusers\": {\n    GET: { response: User[] };\n    POST: { body: { name: string; email: string }; response: User };\n  };\n  \"\u002Fusers\u002F:id\": {\n    GET: { params: { id: string }; response: User };\n    PUT: { params: { id: string }; body: Partial\u003CUser>; response: User };\n    DELETE: { params: { id: string }; response: void };\n  };\n};\n\ntype ExtractParams\u003CT> = T extends { params: infer P } ? P : never;\ntype ExtractBody\u003CT> = T extends { body: infer B } ? B : never;\ntype ExtractResponse\u003CT> = T extends { response: infer R } ? R : never;\n\nclass APIClient\u003CConfig extends Record\u003Cstring, Record\u003CHTTPMethod, any>>> {\n  async request\u003C\n    Path extends keyof Config,\n    Method extends keyof Config[Path]\n  >(\n    path: Path,\n    method: Method,\n    ...[options]: ExtractParams\u003CConfig[Path][Method]> extends never\n      ? ExtractBody\u003CConfig[Path][Method]> extends never\n        ? []\n        : [{ body: ExtractBody\u003CConfig[Path][Method]> }]\n      : [{\n          params: ExtractParams\u003CConfig[Path][Method]>;\n          body?: ExtractBody\u003CConfig[Path][Method]>;\n        }]\n  ): Promise\u003CExtractResponse\u003CConfig[Path][Method]>> {\n    \u002F\u002F Implementation here\n    return {} as any;\n  }\n}\n\nconst api = new APIClient\u003CEndpointConfig>();\n\n\u002F\u002F Type-safe API calls\nconst users = await api.request(\"\u002Fusers\", \"GET\");\n\u002F\u002F Type: User[]\n\nconst newUser = await api.request(\"\u002Fusers\", \"POST\", {\n  body: { name: \"John\", email: \"john@example.com\" }\n});\n\u002F\u002F Type: User\n\nconst user = await api.request(\"\u002Fusers\u002F:id\", \"GET\", {\n  params: { id: \"123\" }\n});\n\u002F\u002F Type: User\n```\n\n### Pattern 3: Builder Pattern with Type Safety\n\n```typescript\ntype BuilderState\u003CT> = {\n  [K in keyof T]: T[K] | undefined;\n};\n\ntype RequiredKeys\u003CT> = {\n  [K in keyof T]-?: {} extends Pick\u003CT, K> ? never : K;\n}[keyof T];\n\ntype OptionalKeys\u003CT> = {\n  [K in keyof T]-?: {} extends Pick\u003CT, K> ? K : never;\n}[keyof T];\n\ntype IsComplete\u003CT, S> =\n  RequiredKeys\u003CT> extends keyof S\n    ? S[RequiredKeys\u003CT>] extends undefined\n      ? false\n      : true\n    : false;\n\nclass Builder\u003CT, S extends BuilderState\u003CT> = {}> {\n  private state: S = {} as S;\n\n  set\u003CK extends keyof T>(\n    key: K,\n    value: T[K]\n  ): Builder\u003CT, S & Record\u003CK, T[K]>> {\n    this.state[key] = value;\n    return this as any;\n  }\n\n  build(\n    this: IsComplete\u003CT, S> extends true ? this : never\n  ): T {\n    return this.state as T;\n  }\n}\n\ninterface User {\n  id: string;\n  name: string;\n  email: string;\n  age?: number;\n}\n\nconst builder = new Builder\u003CUser>();\n\nconst user = builder\n  .set(\"id\", \"1\")\n  .set(\"name\", \"John\")\n  .set(\"email\", \"john@example.com\")\n  .build();  \u002F\u002F OK: all required fields set\n\n\u002F\u002F const incomplete = builder\n\u002F\u002F   .set(\"id\", \"1\")\n\u002F\u002F   .build();  \u002F\u002F Error: missing required fields\n```\n\n### Pattern 4: Deep Readonly\u002FPartial\n\n```typescript\ntype DeepReadonly\u003CT> = {\n  readonly [P in keyof T]: T[P] extends object\n    ? T[P] extends Function\n      ? T[P]\n      : DeepReadonly\u003CT[P]>\n    : T[P];\n};\n\ntype DeepPartial\u003CT> = {\n  [P in keyof T]?: T[P] extends object\n    ? T[P] extends Array\u003Cinfer U>\n      ? Array\u003CDeepPartial\u003CU>>\n      : DeepPartial\u003CT[P]>\n    : T[P];\n};\n\ninterface Config {\n  server: {\n    host: string;\n    port: number;\n    ssl: {\n      enabled: boolean;\n      cert: string;\n    };\n  };\n  database: {\n    url: string;\n    pool: {\n      min: number;\n      max: number;\n    };\n  };\n}\n\ntype ReadonlyConfig = DeepReadonly\u003CConfig>;\n\u002F\u002F All nested properties are readonly\n\ntype PartialConfig = DeepPartial\u003CConfig>;\n\u002F\u002F All nested properties are optional\n```\n\n### Pattern 5: Type-Safe Form Validation\n\n```typescript\ntype ValidationRule\u003CT> = {\n  validate: (value: T) => boolean;\n  message: string;\n};\n\ntype FieldValidation\u003CT> = {\n  [K in keyof T]?: ValidationRule\u003CT[K]>[];\n};\n\ntype ValidationErrors\u003CT> = {\n  [K in keyof T]?: string[];\n};\n\nclass FormValidator\u003CT extends Record\u003Cstring, any>> {\n  constructor(private rules: FieldValidation\u003CT>) {}\n\n  validate(data: T): ValidationErrors\u003CT> | null {\n    const errors: ValidationErrors\u003CT> = {};\n    let hasErrors = false;\n\n    for (const key in this.rules) {\n      const fieldRules = this.rules[key];\n      const value = data[key];\n\n      if (fieldRules) {\n        const fieldErrors: string[] = [];\n\n        for (const rule of fieldRules) {\n          if (!rule.validate(value)) {\n            fieldErrors.push(rule.message);\n          }\n        }\n\n        if (fieldErrors.length > 0) {\n          errors[key] = fieldErrors;\n          hasErrors = true;\n        }\n      }\n    }\n\n    return hasErrors ? errors : null;\n  }\n}\n\ninterface LoginForm {\n  email: string;\n  password: string;\n}\n\nconst validator = new FormValidator\u003CLoginForm>({\n  email: [\n    {\n      validate: (v) => v.includes(\"@\"),\n      message: \"Email must contain @\"\n    },\n    {\n      validate: (v) => v.length > 0,\n      message: \"Email is required\"\n    }\n  ],\n  password: [\n    {\n      validate: (v) => v.length >= 8,\n      message: \"Password must be at least 8 characters\"\n    }\n  ]\n});\n\nconst errors = validator.validate({\n  email: \"invalid\",\n  password: \"short\"\n});\n\u002F\u002F Type: { email?: string[]; password?: string[]; } | null\n```\n\n### Pattern 6: Discriminated Unions\n\n```typescript\ntype Success\u003CT> = {\n  status: \"success\";\n  data: T;\n};\n\ntype Error = {\n  status: \"error\";\n  error: string;\n};\n\ntype Loading = {\n  status: \"loading\";\n};\n\ntype AsyncState\u003CT> = Success\u003CT> | Error | Loading;\n\nfunction handleState\u003CT>(state: AsyncState\u003CT>): void {\n  switch (state.status) {\n    case \"success\":\n      console.log(state.data);  \u002F\u002F Type: T\n      break;\n    case \"error\":\n      console.log(state.error);  \u002F\u002F Type: string\n      break;\n    case \"loading\":\n      console.log(\"Loading...\");\n      break;\n  }\n}\n\n\u002F\u002F Type-safe state machine\ntype State =\n  | { type: \"idle\" }\n  | { type: \"fetching\"; requestId: string }\n  | { type: \"success\"; data: any }\n  | { type: \"error\"; error: Error };\n\ntype Event =\n  | { type: \"FETCH\"; requestId: string }\n  | { type: \"SUCCESS\"; data: any }\n  | { type: \"ERROR\"; error: Error }\n  | { type: \"RESET\" };\n\nfunction reducer(state: State, event: Event): State {\n  switch (state.type) {\n    case \"idle\":\n      return event.type === \"FETCH\"\n        ? { type: \"fetching\", requestId: event.requestId }\n        : state;\n    case \"fetching\":\n      if (event.type === \"SUCCESS\") {\n        return { type: \"success\", data: event.data };\n      }\n      if (event.type === \"ERROR\") {\n        return { type: \"error\", error: event.error };\n      }\n      return state;\n    case \"success\":\n    case \"error\":\n      return event.type === \"RESET\" ? { type: \"idle\" } : state;\n  }\n}\n```\n\n## Type Inference Techniques\n\n### 1. Infer Keyword\n\n```typescript\n\u002F\u002F Extract array element type\ntype ElementType\u003CT> = T extends (infer U)[] ? U : never;\n\ntype NumArray = number[];\ntype Num = ElementType\u003CNumArray>;  \u002F\u002F number\n\n\u002F\u002F Extract promise type\ntype PromiseType\u003CT> = T extends Promise\u003Cinfer U> ? U : never;\n\ntype AsyncNum = PromiseType\u003CPromise\u003Cnumber>>;  \u002F\u002F number\n\n\u002F\u002F Extract function parameters\ntype Parameters\u003CT> = T extends (...args: infer P) => any ? P : never;\n\nfunction foo(a: string, b: number) {}\ntype FooParams = Parameters\u003Ctypeof foo>;  \u002F\u002F [string, number]\n```\n\n### 2. Type Guards\n\n```typescript\nfunction isString(value: unknown): value is string {\n  return typeof value === \"string\";\n}\n\nfunction isArrayOf\u003CT>(\n  value: unknown,\n  guard: (item: unknown) => item is T\n): value is T[] {\n  return Array.isArray(value) && value.every(guard);\n}\n\nconst data: unknown = [\"a\", \"b\", \"c\"];\n\nif (isArrayOf(data, isString)) {\n  data.forEach(s => s.toUpperCase());  \u002F\u002F Type: string[]\n}\n```\n\n### 3. Assertion Functions\n\n```typescript\nfunction assertIsString(value: unknown): asserts value is string {\n  if (typeof value !== \"string\") {\n    throw new Error(\"Not a string\");\n  }\n}\n\nfunction processValue(value: unknown) {\n  assertIsString(value);\n  \u002F\u002F value is now typed as string\n  console.log(value.toUpperCase());\n}\n```\n\n## Best Practices\n\n1. **Use `unknown` over `any`**: Enforce type checking\n2. **Prefer `interface` for object shapes**: Better error messages\n3. **Use `type` for unions and complex types**: More flexible\n4. **Leverage type inference**: Let TypeScript infer when possible\n5. **Create helper types**: Build reusable type utilities\n6. **Use const assertions**: Preserve literal types\n7. **Avoid type assertions**: Use type guards instead\n8. **Document complex types**: Add JSDoc comments\n9. **Use strict mode**: Enable all strict compiler options\n10. **Test your types**: Use type tests to verify type behavior\n\n## Type Testing\n\n```typescript\n\u002F\u002F Type assertion tests\ntype AssertEqual\u003CT, U> =\n  [T] extends [U]\n    ? [U] extends [T]\n      ? true\n      : false\n    : false;\n\ntype Test1 = AssertEqual\u003Cstring, string>;        \u002F\u002F true\ntype Test2 = AssertEqual\u003Cstring, number>;        \u002F\u002F false\ntype Test3 = AssertEqual\u003Cstring | number, string>; \u002F\u002F false\n\n\u002F\u002F Expect error helper\ntype ExpectError\u003CT extends never> = T;\n\n\u002F\u002F Example usage\ntype ShouldError = ExpectError\u003CAssertEqual\u003Cstring, number>>;\n```\n\n## Common Pitfalls\n\n1. **Over-using `any`**: Defeats the purpose of TypeScript\n2. **Ignoring strict null checks**: Can lead to runtime errors\n3. **Too complex types**: Can slow down compilation\n4. **Not using discriminated unions**: Misses type narrowing opportunities\n5. **Forgetting readonly modifiers**: Allows unintended mutations\n6. **Circular type references**: Can cause compiler errors\n7. **Not handling edge cases**: Like empty arrays or null values\n\n## Performance Considerations\n\n- Avoid deeply nested conditional types\n- Use simple types when possible\n- Cache complex type computations\n- Limit recursion depth in recursive types\n- Use build tools to skip type checking in production\n\n## Resources\n\n- **TypeScript Handbook**: https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002F\n- **Type Challenges**: https:\u002F\u002Fgithub.com\u002Ftype-challenges\u002Ftype-challenges\n- **TypeScript Deep Dive**: https:\u002F\u002Fbasarat.gitbook.io\u002Ftypescript\u002F\n- **Effective TypeScript**: Book by Dan Vanderkam\n","# TypeScript Advanced Types\n\nComprehensive guidance for mastering TypeScript's advanced type system including generics, conditional types, mapped types, template literal types, and utility types for building robust, type-safe applications.\n\n## When to Use This Skill\n\n- Building type-safe libraries or frameworks\n- Creating reusable generic components\n- Implementing complex type inference logic\n- Designing type-safe API clients\n- Building form validation systems\n- Creating strongly-typed configuration objects\n- Implementing type-safe state management\n- Migrating JavaScript codebases to TypeScript\n\n## Core Concepts\n\n### 1. Generics\n\n**Purpose:** Create reusable, type-flexible components while maintaining type safety.\n\n**Basic Generic Function:**\n```typescript\nfunction identity\u003CT>(value: T): T {\n  return value;\n}\n\nconst num = identity\u003Cnumber>(42);        \u002F\u002F Type: number\nconst str = identity\u003Cstring>(\"hello\");    \u002F\u002F Type: string\nconst auto = identity(true);              \u002F\u002F Type inferred: boolean\n```\n\n**Generic Constraints:**\n```typescript\ninterface HasLength {\n  length: number;\n}\n\nfunction logLength\u003CT extends HasLength>(item: T): T {\n  console.log(item.length);\n  return item;\n}\n\nlogLength(\"hello\");           \u002F\u002F OK: string has length\nlogLength([1, 2, 3]);         \u002F\u002F OK: array has length\nlogLength({ length: 10 });    \u002F\u002F OK: object has length\n\u002F\u002F logLength(42);             \u002F\u002F Error: number has no length\n```\n\n**Multiple Type Parameters:**\n```typescript\nfunction merge\u003CT, U>(obj1: T, obj2: U): T & U {\n  return { ...obj1, ...obj2 };\n}\n\nconst merged = merge(\n  { name: \"John\" },\n  { age: 30 }\n);\n\u002F\u002F Type: { name: string } & { age: number }\n```\n\n### 2. Conditional Types\n\n**Purpose:** Create types that depend on conditions, enabling sophisticated type logic.\n\n**Basic Conditional Type:**\n```typescript\ntype IsString\u003CT> = T extends string ? true : false;\n\ntype A = IsString\u003Cstring>;    \u002F\u002F true\ntype B = IsString\u003Cnumber>;    \u002F\u002F false\n```\n\n**Extracting Return Types:**\n```typescript\ntype ReturnType\u003CT> = T extends (...args: any[]) => infer R ? R : never;\n\nfunction getUser() {\n  return { id: 1, name: \"John\" };\n}\n\ntype User = ReturnType\u003Ctypeof getUser>;\n\u002F\u002F Type: { id: number; name: string; }\n```\n\n**Distributive Conditional Types:**\n```typescript\ntype ToArray\u003CT> = T extends any ? T[] : never;\n\ntype StrOrNumArray = ToArray\u003Cstring | number>;\n\u002F\u002F Type: string[] | number[]\n```\n\n**Nested Conditions:**\n```typescript\ntype TypeName\u003CT> =\n  T extends string ? \"string\" :\n  T extends number ? \"number\" :\n  T extends boolean ? \"boolean\" :\n  T extends undefined ? \"undefined\" :\n  T extends Function ? \"function\" :\n  \"object\";\n\ntype T1 = TypeName\u003Cstring>;     \u002F\u002F \"string\"\ntype T2 = TypeName\u003C() => void>; \u002F\u002F \"function\"\n```\n\n### 3. Mapped Types\n\n**Purpose:** Transform existing types by iterating over their properties.\n\n**Basic Mapped Type:**\n```typescript\ntype Readonly\u003CT> = {\n  readonly [P in keyof T]: T[P];\n};\n\ninterface User {\n  id: number;\n  name: string;\n}\n\ntype ReadonlyUser = Readonly\u003CUser>;\n\u002F\u002F Type: { readonly id: number; readonly name: string; }\n```\n\n**Optional Properties:**\n```typescript\ntype Partial\u003CT> = {\n  [P in keyof T]?: T[P];\n};\n\ntype PartialUser = Partial\u003CUser>;\n\u002F\u002F Type: { id?: number; name?: string; }\n```\n\n**Key Remapping:**\n```typescript\ntype Getters\u003CT> = {\n  [K in keyof T as `get${Capitalize\u003Cstring & K>}`]: () => T[K]\n};\n\ninterface Person {\n  name: string;\n  age: number;\n}\n\ntype PersonGetters = Getters\u003CPerson>;\n\u002F\u002F Type: { getName: () => string; getAge: () => number; }\n```\n\n**Filtering Properties:**\n```typescript\ntype PickByType\u003CT, U> = {\n  [K in keyof T as T[K] extends U ? K : never]: T[K]\n};\n\ninterface Mixed {\n  id: number;\n  name: string;\n  age: number;\n  active: boolean;\n}\n\ntype OnlyNumbers = PickByType\u003CMixed, number>;\n\u002F\u002F Type: { id: number; age: number; }\n```\n\n### 4. Template Literal Types\n\n**Purpose:** Create string-based types with pattern matching and transformation.\n\n**Basic Template Literal:**\n```typescript\ntype EventName = \"click\" | \"focus\" | \"blur\";\ntype EventHandler = `on${Capitalize\u003CEventName>}`;\n\u002F\u002F Type: \"onClick\" | \"onFocus\" | \"onBlur\"\n```\n\n**String Manipulation:**\n```typescript\ntype UppercaseGreeting = Uppercase\u003C\"hello\">;  \u002F\u002F \"HELLO\"\ntype LowercaseGreeting = Lowercase\u003C\"HELLO\">;  \u002F\u002F \"hello\"\ntype CapitalizedName = Capitalize\u003C\"john\">;    \u002F\u002F \"John\"\ntype UncapitalizedName = Uncapitalize\u003C\"John\">; \u002F\u002F \"john\"\n```\n\n**Path Building:**\n```typescript\ntype Path\u003CT> = T extends object\n  ? { [K in keyof T]: K extends string\n      ? `${K}` | `${K}.${Path\u003CT[K]>}`\n      : never\n    }[keyof T]\n  : never;\n\ninterface Config {\n  server: {\n    host: string;\n    port: number;\n  };\n  database: {\n    url: string;\n  };\n}\n\ntype ConfigPath = Path\u003CConfig>;\n\u002F\u002F Type: \"server\" | \"database\" | \"server.host\" | \"server.port\" | \"database.url\"\n```\n\n### 5. Utility Types\n\n**Built-in Utility Types:**\n\n```typescript\n\u002F\u002F Partial\u003CT> - Make all properties optional\ntype PartialUser = Partial\u003CUser>;\n\n\u002F\u002F Required\u003CT> - Make all properties required\ntype RequiredUser = Required\u003CPartialUser>;\n\n\u002F\u002F Readonly\u003CT> - Make all properties readonly\ntype ReadonlyUser = Readonly\u003CUser>;\n\n\u002F\u002F Pick\u003CT, K> - Select specific properties\ntype UserName = Pick\u003CUser, \"name\" | \"email\">;\n\n\u002F\u002F Omit\u003CT, K> - Remove specific properties\ntype UserWithoutPassword = Omit\u003CUser, \"password\">;\n\n\u002F\u002F Exclude\u003CT, U> - Exclude types from union\ntype T1 = Exclude\u003C\"a\" | \"b\" | \"c\", \"a\">;  \u002F\u002F \"b\" | \"c\"\n\n\u002F\u002F Extract\u003CT, U> - Extract types from union\ntype T2 = Extract\u003C\"a\" | \"b\" | \"c\", \"a\" | \"b\">;  \u002F\u002F \"a\" | \"b\"\n\n\u002F\u002F NonNullable\u003CT> - Exclude null and undefined\ntype T3 = NonNullable\u003Cstring | null | undefined>;  \u002F\u002F string\n\n\u002F\u002F Record\u003CK, T> - Create object type with keys K and values T\ntype PageInfo = Record\u003C\"home\" | \"about\", { title: string }>;\n```\n\n## Advanced Patterns\n\n### Pattern 1: Type-Safe Event Emitter\n\n```typescript\ntype EventMap = {\n  \"user:created\": { id: string; name: string };\n  \"user:updated\": { id: string };\n  \"user:deleted\": { id: string };\n};\n\nclass TypedEventEmitter\u003CT extends Record\u003Cstring, any>> {\n  private listeners: {\n    [K in keyof T]?: Array\u003C(data: T[K]) => void>;\n  } = {};\n\n  on\u003CK extends keyof T>(event: K, callback: (data: T[K]) => void): void {\n    if (!this.listeners[event]) {\n      this.listeners[event] = [];\n    }\n    this.listeners[event]!.push(callback);\n  }\n\n  emit\u003CK extends keyof T>(event: K, data: T[K]): void {\n    const callbacks = this.listeners[event];\n    if (callbacks) {\n      callbacks.forEach(callback => callback(data));\n    }\n  }\n}\n\nconst emitter = new TypedEventEmitter\u003CEventMap>();\n\nemitter.on(\"user:created\", (data) => {\n  console.log(data.id, data.name);  \u002F\u002F Type-safe!\n});\n\nemitter.emit(\"user:created\", { id: \"1\", name: \"John\" });\n\u002F\u002F emitter.emit(\"user:created\", { id: \"1\" });  \u002F\u002F Error: missing 'name'\n```\n\n### Pattern 2: Type-Safe API Client\n\n```typescript\ntype HTTPMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n\ntype EndpointConfig = {\n  \"\u002Fusers\": {\n    GET: { response: User[] };\n    POST: { body: { name: string; email: string }; response: User };\n  };\n  \"\u002Fusers\u002F:id\": {\n    GET: { params: { id: string }; response: User };\n    PUT: { params: { id: string }; body: Partial\u003CUser>; response: User };\n    DELETE: { params: { id: string }; response: void };\n  };\n};\n\ntype ExtractParams\u003CT> = T extends { params: infer P } ? P : never;\ntype ExtractBody\u003CT> = T extends { body: infer B } ? B : never;\ntype ExtractResponse\u003CT> = T extends { response: infer R } ? R : never;\n\nclass APIClient\u003CConfig extends Record\u003Cstring, Record\u003CHTTPMethod, any>>> {\n  async request\u003C\n    Path extends keyof Config,\n    Method extends keyof Config[Path]\n  >(\n    path: Path,\n    method: Method,\n    ...[options]: ExtractParams\u003CConfig[Path][Method]> extends never\n      ? ExtractBody\u003CConfig[Path][Method]> extends never\n        ? []\n        : [{ body: ExtractBody\u003CConfig[Path][Method]> }]\n      : [{\n          params: ExtractParams\u003CConfig[Path][Method]>;\n          body?: ExtractBody\u003CConfig[Path][Method]>;\n        }]\n  ): Promise\u003CExtractResponse\u003CConfig[Path][Method]>> {\n    \u002F\u002F Implementation here\n    return {} as any;\n  }\n}\n\nconst api = new APIClient\u003CEndpointConfig>();\n\n\u002F\u002F Type-safe API calls\nconst users = await api.request(\"\u002Fusers\", \"GET\");\n\u002F\u002F Type: User[]\n\nconst newUser = await api.request(\"\u002Fusers\", \"POST\", {\n  body: { name: \"John\", email: \"john@example.com\" }\n});\n\u002F\u002F Type: User\n\nconst user = await api.request(\"\u002Fusers\u002F:id\", \"GET\", {\n  params: { id: \"123\" }\n});\n\u002F\u002F Type: User\n```\n\n### Pattern 3: Builder Pattern with Type Safety\n\n```typescript\ntype BuilderState\u003CT> = {\n  [K in keyof T]: T[K] | undefined;\n};\n\ntype RequiredKeys\u003CT> = {\n  [K in keyof T]-?: {} extends Pick\u003CT, K> ? never : K;\n}[keyof T];\n\ntype OptionalKeys\u003CT> = {\n  [K in keyof T]-?: {} extends Pick\u003CT, K> ? K : never;\n}[keyof T];\n\ntype IsComplete\u003CT, S> =\n  RequiredKeys\u003CT> extends keyof S\n    ? S[RequiredKeys\u003CT>] extends undefined\n      ? false\n      : true\n    : false;\n\nclass Builder\u003CT, S extends BuilderState\u003CT> = {}> {\n  private state: S = {} as S;\n\n  set\u003CK extends keyof T>(\n    key: K,\n    value: T[K]\n  ): Builder\u003CT, S & Record\u003CK, T[K]>> {\n    this.state[key] = value;\n    return this as any;\n  }\n\n  build(\n    this: IsComplete\u003CT, S> extends true ? this : never\n  ): T {\n    return this.state as T;\n  }\n}\n\ninterface User {\n  id: string;\n  name: string;\n  email: string;\n  age?: number;\n}\n\nconst builder = new Builder\u003CUser>();\n\nconst user = builder\n  .set(\"id\", \"1\")\n  .set(\"name\", \"John\")\n  .set(\"email\", \"john@example.com\")\n  .build();  \u002F\u002F OK: all required fields set\n\n\u002F\u002F const incomplete = builder\n\u002F\u002F   .set(\"id\", \"1\")\n\u002F\u002F   .build();  \u002F\u002F Error: missing required fields\n```\n\n### Pattern 4: Deep Readonly\u002FPartial\n\n```typescript\ntype DeepReadonly\u003CT> = {\n  readonly [P in keyof T]: T[P] extends object\n    ? T[P] extends Function\n      ? T[P]\n      : DeepReadonly\u003CT[P]>\n    : T[P];\n};\n\ntype DeepPartial\u003CT> = {\n  [P in keyof T]?: T[P] extends object\n    ? T[P] extends Array\u003Cinfer U>\n      ? Array\u003CDeepPartial\u003CU>>\n      : DeepPartial\u003CT[P]>\n    : T[P];\n};\n\ninterface Config {\n  server: {\n    host: string;\n    port: number;\n    ssl: {\n      enabled: boolean;\n      cert: string;\n    };\n  };\n  database: {\n    url: string;\n    pool: {\n      min: number;\n      max: number;\n    };\n  };\n}\n\ntype ReadonlyConfig = DeepReadonly\u003CConfig>;\n\u002F\u002F All nested properties are readonly\n\ntype PartialConfig = DeepPartial\u003CConfig>;\n\u002F\u002F All nested properties are optional\n```\n\n### Pattern 5: Type-Safe Form Validation\n\n```typescript\ntype ValidationRule\u003CT> = {\n  validate: (value: T) => boolean;\n  message: string;\n};\n\ntype FieldValidation\u003CT> = {\n  [K in keyof T]?: ValidationRule\u003CT[K]>[];\n};\n\ntype ValidationErrors\u003CT> = {\n  [K in keyof T]?: string[];\n};\n\nclass FormValidator\u003CT extends Record\u003Cstring, any>> {\n  constructor(private rules: FieldValidation\u003CT>) {}\n\n  validate(data: T): ValidationErrors\u003CT> | null {\n    const errors: ValidationErrors\u003CT> = {};\n    let hasErrors = false;\n\n    for (const key in this.rules) {\n      const fieldRules = this.rules[key];\n      const value = data[key];\n\n      if (fieldRules) {\n        const fieldErrors: string[] = [];\n\n        for (const rule of fieldRules) {\n          if (!rule.validate(value)) {\n            fieldErrors.push(rule.message);\n          }\n        }\n\n        if (fieldErrors.length > 0) {\n          errors[key] = fieldErrors;\n          hasErrors = true;\n        }\n      }\n    }\n\n    return hasErrors ? errors : null;\n  }\n}\n\ninterface LoginForm {\n  email: string;\n  password: string;\n}\n\nconst validator = new FormValidator\u003CLoginForm>({\n  email: [\n    {\n      validate: (v) => v.includes(\"@\"),\n      message: \"Email must contain @\"\n    },\n    {\n      validate: (v) => v.length > 0,\n      message: \"Email is required\"\n    }\n  ],\n  password: [\n    {\n      validate: (v) => v.length >= 8,\n      message: \"Password must be at least 8 characters\"\n    }\n  ]\n});\n\nconst errors = validator.validate({\n  email: \"invalid\",\n  password: \"short\"\n});\n\u002F\u002F Type: { email?: string[]; password?: string[]; } | null\n```\n\n### Pattern 6: Discriminated Unions\n\n```typescript\ntype Success\u003CT> = {\n  status: \"success\";\n  data: T;\n};\n\ntype Error = {\n  status: \"error\";\n  error: string;\n};\n\ntype Loading = {\n  status: \"loading\";\n};\n\ntype AsyncState\u003CT> = Success\u003CT> | Error | Loading;\n\nfunction handleState\u003CT>(state: AsyncState\u003CT>): void {\n  switch (state.status) {\n    case \"success\":\n      console.log(state.data);  \u002F\u002F Type: T\n      break;\n    case \"error\":\n      console.log(state.error);  \u002F\u002F Type: string\n      break;\n    case \"loading\":\n      console.log(\"Loading...\");\n      break;\n  }\n}\n\n\u002F\u002F Type-safe state machine\ntype State =\n  | { type: \"idle\" }\n  | { type: \"fetching\"; requestId: string }\n  | { type: \"success\"; data: any }\n  | { type: \"error\"; error: Error };\n\ntype Event =\n  | { type: \"FETCH\"; requestId: string }\n  | { type: \"SUCCESS\"; data: any }\n  | { type: \"ERROR\"; error: Error }\n  | { type: \"RESET\" };\n\nfunction reducer(state: State, event: Event): State {\n  switch (state.type) {\n    case \"idle\":\n      return event.type === \"FETCH\"\n        ? { type: \"fetching\", requestId: event.requestId }\n        : state;\n    case \"fetching\":\n      if (event.type === \"SUCCESS\") {\n        return { type: \"success\", data: event.data };\n      }\n      if (event.type === \"ERROR\") {\n        return { type: \"error\", error: event.error };\n      }\n      return state;\n    case \"success\":\n    case \"error\":\n      return event.type === \"RESET\" ? { type: \"idle\" } : state;\n  }\n}\n```\n\n## Type Inference Techniques\n\n### 1. Infer Keyword\n\n```typescript\n\u002F\u002F Extract array element type\ntype ElementType\u003CT> = T extends (infer U)[] ? U : never;\n\ntype NumArray = number[];\ntype Num = ElementType\u003CNumArray>;  \u002F\u002F number\n\n\u002F\u002F Extract promise type\ntype PromiseType\u003CT> = T extends Promise\u003Cinfer U> ? U : never;\n\ntype AsyncNum = PromiseType\u003CPromise\u003Cnumber>>;  \u002F\u002F number\n\n\u002F\u002F Extract function parameters\ntype Parameters\u003CT> = T extends (...args: infer P) => any ? P : never;\n\nfunction foo(a: string, b: number) {}\ntype FooParams = Parameters\u003Ctypeof foo>;  \u002F\u002F [string, number]\n```\n\n### 2. Type Guards\n\n```typescript\nfunction isString(value: unknown): value is string {\n  return typeof value === \"string\";\n}\n\nfunction isArrayOf\u003CT>(\n  value: unknown,\n  guard: (item: unknown) => item is T\n): value is T[] {\n  return Array.isArray(value) && value.every(guard);\n}\n\nconst data: unknown = [\"a\", \"b\", \"c\"];\n\nif (isArrayOf(data, isString)) {\n  data.forEach(s => s.toUpperCase());  \u002F\u002F Type: string[]\n}\n```\n\n### 3. Assertion Functions\n\n```typescript\nfunction assertIsString(value: unknown): asserts value is string {\n  if (typeof value !== \"string\") {\n    throw new Error(\"Not a string\");\n  }\n}\n\nfunction processValue(value: unknown) {\n  assertIsString(value);\n  \u002F\u002F value is now typed as string\n  console.log(value.toUpperCase());\n}\n```\n\n## Best Practices\n\n1. **Use `unknown` over `any`**: Enforce type checking\n2. **Prefer `interface` for object shapes**: Better error messages\n3. **Use `type` for unions and complex types**: More flexible\n4. **Leverage type inference**: Let TypeScript infer when possible\n5. **Create helper types**: Build reusable type utilities\n6. **Use const assertions**: Preserve literal types\n7. **Avoid type assertions**: Use type guards instead\n8. **Document complex types**: Add JSDoc comments\n9. **Use strict mode**: Enable all strict compiler options\n10. **Test your types**: Use type tests to verify type behavior\n\n## Type Testing\n\n```typescript\n\u002F\u002F Type assertion tests\ntype AssertEqual\u003CT, U> =\n  [T] extends [U]\n    ? [U] extends [T]\n      ? true\n      : false\n    : false;\n\ntype Test1 = AssertEqual\u003Cstring, string>;        \u002F\u002F true\ntype Test2 = AssertEqual\u003Cstring, number>;        \u002F\u002F false\ntype Test3 = AssertEqual\u003Cstring | number, string>; \u002F\u002F false\n\n\u002F\u002F Expect error helper\ntype ExpectError\u003CT extends never> = T;\n\n\u002F\u002F Example usage\ntype ShouldError = ExpectError\u003CAssertEqual\u003Cstring, number>>;\n```\n\n## Common Pitfalls\n\n1. **Over-using `any`**: Defeats the purpose of TypeScript\n2. **Ignoring strict null checks**: Can lead to runtime errors\n3. **Too complex types**: Can slow down compilation\n4. **Not using discriminated unions**: Misses type narrowing opportunities\n5. **Forgetting readonly modifiers**: Allows unintended mutations\n6. **Circular type references**: Can cause compiler errors\n7. **Not handling edge cases**: Like empty arrays or null values\n\n## Performance Considerations\n\n- Avoid deeply nested conditional types\n- Use simple types when possible\n- Cache complex type computations\n- Limit recursion depth in recursive types\n- Use build tools to skip type checking in production\n\n## Resources\n\n- **TypeScript Handbook**: https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002F\n- **Type Challenges**: https:\u002F\u002Fgithub.com\u002Ftype-challenges\u002Ftype-challenges\n- **TypeScript Deep Dive**: https:\u002F\u002Fbasarat.gitbook.io\u002Ftypescript\u002F\n- **Effective TypeScript**: Book by Dan Vanderkam\n",{"name":5,"description":7},"main","7850740bd837adb32f0a109ab2af82482196c6f2","skills\u002F_collections\u002Fwshobson-agents\u002Fplugins\u002Fjavascript-typescript\u002Fskills\u002Ftypescript-advanced-types",1,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills","https:\u002F\u002Fzturnsgo.com","https:\u002F\u002Fgithub.com\u002Fshengdabai","https:\u002F\u002Fzturnsgo.com\u002F","AI × education creator — producer, not consumer. Taught 6,000+ learners; shipping learning tools & daily essays with Claude Code, practicing @xiaolai's way 🥋","2026-11-01 21:28:23",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add shengdabai\u002FTony-Claude-Code-Skills --skill typescript-advanced-types",{"tool":60,"command":61},"bunx","bunx skills add shengdabai\u002FTony-Claude-Code-Skills --skill typescript-advanced-types",{"tool":63,"command":64},"pnpm","pnpm dlx skills add shengdabai\u002FTony-Claude-Code-Skills --skill typescript-advanced-types","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fwshobson-agents\u002Fplugins\u002Fjavascript-typescript\u002Fskills\u002Ftypescript-advanced-types\u002FSKILL.md",true,[],[69,78,86,94,102,110],{"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":73,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":77},"01M73H7XKBHE1ETQDZT94MF9HH","seedance-prompt-en","Write effective prompts for Jimeng Seedance 2.0 multimodal AI video generation. Use when users want to create video prompts using text, images, videos, and audio inputs with the @ reference system. Covers camera movements, effects replication, video extension, editing, music beat-matching, e-commerce ads, short dramas, and educational content.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fseedance-prompt-en\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fseedance-prompt-en\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":82,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":77},"01M73GRE9998Q1DZWC71N41JWG","onepage-pdf","Convert an HTML page into a single continuous-page PDF (one tall page, no pagination breaks), preserving desktop layout, backgrounds and selectable text. Use when the user asks to turn an HTML file\u002Freport\u002Fproposal into a \"single-page PDF\", \"long PDF\", \"不分页 PDF\", \"单页 PDF\", \"长图式 PDF\", or complains that an HTML-to-PDF export breaks into pages or cuts content. Supports optional string redaction with leak verification.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fonepage-pdf\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fonepage-pdf\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":77},"01M73GQG1KZDADVPV3MHAT1J5A","native-feel-cross-platform-desktop","Use when the user is designing, prototyping, or rewriting a desktop app that must run on multiple OSes (macOS + Windows, optionally Linux) AND feel indistinguishable from a native app to its users — fast launch, native windowing, native input handling, native materials. Trigger words include \"cross-platform desktop\", \"Electron alternative\", \"Tauri vs native\", \"WebView wrapper\", \"near-native performance\", \"Raycast architecture\", \"WebKit\u002FWebView2 quirks\", \"WKWebView\", \"system tray app\", \"global hotkey app\", \"launcher app\". Do NOT trigger this skill for pure web apps, pure mobile apps, or for greenfield projects that have no native-feel requirement.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fnative-feel-cross-platform-desktop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fnative-feel-cross-platform-desktop\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":77},"01M73G87PDNSMKG2FHWCYER6N8","gstack","Router for the gstack skill suite. (gstack)","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fgstack\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fgstack\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":77},"01M73G3EAQWKCM8DB8D0N0QSVG","fireworks-tech-graph","Use when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent\u002Fmemory, or concept map - and export as SVG+PNG. Trigger on: \"画图\" \"帮我画\" \"生成图\" \"做个图\" \"架构图\" \"流程图\" \"可视化一下\" \"出图\" \"generate diagram\" \"draw diagram\" \"visualize\" or any system\u002Fflow description the user wants illustrated.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ffireworks-tech-graph\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ffireworks-tech-graph\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":77},"01M73G086AXAH9DW1H5G5N3CPB","dbs-video-extract","接收抖音、小红书、微信视频号等短视频链接或分享文案，查询作品／账号数据并提取语音文字稿，按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用；运行前检查 TikHub 与轻抖使用凭证，缺少时用新手能理解的方式引导购买和安全配置。","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fdbs-video-extract\u002FSKILL.md",[],[]]