gate-code
Skill1 starsChanged 3 months agoMITView on GitHub
Build/type/lint quality gate — executed by the gate-runner agent against the Lead's build of record, FIRST of the six measurement gates in Phase 11 (nothing visual gets judged on a broken build). Dispatched there, on an iterate re-gate, after any multi-file code change to an ultraweb site, or on "run the code gate", "does it build", "check types and lint", "is the build clean", "check the token contract". Proves the codebase green with commands, not claims: the build log's exit code, strict tsc --noEmit, the ESLint CLI (next lint is gone in Next 16), every route 200 with a clean prod log, "use client" placement, stack-relic greps, unused dependencies, and a token-contract linter failing undeclared @theme tokens or sub-AA color pairs. Appends a dated pass/fail entry with command evidence to design/QA.md.
- Deletes or force-pushes
In this repository79 other files it gives its agents.
- ultrawebSkill
- analyticsSkill
- animejsSkill
- api-designSkill
- app-structureSkill
- assetsSkill
- authSkill
- award-canonSkill
- briefSkill
- buttonsSkill
- cardsSkill
- cartSkill
- checkpointSkill
- colorSkill
- command-paletteSkill
- component-apiSkill
- consentSkill
- content-cmsSkill
- copywritingSkill
- databaseSkill
- data-displaySkill
- data-fetchingSkill
- depthSkill
- directionSkill
- emailSkill
- faqSkill
- feature-sectionsSkill
- footerSkill
- formsSkill
- gate-accessibilitySkill
- gate-antislopSkill
- gate-contentSkill
- gate-performanceSkill
- gate-responsiveSkill
- gate-visualSkill
- handoffSkill
- heroSkill
- hidden-craftSkill
- i18nSkill
- iconsSkill
- identitySkill
- imagerySkill
- iterateSkill
- layout-gridSkill
- marginaliaSkill
- media-optimizationSkill
- micro-interactionsSkill
- mockupSkill
- motion-languageSkill
- navigationSkill
- overlaysSkill
- page-transitionsSkill
- paymentsSkill
- physicsSkill
- previewSkill
- pricingSkill
- print-craftSkill
- product-detailSkill
- retrofitSkill
- routingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Every route serves 200; prod log clean [MEASURED]
- Very specific: line 35
Degraded: no browser is used here, so a NO BROWSER preflight downgrades nothing.
- Very specific: line 37
Build of record: read the exit code from PROGRESS.md §Now's Build of record: line — never rebuild — then tail -n 20 …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
gate-code — green by command, not claim
Stage: Phase 11, gate 1 of 6 — code → responsive → antislop → content → accessibility → performance. Executed by the gate-runner agent against the Lead's build of record and the production server of record on prodUrl, both raised once in the Phase 11 preamble (mkdir -p qa && rm -rf .next && npm run build > qa/build.log 2>&1, then PORT=3100 npm start > qa/prod.log 2>&1 &; see root SKILL.md); the runner never builds and never starts a server - Reads: the codebase, package.json, design/PROGRESS.md (§Now's Build of record: line — check 1 reads the exit code there and never rebuilds), design/SITEMAP.md (routes), design/DIRECTION.md, design/SYSTEM.md, <plugin>/STACK.md - Writes: the design/QA.md entry (appended) + qa/gate-code.log; fixes are the Lead's
Standard
Every item is an exit code or a zero-hit grep; a measurement the runner did not run did not pass. The two facts the other gates inherit: the build of record is green, and the design system is honest — every var(--token) declared, every foreground/surface pair clearing AA by computation, not by eye.
Checklist
- Build of record exited 0 [MEASURED]
- Types clean, strict intact [MEASURED]
- Lint clean via the ESLint CLI [MEASURED]
- Every route serves 200; prod log clean [MEASURED]
- RSC boundaries at the leaves [MEASURED]
- Zero stack relics [MEASURED]
- Zero unused dependencies [MEASURED]
- Token contract holds — no undeclared tokens, every pair passes AA [MEASURED]
- Emitted CSS: zero
!important, zero orphaned custom properties [MEASURED] animejs/threecommissioned by name in DIRECTION.md — evidence returned: import file:line + the DIRECTION.md lines quoted, or "no citation" [JUDGMENT → Lead]- Emitted colour/type census inside the system's scales — evidence returned: wallace's counts beside SYSTEM.md's palette and
clamp()scale lengths [JUDGMENT → Lead]
How to verify
Runner contract (the rest lives in agents/gate-runner.md):
- In:
gate·pluginRoot·projectRoot·prodUrl·devUrl·artifacts(BRIEF, DIRECTION, SYSTEM, SITEMAP, QA, PROGRESS) ·tier·market·themeStrategy· optionalrerunOnly(run only those checks). - Out: verdict
PASS/PASS-ON-MEASURED/FAIL/UNVERIFIED(PASSonly whenjudgment-openis empty); failed checks ascheck · file:line · one line · owner skill · MECHANICAL|DESIGN; JUDGMENT items asjudgment-openwith the evidence named above; the QA.md entry appended; the pathqa/gate-code.log. - Logs: full stdout/stderr of every failing or unverified command →
<projectRoot>/qa/gate-code.log; the return carries the path, never the contents. A tooling failure comes back as<check> · qa/build.log · <first error line> · owner: stack-doctor · MECHANICAL, and the Lead hands stack-doctor that LOG PATH. - Never:
npm run build,npm start,npm run dev,rm -rf .next,npm install, any source edit, anydesign/*edit but the QA.md append. Its only other writes areqa/gate-code.log(a shell redirect is fine) and check 8'sqa/token-contract.mjs(Write tool only). - Degraded: no browser is used here, so a NO BROWSER preflight downgrades nothing; UNVERIFIED means a missing toolchain or an unreadable
qa/build.log, and every code-checkable step still runs.
- Build of record: read the exit code from PROGRESS.md §Now's
Build of record:line — never rebuild — thentail -n 20 <projectRoot>/qa/build.log. Exit 0 → PASS, evidence = the "Compiled successfully" line. Non-zero → FAIL tostack-doctorper the contract. - Types:
npx tsc --noEmit→ exit 0, no output. Then prove nothing was loosened to get there:grep -n '"strict"' tsconfig.jsonshowstrue, andgrep -rn "@ts-ignore\|@ts-expect-error\|as any" app components lib→ any hit without a justification comment on the line above fails at that file:line. Common Next 16 failure:params/searchParamsused withoutawait— they are Promises in pages, layouts, generateMetadata. - Lint:
npx eslint .→ exit 0, 0 problems; never--fix(the runner reports, the Lead edits).next lintwas REMOVED in Next 16 —grep -n "next lint" package.jsonreturns nothing.grep -rn "eslint-disable" app components lib→ the justification rule of check 2. - Routes + server log:
curl -s -o /dev/null -w "%{http_code} %{url_effective}\n" <prodUrl><route>for every route in design/SITEMAP.md — all 200; a route that exists only in dev is a build defect. Thengrep -inE "error|hydrat|failed" <projectRoot>/qa/prod.log→ zero hits. Browser-side console errors belong to gate-responsive's console check (7); this check owns the server side. - RSC boundary audit:
grep -rn "use client" app components lib— the census is the evidence; every failure here is owned byapp-structure:- Zero hits in any
layout.tsx; providers belong incomponents/layout/providers.tsx, imported as a leaf. - A hit in
app/**/page.tsxfails unless the line above it is a//comment justifying it; the default is a server page composing client leaves. - Return the count: expect ≤15 client files on a brochure/marketing site, over 30 the boundary plan failed → FAIL, DESIGN.
grep -rl "motion/react" app components | xargs -r grep -L "use client"→ empty, and the same with-rlE "useState|useEffect|useRef|onClick=". A hit means the directive belongs at the true leaf, or the interactivity pushes further down — never up.
- Zero hits in any
- Stack relics — every grep returns nothing:
ls middleware.ts→ absent. Next 16 usesproxy.tsexportingproxy(request).grep -rn "framer-motion" package.json app components lib— the package ismotion.grep -rn "onLoadingComplete" app components— next/image dropped it; it isonLoad.grep -rn "priority" app components --include="*.tsx"— deprecated as an<Image>prop; usepreload.grep -rn "tailwind.config\|@tailwind base\|theme.extend" . --exclude-dir=node_modules— v3 relics; v4.3 is CSS-first via@theme.grep -rn "import anime from\|@types/animejs" package.json app components lib— anime.js v3 relics; v4 has no default export and ships its own types (STACK.md); a baretargets:means nothing.grep -rn "createDraggable" app components libandgrep -rnE "ease: *['\"]cubicBezier" app components— drag is motion's atdomMax, an engine boundary; thecubicBezierstring form is silently linear, pass the importedanimeEase.*.grep -rnE "transpilePackages|MeshProps|Object3DNode|MaterialNode|BufferGeometryNode|LightNode|namespace JSX" next.config.* app components— R3F v8 relics in a v9 world: prop types are nowThreeElements['mesh'], JSX augmentation moved intodeclare module '@react-three/fiber',transpilePackages: ['three']is stale on Turbopack (STACK.md).grep -n '"@types/three"' package.json— must equalthree's version exactly or that augmentation drifts;threeis pinned exactly wheneverpostprocessingis present (STACK.md).
- Unused dependencies — audit
dependenciesonly; devDependencies serve tooling:
for dep in $(node -p "Object.keys(require('./package.json').dependencies).join(' ')"); do
grep -rq "from ['\"]$dep" app components lib || echo "UNUSED: $dep"
doneThe prefix match catches subpath imports (from "next/image" matches next). Before reporting a hit, grep the root configs (next.config.ts, proxy.ts, drizzle.config.ts) and globals.css too; the Lead uninstalls, then repeats the Phase 11 preamble and re-dispatches per Pass criteria. animejs, three and @react-three/* are exempt — their commissioning half is check 10.
- Token contract + AA, by script: the runner puts the script below at
<projectRoot>/qa/token-contract.mjswith the Write tool — a shell heredoc or>redirect to a.mjsis blocked by the shell-write guard — and runsnode qa/token-contract.mjs→ exit 0. Dependency-free. It fails (a) on anyvar(--token)inapp/componentsthatapp/globals.cssnever declares — a typo or a half-finished rename silently renders the CSS default; (b) on any semantic foreground/surface pair below 4.5:1 —--foreground/--backgroundand every--*-foreground/--*, re-derived from the OKLCH tokens in BOTH:rootand.dark(3:1 per pair only where you know it is large-text-only). ultraweb:color's one-time AA pass becomes a per-build gate: weeks of iterate cannot slip a stale token or a sub-AA pair past the other checks.
// qa/token-contract.mjs
import { readFileSync, readdirSync, existsSync } from "node:fs";
const css = readFileSync("app/globals.css", "utf8");
const declared = new Set([...css.matchAll(/--([\w-]+)\s*:/g)].map(m => m[1]));
let fail = 0;
// (1) every var(--token) in app/components must be declared in globals.css
const walk = d => readdirSync(d, { withFileTypes: true }).flatMap(e =>
e.isDirectory() ? walk(`${d}/${e.name}`) : [`${d}/${e.name}`]);
for (const f of ["app", "components"].filter(existsSync).flatMap(walk).filter(f => /\.(tsx?|css)$/.test(f)))
for (const [, t] of readFileSync(f, "utf8").matchAll(/var\(\s*--([\w-]+)/g))
if (!declared.has(t)) (console.error(`UNDECLARED var(--${t}) ${f}`), fail = 1);
// (2) AA contrast for every fg/surface pair, both themes
const lum = ([L, C, H]) => { // oklch -> WCAG relative luminance
const h = H * Math.PI / 180, a = C * Math.cos(h), b = C * Math.sin(h), cube = x => x ** 3;
const l = cube(L + .3963377774*a + .2158037573*b),
m = cube(L - .1055613458*a - .0638541728*b),
s = cube(L - .0894841775*a - 1.2914855480*b),
[r, g, bl] = [ 4.0767416621*l - 3.3077115913*m + .2309699292*s,
-1.2684380046*l + 2.6097574011*m - .3413193965*s,
-.0041960863*l - .7034186147*m + 1.7076147010*s ].map(v => Math.min(1, Math.max(0, v)));
return .2126*r + .7152*g + .0722*bl;
};
const ratio = (x, y) => { const [hi, lo] = [lum(x), lum(y)].sort((p, q) => q - p); return (hi + .05) / (lo + .05); };
const parse = block => Object.fromEntries([...block.matchAll(/--([\w-]+)\s*:\s*oklch\(([^)]+)\)/g)].map(
([, n, v]) => [n, v.split("/")[0].trim().split(/\s+/).map(x => parseFloat(x) / (x.endsWith("%") ? 100 : 1))]));
for (const [name, sel] of [["root", ":root"], ["dark", "\\.dark"]]) {
const t = parse((css.match(new RegExp(`${sel}\\s*{([^}]*)}`, "s")) || [, ""])[1]);
for (const fg in t) {
const bg = fg === "foreground" ? "background" : fg.endsWith("-foreground") ? fg.slice(0, -11) : null;
if (!bg || !t[bg]) continue;
const r = ratio(t[fg], t[bg]);
if (r < 4.5) (console.error(`AA FAIL [${name}] --${fg} on --${bg} ${r.toFixed(2)}:1 (<4.5)`), fail = 1);
}
}
process.exit(fail);- CSS entropy, the hard half: the emitted stylesheet is the honest census of what components minted.
npx wallace-cli .next/static/css/*.cssagainst the build of record (one file per invocation if the glob expands to several) →!importantcount == 0 (the@layerorder ultraweb:tokens sets is what overrides shadcn) and zero orphaned custom properties, declared in globals.css and referenced nowhere — the mirror image of check 8. Both fail at the declaring file:line, ownertokens. - DIRECTION-gated packages [JUDGMENT → Lead]:
animejspasses only with BOTH afrom "animejs"import under app/components — the specifier is the only tell, sinceanimate(is also motion/react and WAAPI — AND a design/DIRECTION.md line commissioning the SVG moment that earned it.threeand@react-three/*are judged identically (<Canvas,useFrame(also appear in dead code): the import under app, components or lib AND a DIRECTION.md line namingultraweb:showpiecefor one set piece, orultraweb:set-designwith route scope and byte budget for a scene persisting across routes. Either half missing is a defect — uninstall, or send the moment back to ultraweb:direction to be named. - CSS census [JUDGMENT → Lead]: the same wallace run read against design/SYSTEM.md as ceilings, never equalities — unique colours ≤ palette + shadcn's base tokens, unique font-sizes ≤ the
clamp()scale length plus a tolerance (Tailwind utilities legitimately emit more, so the tail is what is judged). Every excess traces to a component: delete the stray value, never widen the palette to match the census.
Pass criteria
Checks 1–9 green in ONE sequential pass and 10–11 ruled, before PASS. Checks 2, 3 and 5–9 read the current source and re-verify a fix on the spot, but the server serves the build of record, not the working tree: any fix that touched source, config, tokens or dependencies has the Lead repeat the Phase 11 preamble first — one rebuild, the new exit code in PROGRESS.md §Now — then re-dispatch rerunOnly: [1, <the fixed checks>]: check 1's evidence is that new build, 4 reads the server serving it. A config or token change (globals.css, next.config.ts) widens the re-run to the whole gate. Zero unjustified suppressions. Every result recorded as the command's actual output line, not a memory of it.
QA.md entry
Appended by the runner with cat >> design/QA.md <<'EOF' — never rewritten, never Read first for an anchor. On rerunOnly the append is a dated ### gate-code — re-run <date> block listing only the re-run checks and their new results.
## gate-code — 2026-07-16 — PASS
| # | Check | Result | Evidence |
|---|-------|--------|----------|
| 1 | build of record | PASS | qa/build.log exit 0 — "Compiled successfully" |
| 2 | npx tsc --noEmit | PASS | exit 0, silent |
| 3 | npx eslint . | PASS | 0 problems |
| 4 | routes + prod log | PASS | 7/7 routes 200 on :3100, qa/prod.log clean |
| 5 | RSC boundaries | PASS | 9 client files, all leaves, 0 in layouts |
| 6 | stack relics | PASS | 0 hits across 10 greps |
| 7 | unused dependencies | PASS | 11 deps audited, 0 unused |
| 8 | token contract + AA | PASS | qa/token-contract.mjs exit 0 — 0 undeclared, 14 pairs ≥4.5:1 |
| 9 | CSS entropy | PASS | wallace: 0 !important, 0 orphans |
| 10 | DIRECTION-gated deps | PASS | animejs: seal.tsx:12 + DIRECTION.md L41 — Lead ruled commissioned |
| 11 | CSS census | PASS | 19 colours (palette 16 + base), 11 font-sizes (scale 9) — Lead ruled inside ceiling |
Issues fixed: removed unused `date-fns`; moved "use client" from app/page.tsx to components/sections/hero.tsx; raised `--muted-foreground` lightness to clear AA in `.dark`.Anti-patterns
next lintanywhere — removed in Next 16; ESLint CLI only"strict": false,as anysprinkles, or a blanket/* eslint-disable */to silence a tool — hiding the defect, not fixing it"use client"slapped on a layout to make a hook error vanish — the error is telling you the boundary is wrong- Downgrading next/tailwindcss/motion to dodge an error — hand
stack-doctorthe log path instead
Worked example — Tidepool, first cold pass of the code gate
Moved to references/example.md — read only when this build's case is genuinely ambiguous; the sections above are the decision material.
Composes with
Moved to references/composes.md — the handoff map; load it when orchestrating this skill against its neighbors.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

