---
name: project-guides
description: Best practices for authoring and reviewing guidance. Use this skill any time you're writing or reviewing `guide.md`, `expectations.md`, or `demo.html` files.
title: project-guides
canonical_url: https://skilld.dev/gh/googlechrome/modern-web-guidance-src/project-guides
last_updated: 2026-11-18T01:01:37.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install googlechrome/modern-web-guidance-src/project-guides`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/project-guides`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/googlechrome/modern-web-guidance-src/project-guides) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/project-guides`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/project-guides --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/project-guides --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Stage 2: Authoring guidance for a use case (Needs guidance)

This is the second of three stages in creating guidance:

1. Stage 1: Identifying use cases for a feature
2. Stage 2: Authoring guidance for a use case (you are here)
3. Stage 3: Evaluating guidance for a use case

> **Governance & Review**: See [`GOVERNANCE.md`](../../../GOVERNANCE.md) and [`docs/ATLS.md`](../../../docs/ATLS.md) for authoring permissions (Peers fast-track to Stage 2; every guide requires Peer/ATL authorship and category Content ATL approval before merging).

## What a real-world coding agent sees

When a developer asks an AI coding assistant to implement something, the assistant retrieves the relevant `guide.md` via a RAG (vector search) system. **`guide.md` is the only project file a real-world coding agent ever sees.** Everything else in a use case directory is reference or eval infrastructure:

| File/Directory | Purpose | Seen by real-world agents? |
|---|---|---|
| `guide.md` | Guidance for implementing the use case | ✅ Yes — this is the only file |
| `demo.html` | Canonical standalone reference implementation used for Stage 2 validation and review | ❌ No |
| `expectations.md` | Verification criteria used to generate target evaluation tasks | ❌ No |
| `targets/<base_app>/patches/*-solution.patch` | Multi-agent golden diffs against clean base apps used to calibrate the grader | ❌ No |
| `targets/<base_app>/patches/zero-passrate.patch` | Calibration baseline diff (empty on almost every guide, i.e., the untouched starting app) used to verify grader checks fail when requirements are not implemented | ❌ No |
| `targets/<base_app>/grader.ts` | Playwright grader run against the eval agent's output | ❌ No |
| `targets/<base_app>/task.md` | Simulated developer prompt fed to the eval agent by the harness | ❌ No |

**Implication for Stage 2 authoring (`guide.md`, `demo.html`, & `expectations.md`):** Stage 2 ends at `guide.md`, `demo.html`, and `expectations.md` (self-validated with the [`project-guide-validation`](../project-guide-validation/SKILL.md) skill). `task.md`, the solution patches, and `grader.ts` are generated downstream in Stage 3 by `gd dev` (see [`src/harness/README.md`](../../../src/harness/README.md)); people can hand-edit them, and agents only when a person asks. Never change `guide.md` just to fit a grader; if a grader needs something the guide doesn't require, fix the grader (see [project-evals](../project-evals/SKILL.md)).

**Implication for `guide.md`:** Because `guide.md` is the agent's only source of truth, it must be entirely self-contained. Do not rely on agents reading `expectations.md`, any target patch, or any external link to understand how to implement the use case.

**MANDATORY RULES FOR WRITING `guide.md`:**

### 1. YAML Frontmatter Schema

`guide.md` must start with this YAML frontmatter structure (added in **Stage 1**):

```yaml
---
name: slugified-use-case-name
description: <do thing> <with feature> (e.g., "Create dynamic color systems using modern color syntax")
web-feature-ids:
  - webstatus-feature-id
---
```
* **web-features**: Must be a list of accurate IDs found via webstatus.dev. Include ALL features referenced in the guide body, not just the primary one (validation enforces this for macros). If an ID is missing, inform the USER.
  * **Pending Features (`tmp-` prefix)**: If a feature ID is pending upstream in `@web-platform-dx/web-features` (e.g. an open issue), use `tmp-<candidate-slug>` (e.g. `tmp-scroll-axis-lock`) in `guide.md` AND register it in `features/pending-web-features.json` along with its upstream issue link. Optionally add `group` (a web-features group ID like `scrolling`, or an array of them) so ATL triage routes it to that group's owner in `.github/atls.json` (then run `node src/ci/generate-feature-to-groups.ts`), and `compat_features` (a `@mdn/browser-compat-data` key or array of keys, e.g. `["css.properties.scroll-axis-lock"]`) so CI can detect when the feature graduates upstream even if `web-features` chooses a different final ID than `<candidate-slug>`. On the GitHub `new-feature` issue itself, annotate the predicted final ID **without** the `tmp-` prefix (`<candidate-slug>`); the sync and triage scripts automatically strip `tmp-` when matching guides to issues. When the feature ID is officially released upstream in `web-features`, validator checks will automatically fail in CI to prompt updating the frontmatter to the official ID.
* **draft** (optional): Withholds the guide from all distribution without deleting it. Omit to publish. Must be one of:
  * `stub`: placeholder with outline/author notes; skips the H1 and Baseline checks.
  * `wip`: being written.
  * `blocked`: held back by the platform/spec situation. Requires `draft-reason` (one line, link the deciding issue/PR).

### 2. Tone and Formatting

* **Formatting Directives:** Use strict imperative directives (`MANDATORY:`, `DO`, `DO NOT`) only when emphasis is strictly needed (e.g., for critical constraints, security, or common pitfalls). Do not overuse them for every single instruction (`MANDATORY` is emphasis, not a required tag on every graded step). Coding agents respond best to rigid constraints when they are selectively applied.
* **Focus & Token Economy (Teach Only the Course-Correction Delta):** Keep the guidance focused on the specific use case and short. No fluff or conversational text. Cut reference-style syntax enumeration and textbook explanations of Baseline Widely Available features that coding agents already know (e.g., how `<label>` or `addEventListener` works). Include a brief overview of the use case and explanation of why the solution outlined in the guide is the recommended approach.
* **Maintainer Notes vs. Agent Rationale (`{# ... #}` vs. Prose/Comments):**
  * **Internal notes for human maintainers:** Use `{# ... #}` comments inside `guide.md` (which [`stripComments()`](../../../src/core/macro-parsing.ts) strips out of the built guide served to agents) for upstream bug links, review history, or why an alternative/polyfill was rejected. Never commit separate `reasoning.md` or `notes.md` files in a guide directory.
  * **Actionable rationale for coding agents:** Put concise "why" explanations directly in `guide.md` prose or inline code comments whenever an agent might otherwise doubt or misapply a non-obvious pattern.
* **Self-Contained:** DO NOT include any external links in the markdown body (`[link text](https://skilld.dev/api/skills-raw/googlechrome/modern-web-guidance-src/project-guides/url)`), and DO NOT rely on internal `{{ GUIDE_REF("...") }}` cross-references to supply required implementation details. All required knowledge to use the feature MUST be fully synthesized into the markdown body (or transcluded at build time via `INCLUDE`/`FEATURE`). Agents must not be slowed down or require additional retrievals to implement the guidance.
* **American English:** Always author guidance in American English (`behavior`, `color`, `synchronize`, `center`, `optimize`, etc.) for consistency across documentation, RAG tokens, and search embeddings.
* **Callouts:** Use GitHub alert syntax (`> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]`), with the body on the following `>` lines. Validation rejects bold-label callouts (`> **Note:** …`) and other alert types; the devsite build converts alerts to DevSite notices.

### 3. Code Snippets

* **No Full-Implementation Code Dumps:** Include short, heavily commented code snippets where every snippet illustrates something the agent cannot infer from the prose above. Replace 50+ line boilerplate blocks with minimal, focused snippets and strip orthogonal details (such as inline SVG icons or arbitrary visual styling).
* Put directives directly in code comments so they are impossible to miss (e.g., `<!-- Always use the required attribute -->`).
* Code comments MUST explain why a value or approach is chosen, not just what the code does. An agent that copies magic values without understanding them will apply them incorrectly. If a value is context-dependent (e.g., a threshold that should vary by use case), say so explicitly.
* **Modern Standards**: Exclusively use ES modules (`import`/`export`) in JavaScript code examples; avoid CommonJS (`require`).
* **Clarifying Arbitrary Values**: Explicitly identify placeholder values (like `2rem` or `50ms`) as example-only in comments to avoid them being mistaken for strict technical constraints.

### 4. Implementation Steps

* The implementation steps should assume any web feature can be used. Choose the best feature for the job, regardless of browser support.
* **DO NOT** suggest modern features just because they are modern. If a modern feature has no distinct user-visible advantage over a legacy feature for the given use case — but will require a more complex fallback implementation — use the legacy feature.
* **Weigh tradeoffs across all users.** A guide's output serves many groups: mouse and touch users, keyboard users, assistive technology users, users on slow networks or low-end devices, users in other locales, etc. **DO NOT** recommend an approach that degrades the experience for one group to improve it for another unless the gain clearly outweighs the loss (e.g. a negligible cost to one group for a large benefit to another), and never one that excludes a group from the use case entirely. These are case-by-case calls for the relevant ATLs; when a guide makes such a tradeoff, it must state it explicitly. Maintainability is a cost on the same scale: extra handling for any one group must justify the complexity it adds to the code with a proportionate user benefit.
* **Platform-Native Composition:** Prefer native platform primitives (`<dialog>`, `[popover]`, `<details>`) over manual re-implementations of top-layer or disclosure behavior (light dismiss, `Escape`, focus restoration, `z-index` stacking).
* **DO NOT** include cross-browser fallbacks in the implementation section. Those should only be mentioned in the fallback section.
* Only mark steps as `MANDATORY` if they are truly required for the feature to function. Optional steps (e.g., adding scroll snap, adding an event listener for progressive enhancement) must be labeled as optional so they are not turned into mandatory grader checks. Incorrect use of `MANDATORY` causes agents to implement unnecessary complexity.
* Make sure every code snippet (including in the fallback section) is valid and runs without throwing in a real browser (e.g., no bare npm module specifiers in unbundled HTML, no mismatched element IDs).
* The guide is the agent's **only** source of truth. DO NOT reference `demo.html` or any other file — agents won't have access to them. Everything the agent needs to implement the use case must be in `guide.md`.
* When listing alternatives, say how to choose between them (which use cases favor which). Optional improvements are alternatives too: the choice is between adding them or not, so say when they're worth adding. Don't invent criteria; if the choice genuinely depends on context you can't anticipate, leave it to the agent.

### 5. Fallback Strategies

If the primary implementation uses features that are not Baseline Widely Available, you **MUST** include a fallback recommendation in this section.

* **Framing:** Frame fallback necessity in terms of Baseline target (e.g., "If your Baseline target does not support X, use...").
* **Assessment:** Start with a broad assessment of the fallback's robustness. Recommend the modern approach if the fallback is robust; highlight complexity/caveats and suggest alternatives (like userland solutions) if it is not.
* **Experience:** **MANDATORY:** Explicitly describe the fallback experience (progressive enhancement vs. feature detection/graceful degradation).
* **Feature Detection:** Use the `in` operator rather than `Object.hasOwn()` or `hasOwnProperty()` so checks work across the prototype chain. Check the target instance when you already have one (e.g. `'moveBefore' in container`, `'startViewTransition' in document`), or the specific Web IDL interface prototype when checking without an instance (e.g. `'onbeforematch' in HTMLElement.prototype` over `'onbeforematch' in window`).
* **Fallback Options (in order of preference):**
    1.  **Custom Code:** Short, reliable reimplementation (**<50 lines**) using widely available features.
    2.  **Polyfill:** A robust, performant polyfill (see guidelines below).
    3.  **Abstraction:** A well-tested userland library.
    4.  **Graceful Degradation:** Baseline Newly Available features that degrade gracefully.
    5.  **Progressive Enhancement:** Frame as progressive enhancement only if no robust fallback exists.
* **Faithfulness:** Fallbacks MUST be faithful to the use case. If the primary recommendation gracefully degrades but ultimately doesn't accomplish the core use case, suggest a different fallback if one is available. Graceful degradation **IS** acceptable for features that enhance, but are otherwise not core to the use case.

#### Baseline Status Macros
* **MANDATORY:** Include `{{ FEATURE_FALLBACKS("feature-id") }}` or `{{ BASELINE_STATUS("feature-id") }}` as a standalone line for *every* non-widely available feature used.
  * **When to use `FEATURE_FALLBACKS` vs. `BASELINE_STATUS`:**
    * Prefer `FEATURE_FALLBACKS` when the fallback strategy is reusable across guides and `features/<feature-id>.md` exists with a non-empty `## Fallbacks` section (create `features/<feature-id>.md` if multiple guides share the feature).
    * **Use `BASELINE_STATUS` when no `features/<feature-id>.md#fallbacks` entry exists:** `FEATURE_FALLBACKS` requires `features/<feature-id>.md` with a non-empty `## Fallbacks` section and throws a `MacroError` (failing validation/CI) if missing or empty. Use `{{ BASELINE_STATUS("feature-id") }}` directly when the fallback strategy is specific to a single guide (writing the fallback inline in `guide.md`), when you need the BCD-key second argument (`{{ BASELINE_STATUS("feature-id", "bcd.key") }}`), or when the feature is Baseline Widely Available and needs no fallback section.
* **Baseline Widely Available Features:** While fallback strategies are not required for Baseline Widely Available features, you **SHOULD** include `{{ BASELINE_STATUS("feature-id") }}` for features that became Baseline Widely Available (`baseline_high_date`) within the last 12 months (such as `subgrid` or `:has()`), or that are commonly misjudged by coding agents as lacking support. This affirmatively reassures coding agents whose training data might predate wide availability that the feature is universally supported without needing defensive fallbacks. Do not conflate `baseline_low_date` (Newly Available) with `baseline_high_date` (Widely Available).
* **No Hard-Coded Browser Support Claims:** Never hard-code browser versions, support matrices, or availability timelines in `guide.md` prose (e.g., *"X is only supported in Chromium"* or *"until X is supported across major browsers"*). Always render availability dynamically via `BASELINE_STATUS` or `FEATURE_FALLBACKS` anchored to a valid `web-feature-id` (or `tmp-*` entry in `features/pending-web-features.json`). Brief factual notes explaining OS/UA integration mechanisms not captured by BCD (such as iOS/macOS Safari's `@domain #code` SMS format for `autocomplete="one-time-code"`) are allowed.
* **Placement:** Use separate subsections with their own macros if multiple features are used. **DO NOT** use these macros outside the fallback section.

#### Polyfill Guidelines
* **Conditional Loading:** **MANDATORY:** ALWAYS conditionally load polyfills only when native support is missing. Prefer build-integrated conditional loading (code splitting) over CDNs.
* **Performance:** **DO NOT** recommend polyfills with significant performance tradeoffs, or those requiring fetching/parsing CSS. Prefer abstractions/userland solutions instead.
* **Prohibited CDNs:** **DO NOT** recommend polyfills from polyfill.io.

### 6. Build-time macros

| Macro | What it emits |
|---|---|
| `{{ BASELINE_STATUS("feature-id"[, "bcd.key"]) }}` | `"Baseline status for <Feature>: Widely/Newly available..."` or `"Browser support for <Feature>: Limited availability"`. |
| `{{ INCLUDE("path[#section]") }}` | Whole markdown file (frontmatter + leading `# H1` stripped) or one section (its heading dropped). Bare paths resolve from repo root; `./`/`../` resolve relative to the calling file. |
| `{{ FEATURE("feature-id", "section") }}` | Sugar for `INCLUDE("features/<feature-id>.md#<section>")`. |
| `{{ FEATURE_FALLBACKS("feature-id") }}` | `### Fallbacks & browser support for <Feature name>` + `BASELINE_STATUS` + the `#fallbacks` section from `features/<feature-id>.md` (throws `MacroError` if the file or `#fallbacks` section is missing or empty). |
| `{{ FEATURE_ISSUES("feature-id") }}` | `### Issues to be aware of when using <Feature name>` + the `#issues` section. Returns `""` if `#issues` is empty/missing. |
| `{{ GUIDE_REF("guide-slug") }}` | Cross-reference to another guide (`\`guide-slug\` (via \`npx -y modern-web-guidance@latest retrieve "guide-slug"\`)` in `skills-cli`; markdown link in `devsite`). |

* **Errors**: invalid feature/guide ID or missing required argument → `MacroError` (build fails loudly). Missing or empty referenced *content* (file or section) → `MacroError` for `INCLUDE`, `FEATURE`, and `FEATURE_FALLBACKS`, or falls back to `""` for `FEATURE_ISSUES`.
* **Section IDs**: slugified heading text (`### Fallback strategies` → `fallback-strategies`), or an explicit `{#id}` suffix on the heading. Avoid leaving an explicit `{#section-id}` suffix on a heading in `guide.md` when `slugify(heading)` already matches `#section-id`.
* **Recursion**: macros inside transcluded content expand normally. No cycle detection — don't write self-referential includes.

#### Cross-referencing other guides with `GUIDE_REF`

Coding agents mostly discover and batch-retrieve guides upfront (`retrieve "a,b"`) from `search` or `list` results, and rarely follow cross-references after reading a guide.

* **Never rely on `GUIDE_REF` for requirements of the current guide:** Anything needed to implement *this* guide's use case — core rules, shared prerequisites, accessibility requirements, or fallbacks — must be inlined in `guide.md` or transcluded at build time via `INCLUDE`/`FEATURE`.
* **Only reference published guides:** A published guide that uses `GUIDE_REF` on a stub or draft fails validation, because the link would be dead. To plan a link to a guide that isn't written yet, park the full sentence in a marker comment: `{# PENDING_GUIDE_REF: For X, see {{ GUIDE_REF("<slug>") }}. #}`. Validation fails once `<slug>` is published, prompting you to delete the `{# PENDING_GUIDE_REF: ` / ` #}` wrapper so the link goes live. Drafts may reference unpublished guides directly.
* **Use `GUIDE_REF` to point to a separate use case that is out of scope for the current guide:**
  * **Router / orientation hubs** routing to specialized sub-guides (e.g., `passkeys` or `web-components` routing to specific use-case guides).
  * **Disambiguating closely related sibling guides (place upfront before Section 1):** Place disambiguation notes in the introductory overview *before* Section 1 and before any code snippets (e.g., `progress-ring` vs. `spinner` for determinate vs. indeterminate loading, or `hovercard` vs. `interest-triggered-tooltips`). Coding agents anchor heavily on the first code block they see; an upfront fork lets an agent that retrieved the wrong primitive pivot immediately without wasting context.
  * **Referencing an adjacent use case** (e.g., `forms` pointing to `ime-safe-enter-submit` for `Enter`-key submission during IME composition).

### 7. Reusing per-feature content via `features/`

When the same feature-level content (intro, fallback patterns, a11y, gotchas) applies to multiple guides, extract it into `features/<feature-id>.md` and pull it in with the macros above. Rule of thumb: extract if two or more guides cover the same `web-feature-id` and repeat the same advice. Standard section names: `## Fallbacks` (used by `FEATURE_FALLBACKS`), `## Issues` (used by `FEATURE_ISSUES`); add others as needed and pull them with `FEATURE`. Verify your include resolved by inspecting the build output (`out/build/skills-cli/guides/<category>/<id>.md`) after running `pnpm build`.

## Authoring `expectations.md` and `demo.html`

### Writing `expectations.md`

Write a natural-language, bulleted list of checks that must be true if an agent implements `guide.md` correctly (e.g., "The input element is styled with a red border only AFTER a blur event"). Every completed non-stub, non-draft use-case guide must include a non-empty `expectations.md`. SMEs own `expectations.md`: when reviewing or updating an existing file, preserve its wording and edit a bullet only when its meaning must change (the guide doesn't teach it, the task doesn't ask for it, or it rejects an alternative the guide allows), with a stated reason.

* **1:1 with grader tests:** Each bullet becomes a required must-pass test (`test()` block in `grader.ts` for new expectations). Write one bullet per check; do not combine multiple checks into a single bullet. Never reword existing expectations just to match test titles.
* **Plain declarative phrasing:** Write each bullet as a plain statement of what is true of a correct implementation (e.g., "The dialog closes when the Escape key is pressed"). Strip imperative prefixes such as `MANDATORY:`, `OPTIONAL:`, `MUST`, `MUST NOT`, `DO`, and `DO NOT` — those are a `guide.md` convention for steering coding agents, whereas `expectations.md` describes verifiable outcomes.
* **Concrete, deterministic criteria (ask *"How can a grader know this?"*):** Expectations must be verifiable DOM structures, stylesheet rules, or browser behaviors that a grader can check deterministically—statically (HTML DOM, CSSOM, JS AST) or in-browser (computed styles, accessibility tree, runtime behavior)—not factual statements about an API, statements about the guide/browser, code comments, criteria requiring human judgment (e.g., write *"Every `<button>` inside a `<form>` sets an explicit `type` attribute"* rather than referencing *"non-submit buttons"* or *"decorative SVGs"*), or requirements assuming capabilities the target app and task never include (such as server response headers on a static app, or iframes/media that aren't there). Pair any negative check (*"X is not used"*) with a positive check that the target feature is present so an untouched page without the feature does not trivially pass.
* **Exercised in `demo.html`:** Ensure that every expectation written here is actively exercised in the accompanying `demo.html`.
* **Scoped to this use case (no bullet cap):** Cover every observable outcome `guide.md` requires (even when `task.md` does not explicitly prompt for it), and never drop a required outcome just because it is hard to test. There is no cap on bullet count (roughly 5–10 bullets for a focused task is only a scope-smell hint that much longer guides may have scope creep and should be split). Do not copy generic expectations from other guides if they describe behavior that won't appear in an implementation of this guide. Every bullet is a required must-pass test, so only include checks that every correct implementation satisfies—do not include expectations for genuinely optional branches, *"Prefer"* recommendations, or fallbacks for Baseline Widely Available features that the guide says need none. In **discipline guides**, each bullet must name the element or feature it governs (forms, images, overlays, cookies, response headers) so its relevance to a given app can be judged.
* **No external links:** The grader generator cannot resolve them.
* **Avoid over-constraining:** Prefer observable outcomes over prescribing one syntax when several are valid, and name accepted alternatives explicitly (e.g., *"`100%` or a grid-based full-bleed layout"*). Don't assert implementation details that don't affect correctness (e.g., don't require a direct child relationship if a descendant also works). Never upgrade guide *"Prefer"*, *"Optional"*, or conditional recommendations into unconditional must-pass checks, never narrow guide phrasing (e.g., turning *"preceding"* into *"immediately before"*), never split *"A or B"* alternatives into `AND`-ed tests, and avoid asserting arbitrary snippet example values (`0.4s`, `ease-in-out`) or overusing *"such as"* examples that cause tests to overfit. Never hardcode site-specific DOM locators (`#id`, `.class`) in `guide.md`'s frontmatter `description` or in `expectations.md`.
* **Separate native and fallback expectations:** Write core expectations assuming all features in `guide.md` are natively supported. When `guide.md` includes `## Fallback strategies`, write each fallback requirement as a separate plain-English bullet that names the unsupported feature (e.g., *"When `<feature>` is unsupported, ..."*) rather than combining native and fallback checks in the same bullet, so `gd dev` can scope fallback tests with `skipUnless({ unsupported: '<feature>' })` automatically.

### Writing `demo.html`

* **Reference implementation:** `demo.html` should be a clean, working implementation of the use case (and its fallback strategy when the target feature is not Baseline Widely Available). Keep it self-contained with inline scripts and styles when possible.
* **Warning-free execution:** Demos must run without browser console errors or warnings to ensure clean evaluation runs.

## Self-Validation (Before Submitting a PR)

Once you have authored `guide.md`, `demo.html`, and `expectations.md`, invoke the [`project-guide-validation`](../project-guide-validation/SKILL.md) skill with your AI coding assistant to self-validate your work before opening a PR or proceeding to Stage 3. This autonomously exercises the demo in a browser via DevTools MCP, verifies expectation alignment, and checks accessibility compliance.
