semantic-html
Write well-considered semantic HTML that serves all users. Use when creating components, page structures, or reviewing markup. Emphasizes native HTML elements over ARIA. Treats proper document structure and accessibility as foundations rather than afterthoughts.
What this skill does
# Semantic HTML
Write HTML that conveys meaning, serves all users, and respects the web platform.
## When to Use This Skill
Use this skill when:
- Creating new components or page sections
- Reviewing markup for accessibility and semantics
- Deciding between native HTML elements and ARIA attributes
- Structuring documents with proper heading hierarchy
- Making interactive elements accessible
- Building forms with proper labelling and error handling
- Creating responsive tables
## Core Principles
### Content Realism
Design content is idealized. Real content is messy. Always account for:
- Long sentences and long words
- Images with varying aspect ratios and sizes
- Multi-language support (even if not planned—users can translate via browser)
- Dynamic content that changes in length and structure
Build components that handle real-world content gracefully, not just what looks good in design tools.
### Landmarks-First Planning
Before diving into individual components, consider the full page structure. This allows you to:
- Identify key landmarks for assistive technology users
- Plan heading hierarchy across the document
- Make informed decisions about element choice
- Avoid overusing landmarks (which diminishes their usefulness)
### Native Over ARIA
Follow the first rule of ARIA: if a native HTML element provides the semantics and behaviour you need, use it instead of adding ARIA to a generic element.
**Red flag:** High div count combined with high ARIA count on non-complex components signals reaching for patches rather than foundations.
#### Redundant ARIA
Adding ARIA to elements that already carry the correct semantics is noise—it clutters the code, can confuse assistive technology, and obscures genuine intent:
```html
<!-- Redundant: <ul> already has list semantics -->
<ul role="list">
...
</ul>
<!-- Redundant: alt="" already suppresses the accessible name -->
<img src="avatar.png" alt="" role="presentation" />
<!-- Redundant: aria-label duplicates visible text the AT will already read -->
<span aria-label="Most Popular">Most Popular</span>
```
#### Don't Override Native Semantics with role
ARIA `role` changes how assistive technology interprets an element. Applying a role that changes a native element's semantics introduces inconsistency—native behaviour (keyboard interaction, states, events) stays the same while the announced role changes:
```html
<!-- Wrong: role="switch" changes what AT announces, but the element still
behaves like a checkbox. Use the native checkbox if switch toggle
semantics aren't needed, or build a proper switch widget. -->
<input type="checkbox" role="switch" />
<!-- Right: native checkbox, no role override needed -->
<input type="checkbox" />
```
Only add a `role` attribute to a native element when you deliberately need different semantics and the element's behaviour genuinely matches that role.
### Separation of Visual and Semantic Hierarchy
Visual styling and semantic meaning are related but not coupled. CSS classes bridge the gap:
- Use the appropriate heading level based on document structure
- Apply CSS classes to control visual appearance (size, weight, colour)
- Create utility classes like `.u-Heading-XXL` for consistent visual treatment regardless of semantic level
## Document Structure
### Skip Navigation Links
Skip links let keyboard and screen reader users bypass repeated navigation blocks and jump directly to meaningful content. They are required on any page with a navigation block or other repeated content before the main content.
Place skip links as the **first focusable element** in `<body>`. They can be visually hidden and revealed on focus:
```html
<body>
<a href="#main-content" class="skip-link">Skip to main content</a>
<!-- optional additional skip targets -->
<a href="#search" class="skip-link">Skip to search</a>
<header>...</header>
<nav>...</nav>
<main id="main-content" tabindex="-1">...</main>
</body>
```
```css
.skip-link {
position: absolute;
transform: translateY(-100%);
}
.skip-link:focus {
transform: translateY(0);
}
```
**Why `tabindex="-1"` on `<main>`:** The `<main>` element is not natively focusable. Without `tabindex="-1"`, activating the skip link scrolls to the element but does not move keyboard focus there in all browsers. Adding `tabindex="-1"` makes it programmatically focusable (reachable via the skip link or `.focus()`) without adding it to the natural tab order.
**When to add more skip links:** If the page has a prominent search bar, a sidebar, or a long secondary navigation, consider skip links to those targets too. The goal is reducing the number of Tab presses to reach primary content.
**Sidebar layouts need a "skip to navigation" link:** When a sidebar navigation is placed away from the top of the DOM (e.g., after `<main>` in source order, or deep within the layout), add a skip link pointing to the `<nav>` so keyboard users can reach it without tabbing through all main content first.
**The primary skip link should target `<main>`:** The first skip link should always point to `<main id="main-content">`. Additional skip links can target other meaningful landmarks or controls—a `<search>` element, a sidebar `<nav>`, or a prominent form—depending on the page's complexity.
**Why this matters:** Without skip links, keyboard users must tab through every navigation item on every page load. On a nav with 12 links, that's 12 extra keystrokes — on every page.
### Landmark Elements
Use landmark elements to convey page structure:
| Element | Use When | Notes |
| --------- | ---------------------------- | -------------------------------------------------------------------------------- |
| `header` | Page or section header | Can appear multiple times in different contexts |
| `footer` | Page or section footer | Contact info, copyright, related links |
| `nav` | Navigation sections | Must be labelled; avoid "navigation" in the label (screen readers announce this) |
| `main` | Primary content | Only one per page; must contain the primary `<h1>` |
| `aside` | Tangentially related content | Content removable without changing the page's main story (sidebars, ads) |
| `search` | Search functionality | Contains the search form, not the results |
| `form` | User input | Only becomes a landmark when labelled via `aria-labelledby` or `aria-label` |
| `article` | Self-contained content | Would make sense syndicated or standalone |
| `section` | Thematic grouping | Only becomes a landmark when labelled |
#### `<main>` must contain the primary `<h1>`
Screen reader users often jump directly to `<main>`. If the page `<h1>` sits in a `<div>` between `<header>` and `<main>`, these users land after the title and lose essential context. The `<h1>` (and any subtitle or intro copy introducing the page) belongs inside `<main>`:
```html
<!-- Wrong: h1 is outside main -->
<header>...</header>
<div class="page-header"><h1>FAQ</h1></div>
<main>
<!-- screen reader users start here, after the title -->
</main>
<!-- Right: h1 is the first heading inside main -->
<header>...</header>
<main id="main-content" tabindex="-1">
<h1>FAQ</h1>
...
</main>
```
### The Section Element
A `section` without an accessible name behaves like a `div` semantically. When using `section`:
- Associate it with a heading via `aria-labelledby`
- This transforms it into a valid landmark region
- If you cannot provide a meaningful label, question whether `section` is the right choice
### The Article Element
Think beyond blog posts. Use `articlRelated in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.