/pf-react:pf-chatbot-bundle-auditfrom pf-react
Audits @patternfly/chatbot imports for tree-shaking opportunities. Scans TypeScript/JS files, flags barrel-excluded components, and recommends dynamic subpath imports.
Ships in pf-react. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Scan a project's @patternfly/chatbot imports and flag patterns that inflate bundle size. Based on the tree-shaking work in patternfly/chatbot#893.
@patternfly/chatbot and bundle size is a concernexports and sideEffects fields in package.json)Read package.json. If @patternfly/chatbot is not a dependency, stop immediately — do not produce a ## ChatBot Bundle Audit section or continue to any scan steps. Report exactly:
`@patternfly/chatbot` is not a dependency in this project. This skill does not apply.
If @patternfly/chatbot is present, note the installed version. Tree-shaking support (exports and sideEffects fields) was added in version 6.8.0-prerelease.9. If the installed version is older than 6.8.0-prerelease.9, the audit report should state: "Recommend: upgrade to 6.8.0-prerelease.9 or later for native tree-shaking support." Until the project can upgrade, dynamic subpath imports bypass the barrel and are the best available mitigation.
The ChatBot package supports two import styles that both tree-shake correctly in versions 6.8.0-prerelease.9:
Dynamic subpath (preferred for fastest builds):
import ChatbotToggle from '@patternfly/chatbot/dist/dynamic/ChatbotToggle';
Named barrel import (also tree-shakes with modern bundlers):
import { ChatbotToggle } from '@patternfly/chatbot';
Both resolve to the same bundle size because the package declares sideEffects and exports fields. The key difference is that four modules — CodeModal, PreviewAttachment, AttachmentEdit, and tracking — are excluded from the root barrel entirely. They must use dynamic subpath imports.
The MarkdownContent component lazy-loads its markdown parser (react-markdown, syntax highlighters, rehype/remark plugins) as an async chunk. MessageBox automatically preloads this chunk and coordinates rendering so messages don't individually flash loading states.
Search only TypeScript and JavaScript source files — CSS/SCSS files are checked separately in Step 6 and do not count toward the "Scanned" total.
rg "@patternfly/chatbot" -t ts -t js -l
The number of files this returns is the Scanned count for the report header.
Then classify each import:
rg "from ['\"]@patternfly/chatbot['\"]" -t ts -t js
rg "from ['\"]@patternfly/chatbot/" -t ts -t js
These four modules are not exported from the root barrel. Any import of them from '@patternfly/chatbot' is broken (will fail or pull in nothing):
| Module | Broken import | Correct import |
|---|---|---|
CodeModal | import { CodeModal } from '@patternfly/chatbot' | import CodeModal from '@patternfly/chatbot/dist/dynamic/CodeModal' |
PreviewAttachment | import { PreviewAttachment } from '@patternfly/chatbot' | import PreviewAttachment from '@patternfly/chatbot/dist/dynamic/PreviewAttachment' |
AttachmentEdit | import { AttachmentEdit } from '@patternfly/chatbot' | import AttachmentEdit from '@patternfly/chatbot/dist/dynamic/AttachmentEdit' |
tracking | import { getTrackingProviders } from '@patternfly/chatbot' | import { getTrackingProviders } from '@patternfly/chatbot/dist/dynamic/tracking' |
These were removed from the barrel because they pull in Monaco Editor and other heavy dependencies. Search for them:
rg "import.*\b(CodeModal|PreviewAttachment|AttachmentEdit|getTrackingProviders)\b.*from ['\"]@patternfly/chatbot['\"]" -t ts -t js
Note that CodeModal, PreviewAttachment, and AttachmentEdit use default exports from their dynamic paths — not named exports.
Wildcard imports defeat tree-shaking:
rg "import \* as .* from ['\"]@patternfly/chatbot" -t ts -t js
// Bad — may pull in entire library
import * as Chatbot from '@patternfly/chatbot';
// Good — named import
import { ChatbotToggle } from '@patternfly/chatbot';
// Good — dynamic subpath
import ChatbotToggle from '@patternfly/chatbot/dist/dynamic/ChatbotToggle';
If the project uses CodeModal, PreviewAttachment, or AttachmentEdit, it must import the Monaco worker helper once at application startup before any of those components render:
rg "monaco-environment" -t ts -t js -l
If no import is found but barrel-excluded Monaco components are used, flag it:
// Required — import once at app startup
import '@patternfly/chatbot/monaco-environment';
Without this, Monaco web workers will not be configured and the component will log an error: "Monaco web workers are not configured. Import @patternfly/chatbot/monaco-environment before using CodeModal."
Also verify that monaco-editor and @monaco-editor/react are listed as dependencies when these components are used.
MarkdownContent lazy-loads its renderer. MessageBox handles preloading automatically — it calls preloadMarkdownRenderer() at module scope and wraps children in a MarkdownRendererReadyContext.Provider so messages render their chrome (avatars, timestamps) immediately while markdown fills in once the chunk is ready.
For chatbots that display messages on first render (e.g., a welcome message or conversation history), check whether the markdown chunk could be preloaded earlier:
rg "preloadMarkdownRenderer" -t ts -t js
If messages appear immediately on mount and there's a visible flash before markdown renders, suggest preloading in the app entry point or route loader:
import { preloadMarkdownRenderer } from '@patternfly/chatbot/dist/dynamic/MarkdownContent';
preloadMarkdownRenderer();
This is optional — MessageBox already handles it. Only suggest it when there is evidence of first-render flashing. Otherwise report the ### Markdown preloading section as NOT_NEEDED.
ChatBot styles are side-effectful and must be imported explicitly:
rg "chatbot/dist/css/main.css" -t ts -t js -t css
If missing, flag it. If present, verify it appears after PatternFly CSS imports so ChatBot overrides apply correctly.
If the project is itself a library or package (has main/module/exports in package.json), check that sideEffects is configured so downstream bundlers can tree-shake re-exports:
{
"sideEffects": ["**/*.css", "**/*.scss"]
}
Use this exact template structure for every audit. The header lines and section headings must appear verbatim — downstream tooling parses them.
## ChatBot Bundle Audit
**ChatBot version:** [exact version from package.json, e.g. 6.7.2]
**Scanned:** [N] files importing @patternfly/chatbot
[If version < 6.8.0-prerelease.9, include this line:]
> Recommend: upgrade to `6.8.0-prerelease.9` or later for native tree-shaking. Until then, use dynamic subpath imports.
### Barrel-excluded components (must use dynamic import)
[OK if none found, otherwise list each with file path and fix]
### Wildcard imports
[OK if none found, otherwise list each with file path and fix]
### Monaco worker setup
[OK | MISSING | NOT_NEEDED]
### Markdown preloading
[OK | NOT_NEEDED | SUGGESTED — with rationale]
### CSS import order
[OK | MISSING | WRONG_ORDER]
### Consumer sideEffects
[OK | MISSING | NOT_APPLICABLE]
Every section must appear as its own ### heading — do not collapse sections into a summary table. The **ChatBot version:** and **Scanned:** lines must use those exact prefixes.
When the user asks to fix findings:
import '@patternfly/chatbot/monaco-environment' at app startup if Monaco components are usedsideEffects to package.json if missing and the project is a libraryimport ChatbotHeader, {
ChatbotHeaderMenu,
ChatbotHeaderMain,
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
eval/cases/excluded-code-modal/annotations.yaml (opens in a new tab)eval/cases/excluded-code-modal/input.yaml (opens in a new tab)eval/cases/excluded-code-modal/package.json (opens in a new tab)eval/cases/excluded-code-modal/src/main.tsx (opens in a new tab)eval/cases/first-render-markdown-flash/annotations.yaml (opens in a new tab)eval/cases/first-render-markdown-flash/input.yaml (opens in a new tab)eval/cases/first-render-markdown-flash/package.json (opens in a new tab)eval/cases/first-render-markdown-flash/src/Assistant.tsx (opens in a new tab)eval/cases/first-render-markdown-flash/src/main.tsx (opens in a new tab)eval/cases/legacy-version/annotations.yaml (opens in a new tab)eval/cases/legacy-version/input.yaml (opens in a new tab)eval/cases/legacy-version/package.json (opens in a new tab)eval/cases/legacy-version/src/Assistant.tsx (opens in a new tab)eval/cases/legacy-version/src/main.tsx (opens in a new tab)eval/cases/library-missing-side-effects/annotations.yaml (opens in a new tab)eval/cases/library-missing-side-effects/input.yaml (opens in a new tab)eval/cases/library-missing-side-effects/package.json (opens in a new tab)eval/cases/library-missing-side-effects/src/index.ts (opens in a new tab)eval/cases/library-missing-side-effects/src/styles.css (opens in a new tab)eval/cases/no-chatbot-dependency/annotations.yaml (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub rh-uxd/ai-helpers --plugin pf-react16 skills in this plugin
/pf-chart-genGenerate PatternFly chart components with theming, responsive sizing, and accessibility. Use when building charts, data visualizations, or dashboards with PatternFly./pf-component-checkAudit PatternFly React component nesting, wrapper hierarchies, and layout structure. Use when scanning for hierarchy violations or debugging spacing caused by missing wrapper components./pf-component-reuse-checkDetects custom React components in newly created or modified (uncommitted) code that overlap with PatternFly React components, suggests the PatternFly equivalent, and can replace the custom component then build to verify. Use when creating UI components, reviewing uncommitted React changes, or when the user asks to prefer PatternFly instead of a custom component.Other plugins' skills for the same job