pf-component-structure
Audit PatternFly React component nesting, wrapper hierarchies, and layout structure. Use when scanning for hierarchy violations or debugging spacing caused by missing wrapper components.
Best use case
pf-component-structure is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Audit PatternFly React component nesting, wrapper hierarchies, and layout structure. Use when scanning for hierarchy violations or debugging spacing caused by missing wrapper components.
Teams using pf-component-structure should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pf-component-structure/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pf-component-structure Compares
| Feature / Agent | pf-component-structure | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Audit PatternFly React component nesting, wrapper hierarchies, and layout structure. Use when scanning for hierarchy violations or debugging spacing caused by missing wrapper components.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
Use this skill when you need a **structural audit** of PatternFly usage, or when fixing layouts caused by skipped wrappers. For day-to-day composition rules while writing UI, use the **component-structure-audit** agent (react plugin) or your client’s equivalent subagent for PatternFly structure.
## PatternFly MCP
If `@patternfly/patternfly-mcp` is available, use it for current props, examples, and new components. This skill and the reference files define **nesting and wrapper rules**; the MCP fills in API details.
## Why structure matters
Layout CSS targets specific parent-child trees. Skipping wrappers (`ToolbarContent`, `CardBody`, `PageSection`, etc.) breaks spacing and alignment; custom CSS is usually papering over a wrong tree. **Use every structural wrapper PatternFly provides for that region.**
## Where the hierarchies live
Reference files hold trees, props notes, examples, and anti-patterns — not duplicated here:
| Area | File |
|------|------|
| Page, PageSection, PageGroup, PageSidebar, Masthead | `references/page-layout.md` |
| Card, Modal, Drawer, EmptyState, Sidebar | `references/containers.md` |
| Table, DataList, DescriptionList | `references/data-components.md` |
| Nav, Tabs, Toolbar | `references/navigation-toolbar.md` |
Read the relevant file before suggesting structure for that family.
## Auditing component structure
### How to run
1. Ask the user which directory or files to audit. Default to the current working directory.
2. Search for files importing from `@patternfly/react-core` or `@patternfly/react-table`.
3. For each file, check for the violations below.
4. Report findings grouped by file, with line numbers and the specific violation.
5. If the user requests fixes, apply them. Only fix unambiguous structural issues — if a fix would change behavior or needs a design decision, report it and ask.
### Violations to detect
Use the same structural rules as the **component-structure-audit** agent; during a scan, flag the issues below. **Anti-pattern examples** live in the reference files for each family.
| Area | Flag |
|------|------|
| Page layout | Direct `<Page>` children that aren’t `<PageSection>` / `<PageGroup>`; `<PageSidebar>` without `<PageSidebarBody>`; `<PageSection hasBodyWrapper={false}>` without `<PageBody>` (info) |
| Masthead | `<MastheadBrand>` / `<MastheadToggle>` not under `<MastheadMain>`; `<MastheadLogo>` outside `<MastheadBrand>` |
| Toolbar | `<Toolbar>` children aren’t `<ToolbarContent>`; controls in `<ToolbarContent>` / `<ToolbarGroup>` without `<ToolbarItem>` |
| Card | Raw content in `<Card>` outside `<CardBody>` / `<CardHeader>` / `<CardFooter>`; expandable card missing `<CardExpandableContent>` |
| Modal | Missing `<ModalHeader>` / `<ModalBody>` / `<ModalFooter>`; missing `aria-labelledby` or `aria-label` |
| Drawer | `<DrawerPanelContent>` as child of `<DrawerContent>` instead of `panelContent`; `<DrawerContent>` without `<DrawerContentBody>`; `<DrawerCloseButton>` not under `<DrawerActions>` in `<DrawerHead>` |
| Navigation | `<NavItem>` not under `<NavList>`; extra `<NavList>` inside `<NavGroup>` |
| Table | `<Tr>` direct under `<Table>`; `<Th>` in body rows or `<Td>` in header rows; `<Td>` without `dataLabel` (**WARN**) |
| DataList | Missing `aria-label` on `<DataList>`; item without `<DataListItemRow>`; row without `<DataListItemCells>`; `<DataListContent>` inside `<DataListItemRow>` (should be sibling) |
| Tabs | Tab label as children instead of `title`; `<Tab>` without `eventKey` |
| EmptyState | `<EmptyStateIcon>` directly under `<EmptyState>`; mixing `titleText`/`icon` with explicit `<EmptyStateHeader>` |
| DescriptionList | Terms/descriptions directly under `<DescriptionList>` without `<DescriptionListGroup>` |
### Report format
For each violation:
```
[ERROR|WARN] file/path.tsx:42 - <Toolbar> has direct children that are not <ToolbarContent>
Found: <Button> as direct child of <Toolbar>
Fix: Wrap children in <ToolbarContent><ToolbarItem>...</ToolbarItem></ToolbarContent>
```
Use `ERROR` for layout-breaking issues; `WARN` for best-practice gaps. End with a summary:
```
Scanned: 23 files
Errors: 7 (across 4 files)
Warnings: 3 (across 2 files)
```
Group by violation type so patterns are visible.
### Applying fixes
1. Only fix structure when the correct hierarchy is unambiguous.
2. Preserve props, handlers, and content.
3. Do not reformat unrelated code.
4. Summarize what changed.
**Usually safe:** Wrapping in missing intermediates (`ToolbarContent`, `ToolbarItem`, `CardBody`, `NavList`, `DescriptionListGroup`, …); moving `DrawerPanelContent` to `panelContent`; adding `<Thead>` / `<Tbody>`.
**Needs user input:** New `aria-label` / `aria-labelledby` text; choosing `titleText` vs `<EmptyStateHeader>`; unclear nested intent.
### Custom CSS
**During an audit:** If spacing or padding overrides sit next to a structural issue, add an info line, e.g.:
```
[INFO] file/path.tsx:42 - Custom CSS spacing override near structural violation
.my-toolbar-fix { padding: 8px } may compensate for missing <ToolbarContent>
```
**Before suggesting new overrides:** Map the symptom to a missing wrapper when possible — page content → `PageSection` / `PageBody`; toolbar → `ToolbarContent` / `ToolbarItem`; card → `CardBody`; nav → `NavList`; description list → `DescriptionListGroup`; drawer panel → `panelContent` prop (see reference files for full trees).Related Skills
pf-unit-test-generator
Generate a unit test file for a React component using Testing Library. Use when adding test coverage to new or existing components.
pf-prototype-mode
Enable prototype mode for React apps with grayscale styling and a banner overlay. Use when demoing early concepts, presenting wireframes, or preventing stakeholders from fixating on visual polish.
pf-project-scaffolder
Scaffolds PatternFly React projects with PF6-safe dependencies, imports, and starter layout. Use when creating a new PatternFly app or bootstrapping a migration sandbox.
pf-import-checker
Audit and fix invalid PatternFly import paths across packages. Use when imports fail, modules are unresolved, or after upgrading PatternFly versions.
write-example-description
Write and refine example descriptions for PatternFly.org component and demo pages. Use when authoring or updating the prose in PatternFly example markdown files.
summarize-jira-issues
Summarize your current sprint workload from Jira — assigned issues, contributor roles, and priorities. Use when checking what's left in the sprint or deciding what to work on next.
semantic-release-troubleshooting
Diagnose and fix semantic-release issues when a specific version is not being released. Use when semantic-release skips a version, fails to release, or when troubleshooting after git push --force, squashed commits, permission errors, or reference already exists.
quarterly-initiative-report
Generate quarterly Jira status reports with RAG assessment, blocker tracking, and next-quarter recommendations. Use when preparing quarterly initiative reviews or tracking epic progress.
pf-tokens
Build CSS design tokens for PatternFly core and copy them to the PatternFly repository. Use when regenerating tokens after design changes or during release preparation.
pf-org-version-update
Update patternfly-org for a new PatternFly release — resolve versions, update package.json and versions.json, and provide build steps. Use when cutting a PF release or release candidate.
pf-create-issue
Create well-structured GitHub issues for PatternFly repositories with templates, follow-up tracking, and duplicate detection. Use when filing bugs, feature requests, or cross-repo follow-ups.
pf-bug-triage
Triage PatternFly bug reports — assess completeness, suggest fixes, identify affected components, and recommend assignees. Use when reviewing new bug issues or preparing them for assignment.