Opinionated coding style and tooling preferences by Anthony Fu.
Scanned 5/27/2026
Install via CLI
openskills install H4D3ZS/vscodium-rust---
name: antfu-coding-style
description: Opinionated coding style and tooling preferences by Anthony Fu.
category: development
version: 4.1.0-fractal
layer: master-skill
---
# 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`.
## 2. 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 { ... }`
## 3. 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()`.
## 4. 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).
## 5. 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.
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Drive the full internationalization journey for a project — detect the stack, recommend a library, set up the chosen library, wrap existing strings, and optionally connect a translation platform. Use when the user asks to add or configure i18n, internationalization, localization, multi-language support, or translations — including when they explicitly mention LinguiJS, Lingui, next-intl, "wrap strings", "find hardcoded text", "make my app translatable", or "set up translations". Triggers on g...
PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.