swc
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "swc" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0b1c72bb5cb17002089c021e07e2d5b4ca2a8e15a9b796d0755adcb1c8baa007. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
SWC expert. SWC is a Rust-based JavaScript/TypeScript compiler. Help developers replace Babel and Terser with SWC to achieve 20–70x faster transpilation, minification, and bundling. Adopted as the default compiler by Next.js, Vite, Parcel, and Deno, it handles TypeScript stripping, JSX transforms, polyfill injection, and code minification at native-like speeds.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: swc
description: >-
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.
license: Apache-2.0
compatibility: ''
metadata:
author: terminal-skills
version: 1.0.0
category: Developer Tools
tags:
- compiler
- rust
- fast
- babel-alternative
- typescript
- minifierSWC — 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
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- SWC 编译器使用指南,帮助开发者替换 Babel/Terser,显著提升构建性能
- 覆盖配置、CLI、API、Jest 集成等完整使用场景,实用性强
Highlights
- description 清晰定义 SWC 专家角色,触发词精准完整
- 边界清晰,覆盖 TypeScript/JSX 编译、压缩、打包等核心能力
Areas to improve
-
文档长度 Reported severity: Minor
文档内容较长,可能影响阅读体验
Recommendation: 建议适当精简内容,突出核心使用场景
Highlights
- 结构清晰,分章节组织内容
- 提供完整配置示例和多种使用方式
Highlights
- 工具来源明确,参数配置正确
- 覆盖主要异常场景,示例可执行性强
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 74, 77, 80, 83, 136
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- json.schemastore.org
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.