antfu
하는 일
이 스킬은 AI에게 JavaScript와 TypeScript 프로젝트를 위한 코딩 습관과 도구 선택 방법을 알려 줍니다. 새 프로젝트를 깔끔하고 일관되게 설정하고 싶은 개발자를 위한 것입니다.
사용하는 경우
- ✓새 TypeScript 프로젝트를 시작하고 깔끔하고 표준적인 설정을 원할 때.
- ✓코드를 명확한 파일로 나누고 타입은 따로 두고 싶을 때.
- ✓린팅, 배포, 모노레포를 위한 도구 선택에 도움이 필요할 때.
스킬 링크
https://github.com/antfu/skills/blob/main/skills/antfu/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“깔끔하고 최신 관례를 따르는 새 TypeScript 라이브러리 프로젝트를 설정해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 파일 구조, 타입 처리, 런타임 참고 사항, 도구에 관한 지침을 따르며, 참조용 스타터 프로젝트를 모델로 사용합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Reference template: antfu/starter-ts. When scaffolding a new TypeScript project, mirror its
package.jsonscripts,eslint.config.js,knip.json,tsdown.config.tsand workflows rather than inventing a new layout.
Coding Practices
Code Organization
- Single responsibility: Each source file should have a clear, focused scope/purpose
- Split large files: Break files when they become large or handle too many concerns
- Type separation: Always separate types and interfaces into
types.tsortypes/*.ts - Constants extraction: Move constants to a dedicated
constants.tsfile
Runtime Environment
- Prefer 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
TypeScript
- Explicit return types: Declare return types explicitly when possible
- Avoid complex inline types: Extract complex types into dedicated
typeorinterfacedeclarations
Explicitness
Favor explicit, traceable code over implicit "magic". A reader (human or agent) should be able to follow where every name comes from without running tooling.
- Explicit imports: Prefer explicit
importstatements. Avoid auto-imports — when a framework provides them (e.g. Nuxt/Nitro), turn them off for new projects (see app-development). - No path aliases by default: Use relative imports (
./foo,../bar). Only use path aliases (@/,~/,#imports, etc.) when they are already configured in the project; don't introduce new ones for greenfield code.
Comments
- Avoid unnecessary comments: Code should be self-explanatory
- Explain "why" not "how": Comments should describe the reasoning or intent, not what the code does
Testing (Vitest)
- Test files:
foo.ts→foo.test.ts(same directory) - Use
describe/itAPI (nottest) - Use
toMatchSnapshotfor complex outputs - Use
toMatchFileSnapshotwith explicit path for language-specific snapshots
Tooling Choices
@antfu/ni Commands
| 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 |
Clean install (pnpm i --frozen-lockfile) |
nlx <pkg> |
Execute package (npx) |
Checking npm Package Versions
Use 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).
nlx fast-npm-meta version vite # 7.3.1
nlx fast-npm-meta version "nuxt@^3.5" # 3.5.22 — range-aware
nlx fast-npm-meta version vite nuxt vue # multiple at once
nlx fast-npm-meta version vite --json # JSON for scripting
nlx fast-npm-meta full vite # full version list + dist-tags
Prefer this over npm view <pkg> version when you only need the latest version, and over reading package.json from the registry directly.
TypeScript Config
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
ESLint Setup
// eslint.config.js
import antfu from '@antfu/eslint-config'
export default antfu({
type: 'lib', // or 'app' (default)
pnpm: true, // enforce pnpm catalogs in package.json
antislop: true, // flag redundant/duplicated AI-style code, ban explicit `any`
})
Always enable antislop: true. It requires eslint-plugin-slop and eslint-plugin-sonarjs as dev dependencies.
For detailed configuration options: antfu-eslint-config
Knip
Use Knip to catch unused files, exports and dependencies — the linter only sees one file at a time.
// knip.json
{
"$schema": "https://unpkg.com/knip@6/schema.json",
"project": ["src/**/*.ts"],
"ignoreDependencies": []
}
Fix what Knip reports by deleting; only add to ignoreDependencies for tools invoked outside `p
자주 묻는 질문
Anthony Fu의 프로젝트에만 쓸 수 있나요?
아니요. 누구나 JavaScript와 TypeScript 프로젝트에 적용할 수 있는 관례 모음입니다.
브라우저 코드와 서버 코드에도 맞나요?
네. Node, 브라우저, 워커에서 실행되는 코드를 선호하며, 한 곳에서만 실행되는 파일은 표시합니다.
라이브러리 배포도 다루나요?
네. 라이브러리 배포와 모노레포 설정을 다룹니다.
상세 정보
작성자의 원본 설명
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.
repo: antfu/skills
인기도
- GitHub 스타
- 6.0k
- 순위
- #14439
- 라이선스
- MIT
- 업데이트
- 2026. 10. 30.
댓글
- …
이 저장소의 다른 스킬
antfu-create-pr
6.0k에이전트가 내 브랜치에서 GitHub 풀 리퀘스트를 열도록 돕고, 무엇이 왜 바뀌었는지 쉽게 설명한 요약을 함께 씁니다.
antfu-issue-triage
6.0k에이전트가 열린 GitHub 이슈와 풀 리퀘스트를 살펴 중복과 이미 해결된 항목을 찾고, 실행 전에 사용자에게 먼저 묻도록 돕습니다.
antfu-query
6.0k에이전트가 계획을 한 번에 한 단계씩 질문해, 함께 명확하고 검증된 이해에 이르도록 돕습니다.
antfu-simplify
6.0k에이전트가 코드 변경을 필요 없는 부분을 빼고 가장 작고 올바른 형태로 줄이도록 돕습니다.