[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HY9AH9BFC9MPXFJST9ZEB4":3,"skill-same:01M6HY9AH9BFC9MPXFJST9ZEB4":72},{"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":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":6,"updatedAt":51,"install":52,"resources":65},"01M6HY9AH9BFC9MPXFJST9ZEB4","typescript-import-audit",null,"Systematic workflow for auditing TypeScript codebases for import hygiene issues (value vs. type imports, duplicates), missing base class extensions, and incomplete barrel file re-exports, with actionable fix patterns.","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",8029,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Ftypescript-import-audit\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"typescript import audit","audit","import","typescript","type","for","extensions","re","with","actionable","missing","hygiene","systematic","base","patterns","duplicates","fix","file","issues","workflow","2026-11-10 10:12:30",false,"---\nname: typescript-import-audit\ndescription: Systematic workflow for auditing TypeScript codebases for import hygiene issues (value vs. type imports, duplicates), missing base class extensions, and incomplete barrel file re-exports, with actionable fix patterns.\n---\n\n# TypeScript Import & Structure Audit\n\nA step-by-step workflow for auditing TypeScript projects for common structural and import hygiene problems, then applying targeted fixes.\n\n---\n\n## Overview\n\nThis skill covers four audit checks and their corresponding fixes:\n\n| # | Issue | Fix |\n|---|-------|-----|\n| 1 | Value imports used only as type annotations | Split with `import type` |\n| 2 | Duplicate imports from the same module | Consolidate into one import statement |\n| 3 | Classes missing expected base class extension | Add `extends BaseClass` |\n| 4 | Missing re-exports in barrel (`index.ts`) files | Add the missing `export` lines |\n\n---\n\n## Step 1 — Read All Relevant Files in Parallel\n\nBefore making any changes, read all files that need to be audited in a single parallel batch. This avoids slow sequential reads.\n\n```\nRead in parallel:\n  - src\u002Findex.ts           (barrel file)\n  - src\u002F**\u002F*.ts            (all source files)\n  - Any explicitly named files from the task spec\n```\n\nLook for:\n- All `import` statements at the top of each file\n- Class declarations (`class Foo`)\n- Export lists in barrel files\n\n---\n\n## Step 2 — Audit Check 1: Value Imports Used Only as Types\n\n### Detection\n\nFor every `import { A, B } from 'module'` statement, check whether each\nimported name is used **only** in type positions (`: TypeName`, `as TypeName`,\n`\u003CTypeName>` generics, `implements TypeName`). If a name never appears in a\nvalue position (instantiation, function call, assignment), it should be a\ntype-only import.\n\n```typescript\n\u002F\u002F ❌ Bad — Foo is only used as a type annotation\nimport { Foo, bar } from '.\u002Fmodule';\nconst x: Foo = bar();\n\n\u002F\u002F ✅ Good — split into value import + type import\nimport { bar } from '.\u002Fmodule';\nimport type { Foo } from '.\u002Fmodule';\n```\n\n### Fix Pattern\n\n1. Identify all names in the import that are type-only.\n2. Remove them from the value import (delete the value import entirely if all names are type-only).\n3. Add (or merge into an existing) `import type { ... } from 'module'` statement.\n\n---\n\n## Step 3 — Audit Check 2: Duplicate Imports from the Same Module\n\n### Detection\n\nScan for two or more `import` statements that reference the **same module path**:\n\n```typescript\n\u002F\u002F ❌ Bad — two imports from the same source\nimport { ComponentA } from '.\u002Fcomponents';\nimport { ComponentB } from '.\u002Fcomponents';\n```\n\n### Fix Pattern\n\nMerge all named imports from the same module into a single statement:\n\n```typescript\n\u002F\u002F ✅ Good\nimport { ComponentA, ComponentB } from '.\u002Fcomponents';\n```\n\nIf there is a mix of value and type imports from the same module, keep them as two separate lines (`import { ... }` and `import type { ... }`), but ensure there is at most one of each kind per module path.\n\n---\n\n## Step 4 — Audit Check 3: Classes That Should Extend a Base Class\n\n### Detection\n\nLook for class declarations that:\n- Implement an interface that implies a base class, OR\n- Are described in comments \u002F documentation as extending something, OR\n- Contain methods\u002Fproperties that are defined on a known base class\n\n```typescript\n\u002F\u002F ❌ Missing base class\nclass MyPanel implements PanelInterface {\n  render() { ... }\n}\n\n\u002F\u002F ✅ Correct\nclass MyPanel extends BasePanel implements PanelInterface {\n  render() { ... }\n}\n```\n\n### Fix Pattern\n\nAdd `extends BaseClass` between the class name and any `implements` clause:\n\n```typescript\nclass ClassName extends BaseClass implements InterfaceName { ... }\n```\n\nEnsure the base class is imported if it is not already.\n\n---\n\n## Step 5 — Audit Check 4: Missing Re-exports in Barrel Files\n\n### Detection\n\nA barrel file (`index.ts`) should re-export everything that is part of the\npublic API. Common gaps:\n\n- A new file was added but never added to `index.ts`\n- A named export inside a file is not forwarded by the barrel\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002FMyWidget.ts\nexport class MyWidget { ... }\nexport type MyWidgetProps = { ... }\n\n\u002F\u002F src\u002Fcomponents\u002Findex.ts — ❌ missing MyWidget\nexport { SomeOtherThing } from '.\u002FSomeOtherThing';\n```\n\n### Fix Pattern\n\nAdd the missing re-export line:\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Findex.ts — ✅ fixed\nexport { SomeOtherThing } from '.\u002FSomeOtherThing';\nexport { MyWidget } from '.\u002FMyWidget';\nexport type { MyWidgetProps } from '.\u002FMyWidget';\n```\n\nUse `export type { ... }` for type-only exports to maintain strict type\u002Fvalue separation.\n\n---\n\n## Step 6 — Apply Fixes and Verify\n\n### Order of operations\n\n1. Fix **duplicate imports** first (consolidation may surface type-only candidates).\n2. Fix **value vs. type imports** (split imports).\n3. Fix **missing base class** extensions.\n4. Fix **barrel re-exports** last (they depend on the other files being correct).\n\n### Verification checklist\n\nAfter edits, confirm:\n\n- [ ] No two `import` statements reference the same module path (same kind).\n- [ ] All names used only as types are in `import type { ... }` statements.\n- [ ] Every class that should extend a base class does so.\n- [ ] Every public export in every source file appears in the barrel `index.ts`.\n- [ ] The project compiles without errors (`tsc --noEmit`).\n\n---\n\n## Quick Reference: Import Patterns\n\n```typescript\n\u002F\u002F Value import\nimport { foo, bar } from '.\u002Fmodule';\n\n\u002F\u002F Type-only import\nimport type { Foo, Bar } from '.\u002Fmodule';\n\n\u002F\u002F Mixed (value + type from same module — two lines)\nimport { foo } from '.\u002Fmodule';\nimport type { Foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export value\nexport { foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export type\nexport type { Foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export everything\nexport * from '.\u002Fmodule';\nexport type * from '.\u002Fmodule';  \u002F\u002F TypeScript 5.0+\n```\n\n---\n\n## Notes\n\n- Always prefer **explicit named exports** over `export *` in barrel files for better tree-shaking and discoverability.\n- If the project uses `verbatimModuleSyntax` or `isolatedModules` in `tsconfig.json`, `import type` is **required** for type-only imports — the compiler will error otherwise.\n- Run `tsc --noEmit` after each fix category to catch regressions early.","# TypeScript Import & Structure Audit\n\nA step-by-step workflow for auditing TypeScript projects for common structural and import hygiene problems, then applying targeted fixes.\n\n---\n\n## Overview\n\nThis skill covers four audit checks and their corresponding fixes:\n\n| # | Issue | Fix |\n|---|-------|-----|\n| 1 | Value imports used only as type annotations | Split with `import type` |\n| 2 | Duplicate imports from the same module | Consolidate into one import statement |\n| 3 | Classes missing expected base class extension | Add `extends BaseClass` |\n| 4 | Missing re-exports in barrel (`index.ts`) files | Add the missing `export` lines |\n\n---\n\n## Step 1 — Read All Relevant Files in Parallel\n\nBefore making any changes, read all files that need to be audited in a single parallel batch. This avoids slow sequential reads.\n\n```\nRead in parallel:\n  - src\u002Findex.ts           (barrel file)\n  - src\u002F**\u002F*.ts            (all source files)\n  - Any explicitly named files from the task spec\n```\n\nLook for:\n- All `import` statements at the top of each file\n- Class declarations (`class Foo`)\n- Export lists in barrel files\n\n---\n\n## Step 2 — Audit Check 1: Value Imports Used Only as Types\n\n### Detection\n\nFor every `import { A, B } from 'module'` statement, check whether each\nimported name is used **only** in type positions (`: TypeName`, `as TypeName`,\n`\u003CTypeName>` generics, `implements TypeName`). If a name never appears in a\nvalue position (instantiation, function call, assignment), it should be a\ntype-only import.\n\n```typescript\n\u002F\u002F ❌ Bad — Foo is only used as a type annotation\nimport { Foo, bar } from '.\u002Fmodule';\nconst x: Foo = bar();\n\n\u002F\u002F ✅ Good — split into value import + type import\nimport { bar } from '.\u002Fmodule';\nimport type { Foo } from '.\u002Fmodule';\n```\n\n### Fix Pattern\n\n1. Identify all names in the import that are type-only.\n2. Remove them from the value import (delete the value import entirely if all names are type-only).\n3. Add (or merge into an existing) `import type { ... } from 'module'` statement.\n\n---\n\n## Step 3 — Audit Check 2: Duplicate Imports from the Same Module\n\n### Detection\n\nScan for two or more `import` statements that reference the **same module path**:\n\n```typescript\n\u002F\u002F ❌ Bad — two imports from the same source\nimport { ComponentA } from '.\u002Fcomponents';\nimport { ComponentB } from '.\u002Fcomponents';\n```\n\n### Fix Pattern\n\nMerge all named imports from the same module into a single statement:\n\n```typescript\n\u002F\u002F ✅ Good\nimport { ComponentA, ComponentB } from '.\u002Fcomponents';\n```\n\nIf there is a mix of value and type imports from the same module, keep them as two separate lines (`import { ... }` and `import type { ... }`), but ensure there is at most one of each kind per module path.\n\n---\n\n## Step 4 — Audit Check 3: Classes That Should Extend a Base Class\n\n### Detection\n\nLook for class declarations that:\n- Implement an interface that implies a base class, OR\n- Are described in comments \u002F documentation as extending something, OR\n- Contain methods\u002Fproperties that are defined on a known base class\n\n```typescript\n\u002F\u002F ❌ Missing base class\nclass MyPanel implements PanelInterface {\n  render() { ... }\n}\n\n\u002F\u002F ✅ Correct\nclass MyPanel extends BasePanel implements PanelInterface {\n  render() { ... }\n}\n```\n\n### Fix Pattern\n\nAdd `extends BaseClass` between the class name and any `implements` clause:\n\n```typescript\nclass ClassName extends BaseClass implements InterfaceName { ... }\n```\n\nEnsure the base class is imported if it is not already.\n\n---\n\n## Step 5 — Audit Check 4: Missing Re-exports in Barrel Files\n\n### Detection\n\nA barrel file (`index.ts`) should re-export everything that is part of the\npublic API. Common gaps:\n\n- A new file was added but never added to `index.ts`\n- A named export inside a file is not forwarded by the barrel\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002FMyWidget.ts\nexport class MyWidget { ... }\nexport type MyWidgetProps = { ... }\n\n\u002F\u002F src\u002Fcomponents\u002Findex.ts — ❌ missing MyWidget\nexport { SomeOtherThing } from '.\u002FSomeOtherThing';\n```\n\n### Fix Pattern\n\nAdd the missing re-export line:\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Findex.ts — ✅ fixed\nexport { SomeOtherThing } from '.\u002FSomeOtherThing';\nexport { MyWidget } from '.\u002FMyWidget';\nexport type { MyWidgetProps } from '.\u002FMyWidget';\n```\n\nUse `export type { ... }` for type-only exports to maintain strict type\u002Fvalue separation.\n\n---\n\n## Step 6 — Apply Fixes and Verify\n\n### Order of operations\n\n1. Fix **duplicate imports** first (consolidation may surface type-only candidates).\n2. Fix **value vs. type imports** (split imports).\n3. Fix **missing base class** extensions.\n4. Fix **barrel re-exports** last (they depend on the other files being correct).\n\n### Verification checklist\n\nAfter edits, confirm:\n\n- [ ] No two `import` statements reference the same module path (same kind).\n- [ ] All names used only as types are in `import type { ... }` statements.\n- [ ] Every class that should extend a base class does so.\n- [ ] Every public export in every source file appears in the barrel `index.ts`.\n- [ ] The project compiles without errors (`tsc --noEmit`).\n\n---\n\n## Quick Reference: Import Patterns\n\n```typescript\n\u002F\u002F Value import\nimport { foo, bar } from '.\u002Fmodule';\n\n\u002F\u002F Type-only import\nimport type { Foo, Bar } from '.\u002Fmodule';\n\n\u002F\u002F Mixed (value + type from same module — two lines)\nimport { foo } from '.\u002Fmodule';\nimport type { Foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export value\nexport { foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export type\nexport type { Foo } from '.\u002Fmodule';\n\n\u002F\u002F Re-export everything\nexport * from '.\u002Fmodule';\nexport type * from '.\u002Fmodule';  \u002F\u002F TypeScript 5.0+\n```\n\n---\n\n## Notes\n\n- Always prefer **explicit named exports** over `export *` in barrel files for better tree-shaking and discoverability.\n- If the project uses `verbatimModuleSyntax` or `isolatedModules` in `tsconfig.json`, `import type` is **required** for type-only imports — the compiler will error otherwise.\n- Run `tsc --noEmit` after each fix category to catch regressions early.",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Ftypescript-import-audit",944,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot","https:\u002F\u002Fgithub.com\u002FHKUDS","https:\u002F\u002Fsites.google.com\u002Fview\u002Fchaoh","2026-11-12 22:26:39",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add HKUDS\u002FAgentPilot --skill typescript-import-audit",{"tool":58,"command":59},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill typescript-import-audit",{"tool":61,"command":62},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill typescript-import-audit","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Ftypescript-import-audit\u002FSKILL.md",true,[66],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},".skill_id","OTHER","其他",37,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Ftypescript-import-audit\u002F.skill_id",[73,91,109,134,157,177],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":39},"01M6HYB297NDABRERJRVG0K8R0","agentpilot","Set up AgentPilot and use its single entry to prepare missing inputs and run configured RSI experiments. Use when the user requests AgentPilot installation or work with AgentPilot.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fplugins\u002Fagentpilot\u002Fskills\u002Fagentpilot\u002FSKILL.md",[],[75,80,81,27,29,82,83,84,85,86,87,88,89,90],"prepare","requests","installation","rsi","up","use","user","work","SET","run","experiments",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":39},"01M6HYAYWXTTE1J7DJM0MFNQ4H","remember","Review auto-memory entries and propose promotions to OPENSPACE.md, OPENSPACE.local.md, or retained auto-memory topics; detect duplicates, stale facts, conflicts, and ambiguous entries before making changes.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fskills\u002Fremember\u002FSKILL.md",[],[93,98,99,100,101,102,103,104,105,106,107,108,34],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale",{"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":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":120,"publishedAt":39},"01M6HYAVMPM4SBDV60R2B5HPV8","skill-discovery","Search reusable OpenSpace skills locally, and browse cloud packages step by step when a cloud skill may help. Reusing proven skills saves tokens, improves reliability, and extends your capabilities beyond built-in tools.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fskill-discovery\u002FSKILL.md",[115],{"categoryNo":116,"categoryName":117,"taxonomyType":118,"taxonomyTypeDesc":119},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[121,122,123,101,124,125,126,127,128,129,130,131,132,133],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":141,"publishedAt":39},"01M6HYAR811B3RB0M50RBEDGN6","delegate-task","Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fdelegate-task\u002FSKILL.md",[140],{"categoryNo":116,"categoryName":117,"taxonomyType":118,"taxonomyTypeDesc":119},[142,143,144,101,145,146,147,148,149,123,100,85,150,151,152,24,153,154,155,156],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","tool","stack","share","tasks","automation","MCP",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":39},"01M6HYAM9FSGV6E52AYENDQXYH","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[164,165,166,23,167,168,169,170,36,171,22,172,173,174,24,175,176],"write special chars ts check","write","check","files","filters","only","template","python","output","Existing","type-checking","errors","script",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":39},"01M6HYAH05HGV7SVWSVR8PJRQD","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[184,185,165,27,24,176,186,187,188,189,190,170,36,191,192,171],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]