home / skills / ehtbanton / claudeskillsrepo / swc-config-generator

swc-config-generator skill

/swc-config-generator

This skill generates a complete SWC configuration for TypeScript and React projects, delivering high-performance compilation settings.

npx playbooks add skill ehtbanton/claudeskillsrepo --skill swc-config-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
720 B
---
name: swc-config-generator
description: Generate SWC configuration files for high-performance JavaScript/TypeScript compilation. Triggers on "create swc config", "generate swc configuration", "swc setup", "rust compiler config".
---

# SWC Config Generator

Generate SWC configuration for high-performance JavaScript/TypeScript compilation.

## Output Requirements

**File Output:** `.swcrc` or `swc.config.js`
**Format:** Valid SWC configuration
**Standards:** SWC 1.x

## When Invoked

Immediately generate a complete SWC configuration for the project type.

## Example Invocations

**Prompt:** "Create swc config for React TypeScript"
**Output:** Complete `.swcrc` with React and TypeScript compilation settings.

Overview

This skill generates ready-to-use SWC configuration files for high-performance JavaScript and TypeScript projects. It produces valid SWC 1.x output as either a .swcrc JSON file or a swc.config.js module tailored to the project type. The generator focuses on practical defaults and common presets for frameworks like React, Next.js, Node, and libraries using TypeScript.

How this skill works

On trigger phrases like "create swc config" or "swc setup", the skill inspects the requested project type and target runtime, then composes a complete SWC configuration. It selects presets, parser options, transform plugins, module targets, and output formats consistent with SWC 1.x. The output is delivered either as a .swcrc JSON snippet or as a swc.config.js export depending on the requested file format.

When to use it

  • Bootstrapping a new React, Vue, or plain TypeScript project
  • Migrating from Babel to SWC for faster builds
  • Setting up SWC for server-side Node or Edge runtimes
  • Creating a library build with specific module/target outputs
  • Adding JSX/TSX support and fast minification to a build pipeline

Best practices

  • Specify the target environments (browserslist or Node version) to enable correct transforms
  • Enable loose transforms only when you control runtime assumptions and polyfills
  • Use module.type: "es6" for library outputs and "commonjs" for legacy Node builds
  • Keep separate configs for development (fast rebuilds) and production (minification, mangling)
  • Include sourceMaps in development and preserve original source maps during transpilation

Example use cases

  • Create swc config for React TypeScript producing JSX runtime automatic, decorator and class property transforms, and es2022 target
  • Generate .swcrc for a Node 16 TypeScript service with CommonJS output and inline source maps for debugging
  • Produce swc.config.js for a library build emitting ES modules, targeting modern browsers, and enabling module concatenation and minification
  • Set up SWC for a Next.js-like app with fast server and client compilation and separate dev/prod settings

FAQ

Can this generate both .swcrc and swc.config.js?

Yes. You can request either .swcrc (JSON) or swc.config.js (JS module) and the skill will output the appropriate format.

Does the configuration follow SWC 1.x standards?

Yes. All generated configurations target SWC 1.x features and common presets found in current SWC releases.