Skip to content

feat(agents): frontend and AWS skills, a marketing surface, and read-only AWS guardrails - #255

Merged
athvin merged 6 commits into
mainfrom
feat/agent-skills-frontend-aws
Oct 22, 2026
Merged

athvin merged 6 commits into
mainfrom
feat/agent-skills-frontend-aws

Conversation

@athvin

@athvin athvin commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Four landings, one branch. Each commit stands alone and they can be split if you'd rather review them separately.

What this adds

Four skills (15 → 19), filling the two gaps the library had:

Skill Fills
frontend-design-system what to render and how it should look — the gap that let 12 component files drift into emerald/red/amber before the ESLint rule was added to catch it
frontend-data-ui the hand-rolled-DOM charting policy, the virtualization threshold, score presentation
landing-page the marketing surface's static-prerender traps
aws-account-operations operating the live account, as distinct from authoring its Terraform

Two general-purpose skills are now explicitly superseded, the way rust-conventions already supersedes rust-best-practice: frontend-design asks for a palette against a product whose design doc forbids one, and dataviz assumes a chart library against a codebase that has none by decision. docs/agent-skills.md now treats overriding as a recurring obligation rather than a one-off, and defines three third-party tiers (vendored text, installed plugins, MCP servers) with an in/out decision recorded for every candidate.

Five generators, three of which report a derived gap so nobody maintains it:

  • design-tokens — tokens with both themes and their @theme reachability, installed primitives, the palette-ban regex
  • screens-coverage — every route set-differenced against the axe gate's SCREENS
  • aws-footprint — resource types and counts, permission sets and whether each has an inline policy
  • skill-inventory — the inventory tables in docs/agent-skills.md and CLAUDE.md, which both said "Fifteen" against a larger tree

A public marketing surface — a (marketing) route group prerendering statically inside the same app that serves the BFF. next build reports / as ○ (Static).

Read-only AWS guardrails at three layers, because each alone is bypassable in a different way.

What needs you

  1. terraform apply — DenyMutationViaMCP and the PlatformReadOnly permission set are written and terraform validates clean across all three envs, but are not applied. Until then Layer 2 does not exist and the MCP proxy runs as PlatformAdmin.
  2. /mcp and /skills after first load — confirm exactly one AWS server connected (a plugin bringing a duplicate silently defeats --read-only), and that the eight hidden aws-core skills are gone. The skillOverrides keys may need aws-core: qualification.
  3. The edge topology — the ALB is scheme: internal and Cloudflare records are DNS-only, so the marketing surface is complete and tested but not publicly reachable. Also open: apex vs app. subdomain, which would need host-based routing in src/proxy.ts.

Findings surfaced along the way

  • A stale visual baseline. config-studio-mobile-safari-linux.png still depicted amber bands, green bars and a green badge from before the monochrome rule. Regenerated; grayscale now.
  • A monochrome leak the ESLint rule structurally cannot see. A bare <input type="checkbox"> in the comparison editor renders the browser's default blue — there is no palette utility to match. Documented as a class in the design-system skill; not fixed here to avoid churning baselines in an unrelated PR.
  • Two holes in the skills gate. The no-sibling-reference rule matched only the references/-prefixed spellings, missing the bare filename — the form an author is most likely to write. Tightening it surfaced six pre-existing violations. The documented "every reference links from SKILL.md" half was never implemented at all.
  • A factual error in infra-platform. It asserted infra/k8s/nodepools/ is "not Karpenter" and that a Karpenter NodePool must not be added. All three manifests are apiVersion: karpenter.sh/v1. The real rule is that writing one is correct and installing Karpenter is not, since Auto Mode runs its own.
  • JSON-LD needed no semgrep exemption. The usual dangerouslySetInnerHTML advice assumes React escapes <script> text children; measured against React 19 it does not, and </script is encoded so a payload cannot close its own tag. Pinned by a component test.

Verification

  • make check — green (includes skills-check)
  • make frontend — green, 361 passed / 0 failed
  • terraform fmt -check -recursive + credential-free validate — clean on core, dev and prod
  • The skills gate observed failing on five deliberate violations, per the repo's own rule
  • The Bash guard observed across 13 cases; two real defects found and fixed (terraform -chdir=… apply escaped the deny; a leading VAR= prefix bypassed the generic sweep)

Still outstanding: the eval scenarios need posing in a fresh session, which is the one check that measures whether the right skill actually triggers.

🤖 Generated with Claude Code

bmoore813 and others added 6 commits October 22, 2026 09:11
…ls, and four generators

Three new skills, all first-party:

- `frontend-design-system` — the token system in `globals.css`, the two
  deliberate WCAG deviations from stock shadcn, and the channel to reach for
  instead of each hue. This is the gap that let twelve component files drift
  into emerald/red/amber before the ESLint rule was added to catch it.
- `frontend-data-ui` — the hand-rolled-DOM charting policy and why (pixel
  determinism plus assistive tech), the virtualization threshold, numeric
  column conventions, and the axe-gate registration obligation.
- `aws-account-operations` — the single-account model and its consequence that
  every guardrail is an IAM deny, the permission sets, Pod Identity, what is
  not alarmed, the cost pipeline, and the two traps (cost-allocation tags
  never backfill; the 8-vCPU quotas leave a runner pod Pending forever).

Two general-purpose skills are now explicitly superseded, the way
`rust-conventions` already supersedes `rust-best-practice`: `frontend-design`
asks for a palette against a product whose design doc forbids one, and
`dataviz` assumes a chart library against a codebase that has none by
decision. `docs/agent-skills.md` records overriding as a recurring obligation
rather than a one-off, and defines the three tiers (vendored text, installed
plugins, MCP servers) with an in/out decision for every candidate.

Four generators, three of which report a derived *gap* so nobody maintains it:

- `design-tokens` — tokens with both themes and their `@theme` reachability,
  the installed primitives, the palette-ban regex.
- `screens-coverage` — every route set-differenced against the axe gate's
  SCREENS array. This replaces a prose warning that a new screen is
  "otherwise silently unchecked", which was always true and never read.
- `aws-footprint` — resource types and counts, the permission sets and
  whether each has an inline policy, the workspace's aws-* crates.
- `skill-inventory` — the inventory tables in docs/agent-skills.md and
  CLAUDE.md, which both said "Fifteen" against a larger tree.

Two gate holes closed, both found by observing the gate fail on purpose:

- The no-sibling-reference rule only matched the `references/`-prefixed
  spellings, missing the bare filename — the form an author is most likely to
  write from inside `references/`. Tightening it surfaced six pre-existing
  violations in entity-framework, pentest and security, now fixed with the
  prose workaround `diagnostics.md` already used.
- The documented "every reference links from SKILL.md" half was never
  implemented at all, so an unreachable reference could go stale invisibly.

Also corrects a factual error: `infra-platform` asserted `infra/k8s/nodepools/`
is "not Karpenter" and that a Karpenter NodePool must not be added. All three
manifests are `apiVersion: karpenter.sh/v1`, `kind: NodePool`. The real rule is
that writing one is correct and installing Karpenter is not, since Auto Mode
runs its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…the app

A `(marketing)` route group rather than a second project. `output: 'export'` is
unavailable because the app also serves the BFF, and a separate project would
mean a second copy of 50 chroma-0 tokens, a second five-tool gate, a second
audit/licence allowlist, a second Playwright image pin, and a hosting target
that does not exist. `next build` reports `/` as `○ (Static)`, which is the
output that proves `force-static` took.

`/` becomes the landing page, so the signed-in dispatcher moves to
`src/app/app/page.tsx`. That is a small security improvement, not just a move:
`/app` is deliberately absent from PUBLIC_PATHS, so an anonymous visitor is
turned away by the proxy's cookie check *before* that page's Drizzle query runs,
which it did not used to be at `/`. One CTA is then correct for both signed-in
and signed-out visitors with no session read, and therefore no client JS on the
landing page.

Four things that are not obvious and are now encoded:

- `robots.ts` and `sitemap.ts` MUST sit at the app root. Next's metadata
  normalizer appends a hash to any such file under a route group and only adds
  `.txt` when the page path is exactly `/robots` — inside `(marketing)` it
  serves as `/robots-<hash>` with no extension, a silently broken robots.txt.
- `ensureStatic` would be the natural assertion but requires `cacheComponents`
  and FAILS THE BUILD without it. `force-static` is the applicable config, and
  it does more than hint: it makes cookies()/headers() return empty, so a later
  edit cannot quietly make the page per-request.
- `/robots.txt` and `/sitemap.xml` need explicit PUBLIC_PATHS entries. The
  proxy matcher excludes only .svg/.png/.ico/.webp, so without them every
  crawler gets a 307 to /login. Same reason the OG image is a committed PNG
  rather than `opengraph-image.tsx`, which Next serves extensionless.
- `robots.ts` reads a new narrow `publicBaseUrl()` rather than `env()`. It
  prerenders, so `env()` would run full schema validation during `next build`
  and fail on four required secrets the Docker build deliberately does not set.
  The build caught this.

JSON-LD needed no `dangerouslySetInnerHTML` and no semgrep exemption. The usual
advice assumes React escapes `<script>` text children; measured against React
19, it does not — quotes pass through so the JSON parses, and `</script` is
encoded so the payload cannot close its own tag. The text child is therefore
byte-identical for valid payloads and strictly safer for hostile ones.
`tests/component/structured-data.test.tsx` pins both properties, because the
failure mode is invisible in the page and only breaks crawlers.

The surface inherits the monochrome rule in full (docs/frontend-design.md §3.4).
Hero interest is a 6-8x type-scale ratio, weight contrast, one inversion spent
on the primary CTA, and one honest product image — two near-duplicate records
resolving into a golden record with the evidence, in the same hand-rolled
DOM/CSS vocabulary as the real waterfall.

Gate wiring: the axe `SCREENS` array gains an `anonymous` flag, since the sweep
logged in before every screen and a public route cannot be added without that.
Visual baselines are per-section, not fullPage — a long page captured whole
rewrites all three device baselines on any change with an unreadable diff.
Coverage moved UP (49.39 -> 49.58% statements, 34.85 -> 35.01% functions).

Two findings fell out of the work:

- `grow.spec.ts-snapshots/config-studio-mobile-safari-linux.png` was STALE,
  still depicting amber bands, green bars and a green badge from before the
  monochrome rule landed. Regenerated; it is grayscale now, matching what the
  app actually renders.
- `gen_screens_coverage` only matched backtick template literals, so it
  reported the landing page as unchecked while the gate was in fact sweeping
  it. A gate that cries wolf about a covered screen is worse than one that
  stays quiet. It now reads quoted forms too.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…now exists

Deliberately sequenced after the marketing surface rather than ahead of it: a
skill describing code that does not exist yet is precisely what
docs/agent-skills.md's purpose test rejects, and none of its claims could have
been checked.

What it carries is the knowledge that cost time to find, all of which fails
silently rather than loudly:

- robots.ts and sitemap.ts must sit at the app root, because Next's metadata
  normalizer hashes and de-extensions any such file reached through a route
  group — a robots.txt that does not exist, from a file that looks right.
- `ensureStatic` is the natural assertion and FAILS THE BUILD without
  cacheComponents; `force-static` is the applicable config.
- /robots.txt and /sitemap.xml need explicit PUBLIC_PATHS entries, since the
  proxy matcher excludes only four image extensions.
- A prerendered route cannot call env() — full schema validation runs during
  `next build`, where four required secrets are deliberately unset.
- JSON-LD needs no injection sink: React 19 does not escape <script> text
  children, so the usual `dangerouslySetInnerHTML` advice would have taken the
  first exemption against a semgrep rule with zero occurrences, for nothing.
- The canonical origin is a constant, and that is not a NEXT_PUBLIC evasion:
  metadata is server-rendered into <head> and reaches the browser as HTML.

Its evals are built around the two prompts a generic frontend or SEO skill
answers confidently and wrongly — "put the metadata files with the other
marketing files" and "add NEXT_PUBLIC_SITE_URL for the canonical base".

Routing is reciprocal, per step 6 of the add-a-skill checklist: the four
existing frontend skills now name landing-page, not just the reverse. One-way
routing loses the trigger to whichever neighbour was already answering.

Both inventory tables picked the skill up from `make skills-check` with no hand
editing — the first time that generator has earned its keep.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…rdrail layers

Layer 1, live: a checked-in `.mcp.json` declaring the AWS MCP Server behind
`mcp-proxy-for-aws-cli` with `--read-only`, so write-capable tools are never
offered to the agent at all. SigV4 rather than OAuth, because read-only mode,
multi-profile switching and a default region all require it.

Only the `aws` server is declared here. Terraform's arrives through its plugin,
which ships a config its vendor maintains — a guessed uvx package name fails
silently at session start, and the failure looks like the server simply not
appearing. The AWS invocation is verbatim from AWS's own setup documentation.

Layer 2, written and validated but NOT APPLIED: `DenyMutationViaMCP` as an
eighth statement in the existing `platform_admin_guard` inline policy, plus a
`PlatformReadOnly` permission set so the proxy can stop running as an admin
credential. Two deliberate asymmetries with its neighbours, both commented in
place: it is not scoped to the prod prefix, because it protects the account
from an agent rather than prod from a developer; and it denies `iam:*` rather
than the narrow prod-role set, because an agent that can edit IAM can remove
the statement. Applying it is a human action.

`ProdDataReadOnly` was the obvious candidate for the proxy's identity and is
not usable: its five Allow statements cover the lake, `rds-db:connect`,
`eks:Describe*` and logs, so it cannot list buckets or read Budgets — most of
what introspection actually asks.

Layer 3, live: a PreToolUse Bash guard, because the IAM condition keys exist
ONLY on MCP-routed requests and leave `aws s3 rm`, `terraform apply` and
`kubectl delete` entirely untouched. Deny the unambiguously destructive, ASK on
anything else mutating, pass reads silently — `ask` rather than `deny` because
a guard that blocks legitimate work gets disabled, and a disabled guard
protects nothing. Observed against thirteen cases; two real defects surfaced
and were fixed:

- `terraform -chdir=... apply` escaped the deny, because the pattern did not
  allow flags between the binary and the subcommand. The single most
  destructive command was landing in `ask`.
- `AWS_PROFILE=er-builder aws s3 cp` passed silently, because the generic sweep
  anchors on `^aws` and a leading env assignment defeats it. Leading
  assignments are now stripped before matching — which also closes the general
  bypass of prefixing any guarded command with a variable.

er-builder gets identity-based treatment rather than verb-based: it is the
never-expiring AdministratorAccess static key, Layer 2 cannot reach it (the
deny lives on a permission set, not an IAM user's key), so anything that is not
plainly a read escalates.

Tier 2: `aws-core` and `terraform` plugins, with eight of aws-core's thirteen
skills hidden via skillOverrides — three are the wrong IaC tool for a
Terraform-only repo, one is for a service the stack does not use, and four are
SDKs for languages that are not here. CLAUDE.md states the Terraform-only rule
at the top level where the plugin's documentation search cannot miss it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The rebase onto main brought W0.5b, which revived tests/e2e — so the
frontend-testing skill, the generated tiers table and the generator that
produces it were all still asserting the opposite within minutes of being
written. Exactly the drift the generated blocks exist to prevent, caught here
only because a rebase surfaced it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`uniq -c` pads its count to a different width on BSD and GNU — macOS emits
`   9 aws_iam_role`, GNU emits `      9 aws_iam_role`. `gen_aws_footprint`
passed that padding straight through, so every line of the resource block
differed by leading whitespace between a Mac and CI. The gate failed with
exactly 63 insertions and 63 deletions on a commit that regenerated
byte-identically on the machine that produced it, and on a clean clone of the
same branch.

Same class as the LC_ALL collation bug this script already guards against at
the top: a generated artifact whose bytes depend on the developer's platform is
a gate that cannot be green for everyone at once. The rule that falls out — any
generator shelling out to a coreutil pins its own formatting rather than
inheriting the tool's — is now written beside the fix.

The sort moves to per-key modifiers (`-k1,1nr -k2,2`) at the same time. A
global `-rn` makes key 2 numeric as well, so every resource name parses as 0
and equal-count rows fall back to sort's last-resort rule; per-key keeps the
count numeric-descending and makes the name a plain ascending string sort,
which is total because the names are unique after `uniq`.

The drift check now prints the diff CONTENT, capped at 60 lines, not just
`--stat`. A stat line cannot distinguish "someone forgot to commit the regen"
from "this generator emits different bytes on your machine than on CI" — and
the second is invisible locally, because locally it always agrees with itself.
Verified by regenerating all ten targets under both BSD and GNU: byte-identical.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 4e40cda into main Oct 22, 2026
17 checks passed
athvin added a commit that referenced this pull request Oct 22, 2026
… files (#271)

`git diff --quiet HEAD -- "${generated_files[@]}"` was right while every target
was a generated-only reference. It stopped being right in #255, when CLAUDE.md
and docs/agent-skills.md joined that array: both are mostly hand-written prose,
so ANY in-progress edit to either — a sentence in the authoring rules, a line in
the gate table — failed with "generated skill references are stale" while every
GENERATED block was byte-identical to HEAD.

That is the false-positive mirror of the rule this repo already keeps about
false greens, and it is worse than it sounds: the failure names the right file
with the wrong reason, so the obvious response is to re-run the generator, which
changes nothing, and the next response is to stop believing the gate.

The check now extracts the BEGIN/END blocks from HEAD and from the worktree and
compares only those. Still HEAD-relative, so a `git add` cannot launder a stale
file. A deleted block is still caught, because the markers are included in the
extraction. The failure output is now a real unified diff of the block, labelled
HEAD/ vs regenerated/, instead of a `126 ++---` stat line.

One subtlety worth writing down, because testing it wrong is easy: `check` runs
regen BEFORE it diffs, so hand-editing a block proves nothing — the edit is
overwritten and the gate passes. What it detects is a SOURCE change that makes
committed output wrong. Verified against both: a new `resource "aws_sns_topic"`
surfaced as `+ 1 aws_sns_topic` in footprint.md, and removing the campaigns
screen from the axe gate's SCREENS moved it from swept to unswept in
screens.md. Prose edits to CLAUDE.md and docs/agent-skills.md now pass.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants