> swc
You are an expert in SWC, the Rust-based JavaScript/TypeScript compiler. You help developers replace Babel and Terser with SWC for 20-70x faster compilation, minification, and bundling — used by Next.js, Vite, Parcel, and Deno as their default compiler, handling TypeScript stripping, JSX transformation, polyfill injection, and code minification at native speed.
curl "https://skillshub.wtf/TerminalSkills/skills/swc?format=md"SWC — Super-Fast Rust Compiler
You are an expert in SWC, the Rust-based JavaScript/TypeScript compiler. You help developers replace Babel and Terser with SWC for 20-70x faster compilation, minification, and bundling — used by Next.js, Vite, Parcel, and Deno as their default compiler, handling TypeScript stripping, JSX transformation, polyfill injection, and code minification at native speed.
Core Capabilities
Configuration
// .swcrc
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": true
},
"transform": {
"react": {
"runtime": "automatic",
"importSource": "react"
},
"decoratorVersion": "2022-03"
},
"target": "es2020",
"minify": {
"compress": {
"dead_code": true,
"drop_console": true,
"passes": 2
},
"mangle": true
}
},
"module": {
"type": "es6",
"strict": true,
"lazy": false
},
"minify": true,
"sourceMaps": true
}
CLI Usage
# Compile single file
npx swc src/index.ts -o dist/index.js
# Compile directory
npx swc src -d dist --source-maps
# Watch mode
npx swc src -d dist -w
# Minify
npx swc-minify input.js -o output.min.js
# Performance comparison (10K file project):
# Babel: 32s compile
# SWC: 0.5s compile (64x faster)
Programmatic API
import { transform, transformSync } from "@swc/core";
// Async transform
const output = await transform(sourceCode, {
filename: "app.tsx",
jsc: {
parser: { syntax: "typescript", tsx: true },
transform: { react: { runtime: "automatic" } },
target: "es2020",
},
module: { type: "es6" },
sourceMaps: true,
});
console.log(output.code);
console.log(output.map);
// Sync (for build tools)
const syncOutput = transformSync(sourceCode, {
jsc: { parser: { syntax: "typescript" }, target: "es2022" },
});
Jest Integration
// jest.config.js — Replace babel-jest with @swc/jest
module.exports = {
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest", {
jsc: {
parser: { syntax: "typescript", tsx: true },
transform: { react: { runtime: "automatic" } },
},
}],
},
};
// Test suite runs 3-5x faster than with babel-jest
Installation
npm install -D @swc/core @swc/cli
npm install -D @swc/jest # For Jest
Best Practices
- Replace Babel — SWC handles TypeScript, JSX, decorators, polyfills; drop
.babelrcentirely - Next.js default — Next.js uses SWC by default; no configuration needed
- Jest speedup — Replace
babel-jestwith@swc/jest; test suites run 3-5x faster - Minification — Replace Terser with SWC minifier; same quality, 20x faster
- Target wisely — Set
target: "es2020"for modern browsers;"es5"only for legacy support - Drop console — Enable
drop_consolein minify config for production; removes console.log automatically - Source maps — Always enable
sourceMaps: true; SWC generates source maps at negligible cost - Plugin system — Write SWC plugins in Rust (WASM); for custom AST transforms beyond configuration
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.