Front-End Checklist

repository·main·Indexed 11 days ago

https://github.com/thedaviddias/front-end-checklist

An open-source quality system providing a structured set of best practices for front-end development. It allows developers and AI agents to audit code, URLs, and implementations for accessibility, performance, SEO, and security via a CLI, MCP, and skills.

Tokens
1M
Snippets
2.2K
Records
3.7K
Agent score
96%

What's inside Front-End Checklist

  1. Overview of the Front-End Checklist MCP Server

    main

    The Front-End Checklist MCP (Model Context Protocol) server exposes the project's rule corpus to AI agents. It allows agents to discover, search, audit, and receive guidance on frontend development best practices.

    Key features include:

    • 11 read-only tools for discovery, workflows, and audits.
    • Explicit tool separation: Distinct tools for checking, fixing, and explaining rules to ensure intentional AI actions.
    • Transport support: Runs via a remote HTTP endpoint (at /api/mcp) or via local stdio transport.
    • Fuzzy matching: Provides suggestions when a rule or category is not found using Levenshtein distance.
  2. Overview of Front-End Checklist

    main

    Front-End Checklist is an open-source quality system designed for both humans and AI agents. It provides a practical review workflow to verify front-end implementation quality across categories like accessibility, performance, SEO, security, and more. It consists of 385 English rules across 11 active categories, each providing explanations, remediation guidance, and verification steps.

    Key Resources:

  3. Review Accessibility Checklist Rules

    main

    The Front-End Checklist provides a set of actionable rules to ensure web applications are accessible, performant, and user-friendly. The rules are categorized by priority levels to help developers focus on critical issues first.

    Priority Levels

    • Critical: Essential for preventing harm (e.g., seizures) or ensuring basic usability (e.g., heading hierarchy, zoom reflow).
    • High: Important for significant user groups (e.g., screen reader users, users with motor impairments).
    • Medium: Enhances usability and provides better context (e.g., ARIA names for specific elements).
    • Low: Minor improvements or preference-based options (e.g., smooth scroll).

    Key Accessibility Rule Categories

    Visual & Motion

    • Prevent seizure-triggering flashing content: Content must not flash more than three times per second.
    • Respect reduced motion preferences: Animations should respect user motion preferences and avoid excessive motion.
    • Provide alternatives to parallax effects: Parallax effects must have reduced-motion alternatives.

    Screen Reader & Semantic Markup

    • Provide accessible names: Ensure buttons, interactive elements, <select> elements, tooltips, and ARIA command elements have discernible names.
    • Use semantic HTML: Use correct structures for lists (<ul>, <ol>, <dl>), tables, and landmarks (<main>, <nav>, <footer>).
    • Heading Hierarchy: Use a logical, sequential structure (h1 through h6).
    • ARIA Integrity: Use only allowed ARIA attributes for specific roles and ensure IDs used for ARIA references are unique.

    Content & Interaction

    • Text Resizing & Reflow: Support text resizing up to 200% and ensure content reflows at 400% zoom without horizontal scrolling.
    • Touch Targets: Ensure interactive elements are large enough for touchscreen users.
    • Inclusive Language: Use non-discriminatory and plain language.
  4. Browse the Front-End Checklist categories

    main

    The Front-End Checklist is organized into several key technical categories. You can use these categories to audit specific aspects of your web application. The available categories include:

    • HTML: Semantic markup, metadata, forms, and document structure.
    • CSS: Layout, typography, responsive design, and styling.
    • JavaScript: Logic, interactivity, and language features.
    • Performance: Loading speeds, resource optimization, and runtime efficiency.
    • Accessibility: Compliance with standards for users with disabilities.
    • SEO: Search engine optimization and discoverability.
    • Security: Protection against common web vulnerabilities.
    • Images: Optimization, formats, and responsive image handling.
    • Testing: Unit, integration, and end-to-end testing practices.
    • Privacy: Data handling and user privacy compliance.
    • Internationalization: Support for multiple languages and locales (i18n).

    For a full, interactive experience, you can browse the complete ruleset at frontendchecklist.io.

  5. Understand the Monorepo structure

    main

    The project is organized as a monorepo. Use the following mapping to locate specific parts of the system:

    • apps/web: Public website, rule pages, checklists, and MCP HTTP entrypoints.
    • packages/content: Source MDX content for rules and checklists.
    • packages/mcp: MCP server and tool definitions.
    • packages/rules: Public rules package for external consumers.
    • packages/design-system: Shared UI primitives and custom components.
    • packages/auth, packages/data-layer, packages/schemas, packages/types: Shared infrastructure for auth, data, schema, and types.
  6. Prefer immutable data patterns

    main

    To prevent bugs related to shared state and to enable features like time-travel debugging and efficient change detection (via reference comparison), avoid mutating objects or arrays in place. Instead, treat data as immutable by creating new copies whenever a change is required.

    Implementation Guidelines

    • Objects and Arrays: Use the spread operator (...) to create modified copies rather than direct assignment.
    • Array Transformations: Prefer non-mutating methods like map(), filter(), and reduce() over mutating methods like push(), splice(), or direct index assignment.
    • Configuration: Use Object.freeze() for configuration objects that must remain constant throughout the application lifecycle.
    • State Management: Immutability is critical when working with state management libraries such as Redux, Zustand, or Signals to ensure the framework can detect changes via reference equality.
  7. Distinguish between buttons and links for accessibility

    main

    To maintain correct semantics and accessibility, follow this distinction:

    • Use <button>: For actions that trigger state changes or perform tasks on the current page (e.g., submit, open, close, save, delete, toggle).
    • Use <a> (links): When the interaction navigates the user to a different URL or a different part of the page.

    Using a button for navigation can confuse screen reader users who expect a link to change the URL context.

    <!-- ✅ Action -->
    <button type="button">Save draft</button>
    
    <!-- ✅ Navigation -->
    <a href="/pricing">View pricing</a>
  8. When text images are acceptable

    main

    Text images are acceptable in the following specific scenarios, provided they are handled correctly:

    1. Logos: Use an alt attribute that contains the company name.
    2. Purely Decorative Text: Use alt="" and role="presentation" for ornamental calligraphy that provides no semantic value.
    3. Screenshots for Documentation: Use a <figure> with an <img> and a <figcaption> to describe the content of the screenshot.
    4. Complex Layouts: If an image contains complex text layouts (like a menu), wrap it in a div with role="img" and an aria-label containing the text content.
    <!-- ✅ OK: Logo with company name -->
    <img src="logo.png" alt="Acme Corporation">
    
    <!-- ✅ OK: Decorative calligraphy that's purely visual -->
    <img src="ornamental-text.png" alt="" role="presentation">
    
    <!-- ✅ OK: Screenshot showing text (for documentation) -->
    <figure>
      <img src="error-screenshot.png" alt="Error message showing 'File not found'">
      <figcaption>The error message appears when the file is missing.</figcaption>
    </figure>
    
    <!-- For complex text layouts -->
    <div role="img" aria-label="Menu: Appetizers $8-12, Entrees $18-25, Desserts $6-9">
      <img src="menu-design.png" alt="">
    </div>
  9. Identify and handle falsy values

    main

    In JavaScript, the following values are considered falsy: false, 0, -0, 0n, '', null, undefined, NaN.

    Common Pitfalls:

    • Numeric Zero: if (count) will fail if count is 0. Use if (count !== 0) for explicit numeric checks.
    • Empty Collections: Unlike some languages, empty arrays [] and empty objects {} are truthy in JavaScript. if ([]) will execute.
    // These are all falsy in JavaScript:
    false, 0, -0, 0n, '', null, undefined, NaN
    
    // Common trap — 0 is falsy!
    const count = 0
    if (count) {
      // This block never runs for count = 0
    }
    
    // ✅ Be explicit for numeric checks
    if (count !== 0) { /* runs for count = 0 */ }
    if (count > 0) { /* only positive */ }
    
    // Another trap — empty array and object are truthy!
    if ([])  { /* runs! */ }
    if ({})  { /* runs! */ }
  10. Understand SameSite cookie behavior

    main

    The SameSite attribute controls how cookies are sent with cross-site requests. Choosing the right level is critical for balancing security and usability (e.g., OAuth flows).

    Behavior Comparison

    • SameSite=Strict:

      • ✅ Same-site GET, POST, etc.
      • ❌ Cross-site navigation (typing URL, clicking link from another site)
      • ❌ Cross-site POST, DELETE, PUT, PATCH
    • SameSite=Lax (Modern browser default):

      • ✅ Same-site requests
      • ✅ Top-level cross-site GET navigation (clicking a link)
      • ❌ Cross-site POST, DELETE, PUT, PATCH (subresource requests)
    • SameSite=None:

      • ✅ All requests (same-site and cross-site)
      • ⚠️ Requires Secure flag; provides NO CSRF protection.
  11. Optimize animation performance with transform and opacity

    main

    To achieve smooth 60fps animations, use transform and opacity properties. These are 'compositor-only' properties that allow the browser to skip the Style, Layout, and Paint steps of the rendering pipeline, running the animation directly on the GPU compositor thread. This prevents animations from competing with JavaScript on the main thread.

    Property Categories

    • Compositor-only (Optimal): transform (translate, scale, rotate, skew), opacity, filter (on composited layers).
    • Paint-triggering (Acceptable, but not ideal): color, background-color, box-shadow, border-color, outline, text-shadow.
    • Layout-triggering (Avoid animating): width, height, margin, padding, top, left, right, bottom, border-width, font-size, display, position.
    /* Compositor-only properties (optimal for animation) */
    /* transform (translate, scale, rotate, skew) */
    /* opacity */
    /* filter (on composited layers) */
  12. Quick Reference for CSS custom properties

    main

    Core concepts for implementing CSS custom properties:

    • Definition: Define reusable values using the --variable-name syntax on the :root selector.
    • Cascade & Inheritance: Custom properties cascade and inherit; they can be overridden at any specific scope (e.g., inside a component class).
    • Usage: Use var(--name, fallback) to reference a property and provide a fallback value if the variable is undefined.
    • Runtime Access: Unlike preprocessor variables, custom properties are runtime values that can be read and written by JavaScript.