agentleFS
dublyodublyo/saas-skills/mdn-web-best-practices/SKILL.md

mdn-web-best-practices

Skill14 starsChanged 5 months agoMITView on GitHub

Build, improve, or audit web apps using MDN Web Docs as the standards baseline. Use for frontend and web design/code tasks including new app or landing page creation, redesigns, refactors, code review, accessibility audits, responsive QA, performance checks, security reviews, forms, browser APIs, semantic HTML, CSS, JavaScript, and validation of existing web projects across any framework.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 13 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a spec-first workflow for web work unless the user already provided a precise implementation request.

    line 10
  2. Distinctive:

    Use the local MDN checkout as the standards source of truth.

    line 15
  3. Distinctive:

    Use the local source first.

    line 31
  4. Distinctive:

    Read only the references needed for the task:

    line 35
  5. Very specific:

    Use scripts/search_mdn.py for focused local MDN lookup.

    line 47
  6. Distinctive:

    Prefer established repo conventions for routing, components, styling, state, tests, and build tools.

    line 53
  7. Distinctive:

    Do not let visual polish weaken semantics, keyboard access, contrast, layout stability, or performance.

    line 65
  8. Distinctive:

    Create or confirm a short spec covering user flow, states, data, edge cases, and validation.

    line 70
  9. Distinctive:

    Search local MDN for platform-specific behavior before using browser APIs, complex CSS, advanced forms, media, storage, workers, …

    line 71
  10. Distinctive:

    Add or update focused tests when project tooling exists.

    line 73
  11. Very specific:

    Run available build/test/lint commands.

    line 74
  12. Distinctive:

    Run browser QA for meaningful UI changes.

    line 75
  13. Distinctive:

    Search MDN for any uncertain standards issue.

    line 83
  14. Distinctive:

    If a check cannot run, state why and give the next best manual check.

    line 102
  15. Distinctive:

    Keep script output as guidance.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

MDN Web Best Practices

Operating Model

Use a spec-first workflow for web work unless the user already provided a precise implementation request. Default to:

  1. Clarify the target user, page/app type, core flow, framework, and validation bar.
  2. Inspect the current repo before choosing patterns or adding dependencies.
  3. Route to the smallest relevant reference files below.
  4. Use the local MDN checkout as the standards source of truth.
  5. Design context-aware UI, then implement against MDN-backed web platform rules.
  6. Validate build/tests, browser behavior, responsiveness, accessibility, console, performance, and security before finishing substantial work.

For audit-only requests, skip implementation unless the user asks for fixes. Lead with findings, file/line references, risk, and evidence.

Source Of Truth

Primary MDN source:

/Users/dribrahimm/skills/mozilla/content/files/en-us/web

Fallback source:

https://github.com/mdn/content/tree/main/files/en-us/web

Use the local source first. Use the GitHub fallback only when the local path is missing or the needed MDN topic is not present locally. When browser behavior, API support, accessibility semantics, or security requirements are uncertain, search MDN instead of relying on memory.

Reference Routing

Read only the references needed for the task:

  • references/mdn-routing.md - local MDN search rules, topic map, and fallback behavior.
  • references/html.md - semantic HTML, document structure, media, interactive elements.
  • references/css.md - layout, responsive CSS, media queries, container queries, motion.
  • references/javascript.md - DOM, events, fetch, storage, browser APIs, progressive enhancement.
  • references/accessibility.md - keyboard, focus, labels, ARIA restraint, reduced motion.
  • references/forms.md - native forms, validation, errors, uploads, autofill, mobile inputs.
  • references/performance.md - rendering, loading, images, fonts, animations, Core Web Vitals.
  • references/security.md - XSS, CSP, cookies, CORS, storage, permissions, embeds.
  • references/design-validation.md - design quality bar and final QA expectations.

Use scripts/search_mdn.py for focused local MDN lookup. Use scripts/web_audit_checklist.py to generate a task-specific checklist before deep audits or larger builds.

Framework Behavior

Adapt to the current project instead of forcing a stack. Support plain HTML/CSS/JS and any framework already present, including Next.js, Nuxt, Astro, React, Vue, Svelte, Rails, Phoenix, or static site generators.

Prefer established repo conventions for routing, components, styling, state, tests, and build tools. Add dependencies only when they solve a real problem and fit the existing project.

Design Standard

Choose the visual language from the product context:

  • SaaS/product tools: quiet, dense, efficient, scan-friendly, low decoration.
  • Landing pages: strong first viewport, clear offer, real product or domain visuals, conversion-oriented structure.
  • Dashboards: comparison, filters, tables, states, and repeated workflows over decorative cards.
  • Developer tools: clarity, keyboard flow, logs, errors, and compact controls.
  • Consumer/mobile-responsive pages: fast comprehension, comfortable touch targets, resilient layout.

Do not let visual polish weaken semantics, keyboard access, contrast, layout stability, or performance.

Build Workflow

  1. Inspect package files, routes, app structure, styling system, test scripts, and existing UI conventions.
  2. Create or confirm a short spec covering user flow, states, data, edge cases, and validation.
  3. Search local MDN for platform-specific behavior before using browser APIs, complex CSS, advanced forms, media, storage, workers, permissions, or security-sensitive features.
  4. Implement with semantic HTML first, CSS that responds to content and viewport, and JavaScript that preserves progressive behavior where practical.
  5. Add or update focused tests when project tooling exists.
  6. Run available build/test/lint commands.
  7. Run browser QA for meaningful UI changes.
  8. Report what changed, what was validated, and any remaining risk.

Audit Workflow

  1. Identify the app type, user-critical flows, target browsers if available, and current framework.
  2. Inspect source and rendered behavior when possible.
  3. Generate an audit checklist with scripts/web_audit_checklist.py.
  4. Search MDN for any uncertain standards issue.
  5. Prioritize findings by user impact and regression risk.
  6. Include file/line references for code issues and screenshots or browser evidence for UI issues when available.
  7. Separate confirmed bugs from improvements and questions.

Validation Contract

For substantial web changes, try to complete all applicable checks:

  • Install/build/test/lint using repo scripts.
  • Browser smoke test for the primary flow.
  • Desktop and mobile responsive checks.
  • Console error check.
  • Keyboard navigation and focus visibility check.
  • Accessible name, label, landmark, heading, and contrast review.
  • Loading, empty, error, overflow, and long-content states.
  • Basic performance review for images, fonts, script weight, animation, and layout shift.
  • Security review for user HTML, forms, uploads, storage, cookies, third-party scripts, iframes, and auth/session assumptions.

If a check cannot run, state why and give the next best manual check.

Helper Scripts

Paths below use ${CLAUDE_SKILL_DIR} (this skill's own directory). If that variable is not set in the environment, substitute the absolute path to this skill's scripts/ folder.

Search MDN locally:

python3 "${CLAUDE_SKILL_DIR}/scripts/search_mdn.py" "dialog element"

Create a checklist:

python3 "${CLAUDE_SKILL_DIR}/scripts/web_audit_checklist.py" --mode full --surface app --framework next

Keep script output as guidance. Read the referenced MDN files before making a standards-sensitive claim.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.