{"id":"33afba76-2688-4242-9492-711dcd83b706","shortId":"uRx9Yd","kind":"skill","title":"Antfu","tagline":"Skills skill by Antfu","description":"## Coding Practices\n\n### Code Organization\n\n- **Single responsibility**: Each source file should have a clear, focused scope/purpose\n- **Split large files**: Break files when they become large or handle too many concerns\n- **Type separation**: Always separate types and interfaces into `types.ts` or `types/*.ts`\n- **Constants extraction**: Move constants to a dedicated `constants.ts` file\n\n### Runtime Environment\n\n- **Prefer isomorphic code**: Write runtime-agnostic code that works in Node, browser, and workers whenever possible\n- **Clear runtime indicators**: When code is environment-specific, add a comment at the top of the file:\n\n```ts\n// @env node\n// @env browser\n```\n\n### TypeScript\n\n- **Explicit return types**: Declare return types explicitly when possible\n- **Avoid complex inline types**: Extract complex types into dedicated `type` or `interface` declarations\n\n### Comments\n\n- **Avoid unnecessary comments**: Code should be self-explanatory\n- **Explain \"why\" not \"how\"**: Comments should describe the reasoning or intent, not what the code does\n\n### Testing (Vitest)\n\n- Test files: `foo.ts` → `foo.test.ts` (same directory)\n- Use `describe`/`it` API (not `test`)\n- Use `toMatchSnapshot` for complex outputs\n- Use `toMatchFileSnapshot` with explicit path for language-specific snapshots\n\n---\n\n## Tooling Choices\n\n### @antfu/ni Commands\n\n| Command | Description |\n|---------|-------------|\n| `ni` | Install dependencies |\n| `ni <pkg>` / `ni -D <pkg>` | Add dependency / dev dependency |\n| `nr <script>` | Run script |\n| `nu` | Upgrade dependencies |\n| `nun <pkg>` | Uninstall dependency |\n| `nci` | Clean install (`pnpm i --frozen-lockfile`) |\n| `nlx <pkg>` | Execute package (`npx`) |\n\n### TypeScript Config\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"bundler\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true\n  }\n}\n```\n\n### ESLint Setup\n\n```js\n// eslint.config.mjs\nimport antfu from '@antfu/eslint-config'\n\nexport default antfu()\n```\n\n\nWhen completing tasks, run `pnpm run lint --fix` to format the code and fix coding style.\n\nFor detailed configuration options: [antfu-eslint-config](references/antfu-eslint-config.md)\n\n### Git Hooks\n\n```json\n{\n  \"simple-git-hooks\": {\n    \"pre-commit\": \"pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged\"\n  },\n  \"lint-staged\": { \"*\": \"eslint --fix\" },\n  \"scripts\": {\n    \"prepare\": \"npx simple-git-hooks\"\n  }\n}\n```\n\n### pnpm Catalogs\n\nUse named catalogs in `pnpm-workspace.yaml` for version management:\n\n| Catalog | Purpose |\n|---------|---------|\n| `prod` | Production dependencies |\n| `inlined` | Bundler-inlined dependencies |\n| `dev` | Dev tools (linter, bundler, testing) |\n| `frontend` | Frontend libraries |\n\nAvoid the default catalog. Catalog names can be adjusted per project needs.\n\n---\n\n## References\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| ESLint Config | Framework support, formatters, rule overrides, VS Code settings | [antfu-eslint-config](references/antfu-eslint-config.md) |\n| Project Setup | .gitignore, GitHub Actions, VS Code extensions | [setting-up](references/setting-up.md) |\n| App Development | Vue/Nuxt/UnoCSS conventions and patterns | [app-development](references/app-development.md) |\n| Library Development | tsdown bundling, pure ESM publishing | [library-development](references/library-development.md) |\n| Monorepo | pnpm workspaces, centralized alias, Turborepo | [monorepo](references/monorepo.md) |","tags":["antfu","skills"],"capabilities":["skill","source-antfu","category-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/antfu/skills/antfu","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"install_from":"skills.sh"}},"qualityScore":"0.300","qualityRationale":"deterministic score 0.30 from registry signals: · indexed on skills.sh · published under antfu/skills","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill:v1","enrichmentVersion":1,"enrichedAt":"2026-04-23T22:40:14.606Z","embedding":null,"createdAt":"2026-04-18T20:26:16.861Z","updatedAt":"2026-04-23T22:40:14.606Z","lastSeenAt":"2026-04-23T22:40:14.606Z","tsv":"'add':84,188 'agnost':64 'alway':37 'antfu':1,5 'antfu/ni':178 'api':158 'avoid':108,122 'becom':28 'break':24 'browser':70,97 'category-skills' 'choic':177 'clear':18,75 'code':6,8,60,65,79,125,145 'command':179,180 'comment':86,121,124,135 'complex':109,113,164 'concern':34 'constant':47,50 'constants.ts':54 'd':187 'declar':102,120 'dedic':53,116 'depend':184,189,191 'describ':137,156 'descript':181 'dev':190 'directori':154 'env':94,96 'environ':57,82 'environment-specif':81 'explain':131 'explanatori':130 'explicit':99,105,169 'extract':48,112 'file':14,23,25,55,92,150 'focus':19 'foo.test.ts':152 'foo.ts':151 'handl':31 'indic':77 'inlin':110 'instal':183 'intent':141 'interfac':41,119 'isomorph':59 'languag':173 'language-specif':172 'larg':22,29 'mani':33 'move':49 'ni':182,185,186 'node':69,95 'nr':192 'organ':9 'output':165 'path':170 'possibl':74,107 'practic':7 'prefer':58 'reason':139 'respons':11 'return':100,103 'runtim':56,63,76 'runtime-agnost':62 'scope/purpose':20 'self':129 'self-explanatori':128 'separ':36,38 'singl':10 'skill':2,3 'snapshot':175 'sourc':13 'source-antfu' 'specif':83,174 'split':21 'test':147,149,160 'tomatchfilesnapshot':167 'tomatchsnapshot':162 'tool':176 'top':89 'ts':46,93 'type':35,39,45,101,104,111,114,117 'types.ts':43 'typescript':98 'unnecessari':123 'use':155,161,166 'vitest':148 'whenev':73 'work':67 'worker':72 'write':61","prices":[{"id":"958074f0-e9e3-4855-ab1c-7c8985ad5588","listingId":"33afba76-2688-4242-9492-711dcd83b706","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"antfu","category":"skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:26:16.861Z"}],"sources":[{"listingId":"33afba76-2688-4242-9492-711dcd83b706","source":"github","sourceId":"antfu/skills/antfu","sourceUrl":"https://github.com/antfu/skills/tree/main/skills/antfu","isPrimary":false,"firstSeenAt":"2026-04-18T21:53:46.271Z","lastSeenAt":"2026-04-23T18:53:29.249Z"},{"listingId":"33afba76-2688-4242-9492-711dcd83b706","source":"skills_sh","sourceId":"antfu/skills/antfu","sourceUrl":"https://skills.sh/antfu/skills/antfu","isPrimary":true,"firstSeenAt":"2026-04-18T20:26:16.861Z","lastSeenAt":"2026-04-23T22:40:14.606Z"}],"details":{"listingId":"33afba76-2688-4242-9492-711dcd83b706","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"antfu","slug":"antfu","source":"skills_sh","category":"skills","skills_sh_url":"https://skills.sh/antfu/skills/antfu"},"updatedAt":"2026-04-23T22:40:14.606Z"}}