[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B37E2YHKCQHQ4ZTYPAVVZE":3,"skill-same:01M7B37E2YHKCQHQ4ZTYPAVVZE":49},{"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":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7B37E2YHKCQHQ4ZTYPAVVZE","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.","gethamster\u002Fskills","gethamster","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F215697643?v=4","01M7B2R6PGB3SDZZ71E0WE2S74","Hamster","01M7B2R6Q21HWJRXZZWB78BNDG",4,"MIT","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Ftypescript-advanced-types\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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.\"\nversion: \"1.1.0\"\ncategory: \"Development\"\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\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\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\n```typescript\nfunction merge\u003CT, U>(obj1: T, obj2: U): T & U {\n  return { ...obj1, ...obj2 };\n}\n\nconst merged = merge({ name: \"John\" }, { age: 30 });\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\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\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\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\n```typescript\ntype TypeName\u003CT> = T extends string\n  ? \"string\"\n  : T extends number\n    ? \"number\"\n    : T extends boolean\n      ? \"boolean\"\n      : T extends undefined\n        ? \"undefined\"\n        : T extends Function\n          ? \"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\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\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\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\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\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\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\n```typescript\ntype Path\u003CT> = T extends object\n  ? {\n      [K in keyof T]: K extends string ? `${K}` | `${K}.${Path\u003CT[K]>}` : 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\u003CPath extends keyof Config, Method extends keyof Config[Path]>(\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          {\n            params: ExtractParams\u003CConfig[Path][Method]>;\n            body?: ExtractBody\u003CConfig[Path][Method]>;\n          },\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>(key: K, value: T[K]): Builder\u003CT, S & Record\u003CK, T[K]>> {\n    this.state[key] = value;\n    return this as any;\n  }\n\n  build(this: IsComplete\u003CT, S> extends true ? this : never): 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> = [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\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\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\n```typescript\nfunction merge\u003CT, U>(obj1: T, obj2: U): T & U {\n  return { ...obj1, ...obj2 };\n}\n\nconst merged = merge({ name: \"John\" }, { age: 30 });\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\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\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\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\n```typescript\ntype TypeName\u003CT> = T extends string\n  ? \"string\"\n  : T extends number\n    ? \"number\"\n    : T extends boolean\n      ? \"boolean\"\n      : T extends undefined\n        ? \"undefined\"\n        : T extends Function\n          ? \"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\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\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\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\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\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\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\n```typescript\ntype Path\u003CT> = T extends object\n  ? {\n      [K in keyof T]: K extends string ? `${K}` | `${K}.${Path\u003CT[K]>}` : 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\u003CPath extends keyof Config, Method extends keyof Config[Path]>(\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          {\n            params: ExtractParams\u003CConfig[Path][Method]>;\n            body?: ExtractBody\u003CConfig[Path][Method]>;\n          },\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>(key: K, value: T[K]): Builder\u003CT, S & Record\u003CK, T[K]>> {\n    this.state[key] = value;\n    return this as any;\n  }\n\n  build(this: IsComplete\u003CT, S> extends true ? this : never): 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> = [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,"version":24,"category":25,"description":7},"1.1.0","Development","main","fe3bb1476c3ec23d8a366eac0fa8cd9f0852360a","skills\u002F.experimental\u002Ftypescript-advanced-types",0,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgethamster","https:\u002F\u002Ftryhamster.com","We're building the AI-native future of work, unlocking the promised acceleration for your whole team, from idea to impact.","2026-11-05 11:33:33",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add gethamster\u002Fskills --skill typescript-advanced-types",{"tool":41,"command":42},"bunx","bunx skills add gethamster\u002Fskills --skill typescript-advanced-types",{"tool":44,"command":45},"pnpm","pnpm dlx skills add gethamster\u002Fskills --skill typescript-advanced-types","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Ftypescript-advanced-types\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7B5MWYW0KE251276S56KQDZ","writing-waterfall-requirements-documents","Write a waterfall requirements document: elicit, structure and review testable, traceable requirements, then baseline the specification before design.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-waterfall-requirements-documents\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7B5MRCXWWPKREPB1CHQ7H90","writing-vision-and-values-statements","Write a V2MOM vision a reader can test and a ranked list of values that settles real tradeoffs, so the rest of the document has a clear anchor.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-vision-and-values-statements\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7B5MKH2CH22YZAHQW3080VQ","writing-system-prompts-for-claude","Write Claude prompts and CLAUDE.md files that supply exact inputs, scope the task, and define done so the first attempt can be checked.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-prompts-for-claude\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7B5ME1Y3X9RNRKP5HKHKACZ","writing-page-specific-website-copy","Website copywriting by page type: write homepage, landing page, pricing page and feature page copy that fits each page's visitor and single job.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-page-specific-website-copy\u002FSKILL.md",[],[],{"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":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7B5M8MQNM8MN8PYH6BVWJ2B","writing-internal-press-releases","How to write an internal press release: the one-page working backwards press release that opens a PR\u002FFAQ document before anything is built.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-internal-press-releases\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7B5M3P3YH1XF37R8PWXXSBK","writing-email-sequences-that-sell","Email sequence copywriting for nurture and sales: give each email one job, write clear subject lines, and close with one specific call to action.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-email-sequences-that-sell\u002FSKILL.md",[],[]]