Individual skill
webpack-plugin-authoring
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.
skills/.experimental/webpack-plugin-authoring/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 222
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- writing Derived category
- testing Derived category
- engineering Derived category
- engineering-web Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 12,437 bytesSKILL.mdcore · 10,771 bytesSKILL.mdcore · 10,771 bytesSKILL.mdcore · 10,771 bytesSKILL.mdcore · 10,771 bytesSKILL.mdcore · 10,771 bytesassets/templates/_template.mddoc · 3,043 bytesmetadata.jsonasset · 2,233 bytesreferences/_sections.mddoc · 3,410 bytesreferences/asset-buffer-not-source-for-binary.mddoc · 3,305 bytesreferences/asset-content-hash-via-output-options.mddoc · 3,356 bytesreferences/asset-delete-then-emit-loses-info.mddoc · 2,854 bytesreferences/asset-emit-asset-not-direct-assignment.mddoc · 3,008 bytesreferences/asset-preserve-source-maps.mddoc · 3,088 bytesreferences/asset-set-info-metadata.mddoc · 3,397 bytesreferences/asset-source-from-compiler-webpack.mddoc · 3,274 bytesreferences/cache-add-file-dependencies.mddoc · 3,261 bytesreferences/cache-build-dependencies-for-persistent-cache.mddoc · 3,966 bytesreferences/cache-context-dependencies-for-directories.mddoc · 3,258 bytesreferences/cache-missing-dependencies-for-optional-files.mddoc · 3,075 bytesreferences/cache-use-input-file-system.mddoc · 3,117 bytesreferences/compat-custom-hooks-via-weakmap.mddoc · 4,071 bytesreferences/compat-export-shape-and-cjs-esm.mddoc · 3,850 bytesreferences/compat-feature-detection-not-version-check.mddoc · 3,513 bytesreferences/compat-use-compiler-webpack-namespace.mddoc · 4,461 bytesreferences/compat-webpack-as-peer-dependency.mddoc · 3,426 bytesreferences/diag-attach-loc-to-errors.mddoc · 3,822 bytesreferences/diag-progress-reporting.mddoc · 3,180 bytesreferences/diag-push-webpack-error-not-throw.mddoc · 3,618 bytesreferences/diag-use-compilation-get-logger.mddoc · 3,500 bytesreferences/diag-warnings-vs-errors-exit-codes.mddoc · 3,682 bytesreferences/hook-bail-hook-return-semantics.mddoc · 2,687 bytesreferences/hook-name-matches-class-name.mddoc · 2,534 bytesreferences/hook-normal-module-factory-stages.mddoc · 4,774 bytesreferences/hook-prefer-process-assets-over-emit.mddoc · 3,228 bytesreferences/hook-process-assets-stage.mddoc · 2,958 bytesreferences/hook-tap-method-matches-hook-type.mddoc · 2,315 bytesreferences/hook-tap-once-not-per-compilation.mddoc · 2,528 bytesreferences/hook-thiscompilation-vs-compilation.mddoc · 2,212 bytesreferences/life-cleanup-in-shutdown-hook.mddoc · 3,527 bytesreferences/life-constructor-stores-options-only.mddoc · 3,603 bytesreferences/life-defensively-copy-user-options.mddoc · 3,506 bytesreferences/life-multi-compiler-isolation.mddoc · 3,375 bytesreferences/life-no-mutable-state-across-builds.mddoc · 3,640 bytesreferences/perf-avoid-source-toString-in-hot-paths.mddoc · 3,791 bytesreferences/perf-cache-results-with-compilation-cache.mddoc · 3,994 bytesreferences/perf-jest-worker-for-cpu-bound-work.mddoc · 4,166 bytesreferences/perf-respect-experimental-options.mddoc · 3,781 bytesreferences/perf-traverse-chunks-not-modules.mddoc · 3,757 bytesreferences/schema-additional-properties-false.mddoc · 3,087 bytesreferences/schema-name-and-base-data-path.mddoc · 3,114 bytesreferences/schema-tap-into-validate-hook.mddoc · 3,474 bytesreferences/schema-validate-with-schema-utils.mddoc · 3,333 bytes
Read excerpt
# dot-skills Webpack 5 Plugins Best Practices
Comprehensive guide for writing correct, performant webpack 5 plugins. Contains 44 rules across 8 categories (8 hook + 7 asset + 5 cache + 5 life + 4 schema + 5 diag + 5 perf + 5 compat = 44), ordered by the authoring lifecycle: hook choice is the foundation, then asset manipulation, then caching/watch-mode correctness, then lifecycle hygiene, then user-facing concerns (schema validation, error reporting), then performance, then packaging.
Patterns are derived from `webpack/webpack`, the `webpack-contrib` plugin suite (mini-css-extract, terser, compression, copy, css-minimizer), and Next.js's webpack integration in `vercel/next.js`.
## When to Apply
Reference these rules whenever:
- Writing a new plugin (defining `apply(compiler)`, picking which hook to tap)
- Reviewing existing plugin code for correctness or performance
- Debugging "why isn't my plugin's output showing up" — usually a hook/stage mismatch
- Adding asset manipulation logic (`processAssets`, `emitAsset`, `updateAsset`)
- Fixing watch-mode staleness or persistent-cache poisoning