Webpack plugin authoring
Guides writing and reviewing webpack 5 plugins with the right hooks and caching, so watch builds stay correct.
What we improved
Made SKILL.md work on its own. The original was an index of 44 links; it now contains a complete, working plugin skeleton that applies most of the rules, a hook type and tap method table, the full table of 15 `processAssets` stages with web
Improved by YourAISkill from the original by pproenca, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
9/10 Excellent webpack 5 plugin authoring rules with a tested skeleton, processAssets stage table, asset, cache and lifecycle rules and per-rule reference files.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Writing webpack 5 plugins — hook selection (compiler vs compilation, tap vs tapAsync, processAssets stages), the asset pipeline (emitAsset, source classes, info metadata, source maps), watch-mode and persistent caching (file/context/missing/buildDependencies), plugin lifecycle (constructor purity, multi-compiler isolation, shutdown cleanup), schema-utils validation, WebpackError reporting, jest-worker parallelism, and compatibility patterns (compiler.webpack namespace, peerDependencies, getCompilationHooks WeakMap). Patterns are drawn from production plugins like mini-css-extract-plugin, terser-webpack-plugin, compression-webpack-plugin, and Next.js's webpack plugins. Trigger when writing, reviewing, or debugging webpack 5 plugins — even if the user doesn't explicitly mention "best practices" — anytime an `apply(compiler)` method is being written, hooks are being tapped, or a plugin imports from `webpack-sources`, the rules in this skill apply.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: webpack-plugin-authoring
description: "Writing and reviewing webpack 5 plugins: hook selection (compiler vs compilation, thisCompilation, tap vs tapAsync vs tapPromise, bail hooks, processAssets stages, NormalModuleFactory stages), the asset pipeline (emitAsset, updateAsset, renameAsset, source classes, asset info, source maps, content hashes), watch mode and persistent caching (file, context, missing and build dependencies, compilation.getCache), plugin lifecycle (constructor purity, per-compilation state, MultiCompiler isolation, shutdown cleanup), options validation with schema-utils and the 5.106+ validate hook, WebpackError reporting and logging, worker parallelism, and packaging (compiler.webpack namespace, peerDependencies, getCompilationHooks). Use whenever an apply(compiler) method is written or reviewed, hooks are tapped, or a plugin builds or transforms assets, even if the user does not ask for best practices."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by pproenca. See CHANGES.md. -->
# Webpack 5 Plugin Authoring
44 rules across 8 categories, ordered by the authoring lifecycle: hook choice is the foundation, then asset manipulation, caching and watch-mode correctness, lifecycle hygiene, options validation, error reporting, performance, and packaging. Patterns follow webpack's own built-in plugins and the `webpack-contrib` plugins. API details were checked against webpack 5.113 (December 2026); the skeleton below was run against it.
## When to Apply
- Writing a new plugin (an `apply(compiler)` method, choosing hooks)
- Reviewing plugin code for correctness or performance
- Debugging "my plugin's output doesn't show up" (usually a hook or stage mismatch)
- Adding or transforming assets (`processAssets`, `emitAsset`, `updateAsset`)
- Fixing stale watch-mode builds or persistent-cache problems
- Migrating a webpack 4 plugin, or publishing a plugin to npm
## A correct plugin skeleton
This plugin adds a generated asset and stamps a banner on JavaScript after minification. It applies most of the rules below and was run with webpack 5.113 in production mode.
```js
const path = require('node:path');
const { validate } = require('schema-utils');
const PLUGIN_NAME = 'BuildInfoPlugin';
const schema = {
type: 'object',
properties: {
templatePath: { type: 'string', minLength: 1 },
filename: { type: 'string', minLength: 1 },
banner: { type: 'string' },
},
required: ['templatePath'],
additionalProperties: false,
};
const readFile = (fs, file) =>
...From pproenca's repository, MIT licence.
Related skills
-
Checked
Port code to Rust
Ports C, C++, Python, Go or JavaScript code into idiomatic Rust, with tests that prove it behaves the same.
8/101 credit -
Checked
TypeScript MCP Server Builder
Builds a tested MCP server in TypeScript on the current SDK, so Claude and other AI apps can use your tools.
7/101 credit -
Checked
Scrolling menu upgrade
Finds outdated react-horizontal-scrolling-menu code and rewrites it for version 8 so the menu works again.
7/101 credit -
Checked
Deno Deploy Hosting
Deploys Deno apps to the new Deno Deploy with a database and scheduled jobs, and moves old projects across.
7/101 credit -
Checked
ESLint Setup
Sets up ESLint with the current flat config for TypeScript and React, and makes CI enforce it.
7/101 credit -
Checked
Modern Node.js Features
Uses modern Node.js features like the built in test runner, TypeScript support and env files, not extra packages.
7/101 credit