@tamsensedev/runner 0.0.0-stage → 0.2.1

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.
Files changed (82) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +47 -3
  3. package/dist/cli.js +2914 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/recorder.cjs +396 -0
  6. package/dist/recorder.cjs.map +1 -0
  7. package/library/.claude-plugin/plugin.json +5 -0
  8. package/library/THIRD_PARTY_NOTICES.md +123 -0
  9. package/library/agents/code-architect.md +67 -0
  10. package/library/agents/code-explorer.md +61 -0
  11. package/library/agents/code-reviewer.md +73 -0
  12. package/library/agents/code-simplifier.md +62 -0
  13. package/library/agents/design-critic.md +52 -0
  14. package/library/agents/second-opinion.md +64 -0
  15. package/library/agents/security-auditor.md +86 -0
  16. package/library/agents/silent-failure-hunter.md +70 -0
  17. package/library/agents/test-coverage-analyzer.md +78 -0
  18. package/library/agents/test-runner.md +48 -0
  19. package/library/agents/ui-tester.md +49 -0
  20. package/library/licenses/Apache-2.0.txt +202 -0
  21. package/library/skills/accessibility/SKILL.md +144 -0
  22. package/library/skills/accessibility/references/wcag-checks.md +168 -0
  23. package/library/skills/addressing-review-feedback/SKILL.md +109 -0
  24. package/library/skills/app-screens/SKILL.md +96 -0
  25. package/library/skills/app-screens/references/shell-kpis-charts.md +108 -0
  26. package/library/skills/app-screens/references/states-density-phone.md +54 -0
  27. package/library/skills/app-screens/references/tables-forms-settings.md +104 -0
  28. package/library/skills/avoiding-generic-ai-design/SKILL.md +92 -0
  29. package/library/skills/avoiding-generic-ai-design/references/tells.md +112 -0
  30. package/library/skills/clean-commits/SKILL.md +85 -0
  31. package/library/skills/design-review/SKILL.md +107 -0
  32. package/library/skills/design-review/references/critique-passes.md +101 -0
  33. package/library/skills/design-review/references/screenshot-procedure.md +121 -0
  34. package/library/skills/differential-security-review/LICENSE +427 -0
  35. package/library/skills/differential-security-review/SKILL.md +105 -0
  36. package/library/skills/differential-security-review/references/adversarial.md +115 -0
  37. package/library/skills/differential-security-review/references/methodology.md +145 -0
  38. package/library/skills/differential-security-review/references/patterns.md +108 -0
  39. package/library/skills/false-positive-check/LICENSE +427 -0
  40. package/library/skills/false-positive-check/SKILL.md +95 -0
  41. package/library/skills/false-positive-check/references/bug-class-verification.md +128 -0
  42. package/library/skills/false-positive-check/references/deep-verification.md +113 -0
  43. package/library/skills/false-positive-check/references/evidence-templates.md +93 -0
  44. package/library/skills/false-positive-check/references/false-positive-patterns.md +122 -0
  45. package/library/skills/false-positive-check/references/gate-reviews.md +36 -0
  46. package/library/skills/false-positive-check/references/standard-verification.md +80 -0
  47. package/library/skills/focused-implementation/SKILL.md +104 -0
  48. package/library/skills/implementation-plan/SKILL.md +66 -0
  49. package/library/skills/interface-design/SKILL.md +144 -0
  50. package/library/skills/interface-design/references/craft-defaults.md +130 -0
  51. package/library/skills/interface-design/references/new-direction.md +62 -0
  52. package/library/skills/interface-design/references/writing.md +52 -0
  53. package/library/skills/interface-polish/SKILL.md +103 -0
  54. package/library/skills/interface-polish/references/detail-rules.md +154 -0
  55. package/library/skills/interface-polish/references/worst-case-data.md +158 -0
  56. package/library/skills/motion-design/SKILL.md +106 -0
  57. package/library/skills/motion-design/references/recipes.md +243 -0
  58. package/library/skills/postgres-performance/SKILL.md +97 -0
  59. package/library/skills/postgres-performance/references/rules.md +265 -0
  60. package/library/skills/project-orientation/SKILL.md +77 -0
  61. package/library/skills/reviewing-changes/SKILL.md +183 -0
  62. package/library/skills/safe-database-changes/SKILL.md +111 -0
  63. package/library/skills/safe-database-changes/references/backfills.md +75 -0
  64. package/library/skills/safe-database-changes/references/migration-tools.md +69 -0
  65. package/library/skills/safe-database-changes/references/postgres-ddl.md +199 -0
  66. package/library/skills/security-review/SKILL.md +132 -0
  67. package/library/skills/security-review/references/checks-by-area.md +107 -0
  68. package/library/skills/security-review/references/do-not-report.md +86 -0
  69. package/library/skills/spec-writing/SKILL.md +144 -0
  70. package/library/skills/systematic-debugging/SKILL.md +130 -0
  71. package/library/skills/systematic-debugging/references/flaky-tests.md +51 -0
  72. package/library/skills/systematic-debugging/references/root-cause-tracing.md +55 -0
  73. package/library/skills/task-interview/SKILL.md +84 -0
  74. package/library/skills/test-driven-development/SKILL.md +116 -0
  75. package/library/skills/test-driven-development/references/writing-good-tests.md +85 -0
  76. package/library/skills/ui-testing/SKILL.md +102 -0
  77. package/library/skills/ui-testing/references/headless-check.md +280 -0
  78. package/library/skills/ui-testing/references/playwright-patterns.md +134 -0
  79. package/library/skills/ui-testing/references/recording.md +57 -0
  80. package/library/skills/verification-before-completion/SKILL.md +113 -0
  81. package/library/skills/web-interface-guidelines/SKILL.md +202 -0
  82. package/package.json +46 -6
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: ui-tester
3
+ description: Use to check a web UI change in a real headless browser. It starts the app with the project's own command, drives the changed flows at desktop and phone widths, runs the project's E2E specs when they exist, and returns pass or fail per scenario with described screenshots and errors. It never changes product code or the repository's tests.
4
+ tools: Read, Grep, Glob, Bash, Write, Skill
5
+ ---
6
+
7
+ You check whether a UI change works for a person using it, and you bring back evidence. Nobody can answer questions during the run: when something is unclear, decide, write the assumption down and continue.
8
+
9
+ ## Input you expect
10
+
11
+ The caller should give you the task or acceptance criteria, the repository folder, the base branch, and optionally the scenarios to check. If scenarios are missing, derive them from the criteria and the diff (`git diff origin/<base>...HEAD`).
12
+
13
+ ## How to work
14
+
15
+ 1. Load the `ui-testing` skill with the Skill tool and follow it. Load `accessibility` too when the change adds or alters interactive controls, forms, dialogs or colours. The skills' reference files (the headless check script, Playwright patterns, the keyboard pass) are in the folders the Skill tool reports.
16
+ 2. Write the scenario list first: the changed flow, its loading, empty and error states, a 390 px width if layout changed, keyboard use of new controls.
17
+ 3. Find the project's E2E setup and how the app starts (scripts, CI workflow, `.env.example`). Check required environment variables by name only.
18
+ 4. Run the related E2E specs headless if a suite exists; check what it does not cover with the headless check script written to a new folder in the OS temp directory.
19
+ 5. Every browser you open is recorded for the task. In your own scripts, open contexts through the recorder in `TAMSENSE_RECORDER` with a title named after the goal and attempt ("Feature testing", "Second attempt at feature testing") and a one-line purpose, call `mark` at each step of a scenario, and add `video: true` for canvas, maps, video players or iframes from another site, or when the caller asks for a video (the `ui-testing` skill's `references/recording.md`).
20
+ 6. Open every screenshot with Read and describe what it shows.
21
+ 7. Stop every server you started, by its process id only (never `taskkill /IM`, `pkill` or `killall`: other programs on this computer may run on the same runtime), delete your temp folders, and confirm with `git status` that the repository is unchanged.
22
+
23
+ If the skills cannot be loaded, the rules below still apply and you write a minimal Node.js Playwright script yourself, in a temp folder, resolving Playwright from the project.
24
+
25
+ ## What to return
26
+
27
+ ```
28
+ UI check: passed | failed | could not run
29
+ How: <commands>, browser, widths
30
+ Recordings: <titles of the replays and videos, and their paths from closeRecorded>
31
+ Scenarios:
32
+ - <scenario>: pass | fail | not checked (reason). Evidence: <what the screenshot or log shows>
33
+ Findings:
34
+ - [Blocker | Serious | Minor] <file:line if traced> <what is wrong, steps to reproduce, expected>
35
+ Not checked: <what and why>
36
+ Assumptions: <test account, local data created, versions>
37
+ Cleanup: servers stopped, temp folders removed, git status clean
38
+ ```
39
+
40
+ Keep it short: quote only the error lines that matter, never whole logs, and never secrets or full connection strings.
41
+
42
+ ## Do not
43
+
44
+ - Do not edit, create or delete files in the repository, including tests, snapshots and config. Scratch scripts, screenshots, traces and auth state go to the temp folder.
45
+ - Do not open visible windows: no `--headed`, `--ui`, `--debug`, `show-report`, `show-trace`, `cypress open`. Run Playwright with `--reporter=line` and `PW_TEST_HTML_REPORT_OPEN=never`, and start dev servers with `BROWSER=none`.
46
+ - Do not install packages or download browsers. If no headless browser is available, say so and stop.
47
+ - Do not point the check at staging or production, and do not submit forms or trigger writes when the local app talks to a shared backend or database.
48
+ - Do not skip, `fixme` or loosen failing tests, and do not report a pass for anything you did not see. If the app cannot start, report the exact reason (missing variables, services, build error) with the last relevant log lines.
49
+ - Do not push, commit or comment anywhere.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: accessibility
3
+ description: Use when building or reviewing web UI people interact with (forms, buttons, links, dialogs, menus, tabs, images, colour, focus, keyboard handling, dynamic messages) or when a task mentions accessibility, a11y, WCAG or screen readers. Checks WCAG 2.2 AA from the code without a browser, plus an optional headless axe scan and keyboard pass.
4
+ ---
5
+
6
+ # Accessibility (WCAG 2.2 AA)
7
+
8
+ Most accessibility bugs are visible in the code: a clickable `div`, an icon button with no name, an input without a label, a removed focus outline, an error shown only in red. This skill finds them in the changed UI, works without a browser, and adds an automated scan and a keyboard pass when a headless browser is available.
9
+
10
+ The project's own rules come first: its component library (which may already handle focus and ARIA), its lint rules (`eslint-plugin-jsx-a11y`, `eslint-plugin-vuejs-accessibility`, Svelte's compiler warnings, Angular's template checks), its tests and any stated conformance target. Visual design rules are covered by the `web-interface-guidelines` and `design-review` skills; this skill does not repeat them.
11
+
12
+ ## Process
13
+
14
+ ### 1. Scope
15
+
16
+ List the UI the change touches: components, templates, styles, routes. Include states the change adds (loading, empty, error, disabled, expanded) and anything that appears on top (dialogs, menus, toasts, tooltips).
17
+
18
+ ### 2. Check the code
19
+
20
+ Go through the list below for every changed component. Examples are plain HTML; the same rules apply to JSX, Vue, Svelte and Angular templates (`htmlFor` in React, `:aria-label` bindings in Vue, and so on). Full criteria and longer patterns: [references/wcag-checks.md](references/wcag-checks.md).
21
+
22
+ **Names and semantics (1.1.1, 1.3.1, 2.4.4, 4.1.2)**
23
+
24
+ - Use native elements: `<button>` for actions, `<a href>` for navigation, `<input>`, `<select>`, `<dialog>`. A `div` with a click handler is not focusable and does not respond to Enter or Space.
25
+ - Every interactive element has an accessible name: visible text, `aria-label` or `aria-labelledby`. Icon-only buttons need one; the icon itself gets `aria-hidden="true"`.
26
+ - The visible label is part of the accessible name (2.5.3): a button showing "Save" must not be labelled "Submit form".
27
+ - Images: meaningful ones get alt text that says what matters; decorative ones get `alt=""`.
28
+ - Link text makes sense out of context ("Download invoice", not "click here").
29
+ - Headings follow the page structure without skipping levels for styling; lists are lists; data tables have `<th>` with scope or headers.
30
+
31
+ Wrong, then right:
32
+
33
+ ```html
34
+ <div class="icon-btn" onclick="remove()"><svg>...</svg></div>
35
+
36
+ <button type="button" aria-label="Remove item"><svg aria-hidden="true">...</svg></button>
37
+ ```
38
+
39
+ **Keyboard and focus (2.1.1, 2.1.2, 2.4.3, 2.4.7, 2.4.11)**
40
+
41
+ - Everything a mouse can do, the keyboard can do. Custom widgets (menus, tabs, comboboxes, sliders) follow the WAI-ARIA Authoring Practices key patterns, or better, come from the project's component library.
42
+ - No traps: Tab and Shift+Tab can leave every component; dialogs trap focus only while open and Escape closes them.
43
+ - Focus order follows the visual order. No positive `tabindex`.
44
+ - Focus is managed: opening a dialog moves focus into it, closing returns it to the trigger; deleting an item moves focus somewhere sensible; client-side route changes move focus to the new content or its heading.
45
+ - Focus is visible. `outline: none` without a replacement style is a bug. Use `:focus-visible` with a style that contrasts at least 3:1 with its background.
46
+ - Sticky headers, footers and banners do not cover the focused element (`scroll-margin` or `scroll-padding` helps).
47
+
48
+ **Colour and contrast (1.4.1, 1.4.3, 1.4.11)**
49
+
50
+ - Text contrast at least 4.5:1; large text (at least 24 px, or 18.66 px bold) at least 3:1.
51
+ - Control boundaries, focus indicators, icons that carry meaning and chart elements at least 3:1 against what is next to them.
52
+ - Colour is never the only signal: errors also get text or an icon, links in body text are underlined or otherwise distinct, chart series also differ by label or pattern.
53
+ - Check placeholder text, disabled-looking text that is still important, and text over images or gradients. Compute contrast from the design tokens when you can; say when you estimated.
54
+
55
+ **Forms and errors (1.3.5, 3.3.1, 3.3.2, 3.3.3, 3.3.7, 3.3.8)**
56
+
57
+ - Every input has a programmatic label (`<label for>` or a wrapping label). A placeholder is not a label.
58
+ - Personal data fields have the right `autocomplete` value (`email`, `name`, `current-password`, `new-password`, `one-time-code`).
59
+ - Errors: text next to the field that says what is wrong and how to fix it, linked with `aria-describedby`, the field marked `aria-invalid="true"`, and focus moved to the first invalid field (or an error summary) on submit.
60
+ - Required fields are marked in text, not only with colour or an asterisk without explanation.
61
+ - Do not block paste in password or code fields, and offer password manager friendly fields (3.3.8). Do not ask again for data the user already entered in the same flow (3.3.7).
62
+
63
+ ```html
64
+ <label for="email">Email</label>
65
+ <input id="email" type="email" autocomplete="email"
66
+ aria-invalid="true" aria-describedby="email-error">
67
+ <p id="email-error">Enter an email address like name@example.com.</p>
68
+ ```
69
+
70
+ **Dynamic content (4.1.3)**
71
+
72
+ - Status messages that appear without a focus change (saved, copied, 3 results, upload finished) are announced: put them in a `role="status"` (polite) or `role="alert"` (urgent, errors) region that exists in the page before the message is inserted.
73
+ - Loading states say so in text, not only with a spinner.
74
+
75
+ **Pointer, motion and timing (2.2.1, 2.3.1, 2.5.7, 2.5.8)**
76
+
77
+ - Targets are at least 24 by 24 CSS pixels, or spaced so a 24 px circle around each does not overlap another (inline text links are exempt). Touch-first layouts usually want 44 px.
78
+ - Anything done by dragging also works with single clicks or taps (move up and down buttons, a menu, an input).
79
+ - Animations respect `prefers-reduced-motion`; nothing flashes more than three times a second; auto-playing media can be paused.
80
+ - Time limits can be extended, and sessions warn before expiring.
81
+
82
+ **Page level (2.4.1, 2.4.2, 3.1.1)**
83
+
84
+ - `<html lang>` is set; each route has a descriptive `<title>` (single-page apps must update it).
85
+ - Landmarks (`header`, `nav`, `main`, `footer`) and a skip link or equivalent let keyboard users bypass repeated navigation.
86
+
87
+ **ARIA misuse (4.1.2)**
88
+
89
+ - No ARIA is better than wrong ARIA. Flag `aria-label` on a `div` or `span` with no role, `aria-hidden="true"` on focusable elements or their parents, `role="button"` without keyboard handling, `aria-expanded` or `aria-selected` that never updates, and duplicate `id`s that break label references.
90
+
91
+ ### 3. Run what the project already has
92
+
93
+ Accessibility lint rules, component or E2E tests with axe, `pa11y` or Lighthouse CI configs, Storybook accessibility checks. Run them on the changed files or pages. Do not install new tools to do this.
94
+
95
+ ### 4. Optional: scan and keyboard pass in a headless browser
96
+
97
+ When the app can be started (see the `ui-testing` skill):
98
+
99
+ - **axe:** the headless check in the `ui-testing` skill (its `references/headless-check.md`) runs axe-core on each page when the project already has the `axe-core` package. If the project has `@axe-core/playwright`, use it in its own tests instead. Never download axe or a browser just for this.
100
+ - **Keyboard pass:** use the snippet in [references/wcag-checks.md](references/wcag-checks.md#keyboard-pass-in-a-headless-browser) as the check's `steps` to record the focus order, whether each focused element shows a visible focus style, and whether Escape closes the open dialog and focus returns. The pass is recorded for the task like any browser run: set the check's title to "Keyboard pass" and its purpose to what you checked.
101
+
102
+ Automated tools find roughly a third of WCAG problems. Zero axe violations is not conformance; a violation in third-party markup you do not control is still worth naming, but separately.
103
+
104
+ ### 5. Fix or report
105
+
106
+ In a code step, fix with the smallest change that uses the project's components and patterns: a real `<button>` instead of a clickable `div`, a label, a focus style from the design tokens. Do not add ARIA to paper over the wrong element.
107
+
108
+ In a review or test step, report. Rate each finding:
109
+
110
+ - **Blocker:** someone cannot complete the flow (keyboard trap, unlabeled or unreachable control in a core flow, focus lost in a dialog, form errors not perceivable).
111
+ - **Serious:** harder but possible (low contrast on body text, missing status announcements, no visible focus on some controls).
112
+ - **Moderate:** friction (heading order, redundant alt text, small targets in secondary places).
113
+
114
+ A test-step verdict fails on blockers in the changed flow, and on serious findings the change introduced.
115
+
116
+ ## Report
117
+
118
+ ```
119
+ Accessibility: <checked from code | code + axe | code + axe + keyboard>
120
+ Findings:
121
+ - [Blocker] src/components/DeleteButton.vue:12 icon-only button has no accessible name (4.1.2). Fix: aria-label="Delete project", icon aria-hidden.
122
+ - [Serious] ...
123
+ Not checked: <screen reader output, real devices, pages behind login, and why>
124
+ ```
125
+
126
+ Mention WCAG criterion numbers so findings can be looked up, and say which findings were measured (axe, computed contrast) and which come from reading the code.
127
+
128
+ ## Common mistakes
129
+
130
+ - Adding `role="button"` and `tabindex="0"` to a `div` instead of using `<button>`.
131
+ - `aria-label` that differs from the visible text, or labels like "button" and "icon".
132
+ - Removing focus outlines for looks.
133
+ - Treating a clean axe run as proof of accessibility.
134
+ - Checking only the default state, not errors, loading and open dialogs.
135
+ - Hiding content with `display: none` when it should stay available to screen readers (use a visually-hidden class), or leaving off-screen menus focusable.
136
+
137
+ ## Done when
138
+
139
+ - Every changed interactive element has a name, a role, keyboard support and visible focus.
140
+ - Forms label inputs and explain errors in text tied to the field.
141
+ - Colour is never the only signal and contrast meets AA where you could compute it.
142
+ - Findings carry file, line, WCAG criterion, severity and a concrete fix; what could not be checked is listed.
143
+
144
+ Adapted from addyosmani/web-quality-skills `skills/accessibility` (MIT, commit afa8da942115f2961fdbfa80807ea0b232ff6c00, Copyright (c) 2026 Addy Osmani). Changed: rewritten as a review process for unattended runs, framework-neutral notes added, DevTools MCP and Lighthouse steps replaced by optional headless axe and keyboard checks, large-text threshold corrected to 24 px or 18.66 px bold, severity rules for verdicts added.
@@ -0,0 +1,168 @@
1
+ # WCAG 2.2 checks, patterns and scripts
2
+
3
+ Read this when you need the exact criterion for a finding, a correct markup pattern for a fix, a contrast calculation, or the keyboard pass for the headless check.
4
+
5
+ ## Level A and AA criteria that matter most for web apps
6
+
7
+ | Criterion | Level | What to check |
8
+ |---|---|---|
9
+ | 1.1.1 Non-text Content | A | Alt text on meaningful images, names on icon buttons, `alt=""` on decorative images |
10
+ | 1.2.2 Captions (Prerecorded) | A | Videos with speech have captions |
11
+ | 1.3.1 Info and Relationships | A | Headings, lists, tables, labels and groups exist in markup, not only in styling |
12
+ | 1.3.2 Meaningful Sequence | A | DOM order matches reading order (CSS `order` and grid placement can break it) |
13
+ | 1.3.5 Identify Input Purpose | AA | `autocomplete` on fields about the user |
14
+ | 1.4.1 Use of Color | A | Colour is not the only way information is shown |
15
+ | 1.4.3 Contrast (Minimum) | AA | 4.5:1 text, 3:1 large text (24 px, or 18.66 px bold) |
16
+ | 1.4.4 Resize Text | AA | Usable at 200% zoom |
17
+ | 1.4.10 Reflow | AA | No two-dimensional scrolling at 320 CSS px wide (except maps, tables, editors) |
18
+ | 1.4.11 Non-text Contrast | AA | 3:1 for control boundaries, focus indicators, meaningful icons and graphics |
19
+ | 1.4.12 Text Spacing | AA | No clipped text when line and letter spacing increase (avoid fixed heights on text boxes) |
20
+ | 1.4.13 Content on Hover or Focus | AA | Tooltips and popovers can be dismissed (Escape), hovered and stay until dismissed |
21
+ | 2.1.1 Keyboard | A | Every function works with the keyboard |
22
+ | 2.1.2 No Keyboard Trap | A | Focus can always move away |
23
+ | 2.1.4 Character Key Shortcuts | A | Single-key shortcuts can be turned off or only work when a component has focus |
24
+ | 2.2.1 Timing Adjustable | A | Time limits can be extended |
25
+ | 2.2.2 Pause, Stop, Hide | A | Moving or auto-updating content can be paused |
26
+ | 2.3.1 Three Flashes | A | Nothing flashes more than three times per second |
27
+ | 2.4.1 Bypass Blocks | A | Skip link or landmarks |
28
+ | 2.4.2 Page Titled | A | Descriptive, unique titles per route |
29
+ | 2.4.3 Focus Order | A | Order preserves meaning; dialogs and route changes manage focus |
30
+ | 2.4.4 Link Purpose (In Context) | A | Link text says where it goes |
31
+ | 2.4.6 Headings and Labels | AA | Headings and labels describe their content |
32
+ | 2.4.7 Focus Visible | AA | A visible focus indicator |
33
+ | 2.4.11 Focus Not Obscured (Minimum) | AA | Focused element not fully hidden by sticky or overlay content |
34
+ | 2.5.1 Pointer Gestures | A | Multi-finger or path gestures have a single-pointer alternative |
35
+ | 2.5.2 Pointer Cancellation | A | Actions fire on release, not on press |
36
+ | 2.5.3 Label in Name | A | Accessible name contains the visible label |
37
+ | 2.5.7 Dragging Movements | AA | Dragging has a single-pointer alternative |
38
+ | 2.5.8 Target Size (Minimum) | AA | 24 by 24 CSS px, or enough spacing |
39
+ | 3.1.1 Language of Page | A | `<html lang>` |
40
+ | 3.1.2 Language of Parts | AA | `lang` on passages in another language |
41
+ | 3.2.1 On Focus / 3.2.2 On Input | A | Focusing or changing a field does not navigate or submit unexpectedly |
42
+ | 3.2.3 Consistent Navigation | AA | Navigation in the same order across pages |
43
+ | 3.2.6 Consistent Help | A | Help links or contact options in the same place across pages |
44
+ | 3.3.1 Error Identification | A | Errors described in text and tied to the field |
45
+ | 3.3.2 Labels or Instructions | A | Labels and format hints |
46
+ | 3.3.3 Error Suggestion | AA | Say how to fix it when known |
47
+ | 3.3.4 Error Prevention (Legal, Financial, Data) | AA | Review, confirm or undo for important submissions |
48
+ | 3.3.7 Redundant Entry | A | Do not ask again for data entered earlier in the same process |
49
+ | 3.3.8 Accessible Authentication (Minimum) | AA | No memory or puzzle test without an alternative; allow paste and password managers |
50
+ | 4.1.2 Name, Role, Value | A | Custom controls expose name, role and state |
51
+ | 4.1.3 Status Messages | AA | Status updates announced without moving focus |
52
+
53
+ Criteria 2.4.12, 2.4.13 and 3.3.9 are AAA and new in 2.2; 4.1.1 Parsing was removed in 2.2, so do not report it.
54
+
55
+ ## Patterns
56
+
57
+ **Visually hidden text** (for screen readers only):
58
+
59
+ ```css
60
+ .visually-hidden {
61
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
62
+ overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
63
+ }
64
+ ```
65
+
66
+ Use the project's existing utility if it has one (`sr-only`, `visually-hidden`, a component).
67
+
68
+ **Dialog:** prefer native `<dialog>` opened with `showModal()`, which makes the rest of the page inert and closes on Escape. Give it a name (`aria-labelledby` pointing at its heading), move focus inside on open, and return focus to the trigger on close. A custom dialog needs `role="dialog"`, `aria-modal="true"`, a focus trap, Escape handling and an inert or `aria-hidden` background.
69
+
70
+ **Skip link:**
71
+
72
+ ```html
73
+ <a class="skip-link" href="#main">Skip to main content</a>
74
+ <main id="main" tabindex="-1">...</main>
75
+ ```
76
+
77
+ with CSS that keeps it off-screen until it receives focus.
78
+
79
+ **Error summary on submit:** a heading like "2 problems need fixing" with links to each invalid field, focused after a failed submit; each field keeps its own inline error with `aria-describedby`.
80
+
81
+ **Tabs:** `role="tablist"` containing `role="tab"` elements with `aria-selected` and `aria-controls`; panels with `role="tabpanel"` and `aria-labelledby`. Only the active tab has `tabindex="0"`; arrow keys move between tabs.
82
+
83
+ **Disclosure and menus:** a button with `aria-expanded` that toggles the controlled region. Do not use `role="menu"` for site navigation; it promises application-style keyboard behaviour.
84
+
85
+ **Live region:** render the container empty on page load, then change its text:
86
+
87
+ ```html
88
+ <div role="status" class="visually-hidden" id="announcer"></div>
89
+ ```
90
+
91
+ Clearing it before writing the same message again makes screen readers repeat it.
92
+
93
+ **Reduced motion:**
94
+
95
+ ```css
96
+ @media (prefers-reduced-motion: reduce) {
97
+ *, *::before, *::after {
98
+ animation-duration: 0.01ms !important;
99
+ animation-iteration-count: 1 !important;
100
+ transition-duration: 0.01ms !important;
101
+ scroll-behavior: auto !important;
102
+ }
103
+ }
104
+ ```
105
+
106
+ Or scope it to the animations the change adds, if the project handles motion per component.
107
+
108
+ ## Contrast from design tokens
109
+
110
+ When colours come from tokens or CSS variables, compute the ratio instead of guessing. Run with `node -e` or in a temp file:
111
+
112
+ ```js
113
+ function luminance(hex) {
114
+ const value = hex.replace('#', '')
115
+ const full = value.length === 3 ? value.split('').map(c => c + c).join('') : value
116
+ const [r, g, b] = [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16) / 255)
117
+ .map(c => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4))
118
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
119
+ }
120
+ function contrast(foreground, background) {
121
+ const [light, dark] = [luminance(foreground), luminance(background)].sort((a, b) => b - a)
122
+ return (light + 0.05) / (dark + 0.05)
123
+ }
124
+ console.log(contrast('#6b7280', '#ffffff').toFixed(2))
125
+ ```
126
+
127
+ Semi-transparent colours must be blended with their real background first. For dark mode, check both themes.
128
+
129
+ ## Keyboard pass in a headless browser
130
+
131
+ Use as the `steps` function of the `ui-testing` headless check. It records the first stops of the Tab order, whether each one shows a focus style, and whether Escape closes an open dialog. The focus-style test is a heuristic (it looks for an outline or box shadow); confirm doubtful cases on a screenshot.
132
+
133
+ ```js
134
+ async function steps(page) {
135
+ const stops = []
136
+ for (let i = 0; i < 25; i++) {
137
+ await page.keyboard.press('Tab')
138
+ const stop = await page.evaluate(() => {
139
+ const el = document.activeElement
140
+ if (!el || el === document.body) return null
141
+ const style = getComputedStyle(el)
142
+ const hasOutline = style.outlineStyle !== 'none' && parseFloat(style.outlineWidth) > 0
143
+ const hasShadow = style.boxShadow && style.boxShadow !== 'none'
144
+ const label = el.getAttribute('aria-label') || el.innerText || el.getAttribute('title') || el.getAttribute('name') || ''
145
+ return {
146
+ element: el.tagName.toLowerCase() + (el.getAttribute('role') ? `[role=${el.getAttribute('role')}]` : ''),
147
+ name: label.trim().replace(/\s+/g, ' ').slice(0, 60),
148
+ visibleFocus: Boolean(hasOutline || hasShadow),
149
+ inViewport: (() => { const r = el.getBoundingClientRect(); return r.bottom > 0 && r.top < innerHeight })(),
150
+ }
151
+ })
152
+ if (!stop) break
153
+ stops.push(stop)
154
+ }
155
+ let escapeClosesDialog = null
156
+ const dialog = page.locator('dialog[open], [role="dialog"]').first()
157
+ if (await dialog.isVisible().catch(() => false)) {
158
+ await dialog.locator('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])').first().focus().catch(() => {})
159
+ await page.keyboard.press('Escape')
160
+ escapeClosesDialog = !(await dialog.isVisible().catch(() => false))
161
+ }
162
+ return { stops, escapeClosesDialog }
163
+ }
164
+ ```
165
+
166
+ Read the result: stops with an empty `name` are unnamed controls; `visibleFocus: false` needs a screenshot check; the order should follow the visual layout; stops that repeat in a loop inside one component suggest a trap. To test a dialog, open it in `steps` first (click its trigger), then run the same loop and check focus stays inside it and returns to the trigger after Escape.
167
+
168
+ Adapted from addyosmani/web-quality-skills `skills/accessibility/references/WCAG.md` and `A11Y-PATTERNS.md` (MIT, commit afa8da942115f2961fdbfa80807ea0b232ff6c00, Copyright (c) 2026 Addy Osmani). Changed: limited to A and AA criteria relevant to web apps with "what to check" notes, patterns condensed, contrast and keyboard-pass scripts added.