Communitygithub.com

ComeOnOliver/skillshub

Anthony Fu 对 JavaScript/TypeScript 项目的工具链和约定。在设置新项目、配置 ESLint/Prettier 替代方案、单体仓库、库发布或用户提及 Anthony Fu 偏好时使用。

skillshub 是什么?

该技能封装了 Anthony Fu 对 JavaScript/TypeScript 项目的工具链和编码约定,旨在帮助开发者快速初始化项目并遵循公认的最佳实践。它强调单一职责的文件组织、运行时无关的代码编写、显式 TypeScript 类型声明以及避免不必要的注释。技能推荐使用 `@antfu/ni` 命令进行依赖管理,并提供标准化的 TypeScript 配置、ESLint 配置(通过 `@antfu/eslint-config`)以及 Git Hooks 设置(使用 `simple-git-hooks` 和 `lint-staged`)。此外,它还包含 `pnpm` 分类目录的版本管理策略,以及指向更详细参考文档(如 ESLint 配置、项目设置、应用/库开发、单体仓库)的链接。该技能主要适用于 Claude Code 等 AI Agent,可在新项目搭建或需要遵循 Anthony Fu 风格时提供指导。

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

在你喜欢的 AI 中提问

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

文档

编码规范

代码组织

  • 单一职责:每个源文件应有清晰且聚焦的作用范围/目的
  • 拆分大文件:当文件变得庞大或处理过多职责时,应进行拆分
  • 类型分离:始终将类型和接口分离到 types.ts 或 types/*.ts 中
  • 常量提取:将常量移至专用的 constants.ts 文件中

运行时环境

  • 偏好同构代码:尽可能编写运行时无关的代码,使其在 Node、浏览器和 Worker 中都能正常工作
  • 明确运行时标识:当代码特定于某个环境时,在文件顶部添加注释:
// @env node
// @env browser

TypeScript

  • 显式返回类型:尽可能显式声明返回类型
  • 避免复杂内联类型:将复杂类型提取到专用的 type 或 interface 声明中

注释

  • 避免不必要的注释:代码应能自解释
  • 解释“为什么”而不是“怎么做”:注释应描述推理或意图,而非代码本身做了什么

测试 (Vitest)

  • 测试文件:foo.ts → foo.test.ts(同一目录)
  • 使用 describe/it API(而非 test)
  • 对于复杂输出使用 toMatchSnapshot
  • 对于语言特定快照使用带显式路径的 toMatchFileSnapshot

工具选择

@antfu/ni 命令

命令说明
ni安装依赖
ni <pkg> / ni -D <pkg>添加依赖 / 开发依赖
nr <script>运行脚本
nu升级依赖
nun <pkg>卸载依赖
nci干净安装 (pnpm i --frozen-lockfile)
nlx <pkg>执行包 (npx)

TypeScript 配置

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true
  }
}

ESLint 配置

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

export default antfu()

完成任务时,运行 pnpm run lint --fix 来格式化代码并修复代码风格。

详细配置选项: antfu-eslint-config

Git Hooks

{
  "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 Catalogs

在 pnpm-workspace.yaml 中使用命名分类进行版本管理:

分类用途
prod生产依赖
inlined打包器内联依赖
dev开发工具(linter、打包器、测试)
frontend前端库

避免使用默认分类。分类名称可根据项目需求调整。


参考资料

主题说明参考文档
ESLint 配置框架支持、格式化程序、规则覆盖、VS Code 设置antfu-eslint-config
项目设置.gitignore、GitHub Actions、VS Code 扩展setting-up
应用开发Vue/Nuxt/UnoCSS 约定和模式app-development
库开发tsdown 打包、纯 ESM 发布library-development
单体仓库pnpm workspaces、集中化别名、Turborepomonorepo

Individual skills in this repo

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

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能