antfu-coding-style

Antfu Coding Style & Philosophy

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "antfu-coding-style" with this command: npx skills add dokhacgiakhoa/antigravity-ide/dokhacgiakhoa-antigravity-ide-antfu-coding-style

Antfu Coding Style & Philosophy

Goal: Maximal Developer Experience (DX) through minimalism and smart defaults. "Works out of the box."

  1. Code Organization
  • Single Responsibility: Keep files small. If you scroll too much, split it.

  • Export: Use Named Exports for libraries, Default Exports for components.

  • Constants: Extract magic strings/numbers to constants.ts .

  1. TypeScript Preferences
  • Implicit over Explicit: Let TS infer types when obvious.

  • Bad: const count: number = 0

  • Good: const count = 0

  • Return Types: Explicitly type return values for library limits (public API), infer for internal functions.

  • No Enums: Use const assertion object or String Unions.

  • type Mode = 'dark' | 'light'

enum Mode { ... }

  1. Tooling Stack
  • Package Manager: pnpm (Fast, disk efficient).

  • Runner: ni (NPM/Yarn/PNPM/Bun Agnostic runner).

  • ni -> install

  • nr dev -> run dev

  • nu -> upgrade

  • Testing: Vitest (Fast, Jest compatible, Native ESM).

  • Naming: *.test.ts .

  • Verification: Use toMatchSnapshot() sparingly, prefer toMatchInlineSnapshot() .

  1. CSS / Styling
  • UnoCSS: Atomic CSS engine.

  • Attributify: Use attributes for styles to keep clean class strings.

  • <div text="red 4xl" hover="text-blue"> (Controversial but preferred by Antfu for clean template).

  1. Vue.js Specifics
  • Script Setup: <script setup lang="ts"> .

  • ReactivityTransform: Previously experimental, now prefer ref with .value or explicit .value macros if configured.

  • Structure:

  • defineProps and defineEmits at the top.

  • watch / computed grouped together.

The "Antfu" Vibe:

  • Delete dead code immediately.

  • If it can be automated, write a script.

  • Aesthetics matter: Code should look beautiful.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ui-ux-pro-max-skill

No summary provided by upstream source.

Repository SourceNeeds Review
General

notion-mcp

No summary provided by upstream source.

Repository SourceNeeds Review
General

filesystem-mcp

No summary provided by upstream source.

Repository SourceNeeds Review
General

aws-serverless

No summary provided by upstream source.

Repository SourceNeeds Review