{"id":"33afba76-2688-4242-9492-711dcd83b706","shortId":"uRx9Yd","kind":"skill","title":"antfu","tagline":"Anthony Fu's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier alternatives, monorepos, library publishing, or when the user mentions Anthony Fu's preferences.","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### Checking npm Package Versions\n\nUse [`fast-npm-meta`](https://github.com/antfu/fast-npm-meta) to look up the latest version of a package — it queries a small metadata endpoint instead of downloading the full registry payload (which can be megabytes per package).\n\n```bash\nnlx fast-npm-meta version vite              # 7.3.1\nnlx fast-npm-meta version \"nuxt@^3.5\"       # 3.5.22 — range-aware\nnlx fast-npm-meta version vite nuxt vue     # multiple at once\nnlx fast-npm-meta version vite --json       # JSON for scripting\nnlx fast-npm-meta full vite                 # full version list + dist-tags\n```\n\nPrefer this over `npm view <pkg> version` when you only need the latest version, and over reading `package.json` from the registry directly.\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","agent-skills"],"capabilities":["skill","source-antfu","skill-antfu","topic-agent-skills","topic-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/antfu/skills/antfu","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add antfu/skills","source_repo":"https://github.com/antfu/skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 4987 github stars · SKILL.md body (4,356 chars)","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-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:52:45.423Z","embedding":null,"createdAt":"2026-04-18T20:26:16.861Z","updatedAt":"2026-05-18T18:52:45.423Z","lastSeenAt":"2026-05-18T18:52:45.423Z","tsv":"'add':111,215 'agnost':91 'altern':20 'alway':64 'antfu':1 'antfu/ni':205 'anthoni':2,29 'api':185 'avoid':135,149 'becom':55 'break':51 'browser':97,124 'choic':204 'clear':45,102 'code':33,35,87,92,106,152,172 'command':206,207 'comment':113,148,151,162 'complex':136,140,191 'concern':61 'configur':18 'constant':74,77 'constants.ts':81 'convent':8 'd':214 'declar':129,147 'dedic':80,143 'depend':211,216,218 'describ':164,183 'descript':208 'dev':217 'directori':181 'env':121,123 'environ':84,109 'environment-specif':108 'eslint/prettier':19 'explain':158 'explanatori':157 'explicit':126,132,196 'extract':75,139 'file':41,50,52,82,119,177 'focus':46 'foo.test.ts':179 'foo.ts':178 'fu':3,30 'handl':58 'indic':104 'inlin':137 'instal':210 'intent':168 'interfac':68,146 'isomorph':86 'javascript/typescript':10 'languag':200 'language-specif':199 'larg':49,56 'librari':22 'mani':60 'mention':28 'monorepo':21 'move':76 'new':16 'ni':209,212,213 'node':96,122 'nr':219 'opinion':5 'organ':36 'output':192 'path':197 'possibl':101,134 'practic':34 'prefer':32,85 'project':11,17 'publish':23 'reason':166 'respons':38 'return':127,130 'runtim':83,90,103 'runtime-agnost':89 'scope/purpose':47 'self':156 'self-explanatori':155 'separ':63,65 'set':14 'singl':37 'skill' 'skill-antfu' 'snapshot':202 'sourc':40 'source-antfu' 'specif':110,201 'split':48 'test':174,176,187 'tomatchfilesnapshot':194 'tomatchsnapshot':189 'tool':6,203 'top':116 'topic-agent-skills' 'topic-skills' 'ts':73,120 'type':62,66,72,128,131,138,141,144 'types.ts':70 'typescript':125 'unnecessari':150 'use':12,182,188,193 'user':27 'vitest':175 'whenev':100 'work':94 'worker':99 'write':88","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-05-18T18:52:45.423Z"},{"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-05-07T22:40:17.088Z"}],"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","github":{"repo":"antfu/skills","stars":4987,"topics":["agent-skills","skills"],"license":"mit","html_url":"https://github.com/antfu/skills","pushed_at":"2026-05-01T16:46:24Z","description":"Anthony Fu's curated collection of agent skills.","skill_md_sha":"16c2400ebb5aae8346764f5c17e1695ca624da81","skill_md_path":"skills/antfu/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/antfu/skills/tree/main/skills/antfu"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"antfu","description":"Anthony Fu's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier alternatives, monorepos, library publishing, or when the user mentions Anthony Fu's preferences."},"skills_sh_url":"https://skills.sh/antfu/skills/antfu"},"updatedAt":"2026-05-18T18:52:45.423Z"}}