@su-sws/synthetic-web-team 0.1.0

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/AGENTS.md +149 -0
  2. package/README.md +321 -0
  3. package/package.json +58 -0
  4. package/packages/cli/bin/sws.mjs +722 -0
  5. package/packages/cli/src/axe.mjs +164 -0
  6. package/packages/cli/src/browser.mjs +192 -0
  7. package/packages/cli/src/checks.mjs +1254 -0
  8. package/packages/cli/src/github.mjs +131 -0
  9. package/packages/cli/src/history.mjs +137 -0
  10. package/packages/cli/src/perf.mjs +245 -0
  11. package/packages/cli/src/preflight.mjs +185 -0
  12. package/packages/cli/src/report.mjs +315 -0
  13. package/packages/cli/src/states.mjs +556 -0
  14. package/packages/wizard/bin/wizard.mjs +767 -0
  15. package/packages/wizard/src/detect.mjs +135 -0
  16. package/packages/wizard/src/emit.mjs +553 -0
  17. package/skills/role-accessibility-lead/SKILL.md +183 -0
  18. package/skills/role-api-architect/SKILL.md +65 -0
  19. package/skills/role-backend-developer/SKILL.md +66 -0
  20. package/skills/role-compliance-officer/SKILL.md +73 -0
  21. package/skills/role-content-designer/SKILL.md +145 -0
  22. package/skills/role-devops/SKILL.md +200 -0
  23. package/skills/role-discoverability/SKILL.md +164 -0
  24. package/skills/role-frontend-developer/SKILL.md +167 -0
  25. package/skills/role-fullstack-developer/SKILL.md +56 -0
  26. package/skills/role-identity-engineer/SKILL.md +77 -0
  27. package/skills/role-information-architect/SKILL.md +136 -0
  28. package/skills/role-infrastructure-architect/SKILL.md +60 -0
  29. package/skills/role-qa-engineer/SKILL.md +81 -0
  30. package/skills/role-security-operations/SKILL.md +56 -0
  31. package/skills/role-software-architect/SKILL.md +75 -0
  32. package/skills/role-staff-technical-architect/SKILL.md +73 -0
  33. package/skills/role-strategist/SKILL.md +122 -0
  34. package/skills/role-user-researcher/SKILL.md +66 -0
  35. package/skills/role-ux-designer/SKILL.md +159 -0
  36. package/skills/sws-compliance-check/SKILL.md +153 -0
  37. package/skills/sws-decanter/SKILL.md +191 -0
  38. package/skills/sws-deploy/SKILL.md +162 -0
  39. package/skills/sws-diverge/SKILL.md +131 -0
  40. package/skills/sws-github/SKILL.md +171 -0
  41. package/skills/sws-install/SKILL.md +97 -0
  42. package/skills/sws-netlify/SKILL.md +110 -0
  43. package/skills/sws-onboard/SKILL.md +85 -0
  44. package/skills/sws-preflight/SKILL.md +87 -0
  45. package/skills/sws-prior-art/SKILL.md +137 -0
  46. package/skills/sws-vercel/SKILL.md +117 -0
  47. package/standards/fragments/global-footer.yml +137 -0
  48. package/standards/fragments/identity-bar.yml +180 -0
  49. package/standards/hosting/capabilities.yml +215 -0
  50. package/standards/hosting/github-pages.yml +306 -0
  51. package/standards/hosting/netlify.yml +234 -0
  52. package/standards/hosting/vercel.yml +284 -0
  53. package/standards/patterns/components.md +162 -0
  54. package/standards/patterns/content.md +130 -0
  55. package/standards/patterns/decanter.md +352 -0
  56. package/standards/patterns/discoverability.md +121 -0
  57. package/standards/patterns/forms.md +116 -0
  58. package/standards/patterns/ia.md +126 -0
  59. package/standards/patterns/motion.md +267 -0
  60. package/standards/patterns/sws-conventions.md +225 -0
  61. package/standards/policy/accessibility.md +241 -0
  62. package/standards/policy/brand.md +213 -0
  63. package/standards/policy/escalation.md +53 -0
  64. package/standards/policy/identity.md +96 -0
  65. package/standards/policy/minsec.md +119 -0
  66. package/standards/policy/minweb.md +87 -0
  67. package/standards/policy/privacy.md +114 -0
  68. package/standards/policy/procurement.md +79 -0
  69. package/standards/prior-art/README.md +205 -0
  70. package/standards/prior-art/catalog.yml +409 -0
  71. package/standards/prior-art/patterns/INDEX.md +53 -0
  72. package/standards/prior-art/repos.yml +734 -0
  73. package/standards/recipes/astro-ssr/RECIPE.md +274 -0
  74. package/standards/recipes/astro-ssr/acceptance.yml +168 -0
  75. package/standards/recipes/astro-static/RECIPE.md +468 -0
  76. package/standards/recipes/astro-static/acceptance.yml +800 -0
  77. package/standards/recipes/next-ssr/RECIPE.md +407 -0
  78. package/standards/recipes/next-ssr/acceptance.yml +187 -0
  79. package/standards/scope.md +111 -0
  80. package/standards/stack/performance-budget.yml +95 -0
  81. package/standards/stack/reference-versions.yml +168 -0
  82. package/standards/stack/requirements.yml +154 -0
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: role-devops
3
+ description: Set up and run the delivery pipeline for a Stanford site. Use for repository setup, CI workflows, deployment, environment and secret handling, dependency updates, the test harness, and wiring the advisory compliance checks.
4
+ ---
5
+
6
+ # Delivery and operations
7
+
8
+ Repository, CI, deployment, and the automated quality gates. See `sws-deploy` for
9
+ the deployment mechanics and launch checklist. This skill covers the pipeline
10
+ around it and the operational obligations after launch.
11
+
12
+ ## Repository setup
13
+
14
+ Keep it boring and legible. Someone who is not a developer may need to edit a
15
+ page here.
16
+
17
+ - **`main` is the deploy branch.** No branch strategy to learn.
18
+ - **No branch protection, no required status checks, no protected environment
19
+ beyond `github-pages`.** Each of those silently converts push-to-main into a
20
+ pull-request requirement. If a project already has them, leave them and report;
21
+ someone may have added them deliberately.
22
+ - **`.gitignore` covers `node_modules`, build output, `.sws/prior-art.local.yml`**
23
+ (a local index that must never be committed) **and `.sws/axe-results.json`**
24
+ (derived from a build; committing it lets a stale pass travel with the repo).
25
+ Anchor the `.sws` patterns with `**/` if the site lives in a subdirectory — a
26
+ leading-slash pattern only matches at the repo root, which bit this project.
27
+ - **Dependabot on**, grouped, weekly. This is part of the MinSec patch cadence
28
+ rather than housekeeping.
29
+ - **A README that says what the site is, who owns it, and how to edit it.** For
30
+ many Stanford repos the future maintainer is a person who has never used git.
31
+
32
+ ## The workflow
33
+
34
+ One file. Triggers on push to `main`, on pull requests, and manually. Deploy is
35
+ gated to `main`; checks run on both.
36
+
37
+ ```yaml
38
+ on:
39
+ push:
40
+ branches: [main]
41
+ pull_request:
42
+ workflow_dispatch:
43
+ ```
44
+
45
+ Full permissions block, Pages action versions, and the two gotchas
46
+ (`upload-pages-artifact@v4` excludes dotfiles; subpath deploys need `base`) are in
47
+ `sws-deploy`.
48
+
49
+ ## The report has to reach a reader
50
+
51
+ This is the part that gets designed wrong. A report nobody sees is worse than no
52
+ report, because it implies oversight that is not happening.
53
+
54
+ | Trigger | Destination |
55
+ |---|---|
56
+ | Push to `main` | Job summary via `$GITHUB_STEP_SUMMARY`, plus one long-lived **"Site health" issue updated in place**, plus the HTML report as an artifact |
57
+ | Pull request | Annotations on changed lines, one collapsible comment with score and trend, plus the artifact |
58
+
59
+ The job summary needs no permissions and renders formatted markdown on the run
60
+ page. A single issue rewritten rather than duplicated is findable by someone who
61
+ has never opened the Actions tab, notifies watchers, and keeps history in its own
62
+ edit trail.
63
+
64
+ `sws check` does all of this itself when it detects Actions. Three things to get
65
+ right, each of which silently disables a destination:
66
+
67
+ 1. **`issues: write` and `pull-requests: write`** in the workflow permissions.
68
+ 2. **`GITHUB_TOKEN` in the step's `env`.** It is *not* in the environment by
69
+ default. Without it the CLI skips publishing and says so on stdout.
70
+ 3. **Only ONE workflow should publish** — the one that built the site. A second
71
+ `sws check` running from the repository root has no build output, scores
72
+ meaninglessly low, and will overwrite the real report. Pass `--no-publish`
73
+ there. This project hit exactly that with its own secrets-gate job.
74
+
75
+ The score trend lives in the Site health issue body as an HTML comment, so it
76
+ needs no database, no artifact that can expire, and no committed file to
77
+ conflict. `--html` writes a standalone report for an artifact and `--badge`
78
+ writes shields.io endpoint JSON; put the badge inside the build output so it
79
+ deploys with the site.
80
+
81
+ ## Everything is advisory except one thing
82
+
83
+ **The job succeeds regardless of findings.** A separate, small, fast secrets job
84
+ is the only one allowed to fail.
85
+
86
+ The secrets message must differ by context. On a pull request, blocking stops the
87
+ leak from landing. On a push to `main` the commit is already in the remote's
88
+ history, so blocking only prevents publishing the credential on a public website.
89
+ Still worth stopping, but say it in this order: **rotate the credential now**,
90
+ because blocking the deploy does not un-leak it, then clean the history, then
91
+ push again. "Secret detected" alone teaches nothing and gets worked around.
92
+
93
+ ## Secrets do not live in `.env` in production
94
+
95
+ SWS uses HashiCorp Vault: `netlify-plugin-vault-variables` in the Storyblok
96
+ family, `node-vault` in the decoupled Drupal family. Follow that rather than
97
+ introducing a new pattern.
98
+
99
+ Consequence worth knowing: MinWeb's "no API keys in Git" requirement is largely
100
+ handled institutionally, which makes our secrets check a backstop rather than the
101
+ primary control. That is a good position to be in and it does not mean the check
102
+ is redundant.
103
+
104
+ ## The test harness
105
+
106
+ **Playwright plus `@axe-core/playwright`** against every route in the built
107
+ output, asserting zero violations tagged `wcag2a`, `wcag2aa`, `wcag21a`,
108
+ `wcag21aa`.
109
+
110
+ The CLI ships this. Install the two packages plus a browser in the project, then
111
+ run it as its own CI step **after the build and before `sws check`**:
112
+
113
+ ```bash
114
+ npm i -D @playwright/test @axe-core/playwright
115
+ npx playwright install chromium
116
+ sws a11y # writes .sws/axe-results.json; always exits 0
117
+ sws perf # writes .sws/perf-results.json; always exits 0
118
+ sws check # reads both
119
+ ```
120
+
121
+ **The performance budget is bytes, not Lighthouse.** `sws perf` measures
122
+ first-party uncompressed transfer bytes and request counts per route against
123
+ `standards/stack/performance-budget.yml`. A Lighthouse score moves ten points
124
+ between runs on a shared CI runner, and a self-moving number inside a trended
125
+ compliance score teaches people to ignore the score. Navigation timings are
126
+ recorded but never scored.
127
+
128
+ It also lists **third-party origins**, which is a privacy signal as much as a
129
+ performance one: MinPriv treats a new third-party service as disclosable. Any
130
+ limit can be overridden in `.sws/manifest.yml` under `performance_budget:` with
131
+ a reason, and the report says which limits were overridden.
132
+
133
+ `sws check` deliberately does not launch a browser, so it stays fast and
134
+ installable anywhere. Keep axe a separate step: a browser download failure is
135
+ legible on its own line and invisible inside a compliance report. Never commit
136
+ `.sws/axe-results.json` — results older than the build report as `unknown`.
137
+
138
+ Playwright is the forward default even though `adapt-stanford-homesite`,
139
+ `adapt-directory`, and `ccc-bulletin` all run Cypress with e2e and component
140
+ testing. **Never convert an existing Cypress suite** to match.
141
+
142
+ Two things the harness must get right:
143
+
144
+ 1. **Report `unknown`, not `pass`, when a check cannot run.** axe needs a real
145
+ browser. A harness that prints "0 violations" because axe failed to load is a
146
+ report that lies, and this has actually happened here.
147
+ 2. **No component workshop.** These sites have few components and one consumer.
148
+ Vitest plus `axe-core` covers component-level assertions if a component set
149
+ ever earns real reuse.
150
+
151
+ `ccc-bulletin` runs BackstopJS for visual regression, the only instance across
152
+ SWS. Worth knowing about, not worth requiring.
153
+
154
+ ## Environments
155
+
156
+ Keep the matrix small. For a static site: local, preview, production. Note that
157
+ **GitHub Pages serves one site, so there are no per-PR previews** without
158
+ machinery we do not build. Netlify and Vercel give them free, which is a real
159
+ reason to move once review matters.
160
+
161
+ Record what actually resolved at install time in `.sws/manifest.yml`. Record, do
162
+ not enforce: recipes install latest and pin nothing, so the manifest is
163
+ provenance rather than a gate.
164
+
165
+ ## After launch, which is also yours
166
+
167
+ MinSec applies to low-risk static sites too, and this is the part people assume
168
+ does not apply. The full cadence is in `standards/policy/minsec.md`; the short
169
+ version is patch high-severity within 7 days and others within 90, monthly
170
+ scanning, quarterly inventory, quarterly privilege review, and **MFA or
171
+ SSO-with-MFA on every administrative login** per
172
+ `standards/policy/minweb.md`.
173
+
174
+ Dependabot covers part of the patch cadence. The rest is a documented runbook and
175
+ a named human, and it lives at the infrastructure layer rather than in the repo.
176
+ Write the runbook; do not assume someone remembers.
177
+
178
+ **Secure sunset** gets forgotten and matters: remove DNS, revoke credentials,
179
+ archive or delete content, kill dangling CNAMEs. Ask the strategist for the
180
+ sunset plan on any campaign or event site.
181
+
182
+ ## Artifacts
183
+
184
+ | Artifact | Path |
185
+ |---|---|
186
+ | Workflows | `.github/workflows/` |
187
+ | Deploy configuration | `netlify.toml` or equivalent |
188
+ | Environment matrix | `docs/ops/environments.md` |
189
+ | Operations runbook | `docs/ops/runbook.md` |
190
+ | Manifest | `.sws/manifest.yml` |
191
+
192
+ ## A note on making git invisible
193
+
194
+ For units with non-technical editors, the two paths that work are the **GitHub
195
+ web UI** (edit, commit to `main`, site updates) and a **CMS** where publishing
196
+ fires a webhook and the editor never touches GitHub at all.
197
+
198
+ If the site has content editors who are not developers, raise the CMS path early.
199
+ It changes who can maintain the site, which outlasts every technical decision in
200
+ this document.
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: role-discoverability
3
+ description: Make a Stanford site findable, in search engines and AI answer engines. Use for metadata, structured data, sitemaps, robots.txt, AI crawler policy, site search integration, or when someone asks about SEO, GEO, AEO, llms.txt, or getting cited by ChatGPT.
4
+ ---
5
+
6
+ # SEO and GEO
7
+
8
+ Full evidence-graded doctrine with sources and confidence markers in
9
+ `standards/patterns/discoverability.md`. Read it before making claims, because
10
+ this is the most hype-saturated area in the project and the citations are what
11
+ end an unproductive argument.
12
+
13
+ ## The short version
14
+
15
+ Four things drive inclusion in AI answers, per the largest available
16
+ meta-analysis: **be crawlable, rank in conventional search, answer the question
17
+ directly, and do not suppress your own snippets.** Everything else is
18
+ second-order.
19
+
20
+ Good SEO plus clean semantic HTML is most of GEO. That is unsatisfying and it is
21
+ what the evidence says.
22
+
23
+ ## Do the SEO properly
24
+
25
+ - **Unique title and meta description** on every page.
26
+ - **Correct heading hierarchy.** One `h1`, no skipped levels.
27
+ - **Canonical URLs**, which requires `site` set in the framework config. Missing
28
+ it is the most common failure and it silently breaks the sitemap too.
29
+ - **`sitemap.xml`**, via `@astrojs/sitemap` or the Next equivalent.
30
+ - **Internal linking** with descriptive link text.
31
+ - **Core Web Vitals budget** in CI.
32
+ - **Stable URLs.** See `role-information-architect`; changing a URL is a
33
+ migration.
34
+
35
+ ## Structured data, for rich results and not for AI
36
+
37
+ Ship JSON-LD: `EducationalOrganization` or `Organization`, plus `Course`,
38
+ `Event`, `Person`, `BreadcrumbList` as applicable.
39
+
40
+ **Google states plainly (May 2026) that no special markup, schema, AI text file,
41
+ or Markdown is needed to appear in generative AI features.** Structured data is
42
+ for rich results. Observational studies find 65 to 71 percent of AI-cited pages
43
+ carry schema, but that is confounded: schema correlates with sites that are
44
+ simply better built.
45
+
46
+ So implement it, and **record internally that it is not an AI-citation lever**,
47
+ so nobody claims credit for it later. Being straight about this is more valuable
48
+ than the markup.
49
+
50
+ ## AI crawlers come in three kinds
51
+
52
+ The most useful operational fact, because the choice is not binary.
53
+
54
+ | Purpose | OpenAI | Anthropic | Perplexity | Google |
55
+ |---|---|---|---|---|
56
+ | Training | `GPTBot` | `ClaudeBot` | `PerplexityBot` | `Google-Extended` (token only) |
57
+ | Search index | `OAI-SearchBot` | `Claude-SearchBot` | — | `Googlebot` |
58
+ | User-triggered | `ChatGPT-User` | `Claude-User` | `Perplexity-User` | `Google-Agent` |
59
+
60
+ Allowing `OAI-SearchBot` while disallowing `GPTBot` means visible in ChatGPT
61
+ search, excluded from training. Officially supported.
62
+
63
+ Two traps: **`Google-Extended` and `Applebot-Extended` are robots.txt tokens, not
64
+ crawlers**, so they never appear in logs. And **there is no Copilot user agent**,
65
+ because Copilot is fed by `Bingbot`, so blocking it blocks Bing search.
66
+
67
+ **Write an explicit `robots.txt`.** Only about 8 percent of sites with a
68
+ robots.txt have any AI rules, so silence is a default rather than a decision.
69
+ Allow the retrieval and user-triggered bots. Treat training crawlers as a **unit
70
+ policy decision**, not something we impose: for public-mission content there is
71
+ little reason to block, while licensed library content, embargoed theses, and
72
+ anything with student data should be behind authentication regardless of bot.
73
+
74
+ Note that robots.txt is a preference, not a control. `Bytespider` has been
75
+ observed crawling disallowed paths, and Perplexity operates undeclared stealth
76
+ crawlers. Enforcement needs WAF or edge rules.
77
+
78
+ ## Structure for extraction
79
+
80
+ The one practice with real evidence: **a direct one- or two-sentence answer at
81
+ the top of the page.** Roughly 44 percent of LLM citations come from the first 30
82
+ percent of a document.
83
+
84
+ Then: clear H2 and H3 hierarchy, short paragraphs, dated pages, named authors,
85
+ and **canonical facts in HTML text rather than only in a PDF or a JS-rendered
86
+ component.** A PDF-only tuition figure is invisible to search and to AI.
87
+
88
+ This overlaps almost entirely with `role-content-designer`. That is the point.
89
+
90
+ ## `llms.txt` belongs on documentation sites only
91
+
92
+ Across 500 million AI bot visits in a 90-day window, only 408 targeted
93
+ `llms.txt`. 97 percent of published files receive zero requests. No major AI lab
94
+ has committed to reading it.
95
+
96
+ But **IDE coding agents fetch it routinely** (Cursor, Claude Code, Copilot,
97
+ Cline, Aider), which is why Stripe, Vercel, and Anthropic ship one.
98
+
99
+ So: `llms.txt` on a docs site, for the agent audience. **Not on a unit marketing
100
+ site**, where it signals a misunderstanding. Never present it as an SEO or GEO
101
+ tactic.
102
+
103
+ ## What to push back on
104
+
105
+ **The "+40 percent GEO visibility" figure.** The underlying KDD '24 paper is real
106
+ and peer-reviewed. The first critical survey (Sciences Po, July 2026) reviewed 45
107
+ studies and found the number is a relative maximum on one metric in one fixed
108
+ configuration, that **no reviewed GEO technique shows a stable, longitudinal,
109
+ cross-platform causal effect**, and that GEO rewrites can **cut AI retrieval by 16
110
+ percent**. Cite it.
111
+
112
+ **Q&A and FAQ blocks added for AI citation** measure slightly *negative*.
113
+
114
+ **"4.3x more likely if fresh"** is an unsourced inflation of a real ~25.7 percent
115
+ effect.
116
+
117
+ **Correlation tables sold as ranking factors** are observational data from
118
+ vendors selling monitoring tools.
119
+
120
+ **`ai.txt`, `noai`, and Cloudflare's Content Signals** are unenforced
121
+ preferences. John Mueller said Content Signals has no effect for any crawler.
122
+ **IETF `aipref`** has drafts and no RFC. Track all of it, build on none of it.
123
+
124
+ **Do not name or rank a GEO vendor.** State the obligation, name the office.
125
+
126
+ ## Google's AI Overviews opt-out exists. Do not use it.
127
+
128
+ A Search Console toggle launched June 2026 excludes a property from AI Overviews
129
+ and AI Mode without affecting normal Search. The Gemini app is excluded from the
130
+ opt-out.
131
+
132
+ Recommend against it for Stanford. A 51-institution study found a **35 percent
133
+ brand-mention rate but only 10.5 percent owned-domain citation**, a 24.5-point
134
+ gap, and only about a third of institutions have any AI-search strategy.
135
+ Stanford's problem is too few citations to stanford.edu, not too many.
136
+
137
+ ## Site search
138
+
139
+ Below roughly fifty pages, good navigation beats search. Above that:
140
+
141
+ - **Algolia DocSearch** is the default. Free for public education content, no
142
+ crawler to run. v5 also ships a first-party Ask AI side panel.
143
+ - **`algoliasearch` plus `react-instantsearch`** when you need faceting beyond
144
+ DocSearch. Four SWS repos use this, including `react-instantsearch-nextjs` for
145
+ App Router.
146
+ - **Coveo** only when enterprise unified search is genuinely warranted. It is
147
+ sales-gated and over-scoped for a unit site. `adapt-directory` is the reference.
148
+
149
+ Design the zero-results and empty states. That is where search gets judged.
150
+
151
+ ## Artifacts
152
+
153
+ | Artifact | Path |
154
+ |---|---|
155
+ | Metadata and structured data plan | `docs/seo.md` |
156
+ | `robots.txt` | `public/robots.txt` |
157
+ | Search configuration | `docs/search.md` |
158
+
159
+ ## One action item with a deadline
160
+
161
+ From **15 September 2026** Cloudflare blocks Training and Agent bots by default
162
+ for new domains and all existing free-tier customers. Any Stanford site on
163
+ Cloudflare free tier may be silently opted into blocking. Check the zone settings
164
+ before that date so it is a decision rather than a discovery.
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: role-frontend-developer
3
+ description: Build the front end of a Stanford site. Use when writing components, templates, layouts, or styles; setting up Astro or Next; wiring Tailwind and Decanter; handling images, fonts, and performance; or reviewing front-end code.
4
+ ---
5
+
6
+ # Front-end development
7
+
8
+ Astro or Next, Tailwind 4 through Decanter 8, static output. See `sws-decanter`
9
+ for the styling mechanics and `sws-deploy` for CI and hosting. This skill is
10
+ about how to write the code.
11
+
12
+ ## Semantic HTML is the whole accessibility foundation
13
+
14
+ Component conventions, the no-workshop decision, and the state inventory are in
15
+ `standards/patterns/components.md`.
16
+
17
+ Most accessibility failures are a `div` that should have been a `button`.
18
+
19
+ - **Real elements before ARIA.** A `button` is focusable, keyboard-operable, and
20
+ announced correctly for free. `<div role="button">` needs `tabindex`, key
21
+ handlers, and still behaves worse.
22
+ - **Landmarks on every page**: `header`, `nav`, `main`, `footer`. One `main`.
23
+ - **One `h1`**, no skipped levels. Heading level is structure, not size.
24
+ - **Lists for lists**, including navigation.
25
+ - **ARIA only when no element exists.** Bad ARIA is worse than none, and the
26
+ first rule of ARIA is not to use it.
27
+
28
+ Reach for `react-aria` or a headless library when building genuinely complex
29
+ widgets like combo boxes or date pickers. `sulgryphon-nextjs` uses `react-aria`
30
+ and is the strongest accessibility signal across SWS repos. Note there is no
31
+ house headless library, so pick one per project rather than mixing.
32
+
33
+ ## Astro specifics
34
+
35
+ **Default to zero JavaScript.** Astro components render to HTML with no runtime.
36
+ Only add an island when something needs interactivity, and use the narrowest
37
+ directive that works: `client:visible` over `client:load`, `client:idle` over
38
+ `client:load`.
39
+
40
+ **`output: 'static'`** for Pages. `'hybrid'` no longer exists.
41
+
42
+ **Set `site`** in the config. Without it the sitemap emits nothing and canonical
43
+ URLs are wrong, which fails two acceptance criteria. This is the single most
44
+ common configuration miss.
45
+
46
+ **Set `base`** if deploying to a subpath, or internal links work locally and
47
+ break in production.
48
+
49
+ **Content collections** for anything repeated: news, people, programs, events.
50
+ Define a schema, get type safety and validation. Hand-maintained arrays of
51
+ frontmatter drift.
52
+
53
+ Run `astro check` as the typecheck step. `sws-astro` is the reference for config,
54
+ eslint, and island composition.
55
+
56
+ ## Next specifics
57
+
58
+ Static export forfeits `redirects`, `headers`, `rewrites`, Proxy, ISR, Server
59
+ Actions, Draft Mode, and default-loader image optimization. Route Handlers work
60
+ for `GET` only. Know that going in rather than discovering it.
61
+
62
+ `ccc-bulletin` is the reference for Next with Decanter 8 and Tailwind 4 through
63
+ `@tailwindcss/postcss`. Note the decoupled Drupal family deliberately runs
64
+ `--webpack` rather than Turbopack across all four repos. **That is a
65
+ point-in-time decision, not a forward choice** (confirmed with SWS 2026-09-01):
66
+ **Turbopack is the forward default for Next.js sites.** Recommend it for new
67
+ work. Do not convert an existing `--webpack` project just to match.
68
+
69
+ ## Conventions from the repos
70
+
71
+ **`cnbuilder`** for conditional classes on Astro and Storyblok projects, pinned
72
+ at `^3.1.0` across seven SWS repos. The decoupled Drupal family uses `clsx` plus
73
+ `tailwind-merge`. Both fine, one per project.
74
+
75
+ **Heroicons.** Not FontAwesome Pro: one repo uses it behind a licence-gated
76
+ preinstall token check, and a unit site inheriting that gets an install failure
77
+ and a licence nobody mentioned.
78
+
79
+ **npm, or yarn if the project already has it.** Never convert a project's package
80
+ manager. Advice about dependency overrides must be manager-aware, since npm
81
+ `overrides` and yarn `resolutions` differ.
82
+
83
+ ## Images, fonts, performance
84
+
85
+ **Images.** Use the framework's image component for local images so you get
86
+ dimensions, lazy loading, and modern formats. Always set width and height, or
87
+ explicit aspect ratio, to prevent layout shift. Under static export in Next, the
88
+ default image loader does not work and you need a custom one.
89
+
90
+ **Fonts.** Decanter ships no font assets. Import `fonts.css` or
91
+ `fonts-basic.css`. Preload the one or two faces above the fold and let the rest
92
+ load normally. `font-display: swap` unless you have a reason.
93
+
94
+ **Motion** uses the `motion` library, and the choice of entry point is a
95
+ budget decision. `motion/react` plus a React island measured **266.7 KB** of
96
+ JavaScript on this project's own docs page; the vanilla `motion` API
97
+ (`animate` + `inView`) measured **60.4 KB** for identical animation. Use the
98
+ React component when the project already has React, and the vanilla API when the
99
+ animation is the only reason you would add it. Pattern, values, and the
100
+ no-JavaScript trap: `standards/patterns/motion.md`.
101
+
102
+ **Performance budget** in CI, and treat it as a real number. These are
103
+ information sites; a department page that takes four seconds is a failure
104
+ regardless of what the design looks like. The wins are almost always: fewer
105
+ images, correctly sized; fewer islands; no client-side framework for static
106
+ content.
107
+
108
+ ## Do not
109
+
110
+ - Create `tailwind.config.js`, install `@astrojs/tailwind`, or install
111
+ `tailwindcss` directly. All three are v7 mental models;
112
+ `standards/patterns/decanter.md` has the reasoning and the full avoid-list.
113
+ - Install `@tailwindcss/forms` directly. In Decanter 8 it sits behind the
114
+ `decanter/forms` entry point, which a site with a form must `@import`
115
+ explicitly or the form silently renders unstyled.
116
+ - Hardcode Stanford hex values. Use the token.
117
+ - Remove a focus outline without replacing it with something better.
118
+ - Ship a hover or focus state whose only change is a colour. Add or remove an
119
+ underline: `hocus:underline`, or `hocus:no-underline` where the link is
120
+ underlined at rest. `sws a11y` measures this.
121
+ - Put canonical facts in an image, a PDF, or a client-rendered component.
122
+ - Add a component workshop. These sites have few components and one consumer.
123
+
124
+ ## Testing
125
+
126
+ Playwright plus `@axe-core/playwright` against every built route, asserting zero
127
+ violations tagged `wcag2a`, `wcag2aa`, `wcag21a`, `wcag21aa`. Run it with
128
+ `sws a11y` after the build. Playwright is the forward default even though three
129
+ SWS repos use Cypress; never convert an existing Cypress suite.
130
+
131
+ **If axe reports color-contrast failures with near-white foregrounds and ratios
132
+ close to 1, suspect an animation rather than a design defect.** axe reads
133
+ computed colour, so an element captured mid-fade measures the blend against its
134
+ backdrop. `sws a11y` waits for animations to settle for exactly this reason. A
135
+ hand-rolled harness that does not wait will report false positives on any page
136
+ with entry animations.
137
+
138
+ **`sws a11y` also measures hover and focus states**, which axe cannot: it audits
139
+ one static snapshot of the DOM, and a hover state does not exist in a snapshot,
140
+ so `hover:text-poppy-light` with nothing else in the rule reads as a clean page.
141
+ The runner moves a real mouse over each distinct control shape, presses a real
142
+ Tab key — Chromium only matches `:focus-visible` for keyboard focus, so a
143
+ scripted `.focus()` would report every `focus-visible:` utility as missing — and
144
+ diffs computed style, classifying each change as a colour or a non-colour cue.
145
+ Findings: `a11y.state.hover-non-color`, `a11y.state.focus-non-color`,
146
+ `a11y.state.focus-visible`. The fix is nearly always one class; the table is in
147
+ `standards/patterns/components.md`.
148
+
149
+ If a11y assertions are needed at component level, Vitest plus `axe-core` gets
150
+ there without a workshop. Reach for that when a component set earns real reuse.
151
+
152
+ ## Artifacts
153
+
154
+ Components, layouts, and config in the project. Plus:
155
+
156
+ | Artifact | Path |
157
+ |---|---|
158
+ | Performance budget | `docs/performance-budget.md` |
159
+ | Component inventory | `docs/components.md`, shared with `role-ux-designer` |
160
+
161
+ ## When reviewing front-end code
162
+
163
+ Look for the `div` that should be a `button`, the missing `site` config, a
164
+ hardcoded hex, a removed focus outline, a hover or focus state that is only a
165
+ colour change, an island that did not need to be one, an image without
166
+ dimensions, and a heading level chosen for its size. That list catches most of
167
+ what actually goes wrong.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: role-fullstack-developer
3
+ description: End-to-end development across front end and back end on a Stanford site. Use when one person owns the whole stack, or for questions spanning both layers. PARTIALLY IMPLEMENTED: the front-end half ships today, the server-side half does not.
4
+ ---
5
+
6
+ # Full-stack development
7
+
8
+ **Status: stub, and half of it already exists.** `role-frontend-developer` ships
9
+ in v1 and covers the client layer completely. The server-side half is
10
+ `role-backend-developer`, which is a stub until v2.
11
+
12
+ For most SWS unit sites the front-end role plus a CMS is the whole job, so start
13
+ there and only come back here if there is genuinely server-side work.
14
+
15
+ ## Use the specific roles instead
16
+
17
+ This role exists because "full stack" is how many SWS engineers describe
18
+ themselves, not because the guidance differs. Prefer:
19
+
20
+ - `role-frontend-developer` for anything rendered
21
+ - `role-backend-developer` for server logic, when v2 lands
22
+ - `role-devops` for pipeline, deployment, and operations
23
+ - `role-identity-engineer` before writing any authentication
24
+
25
+ ## What is genuinely full-stack judgment
26
+
27
+ The part that does not live in either half:
28
+
29
+ **Where does this logic belong.** Default to build time. Astro renders components
30
+ to HTML with no runtime, so most "dynamic" requirements on a university site are
31
+ build-time data problems. Ask what actually changes per request, and often nothing
32
+ does.
33
+
34
+ **What crosses the boundary.** Every piece of data that moves from server to
35
+ client is a payload cost and a potential privacy question. On a Stanford site, ask
36
+ whether the client needs it at all before shipping it.
37
+
38
+ **Where the compliance tier is set.** This is the one you can accidentally change
39
+ without noticing. Adding a form that collects personal data, or an authenticated
40
+ route, moves a site from `low` to `moderate` and attaches Duo, centralised
41
+ logging, secure SDLC, training, and backups. That is a tier change rather than a
42
+ feature and it needs flagging before implementation.
43
+
44
+ **What you are now responsible for patching.** Every server-side dependency joins
45
+ the MinSec cadence: high-severity within 7 days, others within 90, monthly
46
+ scanning. A static site has almost none of this. A Node service has a lot.
47
+
48
+ ## Practical advice for one person owning everything
49
+
50
+ Keep the surface small on purpose. The most maintainable Stanford site is a static
51
+ build from a CMS, deployed on push, with no server you own. Every deviation from
52
+ that should be a decision you can defend in eighteen months when you have
53
+ forgotten the context.
54
+
55
+ Record those decisions. `sws-diverge` explains where, and the record is what makes
56
+ the site legible to whoever inherits it.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: role-identity-engineer
3
+ description: Stanford authentication and authorisation. Use when a site needs login, SSO, SAML, OIDC, Shibboleth, Duo two-step, workgroup-based permissions, or any question about restricting content to certain people. NOT YET IMPLEMENTED as a full role, but read this before writing any auth code.
4
+ ---
5
+
6
+ # Identity, authentication, authorisation
7
+
8
+ **Status: stub. Full role lands in v2.** Static sites in v1 have no authenticated
9
+ surface by design.
10
+
11
+ Read this anyway before writing auth code, because improvising Stanford
12
+ authentication is one of the few places where getting it wrong has consequences
13
+ beyond a bad website.
14
+
15
+ ## Do not improvise this
16
+
17
+ Adding authentication changes the **compliance tier** from `low` to at least
18
+ `moderate`, which attaches real obligations: Duo for all users and admins,
19
+ centralised logging to Splunk, secure SDLC with code review and static analysis,
20
+ annual developer training, and weekly encrypted backups. If the site touches
21
+ regulated data it goes to `high` and requires a Data Risk Assessment before
22
+ deployment plus administrative access from a privileged access workstation.
23
+
24
+ So "add a login" is never a feature. Flag it as a tier change, name the
25
+ obligations, and route to UIT Security.
26
+
27
+ ## What is actually true at Stanford
28
+
29
+ The authoritative summary, including the OIDC constraints and the yearly RP
30
+ secret expiry, is `standards/policy/identity.md`. Repeated here because a stub
31
+ that makes you open another file to learn the one dangerous fact is a bad stub.
32
+
33
+ Verified as of August 2026, and worth knowing even in stub form:
34
+
35
+ - **SAML 2.0 via Shibboleth is the primary recommended path** for enterprise web
36
+ applications. Registration is self-service through SPDB. Typical stack is a
37
+ Shibboleth SP with Apache.
38
+ - **WebAuth is archived legacy.** Do not build against it.
39
+ - **OIDC is supported** by the same Shibboleth IdP, with real constraints:
40
+ confidential clients only, authorization code flow only, PKCE enforced in
41
+ production, user consent required for claim release, and the **RP secret
42
+ expires yearly**, which is an operational trap. Discovery at
43
+ `https://login.stanford.edu/.well-known/openid-configuration`.
44
+ - **Duo two-step is required for all applications.**
45
+ - **Authorisation is workgroup-based**, via Workgroup Manager and the Workgroup
46
+ API 2.0 (JSON), not by maintaining your own user lists.
47
+ - **MaIS Registry APIs** use x509 mutual TLS, with a CSR submitted to the MaIS
48
+ Certificate Manager and data-owner approval.
49
+
50
+ ## Prior art that exists today
51
+
52
+ `cardinalsites-nextjs` (`1.x` branch) is the only SAML implementation across the
53
+ SWS repos: `passport-saml`, `xml-encryption`, `jose`, plus `node-vault` for
54
+ secrets. It is the reference for this work and the key input to the v2 role. Note
55
+ its era is Decanter 7, so borrow the auth patterns and not the CSS.
56
+
57
+ **Which SDK, answered 2026-09-01.** `weblogin-auth-sdk` is **the preferred
58
+ package for all Stanford auth** — SAML, integrating with **Weblogin**, the
59
+ primary SSO. `adapt-auth-sdk` is SAML too but is **for alumni-based websites
60
+ only**. It appears in `adapt-directory` and `adapt-online-giving`; do not read
61
+ those usages as a general endorsement. See `standards/policy/identity.md`.
62
+
63
+ ## What to do now
64
+
65
+ 1. Say that authenticated Stanford applications are outside what this project
66
+ currently covers.
67
+ 2. Name the tier change and its obligations.
68
+ 3. Point at `cardinalsites-nextjs` as the working example.
69
+ 4. Route to UIT Security and the authentication service owners per
70
+ `standards/policy/escalation.md`.
71
+ 5. Do not hand-roll session handling, do not store Stanford credentials, and do
72
+ not build a local user table as a shortcut.
73
+
74
+ Also worth saying: often the right answer is not authentication at all. If the
75
+ requirement is "only our department should see this," a private repo, a
76
+ non-indexed path, or simply not publishing it may serve better than standing up
77
+ an SP.