General 638 installs

antfu

by antfu/skills

Anthony Fu's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier…

Skill content

Opinionated TypeScript/JavaScript conventions and tooling setup for modern projects.

- Covers code organization (single responsibility, type separation, constants extraction), runtime practices (isomorphic code with environment markers), and explicit TypeScript typing

- Includes ESLint configuration via @antfu/eslint-config, Vitest testing patterns, and Git hooks with lint-staged for automated code formatting

- Provides @antfu/ni command shortcuts for dependency management across package managers, and pnpm catalog-based version management for monorepos

- References detailed guides for ESLint setup, project initialization, Vue/Nuxt app development, library publishing, and monorepo patterns

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.ts or types/*.ts

- Constants extraction: Move constants to a dedicated constants.ts file

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