[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MMBHNKS0WZB42PSRN4PBWT":3,"skill-same:01M6MMBHNKS0WZB42PSRN4PBWT":74},{"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":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":50,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":53,"updatedAt":54,"install":55,"resources":67},"01M6MMBHNKS0WZB42PSRN4PBWT","typescript-best-practices",null,"Sixteen type-safety rules for writing and reviewing TypeScript, with do and don't examples in references\u002Fpatterns.md. Use whenever you open or edit a .ts or .tsx file, or on \u002Ftypescript-best-practices.","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1575,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Frequie\u002Fendostack\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"typescript","best practices","typescript best practices","for","writing","true","you","with","type-safety","type","do","references","best-practices","tsx","use","edit","Rules","open","examples","file","2026-11-10 10:12:30",false,"---\nname: typescript-best-practices\ndescription: Sixteen type-safety rules for writing and reviewing TypeScript, with do and don't examples in references\u002Fpatterns.md. Use whenever you open or edit a .ts or .tsx file, or on \u002Ftypescript-best-practices.\ndisable-model-invocation: true\n---\n\n# typescript-best-practices\n\nRead `principle-type-system-discipline` ([..\u002Fprinciple-type-system-discipline\u002FSKILL.md](..\u002Fprinciple-type-system-discipline\u002FSKILL.md)) first. These rules apply it to TypeScript. [references\u002Fpatterns.md](references\u002Fpatterns.md) has a short code example for each rule, numbered to match.\n\nIf your agent supports path-scoped skills, attach this one to `**\u002F*.ts` and `**\u002F*.tsx`. Otherwise the router or the user loads it when TypeScript is in play. For other languages, use `principle-type-system-discipline` and `principle-boundary-discipline` ([..\u002Fprinciple-boundary-discipline\u002FSKILL.md](..\u002Fprinciple-boundary-discipline\u002FSKILL.md)) directly.\n\nBefore you write anything, find the repo's existing conventions: its schema library, its logger, the name it uses for union tags, and the shape of its brand marker. Follow them over the examples in the reference.\n\n## Modeling\n\n1. **Tagged unions for variants.** Model alternative states as a union of object types that share one literal tag field. A boolean flag plus optional fields lets contradictory combinations exist (`loading: true` with an `error` set). Use one tag name across the codebase.\n2. **Branded primitives.** Intersect a primitive with a readonly brand property so an `InvoiceId` cannot be passed where a `CustomerId` is expected. Mint the brand only through a type guard that validates (`value is InvoiceId`) and a parse function that wraps the guard and throws on failure. Never brand with `as`. Check once where the value enters; downstream code trusts the brand.\n3. **Make illegal values unconstructible.** Prefer a shape that cannot hold a bad value to a runtime check: `[T, ...T[]]` for a non-empty list, `Array\u003C[K, V]>` for paired data, a start plus a duration instead of start and end with an ordering invariant in a comment. Provide helpers for derived views (the computed end time). Brand the duration only if some unrelated number could be passed in its place.\n4. **Use the simplest type that keeps every operation total.** A plain array is fine while every operation on it works for empty input (a sum of nothing is zero). Strengthen to non-empty only where the weak type forces a lie: a `!`, an index cast, or an \"unreachable\" throw. Or widen the return type to include `undefined`. Provide a guard so a plain array can be checked once and then carried as non-empty.\n\n## Untrusted data\n\n5. **External data is `unknown`, never `any`.** RPC payloads, parsed JSON, `postMessage` events, IPC, files, environment variables, and database rows all arrive as `unknown` and get narrowed before use. `any` turns off the checker exactly where an attacker controls the input.\n6. **Schemas before hand-written guards.** Check whether the codebase uses a runtime validation library and already defines a schema for this data. Define one schema and infer the static type from it. Use the non-throwing parse call when bad input is an expected outcome (a user form), and the throwing one when it is a bug. Never add a validation library for one guard. If the static type already exists, annotate the schema with it so the compiler rejects a schema that checks less than the type promises.\n7. **No `as` except after validation.** When you remove an assertion, find out why inference failed: add a missing discriminant, narrow a source typed as `Record\u003Cstring, unknown>`, parse at the untyped boundary with the owning schema, or, if the fact truly cannot be expressed, use a brand or `satisfies`.\n8. **Narrow in this order, best first:** switch on the tag; an `in` check; `typeof` or `instanceof`; a custom guard; an assertion after validation.\n9. **Guards must check what they claim.** A guard that lies is worse than `as` because its name promises safety. Name guards `isX` or `hasX`. Prefer tag narrowing when a tag exists.\n10. **Exhaustive switches.** In the `default` branch of a switch over a union, assign the value to a local typed `never`. Adding a variant then fails to compile at every switch that forgot it. Return that local in value-returning switches; mark it used with `void` in statement switches.\n11. **`satisfies` over `as` for literals.** It checks conformance and keeps the literal types.\n12. **Parse once at the boundary.** Data crossing into the system is parsed once into a named domain type. A loose record type never travels past that parse. Wire formats tolerate unknown fields so older code can read newer messages. Persisted JSON is a versioned blob parsed inside `try`\u002F`catch`. Inner functions do not re-validate. See `principle-boundary-discipline`.\n13. **Derive types from generated sources.** When types already come from protobuf, OpenAPI, GraphQL, or database migrations, build on them with `Pick`, `Omit`, `Partial`, and `typeof`. A hand-written duplicate interface drifts the first time the source changes.\n\n## Calls, tests, and telemetry\n\n14. **One object parameter over several positional ones.** Swapped positional arguments of the same type compile without complaint; named fields do not. Exempt hot paths (per-frame rendering, tokenizers, parsers, tight loops) where the allocation shows up in a profile.\n15. **Run real code in tests.** Do not mock what can run on a dev machine. Use the test framework's own facilities, including its checks for leaked handles and undisposed resources. Check UI behavior in a real running build. Keep mocks for dependencies that cannot run locally. See the `tdd` skill ([..\u002Ftdd\u002FSKILL.md](..\u002Ftdd\u002FSKILL.md)).\n16. **Structured telemetry.** Log through the project's structured logger with enough fields that an id alone lets someone debug the case. No bare `console.log` in shipped code. Never log secrets, tokens, or full request bodies that may contain them.\n\n## Done when\n\nNo `any` touches external data, every `as` follows a validation, no guard lies, every switch over a union is exhaustive, and boundary data is parsed once into a domain type.\n","# typescript-best-practices\n\nRead `principle-type-system-discipline` ([..\u002Fprinciple-type-system-discipline\u002FSKILL.md](..\u002Fprinciple-type-system-discipline\u002FSKILL.md)) first. These rules apply it to TypeScript. [references\u002Fpatterns.md](references\u002Fpatterns.md) has a short code example for each rule, numbered to match.\n\nIf your agent supports path-scoped skills, attach this one to `**\u002F*.ts` and `**\u002F*.tsx`. Otherwise the router or the user loads it when TypeScript is in play. For other languages, use `principle-type-system-discipline` and `principle-boundary-discipline` ([..\u002Fprinciple-boundary-discipline\u002FSKILL.md](..\u002Fprinciple-boundary-discipline\u002FSKILL.md)) directly.\n\nBefore you write anything, find the repo's existing conventions: its schema library, its logger, the name it uses for union tags, and the shape of its brand marker. Follow them over the examples in the reference.\n\n## Modeling\n\n1. **Tagged unions for variants.** Model alternative states as a union of object types that share one literal tag field. A boolean flag plus optional fields lets contradictory combinations exist (`loading: true` with an `error` set). Use one tag name across the codebase.\n2. **Branded primitives.** Intersect a primitive with a readonly brand property so an `InvoiceId` cannot be passed where a `CustomerId` is expected. Mint the brand only through a type guard that validates (`value is InvoiceId`) and a parse function that wraps the guard and throws on failure. Never brand with `as`. Check once where the value enters; downstream code trusts the brand.\n3. **Make illegal values unconstructible.** Prefer a shape that cannot hold a bad value to a runtime check: `[T, ...T[]]` for a non-empty list, `Array\u003C[K, V]>` for paired data, a start plus a duration instead of start and end with an ordering invariant in a comment. Provide helpers for derived views (the computed end time). Brand the duration only if some unrelated number could be passed in its place.\n4. **Use the simplest type that keeps every operation total.** A plain array is fine while every operation on it works for empty input (a sum of nothing is zero). Strengthen to non-empty only where the weak type forces a lie: a `!`, an index cast, or an \"unreachable\" throw. Or widen the return type to include `undefined`. Provide a guard so a plain array can be checked once and then carried as non-empty.\n\n## Untrusted data\n\n5. **External data is `unknown`, never `any`.** RPC payloads, parsed JSON, `postMessage` events, IPC, files, environment variables, and database rows all arrive as `unknown` and get narrowed before use. `any` turns off the checker exactly where an attacker controls the input.\n6. **Schemas before hand-written guards.** Check whether the codebase uses a runtime validation library and already defines a schema for this data. Define one schema and infer the static type from it. Use the non-throwing parse call when bad input is an expected outcome (a user form), and the throwing one when it is a bug. Never add a validation library for one guard. If the static type already exists, annotate the schema with it so the compiler rejects a schema that checks less than the type promises.\n7. **No `as` except after validation.** When you remove an assertion, find out why inference failed: add a missing discriminant, narrow a source typed as `Record\u003Cstring, unknown>`, parse at the untyped boundary with the owning schema, or, if the fact truly cannot be expressed, use a brand or `satisfies`.\n8. **Narrow in this order, best first:** switch on the tag; an `in` check; `typeof` or `instanceof`; a custom guard; an assertion after validation.\n9. **Guards must check what they claim.** A guard that lies is worse than `as` because its name promises safety. Name guards `isX` or `hasX`. Prefer tag narrowing when a tag exists.\n10. **Exhaustive switches.** In the `default` branch of a switch over a union, assign the value to a local typed `never`. Adding a variant then fails to compile at every switch that forgot it. Return that local in value-returning switches; mark it used with `void` in statement switches.\n11. **`satisfies` over `as` for literals.** It checks conformance and keeps the literal types.\n12. **Parse once at the boundary.** Data crossing into the system is parsed once into a named domain type. A loose record type never travels past that parse. Wire formats tolerate unknown fields so older code can read newer messages. Persisted JSON is a versioned blob parsed inside `try`\u002F`catch`. Inner functions do not re-validate. See `principle-boundary-discipline`.\n13. **Derive types from generated sources.** When types already come from protobuf, OpenAPI, GraphQL, or database migrations, build on them with `Pick`, `Omit`, `Partial`, and `typeof`. A hand-written duplicate interface drifts the first time the source changes.\n\n## Calls, tests, and telemetry\n\n14. **One object parameter over several positional ones.** Swapped positional arguments of the same type compile without complaint; named fields do not. Exempt hot paths (per-frame rendering, tokenizers, parsers, tight loops) where the allocation shows up in a profile.\n15. **Run real code in tests.** Do not mock what can run on a dev machine. Use the test framework's own facilities, including its checks for leaked handles and undisposed resources. Check UI behavior in a real running build. Keep mocks for dependencies that cannot run locally. See the `tdd` skill ([..\u002Ftdd\u002FSKILL.md](..\u002Ftdd\u002FSKILL.md)).\n16. **Structured telemetry.** Log through the project's structured logger with enough fields that an id alone lets someone debug the case. No bare `console.log` in shipped code. Never log secrets, tokens, or full request bodies that may contain them.\n\n## Done when\n\nNo `any` touches external data, every `as` follows a validation, no guard lies, every switch over a union is exhaustive, and boundary data is parsed once into a domain type.\n",{"name":5,"description":7,"disable-model-invocation":44},true,"main","2b63f856ce19c2a797929cacabd9e0fc936812fa","plugins\u002Frequie\u002Fendostack\u002Fskills\u002Ftypescript-best-practices",491,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 14:06:13",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":44},[57,60,63],{"tool":58,"command":59},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill typescript-best-practices",{"tool":61,"command":62},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill typescript-best-practices",{"tool":64,"command":65},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Frequie\u002Fendostack\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fpatterns.md","REFERENCE","参考文档",7357,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Frequie\u002Fendostack\u002Fskills\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[75,85,93,101,109,117],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":84},"01M7DV332YQMGD8WTRJ9DZQXTB","worktable-review-with-annotations","Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.","MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"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":79,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":84},"01M7DV2YGHCZVBEB1AHYB6CGHE","worktable-find-and-synthesize-context","Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":84},"01M7DV2TQN1H11ME2SAF9MXN7V","worktable-create-or-update-docs","Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":84},"01M7DV2NE452NEA8TXATKSNAJH","worktable-create-or-manage-records","Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":84},"01M7DV2HENRBR2KSCVM064WH0Y","worktable-create-or-manage-interactive-html","Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":84},"01M7DV2CADR5R7RQFFYPNAGR9Y","worktable-collaborate-threads","Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FSKILL.md",[],[]]