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.

25 stars

Best use case

SWC — Super-Fast Rust Compiler is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using SWC — Super-Fast Rust Compiler should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/swc/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/TerminalSkills/skills/swc/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/swc/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How SWC — Super-Fast Rust Compiler Compares

Feature / AgentSWC — Super-Fast Rust CompilerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```json
// .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

```bash
# 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

```typescript
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

```javascript
// 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

```bash
npm install -D @swc/core @swc/cli
npm install -D @swc/jest                  # For Jest
```

## Best Practices

1. **Replace Babel** — SWC handles TypeScript, JSX, decorators, polyfills; drop `.babelrc` entirely
2. **Next.js default** — Next.js uses SWC by default; no configuration needed
3. **Jest speedup** — Replace `babel-jest` with `@swc/jest`; test suites run 3-5x faster
4. **Minification** — Replace Terser with SWC minifier; same quality, 20x faster
5. **Target wisely** — Set `target: "es2020"` for modern browsers; `"es5"` only for legacy support
6. **Drop console** — Enable `drop_console` in minify config for production; removes console.log automatically
7. **Source maps** — Always enable `sourceMaps: true`; SWC generates source maps at negligible cost
8. **Plugin system** — Write SWC plugins in Rust (WASM); for custom AST transforms beyond configuration

Related Skills

fastify-plugin-creator

25
from ComeOnOliver/skillshub

Fastify Plugin Creator - Auto-activating skill for Backend Development. Triggers on: fastify plugin creator, fastify plugin creator Part of the Backend Development skill category.

fastapi-router-creator

25
from ComeOnOliver/skillshub

Fastapi Router Creator - Auto-activating skill for Backend Development. Triggers on: fastapi router creator, fastapi router creator Part of the Backend Development skill category.

fastapi-ml-endpoint

25
from ComeOnOliver/skillshub

Fastapi Ml Endpoint - Auto-activating skill for ML Deployment. Triggers on: fastapi ml endpoint, fastapi ml endpoint Part of the ML Deployment skill category.

rust-mcp-server-generator

25
from ComeOnOliver/skillshub

Generate a complete Rust Model Context Protocol server project with tools, prompts, resources, and tests using the official rmcp SDK

ralph-tui-create-beads-rust

25
from ComeOnOliver/skillshub

Convert PRDs to beads for ralph-tui execution using beads-rust (br CLI). Creates an epic with child beads for each user story. Use when you have a PRD and want to use ralph-tui with beads-rust as the task source. Triggers on: create beads, convert prd to beads, beads for ralph, ralph beads, br beads.

systems-programming-rust-project

25
from ComeOnOliver/skillshub

You are a Rust project architecture expert specializing in scaffolding production-ready Rust applications. Generate complete project structures with cargo tooling, proper module organization, testing

rust-pro

25
from ComeOnOliver/skillshub

Master Rust 1.75+ with modern async patterns, advanced type system features, and production-ready systems programming. Expert in the latest Rust ecosystem including Tokio, axum, and cutting-edge crates. Use PROACTIVELY for Rust development, performance optimization, or systems programming.

python-fastapi-development

25
from ComeOnOliver/skillshub

Python FastAPI backend development with async patterns, SQLAlchemy, Pydantic, authentication, and production API patterns.

fastapi-templates

25
from ComeOnOliver/skillshub

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

fastapi-router-py

25
from ComeOnOliver/skillshub

Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.

fastapi-pro

25
from ComeOnOliver/skillshub

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

azure-storage-blob-rust

25
from ComeOnOliver/skillshub

Azure Blob Storage SDK for Rust. Use for uploading, downloading, and managing blobs and containers. Triggers: "blob storage rust", "BlobClient rust", "upload blob rust", "download blob rust", "container rust".