/pf-code-review:pf-state-auditfrom pf-code-review
Audits PatternFly React components for missing UI states: loading, error, empty, and unauthorized. Scans files importing from @patternfly/*, identifies data-dependent components, and recommends the correct PF6 component for each missing state.
Ships in pf-code-review. 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.
Audit PatternFly React components for missing UI states. Every data-dependent component should handle four states: loading, error, empty, and unauthorized. Teams consistently miss 2 of 4 — this skill finds the gaps and recommends the right PF6 component for each.
If PatternFly documentation tools are available, use them to verify component props and variant values before recommending. Without documentation available, rely on the component recommendations and signal tables in this skill.
The user provides a directory, file path, or set of components to audit. Default to the current working directory. Limit scope to files importing from @patternfly/* packages.
Identify data-dependent components — components that fetch, receive, or display dynamic data (API responses, query results, user-generated content). Look for:
useEffect / useQuery / useSWR / fetch / axios calls.map() over data arraysCheck each component for all four states:
The component should show a loading indicator while data is being fetched.
| Signal | What to flag |
|---|---|
isLoading / loading state exists but no loading UI rendered | Missing loading UI |
| Data fetch starts on mount but component renders data immediately | No loading guard |
| Loading state exists but uses a bare "Loading..." text string | Should use PF component |
PF6 recommendation:
Spinner — indeterminate loading, no content shape knownSkeleton — content placeholder when layout shape is known (tables, cards, text blocks)Skeleton for page loads where layout is predictable; Spinner for actions and modalsThe component should display an error when data fetching fails.
| Signal | What to flag |
|---|---|
.catch() or onError exists but error state isn't rendered | Swallowed error |
Error state renders null or empty fragment | Silent failure |
Error shown as raw error.message without formatting | Should use PF component |
| Error state doesn't offer a retry action | Missing recovery path |
PF6 recommendation:
Alert with variant="danger" — inline error within a page sectionEmptyState with error icon — full-page or panel-level errorAlert with actionLinks or EmptyState with primary action buttonThe component should communicate when data exists but the result set is empty.
| Signal | What to flag |
|---|---|
.map() on data array with no empty guard | Renders nothing when array is [] |
data?.length === 0 check exists but renders null | Silent empty |
| Empty state shows raw text without structure | Should use PF component |
| Table renders headers with no rows and no explanation | Confusing empty table |
PF6 recommendation:
EmptyState with titleText and descriptive body — alwaysEmptyStateIcon with contextual icon (search, plus-circle, cubes)The component should handle cases where the user lacks permission to view or modify data.
| Signal | What to flag |
|---|---|
| API returns 401/403 but component shows generic error | Missing authz-specific UI |
| Role-based UI gating exists but no explanation shown when gated | Silent permission denial |
| Admin-only actions visible but disabled without explanation | Confusing disabled state |
PF6 recommendation:
EmptyState with lock icon and "You don't have access" messageAlert with variant="warning" for partial access (can view but not edit)unauthorized as lower priority than loading/error/empty — not all components have permission concernsSpinner and Skeleton recommendations — Skeleton is the better choice when the content layout is known## State Audit: [directory or component]
### Missing States
| Component | File | Missing | Recommendation |
|-----------|------|---------|---------------|
| UserList | src/UserList.tsx:15 | empty | `EmptyState` with search icon and "No users found" |
| DashboardCards | src/Dashboard.tsx:42 | loading, error | `Skeleton` for cards; `Alert variant="danger"` for fetch errors |
### Coverage Summary
| State | Covered | Missing | Coverage |
|-------|---------|---------|----------|
| Loading | 8 | 2 | 80% |
| Error | 6 | 4 | 60% |
| Empty | 5 | 5 | 50% |
| Unauthorized | 3 | 7 | 30% |
**Components audited:** [N] | **Fully covered:** [N] | **Gaps found:** [N]
Do not fabricate file paths or line numbers — read the actual source files before reporting.
eval/cases/all-states-covered/annotations.yaml (opens in a new tab)eval/cases/all-states-covered/input.yaml (opens in a new tab)eval/cases/missing-error-with-retry/annotations.yaml (opens in a new tab)eval/cases/missing-error-with-retry/input.yaml (opens in a new tab)eval/cases/missing-loading-and-empty/annotations.yaml (opens in a new tab)eval/cases/missing-loading-and-empty/input.yaml (opens in a new tab)eval/cases/missing-unauthorized/annotations.yaml (opens in a new tab)eval/cases/missing-unauthorized/input.yaml (opens in a new tab)eval/eval.yaml (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/pf-adversarial-reviewReview PatternFly React components for unhandled edge cases and missing defensive code. Use when auditing components for production readiness or stress-testing before a release./pf-i18n-auditAudit PatternFly React code for i18n readiness — hardcoded user-facing strings, concatenation anti-patterns, locale-dependent formatting, and RTL-unsafe CSS. Use when reviewing code for global deployment or auditing i18n compliance./pf-reviewRun all PatternFly compliance checks on a project — imports, components, colors, legacy CSS, and security. Use when auditing PF code, before merging PRs, or for comprehensive compliance review./pf-security-scanScan PatternFly React code for security anti-patterns — XSS via dangerouslySetInnerHTML, unsanitized user input in tooltips/labels, and insecure href patterns. Use when reviewing PF code for security vulnerabilities or auditing user-controlled content in PF components.npx claudepluginhub rh-uxd/ai-helpers --plugin pf-code-reviewOther plugins' skills for the same job