swc
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "swc":https://skillpi.com/zh/skills/deepskill-0b1c72bb5cb17002089c021e07e2d5b4ca2a8e15a9b796d0755adcb1c8baa007。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
SWC 专家,SWC 是基于 Rust 的 JavaScript/TypeScript 编译器。帮助开发者用 SWC 替代 Babel 和 Terser,实现 20–70 倍更快的编译、压缩和打包速度。Next.js、Vite、Parcel 和 Deno 等将其作为默认编译器,能够以原生速度处理 TypeScript 剥离、JSX 转换、polyfill 注入和代码压缩。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
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
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- SWC 编译器使用指南,帮助开发者替换 Babel/Terser,显著提升构建性能
- 覆盖配置、CLI、API、Jest 集成等完整使用场景,实用性强
亮点
- description 清晰定义 SWC 专家角色,触发词精准完整
- 边界清晰,覆盖 TypeScript/JSX 编译、压缩、打包等核心能力
待提升项
-
文档长度 原报告严重程度:轻微
文档内容较长,可能影响阅读体验
改进建议:建议适当精简内容,突出核心使用场景
亮点
- 结构清晰,分章节组织内容
- 提供完整配置示例和多种使用方式
亮点
- 工具来源明确,参数配置正确
- 覆盖主要异常场景,示例可执行性强
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 74, 77, 80, 83, 136 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- json.schemastore.org
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。