@groupby/ai-dev 0.5.14 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/teams/brain-studio/skills/arch-context/SKILL.md +135 -0
- package/teams/brain-studio/skills/draft-plan/SKILL.md +222 -0
- package/teams/brain-studio/skills/draft-pr/SKILL.md +291 -0
- package/teams/brain-studio/skills/git-context/SKILL.md +159 -0
- package/teams/brain-studio/skills/html/SKILL.md +233 -0
- package/teams/brain-studio/skills/javascript/SKILL.md +680 -0
- package/teams/brain-studio/skills/jira-context/SKILL.md +113 -0
- package/teams/brain-studio/skills/jira-spec/SKILL.md +247 -0
- package/teams/brain-studio/skills/pr-review/SKILL.md +310 -0
- package/teams/brain-studio/skills/react/SKILL.md +282 -0
- package/teams/brain-studio/skills/styled-components/SKILL.md +336 -0
- package/teams/brain-studio/skills/tdd-implement/SKILL.md +278 -0
- package/teams/brain-studio/skills/typescript/SKILL.md +491 -0
- package/teams/fhr-orchestration/skills/create-jira/SKILL.md +47 -0
- package/teams/fhr-orchestration/skills/create-jira/TEMPLATE.md +10 -0
- package/teams/fhr-orchestration/skills/create-plan/SKILL.md +48 -0
- package/teams/fhr-orchestration/skills/create-plan/TEMPLATE.md +13 -0
- package/teams/fhr-orchestration/skills/init-harness/SKILL.md +164 -0
- package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.CLAUDE.md +88 -0
- package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.architecture.md +152 -0
- package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.coding-guidelines.md +320 -0
- package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.glossary.md +55 -0
- package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.harness-gap-log.md +59 -0
- package/teams/fhr-orchestration/skills/use-case-writer/SKILL.md +123 -0
- package/teams/fhr-orchestration/skills/use-case-writer/TEMPLATE.md +39 -0
- package/teams/fhr-orchestration/skills/write-spec/SKILL.md +56 -0
- package/teams/fhr-orchestration/skills/write-spec/TEMPLATE.md +29 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-context
|
|
3
|
+
description: Provides standardized procedures for acquiring git context in agent workflows — syncing with origin/main (with conflict handling), extracting the current branch name and Jira ticket key, acquiring committed and working-tree diffs, and classifying change types for arch-doc routing. Outputs five named variables (branch-name, ticket-key, committed-diff, working-tree-status, change-types) consumed by jira-context, arch-context, and downstream review, planning, and PR workflow steps (whether skills or prompts). Auto-apply before any prompt that needs the current branch, ticket key, diff, or sync state.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Context Guide
|
|
7
|
+
|
|
8
|
+
## Relationship to other repository skills
|
|
9
|
+
|
|
10
|
+
This skill has no dependencies on other skills. It is a foundational workflow skill
|
|
11
|
+
consumed by `jira-context`, `arch-context`, and the downstream workflow steps that
|
|
12
|
+
consume this context (review, planning, and PR steps — skills or prompts).
|
|
13
|
+
|
|
14
|
+
- `jira-context` — depends on `<ticket-key>` produced here
|
|
15
|
+
- `arch-context` — depends on `<change-types>` produced here
|
|
16
|
+
|
|
17
|
+
## Mandatory application (agents)
|
|
18
|
+
|
|
19
|
+
Whenever a prompt or workflow stage requires git context:
|
|
20
|
+
|
|
21
|
+
1. **Read this skill file** before running any git commands.
|
|
22
|
+
2. Run the **Working method** steps in order.
|
|
23
|
+
3. Store each output variable for use by the calling prompt.
|
|
24
|
+
|
|
25
|
+
This skill is optional for tasks that do not need branch or diff information
|
|
26
|
+
(e.g. pure documentation lookups or static file edits with no git dependency).
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- Before fetching a Jira ticket (ticket key is extracted from the branch name here).
|
|
31
|
+
- Before performing a code review (the diff is the subject of review).
|
|
32
|
+
- Before creating or describing a PR (branch must be synced; diff needed for summary).
|
|
33
|
+
- Before writing an implementation plan (diff shows scope of existing work).
|
|
34
|
+
- Any time a prompt says "get the current branch and diff" or "sync with main".
|
|
35
|
+
|
|
36
|
+
## When not to use
|
|
37
|
+
|
|
38
|
+
- The user has already provided the diff inline — skip the diff commands; still run the
|
|
39
|
+
sync and branch steps unless the caller explicitly says they are already done.
|
|
40
|
+
- The calling prompt explicitly says to skip git setup (e.g. a review step signals the
|
|
41
|
+
PR step that sync is already done) — honour that instruction.
|
|
42
|
+
|
|
43
|
+
## Truthfulness and claims
|
|
44
|
+
|
|
45
|
+
- Do not assume the branch name format — always extract from `git branch --show-current`.
|
|
46
|
+
- Do not assume the ticket key pattern — use the regex `[A-Z]+-[0-9]+` against the
|
|
47
|
+
branch name; do not guess.
|
|
48
|
+
- Do not invent diff content — always use actual command output.
|
|
49
|
+
- Do not declare "no changes" unless all four diff commands return empty output.
|
|
50
|
+
|
|
51
|
+
## Self-contained operating mode
|
|
52
|
+
|
|
53
|
+
Use the procedures in the **Embedded implementation standard** below as the sole
|
|
54
|
+
authority for git context gathering in this project. Do not substitute in-memory
|
|
55
|
+
context from a previous session or conversation turn — always re-run the commands.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Embedded implementation standard
|
|
60
|
+
|
|
61
|
+
### 1) Sync with origin/main
|
|
62
|
+
|
|
63
|
+
Run in order:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git fetch origin
|
|
67
|
+
git merge origin/main
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Outcomes:
|
|
71
|
+
|
|
72
|
+
| Output | Action |
|
|
73
|
+
|--------|--------|
|
|
74
|
+
| `Already up to date` | Continue immediately. |
|
|
75
|
+
| Merge commit created | Note it; continue. |
|
|
76
|
+
| Merge conflict detected | **Stop. Ask the user to resolve conflicts before continuing.** |
|
|
77
|
+
|
|
78
|
+
### 2) Acquire branch name and ticket key
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git branch --show-current
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Store the exact output as `<branch-name>`.
|
|
85
|
+
- Extract `<ticket-key>` using the pattern `[A-Z]+-[0-9]+` applied to `<branch-name>`.
|
|
86
|
+
- Example: `S4R-10620-my-feature` → `S4R-10620`
|
|
87
|
+
- Example: `BS-1056-some-fix` → `BS-1056`
|
|
88
|
+
- If no key matches, set `<ticket-key>` to `none` and note it prominently — the caller
|
|
89
|
+
decides whether a missing key is a hard stop.
|
|
90
|
+
|
|
91
|
+
### 3) Acquire committed diff
|
|
92
|
+
|
|
93
|
+
Primary commands:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git --no-pager diff --stat origin/main...HEAD
|
|
97
|
+
git --no-pager diff origin/main...HEAD
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If both return empty output (new branch, no commits ahead of main, or detached HEAD), fall back to:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git --no-pager diff --stat HEAD
|
|
104
|
+
git --no-pager diff HEAD
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- If all four commands return empty, report: **"No committed changes detected."** and stop
|
|
108
|
+
unless the caller explicitly continues.
|
|
109
|
+
- Store the full diff output as `<committed-diff>`.
|
|
110
|
+
|
|
111
|
+
### 4) Acquire working-tree state
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git status --short
|
|
115
|
+
git --no-pager diff --stat
|
|
116
|
+
git --no-pager diff
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- If `git status --short` is empty, there are no uncommitted changes — record this.
|
|
120
|
+
- If staged or unstaged changes exist, store them as `<working-tree-status>` and include
|
|
121
|
+
them in any summary, PR description, or review the caller produces.
|
|
122
|
+
|
|
123
|
+
### 5) Classify change types
|
|
124
|
+
|
|
125
|
+
Inspect `<committed-diff>` (and `<working-tree-status>` if present) and identify which
|
|
126
|
+
categories apply. Store as `<change-types>` for use by the `arch-context` skill.
|
|
127
|
+
|
|
128
|
+
| Category | Signal |
|
|
129
|
+
|----------|--------|
|
|
130
|
+
| Component / hook (`.tsx`) | Files ending in `.tsx` outside `.styles.tsx` |
|
|
131
|
+
| Styling (`.styles.ts` / `.styles.tsx`) | Files ending in `.styles.ts` or `.styles.tsx` |
|
|
132
|
+
| API / data fetching | `useQuery`, `useMutation`, RTK Query slice files, `api/` paths |
|
|
133
|
+
| State management | Redux slices, selectors, `store/` paths |
|
|
134
|
+
| Test changes | Files under `test/` |
|
|
135
|
+
| Config / build | `webpack`, `tsconfig`, `.env`, `helm/`, `Dockerfile`, `package.json` |
|
|
136
|
+
| Auth / permissions | `auth/`, token, role, permission references |
|
|
137
|
+
| Feature flags | `feature-flag`, `launch-darkly` references |
|
|
138
|
+
| i18n | `localization/`, `.json` translation files |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Working method (apply in this order)
|
|
143
|
+
|
|
144
|
+
1. **Sync** — Run `git fetch origin` and `git merge origin/main`; stop on conflict.
|
|
145
|
+
2. **Identify** — Run `git branch --show-current`; extract and store `<branch-name>` and
|
|
146
|
+
`<ticket-key>`.
|
|
147
|
+
3. **Diff** — Run committed diff commands; fall back as needed; store `<committed-diff>`.
|
|
148
|
+
4. **Status** — Run working-tree commands; store `<working-tree-status>`.
|
|
149
|
+
5. **Classify** — Derive `<change-types>` from the diff content.
|
|
150
|
+
6. **Confirm** — Verify all five variables are set before returning to the caller.
|
|
151
|
+
|
|
152
|
+
## Quality bar before final answer
|
|
153
|
+
|
|
154
|
+
- `<branch-name>` equals the exact output of `git branch --show-current`.
|
|
155
|
+
- `<ticket-key>` is a extracted key matching `[A-Z]+-[0-9]+`, or explicitly `none`.
|
|
156
|
+
- `<committed-diff>` is non-empty, or "no committed changes detected" is reported.
|
|
157
|
+
- Merge conflicts (if any) caused an immediate stop — no further steps executed.
|
|
158
|
+
- `<change-types>` is derived from the actual diff, not from memory or assumption.
|
|
159
|
+
- No output variable is invented or guessed.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: html
|
|
3
|
+
description: >-
|
|
4
|
+
Provides self-contained modern HTML authoring rules — document baseline (`<!doctype html>`, `lang`, `charset`, viewport, `title`), semantic structure (`header`/`nav`/`main`/`aside`/`footer`/`article`/`section`/`figure`), heading and landmark hierarchy, interactive element discipline (`button` for actions, `a` for navigation), accessible forms (explicit `<label>`, `fieldset`/`legend`, real input types — never placeholder-as-label), accessibility defaults (WCAG 2.2: keyboard operability, visible focus, meaningful link text, `alt` strategy, accessible status updates), tables/media (data tables only, captions/transcripts), metadata/SEO fundamentals, validation via Nu HTML Checker, and the project's `js-` / `ts-` `id` prefix convention for script-targeted nodes — without relying on fetching external docs. Project rule: **markup, styles, and scripts live in separate files** (`.html`, `.css`, `.js`/`.mjs`/`.ts`). **Project rule (script placement):** `type="module"` scripts go in `<head>` (implicitly deferred, early download, compatible with `<link rel="modulepreload">`); non-module `<script src="…">` go at the **end of `<body>`** or use explicit `defer` in `<head>`; `async` only for truly independent scripts (analytics, widgets) with no DOM dependency or ordering requirement. **Hard bans:** do not put authored CSS in `<style>` blocks or bulk inline `style=""`; do not put application logic in inline `<script>` bodies; do not use non-interactive elements (`div`, `span`) as controls; do not use placeholder text as a label replacement; do not use tables for page layout. Auto-apply whenever working with HTML files (`.html`) or HTML snippets, including creating, editing, reviewing, refactoring, or explaining markup.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HTML Best Practices Guide
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
Answer HTML implementation questions using **embedded rules below** as the default standard. Treat external URLs as **optional citations**, not prerequisites.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
- Writing or reviewing HTML, accessible markup, semantic structure, forms, or document metadata
|
|
14
|
+
- HTML audits / reviews against semantic + accessibility (WCAG 2.2) + SEO fundamentals
|
|
15
|
+
- Choosing between `button` vs `a`, `section` vs `article`, `figure` vs raw `img`, native input types, ARIA only when needed
|
|
16
|
+
- Wiring **`id` hooks** that scripts will query (`js-…` / `ts-…` prefix convention)
|
|
17
|
+
- HTML validation strategy (Nu HTML Checker) and accessibility checks (automated + manual keyboard pass)
|
|
18
|
+
|
|
19
|
+
## When not to use
|
|
20
|
+
- Primary request is **CSS-only** styling strategy (use the **styled-components** skill)
|
|
21
|
+
- Primary request is **JavaScript-only** logic (use the **javascript** / **typescript** skill)
|
|
22
|
+
- Framework-specific component logic not centered on markup
|
|
23
|
+
- Backend/API design unrelated to markup
|
|
24
|
+
|
|
25
|
+
## Truthfulness and claims
|
|
26
|
+
- Do not invent browser support percentages, survey stats, or traffic numbers
|
|
27
|
+
- Do not claim there is one official global ranking of HTML guides — distinguish **authority** (standards) from **popularity** (usage/traffic)
|
|
28
|
+
- Never invent statistics, versions, or survey results
|
|
29
|
+
- Label third-party traffic metrics as **estimates**
|
|
30
|
+
- For uncertain edge behavior (validator quirks, ARIA pattern correctness, screen-reader output), prefer **verify with a minimal repro + Nu HTML Checker + screen-reader pass** over guessing
|
|
31
|
+
|
|
32
|
+
## Self-contained operating mode
|
|
33
|
+
- **Default:** follow **Embedded implementation standard** in this file for all recommendations
|
|
34
|
+
- **Do not** rely on parsing optional reference URLs to decide routine markup, accessibility patterns, or document metadata
|
|
35
|
+
- Use external links **only** when:
|
|
36
|
+
- the user asks for citations or "official docs"
|
|
37
|
+
- behavior is ambiguous/edge-case and needs verification
|
|
38
|
+
- standards-version confirmation is required (WHATWG HTML, WCAG 2.2)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Embedded implementation standard
|
|
43
|
+
|
|
44
|
+
### 0) File separation (required)
|
|
45
|
+
- Treat **`.html` as markup-only** for authored pages: structure, text, media, and **links** to other assets — not a container for large inline styles or application scripts.
|
|
46
|
+
- **Styles** live in one or more **`.css` files**; reference them from the document head with `<link rel="stylesheet" href="…">` (adjust paths if a build step emits different URLs).
|
|
47
|
+
- **Scripts** live in **`.js` or `.mjs` files** (or `.ts` compiled to `.js`); reference them with `<script src="…"></script>` (or `<script type="module" src="…"></script>` when the script uses ES module syntax). Do **not** embed application logic in inline `<script>…</script>` bodies.
|
|
48
|
+
- **Inline `style=""` attributes** are not the home for authored layout or theme; use classes and external stylesheets (see the **styled-components** skill). Reserve inline styles only for **tiny, dynamic** values when no class-based token suffices (rare).
|
|
49
|
+
- **Exception:** environments that **cannot** load external assets (some email templates, locked sandboxes, single-file demos) may inline; default for normal web pages is always **three files minimum** when the page needs CSS and JS.
|
|
50
|
+
|
|
51
|
+
### 0.1) Script placement (required, project rule)
|
|
52
|
+
|
|
53
|
+
Script type determines placement. Apply the rule for each script independently; never scatter scripts mid-document.
|
|
54
|
+
|
|
55
|
+
| Script type | Placement | Notes |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `<script type="module" src="…">` | **`<head>`** | Implicitly deferred — never render-blocking; early placement enables `<link rel="modulepreload">` for sub-module preloading. |
|
|
58
|
+
| `<script src="…">` (non-module, no `defer`) | **End of `<body>`, immediately before `</body>`** | Parser has already built the DOM by the time it executes; `defer` is unavailable or unsupported. |
|
|
59
|
+
| `<script src="…" defer>` | **`<head>`** (or end of `<body>`) | Both are equivalent; prefer `<head>` with `defer` when early download matters; end-of-body when simplicity is preferred and early download is irrelevant. |
|
|
60
|
+
| `<script src="…" async>` | `<head>` | Use **only** for truly independent scripts (analytics, chat widgets) that have **no** DOM dependency and **no** ordering requirement. Never use `async` for application scripts. |
|
|
61
|
+
| Inline `<script>` — application logic | **Banned** | See §0. |
|
|
62
|
+
|
|
63
|
+
Additional rules:
|
|
64
|
+
- Do **not** scatter scripts mid-document regardless of type.
|
|
65
|
+
- Order module scripts within `<head>` in **dependency order** (polyfills / shared utilities first, app entry last); add `<link rel="modulepreload" href="…">` for critical sub-modules when load performance matters.
|
|
66
|
+
- Non-module end-of-body scripts are also ordered by dependency: helpers/polyfills first, app entry last.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<!-- good: module scripts in <head> (deferred), legacy polyfill at end of body -->
|
|
70
|
+
<!doctype html>
|
|
71
|
+
<html lang="en">
|
|
72
|
+
<head>
|
|
73
|
+
<meta charset="utf-8">
|
|
74
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
75
|
+
<title>Example</title>
|
|
76
|
+
<link rel="stylesheet" href="./styles.css">
|
|
77
|
+
<link rel="modulepreload" href="./app.js">
|
|
78
|
+
<script type="module" src="./app.js"></script>
|
|
79
|
+
</head>
|
|
80
|
+
<body>
|
|
81
|
+
<main id="ts-root">…</main>
|
|
82
|
+
|
|
83
|
+
<!-- non-module polyfill that has no defer support goes at end of body -->
|
|
84
|
+
<script src="./vendor/legacy-polyfill.js"></script>
|
|
85
|
+
</body>
|
|
86
|
+
</html>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<!-- bad: type="module" script at end of body — wastes implicit defer advantage, prevents modulepreload -->
|
|
91
|
+
<body>
|
|
92
|
+
<main>…</main>
|
|
93
|
+
<script type="module" src="./app.js"></script>
|
|
94
|
+
</body>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<!-- bad: non-module script mid-document (render-blocking, unpredictable DOM state) -->
|
|
99
|
+
<body>
|
|
100
|
+
<header>…</header>
|
|
101
|
+
<script src="./header-thing.js"></script>
|
|
102
|
+
<main>…</main>
|
|
103
|
+
</body>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 1) Document baseline (required)
|
|
107
|
+
- Use `<!doctype html>`
|
|
108
|
+
- Set `<html lang="...">` to the document language
|
|
109
|
+
- Include `<meta charset="utf-8">`
|
|
110
|
+
- Include `<meta name="viewport" content="width=device-width, initial-scale=1">`
|
|
111
|
+
- Include a unique, descriptive `<title>`
|
|
112
|
+
|
|
113
|
+
### 2) Semantic structure (required)
|
|
114
|
+
- Prefer semantic elements over generic containers:
|
|
115
|
+
- layout/regions: `header`, `nav`, `main`, `aside`, `footer`
|
|
116
|
+
- content: `article`, `section`, `figure`, `figcaption`
|
|
117
|
+
- text semantics: `strong`, `em`, `blockquote`, `cite`, `time`
|
|
118
|
+
- Use `section` only when it has a meaningful heading or grouping purpose
|
|
119
|
+
- Keep DOM structure shallow and readable; avoid unnecessary wrapper nesting
|
|
120
|
+
|
|
121
|
+
### 3) Heading and landmark rules
|
|
122
|
+
- Use a logical heading hierarchy (`h1` → `h2` → `h3`...)
|
|
123
|
+
- Do not skip heading levels without reason
|
|
124
|
+
- Ensure one clear page-level heading strategy
|
|
125
|
+
- Ensure primary content is inside `main`
|
|
126
|
+
|
|
127
|
+
### 4) Interactive element rules
|
|
128
|
+
- Use **`button`** for actions, **`a`** for navigation
|
|
129
|
+
- Never use non-interactive elements (`div`, `span`) as controls unless absolutely necessary
|
|
130
|
+
- If custom controls are required, they must support **keyboard, focus, role, and state** semantics (consult ARIA Authoring Practices Guide before inventing one)
|
|
131
|
+
|
|
132
|
+
### 5) Forms (required for form UIs)
|
|
133
|
+
- Every form control must have an associated label (`<label for>` or wrapped label)
|
|
134
|
+
- Group related options with `fieldset` and `legend`
|
|
135
|
+
- Use appropriate input types (`email`, `tel`, `url`, `date`, `number`, etc.)
|
|
136
|
+
- Use `name` attributes for successful form submission mapping
|
|
137
|
+
- **Do not use placeholder text as a label replacement**
|
|
138
|
+
- Required/error/help text must be visible and understandable in **text, not color alone**
|
|
139
|
+
|
|
140
|
+
### 6) Accessibility defaults (required)
|
|
141
|
+
- **Keyboard operability** for all interactive controls
|
|
142
|
+
- **Visible focus indicator** must remain present (do not remove `:focus-visible` styling without a comparable replacement — see the **styled-components** skill)
|
|
143
|
+
- **Meaningful link text** (avoid vague labels such as "click here", "read more")
|
|
144
|
+
- **Informative images** need meaningful `alt`; **decorative images** should use empty `alt=""`
|
|
145
|
+
- Announce **status / error updates** in an accessible way when forms are dynamic (`aria-live`, `role="status"`, `role="alert"` as appropriate)
|
|
146
|
+
|
|
147
|
+
### 7) Tables and media
|
|
148
|
+
- Use **tables only for tabular data**, not page layout
|
|
149
|
+
- For data tables, include header cells (`th`), `scope`, and associations where needed (`headers` / `id`)
|
|
150
|
+
- Provide **captions / transcripts** for audio/video media when relevant to content meaning
|
|
151
|
+
- Pair `<img>` with explicit `width`/`height` (or `aspect-ratio` in CSS) to avoid layout shift
|
|
152
|
+
|
|
153
|
+
### 8) Metadata and discoverability
|
|
154
|
+
- Add accurate metadata (`title`, optional meta description)
|
|
155
|
+
- Use **canonical URLs** where duplicate URL variants exist
|
|
156
|
+
- Keep URL and heading structure descriptive and human-readable
|
|
157
|
+
- Avoid spam tactics (keyword stuffing, hidden text, manipulative markup)
|
|
158
|
+
|
|
159
|
+
### 9) Validation and quality gate
|
|
160
|
+
- Validate HTML with **Nu HTML Checker** before finalizing significant markup work
|
|
161
|
+
- Run accessibility checks: **automated** (axe, Lighthouse) **plus manual keyboard pass**
|
|
162
|
+
- Treat validator / a11y issues as **must-fix** unless intentionally documented
|
|
163
|
+
|
|
164
|
+
### 10) Script-targeted `id` names (project convention)
|
|
165
|
+
- Give any **`id` that scripts select or update** a leading **`js-`** or **`ts-`** prefix so reviewers can see script ownership without opening every module.
|
|
166
|
+
- Use **`js-`** when the consuming code lives in **`.js` / `.mjs`** (or the project treats the hook as plain JavaScript).
|
|
167
|
+
- Use **`ts-`** when the consuming code lives in **`.ts` / `.tsx`** (or the build is TypeScript-first for that feature).
|
|
168
|
+
- After the prefix, keep the token **`kebab-case`** and descriptive (e.g. `js-todo-list`, `ts-chart-root`); **`id` uniqueness** on the document still applies.
|
|
169
|
+
- Elements referenced **only** by declarative HTML (for example **`for`/`id`**, URL fragments, **`aria-labelledby`**) **without** script queries may omit the prefix; if the same node is **both** scripted and referenced that way, **one** `id` with the script prefix keeps markup and scripts aligned.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Working method
|
|
174
|
+
1. Identify user intent: **implementation**, **learning**, or **audit**
|
|
175
|
+
2. Start with **semantic native HTML** choices — pick `button` / `a` / `nav` / `main` etc. before reaching for `div` + ARIA
|
|
176
|
+
3. Apply **accessibility defaults** (section 6):
|
|
177
|
+
- proper heading structure and landmarks
|
|
178
|
+
- explicit form labels
|
|
179
|
+
- keyboard operability and visible focus
|
|
180
|
+
- meaningful link text
|
|
181
|
+
- image `alt` strategy
|
|
182
|
+
4. Add **metadata and SEO basics** where relevant (section 8)
|
|
183
|
+
5. Enforce **file separation** (section 0) and **document baseline** (section 1): linked `.css` / `.js`, no inline app CSS/JS unless the delivery context forbids externals
|
|
184
|
+
6. When scripts query nodes by **`id`**, apply **section 10** (`js-` / `ts-` prefix convention)
|
|
185
|
+
7. Recommend **validation** (section 9) via Nu HTML Checker + automated and manual a11y checks
|
|
186
|
+
8. Provide concise recommendations; include external links only when asked or needed
|
|
187
|
+
|
|
188
|
+
## Response template
|
|
189
|
+
1. Summary decision (why this approach)
|
|
190
|
+
2. Best-practice recommendations
|
|
191
|
+
3. Common mistakes to avoid
|
|
192
|
+
4. Verification checklist
|
|
193
|
+
5. Sources (optional unless requested)
|
|
194
|
+
|
|
195
|
+
## Quality bar before final answer
|
|
196
|
+
- Guidance cites **embedded sections** above, not unnamed blogs
|
|
197
|
+
- Recommendations are **semantic-first** and **accessibility-first** (sections 2, 3, 4, 6)
|
|
198
|
+
- **Document baseline** is present (`<!doctype html>`, `lang`, `charset`, viewport, `title`) — section 1
|
|
199
|
+
- **Markup, CSS, and JS are in separate files** when the page uses authored styles or scripts (section 0)
|
|
200
|
+
- **Script placement follows the type-based rule (section 0.1):** `type="module"` scripts are in `<head>`; non-module scripts without `defer` are at the end of `<body>`; `async` is used only for truly independent scripts; no scripts are scattered mid-document; inline application logic remains banned
|
|
201
|
+
- Script-selected `id`s follow **section 10** (`js-` / `ts-` prefix) when external scripts wire the DOM
|
|
202
|
+
- Headings follow a **logical hierarchy** (section 3); primary content lives in `main`
|
|
203
|
+
- Form controls are **labeled**, with `fieldset`/`legend` where relevant; **placeholder is not used as a label replacement** (section 5)
|
|
204
|
+
- Tables are used **only for tabular data** with proper `th` / `scope` (section 7)
|
|
205
|
+
- Accessibility-sensitive choices mention **keyboard, focus, contrast, and `alt` strategy** explicitly when relevant (section 6)
|
|
206
|
+
- Claims are either sourced or clearly labeled as opinion/estimate
|
|
207
|
+
- Includes at least one **validation step** (`validator.w3.org/nu`) — section 9
|
|
208
|
+
- No fabricated statistics; uncertain edges flagged for manual verification
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Source hierarchy (for conflicts only)
|
|
213
|
+
1. **Normative standards:** WHATWG HTML, W3C WCAG 2.2
|
|
214
|
+
2. **Practical implementation docs:** MDN, web.dev, W3C WAI tutorials, WCAG quickref, ARIA Authoring Practices Guide
|
|
215
|
+
3. **Adoption context:** Stack Overflow Developer Survey
|
|
216
|
+
4. **Search guidance:** Google SEO Starter Guide
|
|
217
|
+
|
|
218
|
+
## Optional references (citations / verification only)
|
|
219
|
+
- https://html.spec.whatwg.org/multipage/
|
|
220
|
+
- https://developer.mozilla.org/en-US/docs/Web/HTML
|
|
221
|
+
- https://www.w3.org/TR/WCAG22/
|
|
222
|
+
- https://www.w3.org/WAI/WCAG22/quickref/
|
|
223
|
+
- https://www.w3.org/WAI/tutorials/
|
|
224
|
+
- https://www.w3.org/WAI/ARIA/apg/
|
|
225
|
+
- https://web.dev/learn/html/welcome
|
|
226
|
+
- https://developers.google.com/search/docs/fundamentals/seo-starter-guide
|
|
227
|
+
- https://survey.stackoverflow.co/2024/technology/#most-popular-technologies-language-prof
|
|
228
|
+
- https://validator.w3.org/nu/
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Project automation
|
|
233
|
+
- If the project includes a `.cursor/hooks/html-guard.mjs` hook, it may run `postToolUse` when writing or reviewing `.html` files and may inject follow-up context for baseline HTML issues.
|