Agent Skills: dot-skills Webpack 5 Plugins Best Practices

Use whenever you face a webpack-build problem that ends with needing to write a plugin — 26 production-shaped recipes covering bundle-size budgets, forbidden architectural imports, env-var validation, secret-leak prevention, build-info injection, asset manifests, license walking, SRI hashes, virtual modules (Vite-style), filesystem routing (Next.js-style), generated barrels, runtime-driven TS types, library replacement (react→preact), debug-stripping, conditional polyfills, dynamic banners, feature flags, build-duration regression tracking, desktop/Slack notifications, changed-chunks diffing, browser auto-open, gzip/brotli pre-compression, image optimization, type-based dist layout, empty-chunk cleanup, cache-busting query strings. Each recipe is a complete working plugin drawn from production patterns at Next.js, Storybook, webpack-contrib. Trigger when the user asks how to do X with webpack or whether a plugin exists for X. Companion to webpack-plugin-authoring.

UncategorizedID: pproenca/dot-skills/webpack-plugin-recipes

Install this agent skill to your local

pnpm dlx add-skill https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/webpack-plugin-recipes

Skill Files

Browse the full folder contents for webpack-plugin-recipes.

Download Skill

Loading file tree…

skills/.experimental/webpack-plugin-recipes/SKILL.md

Skill Metadata

Name
webpack-plugin-recipes
Description
Use whenever you face a webpack-build problem that ends with needing to write a plugin — 26 production-shaped recipes covering bundle-size budgets, forbidden architectural imports, env-var validation, secret-leak prevention, build-info injection, asset manifests, license walking, SRI hashes, virtual modules (Vite-style), filesystem routing (Next.js-style), generated barrels, runtime-driven TS types, library replacement (react→preact), debug-stripping, conditional polyfills, dynamic banners, feature flags, build-duration regression tracking, desktop/Slack notifications, changed-chunks diffing, browser auto-open, gzip/brotli pre-compression, image optimization, type-based dist layout, empty-chunk cleanup, cache-busting query strings. Each recipe is a complete working plugin drawn from production patterns at Next.js, Storybook, webpack-contrib. Trigger when the user asks how to do X with webpack or whether a plugin exists for X. Companion to webpack-plugin-authoring.

dot-skills Webpack 5 Plugins Best Practices

Cookbook of 26 production-shaped webpack 5 plugins, organized by the problem they solve. Each recipe starts with a clearly defined problem statement ("here's what hurts without this"), shows the naive non-plugin approach, then provides a complete working plugin (60-150 lines) with explanation, variations, and "when NOT to use" guidance.

Companion to webpack-plugin-authoring — authoring teaches how to write any plugin correctly; recipes teach which plugin to write for a specific pain point. Recipes cross-reference the authoring rules they apply.

When to Apply

Reference these recipes whenever:

  • A team has a recurring build-time problem that "feels like it should be a plugin" (architecture rules, secret leak prevention, asset organization)
  • You need to integrate webpack output with downstream systems (SSR servers, CDNs, monitoring)
  • You're considering whether to write your own plugin OR adopt an existing one — these recipes show the underlying pattern so you can judge fit
  • Migrating from another bundler and need to recreate framework-style features (filesystem routing, virtual modules)
  • Onboarding new engineers to webpack plugin authoring — recipes give realistic, end-to-end examples

Recipe Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Build-time Guardrails | CRITICAL | guard- | | 2 | Build Metadata & Manifests | HIGH | meta- | | 3 | Virtual Modules & Codegen | HIGH | virtual- | | 4 | Code Transformation | MEDIUM-HIGH | transform- | | 5 | Developer Experience | MEDIUM | dx- | | 6 | Asset Pipeline | MEDIUM | assets- |

Quick Reference

1. Build-time Guardrails (CRITICAL)

2. Build Metadata & Manifests (HIGH)

3. Virtual Modules & Codegen (HIGH)

4. Code Transformation (MEDIUM-HIGH)

5. Developer Experience (MEDIUM)

6. Asset Pipeline (MEDIUM)

How to Use

When the user describes a webpack problem (or asks for a plugin):

  1. Identify the problem category (guardrail? metadata? codegen? transformation? dx? asset?)
  2. Open the matching recipe file — read the Problem section first to confirm it's the right recipe
  3. Use the Plugin section as a working starting point — adapt to the project's specifics
  4. Read How it works for the WHY behind each design choice (cross-references the authoring rules)
  5. Check Variations for common adaptations and When NOT to use to confirm the fit

For learning plugin authoring patterns more broadly, pair with the webpack-plugin-authoring skill — its 44 rules teach the underlying APIs every recipe in this skill applies.

Reference Files

| File | Description | |------|-------------| | references/_sections.md | Category definitions and impact levels | | assets/templates/_template.md | Template for authoring new recipes | | metadata.json | Version and source references |