Skip to content

Commit 3a9ded3

Browse files
authored
Merge pull request #164: docs: update validation workflow with new anti-hallucination tools
docs: update validation workflow with new anti-hallucination tools
2 parents 09b9a98 + d3710c0 commit 3a9ded3

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.automaker/context/validation-workflow.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@
22

33
When writing code that uses web components, follow this workflow to prevent Shadow DOM, styling, and API mistakes.
44

5-
## Quick Start: One-Call Validation
5+
## Quick Start: One-Call Styling Validation
66

7-
After generating any code that uses web components, call `validate_component_code` with your HTML, CSS, and JS. It runs 20 sub-validators in one shot:
7+
**For CSS/styling work**, call `styling_preflight` — it combines API discovery + validation in one call:
8+
9+
```
10+
styling_preflight({
11+
cssText: "hx-button::part(base) { --hx-button-bg: blue; }",
12+
tagName: "hx-button",
13+
htmlText: "<hx-button><span slot='prefix'>X</span></hx-button>"
14+
})
15+
```
16+
17+
Returns: component's full style API (parts, tokens, slots), valid/invalid status for every `::part()` and token reference, Shadow DOM/theme issues, a correct CSS snippet, and a pass/fail verdict.
18+
19+
## Full Code Validation
20+
21+
For comprehensive validation (HTML + CSS + JS), call `validate_component_code`:
822

923
```
1024
validate_component_code({
11-
html: "<sl-button variant='primary'>Click</sl-button>",
12-
css: "sl-button { --sl-button-font-size: 1rem; }",
13-
code: "button.addEventListener('sl-click', handler);",
14-
tagName: "sl-button",
25+
html: "<hx-button variant='primary'>Click</hx-button>",
26+
css: "hx-button { --hx-button-bg: blue; }",
27+
code: "button.addEventListener('hx-click', handler);",
28+
tagName: "hx-button",
1529
framework: "html" // or "react", "vue", "angular"
1630
})
1731
```
@@ -20,10 +34,11 @@ validate_component_code({
2034

2135
1. **get_component_quick_ref** — Get the full API surface (attributes, events, slots, CSS parts, CSS custom properties)
2236
2. **diagnose_styling** — Get Shadow DOM styling guide specific to that component
37+
3. **resolve_css_api** — Verify that every `::part()`, token, and slot name in your CSS/HTML actually exists on the component
2338

2439
## After Writing Code
2540

26-
Run `validate_component_code` (all-in-one) OR individual validators:
41+
Run `styling_preflight` (CSS focus) or `validate_component_code` (full) or individual validators:
2742

2843
### HTML Validators
2944
| Tool | What it catches |
@@ -38,6 +53,8 @@ Run `validate_component_code` (all-in-one) OR individual validators:
3853
### CSS Validators
3954
| Tool | What it catches |
4055
|---|---|
56+
| `styling_preflight` | **RECOMMENDED**: One-call CSS validation — API discovery + reference resolution + Shadow DOM + theme checks + correct snippet + pass/fail verdict |
57+
| `resolve_css_api` | Validates every `::part()`, CSS custom property, and slot reference against CEM data — catches hallucinated names with fuzzy-match suggestions |
4158
| `check_shadow_dom_usage` | 15 patterns: descendant piercing, ::part() misuse (chaining, structural combining, descendant selectors), deprecated /deep/>>>/::deep, ::slotted() in consumer CSS + compound/descendant misuse, :host/:host-context() in consumer CSS, !important on tokens, display:contents on host, unknown parts, misspelled tokens |
4259
| `check_css_vars` | Unknown CSS custom properties, typos |
4360
| `check_token_fallbacks` | Missing var() fallbacks, hardcoded colors |

0 commit comments

Comments
 (0)