[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AVGAYJ6APXRB9QWBG7482S":3,"skill-same:01M7AVGAYJ6APXRB9QWBG7482S":56},{"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":36,"commitSha":37,"skillDirectory":38,"forksCount":14,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":41,"install":42,"resources":55},"01M7AVGAYJ6APXRB9QWBG7482S","typescript-coding-standards",null,"Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.","MinhDuyDEV\u002Fmd-pikit","MinhDuyDEV","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F94704296?v=4","01M7AVDRJB5JM5VG5B6K49X0EZ","Nguyễn Viết Minh Duy","01M7AVDRKDB3JPGHFE4HGK1Z5M",0,"MIT","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Ftypescript-coding-standards\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript-coding-standards\ndescription: Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.\nversion: 1.0.0\ntags: [typescript, code-quality, architecture, testing]\ndependencies: []\nagent_types: [planner, worker, reviewer]\ntools: []\n---\n\n# TypeScript Coding Standards\n\n## Iron Laws\n\n\u003CEXTREMELY-IMPORTANT>\n- **No `any`.** Branded primitives, schema boundaries, `unknown` + narrow.\n- **Errors as data.** Use typed domain errors, `Result\u003CT, E>`, or `Effect\u003CT, E>` according to project conventions; do not force a library or use untyped throws for recoverable failures.\n- **Pure core, effects at edges.** Business logic takes inputs, returns values.\n- **Types describe the domain.** `UserId` not `string`.\n- **Test seams over mocking.** Inject dependencies as values.\n\u003C\u002FEXTREMELY-IMPORTANT>\n\n## Domain Modeling\n\n```ts\n\u002F\u002F Branded primitives (no runtime cost)\ntype UserId = string & { readonly __brand: \"UserId\" }\nconst UserId = (s: string): UserId => s as UserId\n\n\u002F\u002F Discriminated unions\ntype RequestState\u003CT> =\n  | { kind: \"idle\" }\n  | { kind: \"loading\" }\n  | { kind: \"success\"; data: T }\n  | { kind: \"error\"; error: AppError }\n```\n\nUse `kind` for discriminants (not `type` — collides with TS).\n\n## Schema Boundaries\n\nValidate untrusted input at the edge. Inside, trust the types.\n\n```ts\nconst input = Schema.decodeUnknownSync(UserSchema)(req.body)\n\u002F\u002F Now `input` is `User`, not `unknown`\n```\n\nNever let `req.body`, `JSON.parse`, `process.env`, or query strings reach the core. Decode at the boundary.\n\n## Error Modeling\n\nChoose the error shape already used by the project or dependency boundary. Typed domain errors, `Result`, and `Effect` are valid options; preserve the public contract and avoid forcing a new error library for a local fix.\n\n```ts\nclass UserNotFound extends Error {\n  readonly _tag = \"UserNotFound\" as const\n  constructor(readonly userId: UserId) { super(`User ${userId} not found`) }\n}\n\ntype GetUser = (id: UserId) => Effect.Effect\u003CUser, UserNotFound | DbError>\n```\n\nThe return type is the contract. Handlers switch on `_tag`.\n\n## Adapters\n\nExternal systems get an adapter. Adapter implements a domain interface, hides the external API.\n\n```ts\ninterface UserRepo {\n  findById: (id: UserId) => Effect.Effect\u003CUser, UserNotFound | DbError>\n}\n\nclass PostgresUserRepo implements UserRepo {\n  findById = (id) => Effect.tryPromise({\n    try: () => pg.query(\"SELECT * FROM users WHERE id = $1\", [id]),\n    catch: (e) => toDbError(e)\n  })\n}\n```\n\nBusiness code depends on `UserRepo`, not `pg`. Tests use in-memory `UserRepo`.\n\n## Testing\n\nTest pure core with input\u002Foutput cases. Test impure edges through injected ports and deterministic fakes; assert boundary interactions. Mock unavoidable systems.\n\n## Module Boundaries\n\n- One concern per module. Name after the concept, not the file type.\n- Give public concepts the shortest name that greps uniquely; include a domain term and keep one concept, one spelling.\n- Put a definition comment only where it states a hidden constraint or natural-language search phrase; do not restate the type.\n- Public API: explicit exports. Internal: not exported or in `internal\u002F`.\n- No circular deps. If A imports B, B does not import A.\n- Index files are minimal — only the public surface.\n\n## Red Flags\n\n`any` in production; untyped `JSON.parse`; `try\u002Fcatch` around `await`; `Date.now()` in logic; `console.log` left; `data: any`; circular imports; tests that don't test.\n\n## Anti-Patterns\n\n**\"Just a string\"** (no branded type); **\"errors are exceptions\"**; **\"types later\"**; **\"test with mock\"** (test seam); **\"any to unblock\"**; **\"utils.ts\"**.\n","# TypeScript Coding Standards\n\n## Iron Laws\n\n\u003CEXTREMELY-IMPORTANT>\n- **No `any`.** Branded primitives, schema boundaries, `unknown` + narrow.\n- **Errors as data.** Use typed domain errors, `Result\u003CT, E>`, or `Effect\u003CT, E>` according to project conventions; do not force a library or use untyped throws for recoverable failures.\n- **Pure core, effects at edges.** Business logic takes inputs, returns values.\n- **Types describe the domain.** `UserId` not `string`.\n- **Test seams over mocking.** Inject dependencies as values.\n\u003C\u002FEXTREMELY-IMPORTANT>\n\n## Domain Modeling\n\n```ts\n\u002F\u002F Branded primitives (no runtime cost)\ntype UserId = string & { readonly __brand: \"UserId\" }\nconst UserId = (s: string): UserId => s as UserId\n\n\u002F\u002F Discriminated unions\ntype RequestState\u003CT> =\n  | { kind: \"idle\" }\n  | { kind: \"loading\" }\n  | { kind: \"success\"; data: T }\n  | { kind: \"error\"; error: AppError }\n```\n\nUse `kind` for discriminants (not `type` — collides with TS).\n\n## Schema Boundaries\n\nValidate untrusted input at the edge. Inside, trust the types.\n\n```ts\nconst input = Schema.decodeUnknownSync(UserSchema)(req.body)\n\u002F\u002F Now `input` is `User`, not `unknown`\n```\n\nNever let `req.body`, `JSON.parse`, `process.env`, or query strings reach the core. Decode at the boundary.\n\n## Error Modeling\n\nChoose the error shape already used by the project or dependency boundary. Typed domain errors, `Result`, and `Effect` are valid options; preserve the public contract and avoid forcing a new error library for a local fix.\n\n```ts\nclass UserNotFound extends Error {\n  readonly _tag = \"UserNotFound\" as const\n  constructor(readonly userId: UserId) { super(`User ${userId} not found`) }\n}\n\ntype GetUser = (id: UserId) => Effect.Effect\u003CUser, UserNotFound | DbError>\n```\n\nThe return type is the contract. Handlers switch on `_tag`.\n\n## Adapters\n\nExternal systems get an adapter. Adapter implements a domain interface, hides the external API.\n\n```ts\ninterface UserRepo {\n  findById: (id: UserId) => Effect.Effect\u003CUser, UserNotFound | DbError>\n}\n\nclass PostgresUserRepo implements UserRepo {\n  findById = (id) => Effect.tryPromise({\n    try: () => pg.query(\"SELECT * FROM users WHERE id = $1\", [id]),\n    catch: (e) => toDbError(e)\n  })\n}\n```\n\nBusiness code depends on `UserRepo`, not `pg`. Tests use in-memory `UserRepo`.\n\n## Testing\n\nTest pure core with input\u002Foutput cases. Test impure edges through injected ports and deterministic fakes; assert boundary interactions. Mock unavoidable systems.\n\n## Module Boundaries\n\n- One concern per module. Name after the concept, not the file type.\n- Give public concepts the shortest name that greps uniquely; include a domain term and keep one concept, one spelling.\n- Put a definition comment only where it states a hidden constraint or natural-language search phrase; do not restate the type.\n- Public API: explicit exports. Internal: not exported or in `internal\u002F`.\n- No circular deps. If A imports B, B does not import A.\n- Index files are minimal — only the public surface.\n\n## Red Flags\n\n`any` in production; untyped `JSON.parse`; `try\u002Fcatch` around `await`; `Date.now()` in logic; `console.log` left; `data: any`; circular imports; tests that don't test.\n\n## Anti-Patterns\n\n**\"Just a string\"** (no branded type); **\"errors are exceptions\"**; **\"types later\"**; **\"test with mock\"** (test seam); **\"any to unblock\"**; **\"utils.ts\"**.\n",{"name":5,"tags":24,"tools":29,"version":30,"agent_types":31,"description":7,"dependencies":35},[25,26,27,28],"typescript","code-quality","architecture","testing",[],"1.0.0",[32,33,34],"planner","worker","reviewer",[],"main","01207a96514af9f9c4d7d6cb594b936c6a9ddb10",".pi\u002Fskills\u002Ftypescript-coding-standards","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV","2026-08-20 02:00:33",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add MinhDuyDEV\u002Fmd-pikit --skill typescript-coding-standards",{"tool":48,"command":49},"bunx","bunx skills add MinhDuyDEV\u002Fmd-pikit --skill typescript-coding-standards",{"tool":51,"command":52},"pnpm","pnpm dlx skills add MinhDuyDEV\u002Fmd-pikit --skill typescript-coding-standards","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Ftypescript-coding-standards\u002FSKILL.md",true,[],[57,64,71,78,85,92],{"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},"01M7AVGJR1RSRVA3VJT8ZW4Y27","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fwriting-skills\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},"01M7AVGE076BNB3J7JDBGAKD2T","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fverification-before-completion\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},"01M7AVG8CE5BTR2CRFPHHVJCJZ","test-driven-development","Use when implementing a feature, bugfix, or behavior-changing refactor — require a failing behavior test before production code, then make the smallest change that passes.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Ftest-driven-development\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},"01M7AVG5FJH3WTG9XR2G0608ND","source-driven-development","Use when unfamiliar libraries, dependency internals, external APIs, framework behavior, migrations, or current ecosystem guidance require official documentation, version-matched source, read the tests, and cited evidence.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fsource-driven-development\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},"01M7AVG37PZ77CF35KAR6E93ZJ","security-and-hardening","Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fsecurity-and-hardening\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7AVG0HSKDA2Q23AEWDT8TNS","prototype","Use when the user wants to prototype, sanity-check a data model or state machine, mock up a UI, explore design options, or says \"prototype this\", \"let me play with it\", \"try a few designs\".","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fprototype\u002FSKILL.md",[],[]]