Community编程与开发github.com

antfu/antfu

Anthony Fu 为 JavaScript/TypeScript 项目定制的工具链和约定。适用于搭建新项目、配置 ESLint/Prettier 替代方案、管理 monorepo、发布库,或当用户提及 Anthony Fu 的偏好时。

antfu 是什么?

该技能代表了 Anthony Fu(Vue 核心团队成员)对 JavaScript/TypeScript 项目的个人化工具链偏好和代码约定。它整合了 Anthony Fu 常用的开发工具链,如 ESLint/Prettier 的替代方案(使用 @antfu/eslint-config 或更现代的 eslint-flat-config)、使用 pnpm 管理 monorepo、使用 unbuild 或 tsup 构建库、以及采用 Vitest 进行测试。该技能适用于多种场景:当用户需要创建新项目并希望采用 Anthony Fu 风格的代码规范时,当需要配置 monorepo 工作流时,或当讨论到 Anthony Fu 在开源社区中的特定工具偏好时。技能实现方式是通过读取项目上下文,自动推荐使用 Anthony Fu 常用的库和配置模式,例如优先使用 TypeScript、采用 ESM 模块、使用 Changesets 管理版本和发布日志。对于 Cursor 或 Codex 等 AI agent 平台,该技能能帮助开发者快速遵循 Anthony Fu 的代码风格和项目结构,减少配置讨论时间,直接生成符合其偏好的代码。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/antfu/skills/tree/main/skills/antfu

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

antfu 是做什么的?

Anthony Fu 为 JavaScript/TypeScript 项目定制的工具链和约定。适用于搭建新项目、配置 ESLint/Prettier 替代方案、管理 monorepo、发布库,或当用户提及 Anthony Fu 的偏好时。

概述

该技能封装了 Anthony Fu 在 JavaScript/TypeScript 生态中的个人偏好和工具选择。核心原则包括:

  • 工具链:优先使用 @antfu/eslint-config 作为扁平化 ESLint 配置,替代传统的 ESLint + Prettier 组合。
  • 包管理器:推荐使用 pnpm,并配合 pnpm-workspace.yaml 管理 monorepo。
  • 构建工具:使用 unbuild 或 tsup 进行库的构建和发布。
  • 测试框架:采用 Vitest 进行单元测试和集成测试。
  • 版本管理:使用 @changesets/cli 管理版本和生成发布日志。

使用场景

当用户明确提到“Anthony Fu 风格”、“按照 Anthony Fu 的方式”、“@antfu”或相关术语时,该技能应被激活。具体包括:

  1. 新项目初始化:生成符合 Anthony Fu 偏好的 package.json、eslint.config.js、tsconfig.json 等配置文件。
  2. 代码规范配置:将 ESLint 配置迁移到扁平的 @antfu/eslint-config 格式。
  3. Monorepo 设置:使用 pnpm workspace 创建 monorepo 结构。
  4. 库发布:设置 changeset 工作流和 unbuild 构建配置。

示例配置

1. ESLint 配置(扁平格式)

// eslint.config.js
import antfu from '@antfu/eslint-config'

export default antfu()

2. 典型的 tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  }
}

3. Vitest 配置

// vitest.config.ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
    environment: 'node'
  }
})

相关环境变量

  • ANTHFU_PREFER: 如设置为 true,将强制应用 Anthony Fu 的偏好。
  • ANTHFU_STRICT: 启用严格的 ESLint 规则。
  • USE_PNPM: 如设置,强制使用 pnpm 代替其他包管理器。

提示

  • 当用户提及“Vue”、“unplugin”、“vite”等相关项目时,应优先采用 Anthony Fu 的工具链。
  • 该技能应避免破坏用户已有的项目配置,仅在用户明确要求或项目为新项目时应用。
  • 对于 monorepo,默认工作区目录为 packages/*。

许可

该技能遵循 MIT 协议。更多信息请参阅 antfu/antfu 仓库。

Individual skills in this repo

This repo contains 16 individual skills — each has its own dedicated page.

antfu/nuxt

Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.

antfu/pinia

Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.

antfu/pnpm

Node.js package manager with strict dependency resolution. Use when running pnpm specific commands, configuring workspaces, or managing dependencies with catalogs, patches, or overrides.

antfu/slidev

Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks.

antfu/tsdown

Bundle TypeScript and JavaScript libraries with blazing-fast speed powered by Rolldown. Use when building libraries, generating type declarations, bundling for multiple formats, or migrating from tsup.

antfu/turborepo

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

antfu/unocss

UnoCSS instant atomic CSS engine, superset of Tailwind CSS. Use when configuring UnoCSS, writing utility rules, shortcuts, or working with presets like Wind, Icons, Attributify.

antfu/vite

Vite build tool configuration, plugin API, SSR, and Vite 8 Rolldown migration. Use when working with Vite projects, vite.config.ts, Vite plugins, or building libraries/SSR apps with Vite.

antfu/vitepress

VitePress static site generator powered by Vite and Vue. Use when building documentation sites, configuring themes, or writing Markdown with Vue components.

antfu/vitest

Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

antfu/vue

Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.

antfu/vue-best-practices

MUST be used for Vue.js tasks. Strongly recommends Composition API with `<script setup>` and TypeScript as the standard approach. Covers Vue 3, SSR, Volar, vue-tsc. Load for any Vue, .vue files, Vue Router, Pinia, or Vite with Vue work. ALWAYS use Composition API unless the project explicitly requires Options API.

antfu/vue-router-best-practices

Vue Router 4 patterns, navigation guards, route params, and route-component lifecycle interactions.

antfu/vue-testing-best-practices

Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.

antfu/vueuse-functions

Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.

antfu/web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

相关技能