ai-friendly-web-design
install
source · Clone the upstream repo
git clone https://github.com/ianho7/ai-friendly-web-design-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ianho7/ai-friendly-web-design-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/ai-friendly-web-design" ~/.claude/skills/ianho7-ai-friendly-web-design-skill-ai-friendly-web-design && rm -rf "$T"
manifest:
skills/ai-friendly-web-design/SKILL.mdsource content
AI-Friendly Web Design (AI Accessibility)
Original: @karminski-牙医 · Compiled by: @ianho7
Core principle: Treat AI agents the same way you'd treat a screen reader for a visually impaired user.
Getting AI Accessibility right is a win on three fronts simultaneously: future-proofing for agent traffic, improving human accessibility, and boosting SEO.
Prime Directive
Minimize modals and popups. They're bad for humans and bad for AI. When you must alert the user, use a banner instead.
Core Checklist
DOM Structure & Semantics
- Use semantic HTML tags:
,<main>
,<article>
,<nav>
, etc. Add<button>
to icon-only buttonsaria-label - Hide decorative elements: Mark long SVGs, background layers, and visual noise with
oraria-hidden="true"
to reduce irrelevant token consumptiondata-ai-hidden="true" - Provide stable locators: Add
ordata-testid="submit-order"
to key interactive nodes — never rely on volatile Tailwind-generated class namesdata-ai-action="submit-order"
Forms & Interactions
- Use native form controls: Prefer
,<select>
over div-based custom components — native controls have standard APIs that tools like Playwright can drive directly<input type="checkbox"> - Don't hide actions behind hover: Agents won't probe hover states; content that's only visible on hover may never be discovered
- Listen to
/input
events: Programmatic input doesn't firechange
/keydown
— relying solely on keyboard events will break validationkeyup - Error messages must be plain text: Use
to surface readable error text; don't rely on color changes alonearia-describedby
State & Navigation
- Make loading states explicit: Disable buttons during loading and show text like "Saving..." or "Loading..."
- Prefer pagination over infinite scroll: Pagination controls give agents a clear navigation target; infinite scroll has no definable end condition
- Sync state to the URL: Write search terms, filters, categories, and page numbers into the URL to support deep linking and reproducibility
Context & Isolation
- Use iframes and Shadow DOM sparingly: If unavoidable, keep enough context, status hints, and key summaries in the top-level DOM — many lightweight extraction tools can't pierce these boundaries
- Complete critical flows in-page: Keep login, payment, and authorization in the current context; avoid opening new tabs or popup windows, which cause agents to lose focus
Advanced: Dual Entry Points
- Expose an AI-consumable API manifest at
or a prominent location.well-known/ai.json - Don't default to ReCAPTCHA — it's an impenetrable wall for AI agents; prefer rate limiting, honeypot fields, or behavioral analysis instead
Code Review Checklist
When reviewing frontend code, check in order:
- Do interactive elements have semantic tags or
?aria-label - Are decorative elements marked with
?aria-hidden - Do key buttons and forms have stable
ordata-testid
attributes?data-ai-action - Are any actions only reachable via hover?
- Are forms using native controls or div-based simulations?
- Are error messages in readable text form, not just color changes?
- Do loading states include
+ text feedback?disabled - Do critical flows open new tabs or popup windows?
For full rationale and code examples, see
references/guidelines.md