antfu by antfu/skills
npx skills add https://github.com/antfu/skills --skill antfutypes.ts 或 types/*.ts 文件中constants.ts 文件中优先使用同构代码:尽可能编写与运行时无关的代码,使其能在 Node、浏览器和 worker 中工作
清晰的运行时指示器:当代码是特定于环境的时,在文件顶部添加注释:
// @env node // @env browser
type 或 interface 声明中广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
foo.ts → foo.test.ts(同一目录)describe/it API(而非 test)toMatchSnapshottoMatchFileSnapshot 并指定显式路径| 命令 | 描述 |
|---|---|
ni | 安装依赖项 |
ni <pkg> / ni -D <pkg> | 添加依赖项 / 开发依赖项 |
nr <script> | 运行脚本 |
nu | 升级依赖项 |
nun <pkg> | 卸载依赖项 |
nci | 纯净安装 (pnpm i --frozen-lockfile) |
nlx <pkg> | 执行包 (npx) |
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
// eslint.config.mjs
import antfu from '@antfu/eslint-config'
export default antfu()
完成任务时,运行 pnpm run lint --fix 来格式化代码并修复编码风格。
详细配置选项:antfu-eslint-config
{
"simple-git-hooks": {
"pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
},
"lint-staged": { "*": "eslint --fix" },
"scripts": {
"prepare": "npx simple-git-hooks"
}
}
在 pnpm-workspace.yaml 中使用命名分类目录进行版本管理:
| 分类目录 | 用途 |
|---|---|
prod | 生产依赖项 |
inlined | 打包器内联的依赖项 |
dev | 开发工具(linter、bundler、testing) |
frontend | 前端库 |
避免使用默认分类目录。分类目录名称可根据项目需求调整。
| 主题 | 描述 | 参考链接 |
|---|---|---|
| ESLint 配置 | 框架支持、格式化程序、规则覆盖、VS Code 设置 | antfu-eslint-config |
| 项目设置 | .gitignore、GitHub Actions、VS Code 扩展 | setting-up |
| 应用开发 | Vue/Nuxt/UnoCSS 约定和模式 | app-development |
| 库开发 | tsdown 打包、纯 ESM 发布 | library-development |
| Monorepo | pnpm 工作区、集中化别名、Turborepo | monorepo |
每周安装量
5.1K
代码仓库
GitHub Stars
3.9K
首次出现
Jan 28, 2026
安全审计
安装于
opencode3.9K
codex3.9K
gemini-cli3.8K
github-copilot3.7K
kimi-cli3.2K
amp3.2K
types.ts or types/*.tsconstants.ts filePrefer isomorphic code : Write runtime-agnostic code that works in Node, browser, and workers whenever possible
Clear runtime indicators : When code is environment-specific, add a comment at the top of the file:
// @env node // @env browser
type or interface declarationsfoo.ts → foo.test.ts (same directory)describe/it API (not test)toMatchSnapshot for complex outputstoMatchFileSnapshot with explicit path for language-specific snapshots| Command | Description |
|---|---|
ni | Install dependencies |
ni <pkg> / ni -D <pkg> | Add dependency / dev dependency |
nr <script> | Run script |
nu | Upgrade dependencies |
nun <pkg> | Uninstall dependency |
nci |
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
// eslint.config.mjs
import antfu from '@antfu/eslint-config'
export default antfu()
When completing tasks, run pnpm run lint --fix to format the code and fix coding style.
For detailed configuration options: antfu-eslint-config
{
"simple-git-hooks": {
"pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
},
"lint-staged": { "*": "eslint --fix" },
"scripts": {
"prepare": "npx simple-git-hooks"
}
}
Use named catalogs in pnpm-workspace.yaml for version management:
| Catalog | Purpose |
|---|---|
prod | Production dependencies |
inlined | Bundler-inlined dependencies |
dev | Dev tools (linter, bundler, testing) |
frontend | Frontend libraries |
Avoid the default catalog. Catalog names can be adjusted per project needs.
| Topic | Description | Reference |
|---|---|---|
| ESLint Config | Framework support, formatters, rule overrides, VS Code settings | antfu-eslint-config |
| Project Setup | .gitignore, GitHub Actions, VS Code extensions | setting-up |
| App Development | Vue/Nuxt/UnoCSS conventions and patterns | app-development |
| Library Development | tsdown bundling, pure ESM publishing | library-development |
| Monorepo | pnpm workspaces, centralized alias, Turborepo | monorepo |
Weekly Installs
5.1K
Repository
GitHub Stars
3.9K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode3.9K
codex3.9K
gemini-cli3.8K
github-copilot3.7K
kimi-cli3.2K
amp3.2K
97,600 周安装
Clean install (pnpm i --frozen-lockfile) |
nlx <pkg> | Execute package (npx) |