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

rollup-config-generator skill

/rollup-config-generator

This skill generates a complete Rollup configuration for bundling libraries, including TypeScript support and multiple outputs.

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

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

Files (2)
SKILL.md
736 B
---
name: rollup-config-generator
description: Generate Rollup configuration files for bundling JavaScript libraries. Triggers on "create rollup config", "generate rollup configuration", "rollup setup", "library bundler config".
---

# Rollup Config Generator

Generate Rollup configuration files for efficient library bundling.

## Output Requirements

**File Output:** `rollup.config.js` or `rollup.config.mjs`
**Format:** Valid Rollup configuration
**Standards:** Rollup 4.x

## When Invoked

Immediately generate a complete Rollup configuration with plugins for bundling libraries.

## Example Invocations

**Prompt:** "Create rollup config for TypeScript library"
**Output:** Complete `rollup.config.mjs` with ESM and CJS outputs.

Overview

This skill generates complete Rollup configuration files for bundling JavaScript and TypeScript libraries. It produces valid Rollup 4.x configs as rollup.config.js or rollup.config.mjs, including sensible plugin setups and both ESM and CJS outputs when appropriate. The focus is on producing ready-to-run configs that follow common library distribution patterns.

How this skill works

On trigger phrases like "create rollup config" or "rollup setup" the skill reads the requested target (TypeScript, plain JS, library formats, external dependencies) and emits a finished Rollup configuration file. It includes plugin choices (TypeScript/Babel, resolve, commonjs, terser, peer-deps handling), output formats, sourcemaps, and externals derived from typical library constraints. The result is a single config file tailored for library bundling with Rollup 4.x.

When to use it

  • Creating a new Rollup config for a TypeScript or JavaScript library
  • Generating both ESM and CommonJS outputs for npm packages
  • Adding minification, sourcemaps, and external/peer dependency handling
  • Migrating an existing build to Rollup 4.x standards
  • Preparing a library for publishing while keeping runtime externals

Best practices

  • Emit both ESM and CJS builds for broad compatibility
  • Mark peer dependencies and runtime libs as externals to avoid bundling
  • Enable sourcemaps for published builds to help debugging
  • Use terser or a similar minifier only for production/minified output
  • Keep config modular and comment plugin sections for clarity

Example use cases

  • Create rollup config for TypeScript library that outputs ESM and CJS with declaration file support
  • Generate rollup.config.mjs for a small utility that should be tree-shakeable and minified for production
  • Produce config that treats React and other peer deps as externals while bundling helper code
  • Set up Rollup with Babel for transpiling modern syntax to older Node targets
  • Create a config that emits sourcemaps and uses terser for a minified distribution

FAQ

Which file formats will you produce?

I produce rollup.config.js or rollup.config.mjs tailored to your choice; outputs typically include ESM and CJS bundles.

Do you handle TypeScript declaration files?

Yes — the config can integrate TypeScript or dts plugins to emit declaration files alongside JS bundles when requested.