auditmos-lp
AGENTS.md0 starsChanged 6 months agoISCView on GitHub
The auditmos.com landing page — Astro on Cloudflare Workers, static-first.
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 90
Prefer deep modules (Ousterhout): small interface hiding large implementation.
- Distinctive: line 131
Run manually before declaring done:
- Very specific: line 153
Never create separate md files for reviews/audits/analyses unless explicitly asked </important>
- Very specific: line 157
Run pnpm cf-typegen immediately to keep worker-configuration.d.ts in sync
- Very specific: line 158
Don't edit worker-configuration.d.ts by hand — it's auto-generated
- Very specific: line 159
Prefer custom_domain: true over routes with zone_name (see .claude/rules/cloudflare-deployment.md) </important>
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md 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
auditmos-lp
The auditmos.com landing page — Astro on Cloudflare Workers, static-first.
- PRD:
docs/prd-website-rebuild.md(GH #1) - Plan:
plans/website-rebuild.md— 7 phases (GH #2–#8) - Brand accent:
#04d9ff(Tailwind v4@themetoken) - Legal entity (footer, every page): Auditmos OÜ · Reg 17025406 · VAT EE102758111 · Narva mnt 13-27, 10151 Tallinn, Estonia
Stack
| Layer | Technology |
| Framework | Astro 6 (mostly prerender = true) |
| Adapter | @astrojs/cloudflare |
| Runtime | Cloudflare Workers (nodejs_compat) |
| Styling | Tailwind CSS v4 (@tailwindcss/vite) |
| Content | Astro Content Collections + Zod (projects) |
| API | Astro endpoints (src/pages/api/*.ts) — only /api/contact runs at request time |
| Resend (transactional) | |
| Anti-spam | Cloudflare Turnstile |
| Analytics | Cloudflare Web Analytics (no cookies, no consent banner) |
| Language | TypeScript (strict, @/* → src/*) |
| Linter | Biome 2 |
| Testing | Vitest |
| Dead-code | knip |
| Release | semantic-release |
| Package manager | pnpm 10 |
Project Structure
src/pages/— file-based routes (.astro,.md, or.tsfor endpoints). Most pages haveexport const prerender = true.src/pages/api/contact.ts— the only request-time route (Zod → Turnstile verify → Resend notify + confirm).src/pages/**/*.md.ts— markdown twin of every URL;src/pages/llms.txt.tsis the index for AI agents.src/content/projects/— Markdown source for theprojectscontent collection (Zod-validated at build).src/layouts/— shared layouts wrapping page slots.src/components/— reusable Astro components (organize by feature folder when groups emerge).src/assets/logos/— brand assets vendored fromgithub.com/auditmos/branding.src/styles/globals.css— Tailwind v4 entry (@import "tailwindcss";) +@themeblock with brand tokens.src/env.d.ts— declaresApp.Localstyped against CloudflareEnv.src/mail/— mail-security policy as data: the MTA-STS policy text and MX list, shared by the Worker that serves it and the tests that pin it.workers/mta-sts/— a second Worker, deployed separately tomta-sts.auditmos.com(pnpm deploy:mta-sts, ownwrangler.jsonc). It is not part of the site build and shares no bindings with it.worker-configuration.d.ts— auto-generated bypnpm cf-typegen, never edit. Gitignored, not committed:pnpm installregenerates it via thepreparescript, so a fresh clone gets one before the first typecheck. Its contents vary with your local.dev.vars, which is why committing it produced churn.- Path alias
@/*→src/*.
Commands
pnpm dev # dev server on http://localhost:3000
pnpm build # production build to ./dist
pnpm preview # preview the production build locally
pnpm deploy # build + wrangler deploy (dev worker)
pnpm deploy:staging # build with staging vars + deploy staging.auditmos.com
pnpm deploy:production # build with production vars + deploy auditmos.com
pnpm secrets:staging # push runtime secrets from .dev.vars.staging
pnpm secrets:production # push runtime secrets from .dev.vars.production
pnpm cf-typegen # regenerate Env types from wrangler.jsonc
pnpm agents:verify # scan production for agent-readiness regressions
pnpm agents:verify <url> # ...or any other deployed host
pnpm deploy:mta-sts # deploy the standalone MTA-STS policy Worker
pnpm mta-sts:verify # policy vs. live MX + the _mta-sts TXT id
pnpm security:gates # are the deferred security changes due yet?
pnpm csp:violations # watch production for CSP violations (Ctrl-C summarises)
pnpm csp:violations staging # ...or any configured env
pnpm new-project "<title>" # scaffold a new project MD with frontmatter prefilled
pnpm import-article [path] # publish an authored article.md to /work (asks for year, client, industry)
pnpm import-article --help # ...its flags, for a non-interactive run
pnpm test # vitest run
pnpm test:watch # vitest watch
pnpm test:coverage # vitest + v8 coverage
pnpm types # astro check + tsc --noEmit
pnpm lint # biome check .
pnpm lint:fix # biome check --write .
pnpm knip # unused files / deps / exports
pnpm deps # check minor + patch updates
pnpm deps:update # apply them
pnpm deps:major # show major updates
pnpm release # semantic-release (CI only)Architecture
Prefer deep modules (Ousterhout): small interface hiding large implementation. Test at module boundaries, not internals. See .claude/rules/deep-modules.md.
Technology-specific rules live in .claude/rules/. Activate automatically when touching relevant files — frontend/astro.md, frontend/tailwind-v4.md, api/astro-endpoints.md, api/cloudflare-workers.md, cloudflare-deployment.md, error-handling.md, atomic-imports.md, general.md.
Project-specific conventions
- Static-first: every page sets
export const prerender = trueexceptsrc/pages/api/contact.ts,src/pages/api/csp-report.ts(a report-only policy with nowhere to report cannot be validated before it is enforced, and a prerendered asset cannot read a POST body),src/pages/api/resend-webhook.ts(a signature must be verified against a raw POST body),src/pages/mcp.ts, and the two OAuth routes (src/pages/oauth/register.ts,src/pages/oauth/token.ts— issuing a credential is a cryptographic exchange over a POST body, which a prerendered asset cannot perform). Don't introduce new request-time routes without a reason documented in the PRD. Page routes pass through the Worker (see markdown negotiation below) but are still served from their prerendered asset — that is a routing hop, not a render, and it must stay that way. - Agent-readiness regressions:
pnpm agents:verify [url]scans a deployed host and diffs the result againstREQUIRED_CHECKSinscripts/agents-verify-lib.ts— the checks backed by something this site actually ships. Most scanner checks fail by design (OAuth discovery, A2A, WebMCP are not implemented), so a raw pass count means nothing; only the declared set is enforced. Run it after deploying. When you implement a new agent surface, add its check toREQUIRED_CHECKS— the script reports newly-passing checks asNEW PASSprecisely so the list does not drift behind reality. It also runs four wire-only checks — canonical redirects, the Web Analytics beacon,security.txt, and indexability — for the same reason the scanner half exists: each fails in the layer between the build and the browser, or on a clock rather than on a change, so no build artifact can describe them. The indexability check readsX-Robots-Tagoff the deployed homepage and demands the value the host's environment implies — production must not saynoindex(the accident that would silently deindex the site), every other host must (see the noindex bullet below). Thesecurity.txtcheck reportsRENEWwithout failing whenExpiresis within 30 days: the value is derived from the build, so any deploy renews it, and failing would block the fix. - MTA-STS lives in its own Worker, and that is not a style choice.
mta-sts.auditmos.commust serve one file and 404 everything else (#34). Binding it as a secondcustom_domainon the site Worker cannot achieve that: Workers Assets answers static assets before the Worker runs for any path outsideassets.run_worker_first, and that list matches on path, not host — so/og.png,/sitemap.xmland/_astro/*would be served there with the Worker never in the loop, giving site content a second URL. The only interception point would berun_worker_first: ["/*"], routing every asset of the main site through the Worker to tidy a subdomain. Henceworkers/mta-sts/, with the policy itself insrc/mail/mta-sts.tsso the file mail servers fetch has one source. Changing the policy needs two edits — the constant and a newidin the_mta-stsTXT record, sincemax_ageis a week and the id is the only re-fetch signal.pnpm mta-sts:verifycompares the served policy against live MX, which nothing in a build can do; undermode: enforcea mismatch refuses inbound mail. - Web Analytics is injected by the edge, not by the site. Cloudflare's RUM automatic injection adds the beacon as the response leaves for the browser, after the Worker has returned it. So the layout deliberately emits no analytics tag and
CLOUDFLARE_WEB_ANALYTICS_TOKENis read nowhere: a tag here would be a second beacon, double-counting every pageview while the numbers still looked plausible (#39). A build-output test assertsdist/contains no beacon, andpnpm agents:verifyasserts the deployed pages carry exactly one. Injection is gated on the requestAcceptheader — a barecurlsends a wildcardAcceptand gets a beacon-free page whether or not analytics works, which is the false negative that hid this for weeks. It is also zone-wide: staging reports under production's token, and the Worker cannot strip it, because it never sees it. - Markdown negotiation:
Accept: text/markdownon a page URL returns that page's markdown twin (src/site/markdown-negotiation.ts, wrapped around the adapter handler bysrc/worker.ts, which ismainin wrangler.jsonc). It only works becauseassets.run_worker_firstlists the page routes — otherwise the asset server answers first and the Worker never sees the request. Adding a page means adding both its URL forms torun_worker_first—/aboutand/about/, because those patterns match the path literally and the bare form does not claim the slash form (src/site/run-worker-first.tsencodes exactly what a pattern claims). A wildcard entry like/work/*spans both and needs no second line. Build-output tests fail when either form is missing. Both representations sendVary: Accept, so don't strip it — a shared cache would start handing markdown to browsers.pnpm devnever runs the Worker entry or the asset router, so negotiation always returns HTML there — verify withpnpm preview, which does. - Slash-free canonical URLs:
/about, never/about/. Three things enforce it and must move together —trailingSlash: "never"(astro.config.mjs, drives dev-server routing),assets.html_handling: "drop-trailing-slash"(wrangler.jsonc, makes the asset server serve the bare form instead of redirecting to the slash form), andcanonicalRedirect()(src/site/canonical-url.ts, first thing insrc/worker.ts). The third exists because the second only governs requests the asset server answers, andrun_worker_firstclaims every page route before it:/work/<slug>/used to answer 200 with the page body, a second reachable URL for the same document. The Worker 301s any trailing-slash URL to its canonical form for GET/HEAD, leaving other methods alone so a 301 cannot rewrite a POST to/api/contactor/mcpinto a GET. Changing one alone reintroduces a redirect hop on every internal link or a duplicate URL; build-output tests assert all three. The third only fires for pathsrun_worker_firstclaims, and those patterns match literally:/about/used to answerhtml_handling's 307 instead, because only/aboutwas listed — a temporary redirect consolidates no ranking signals, which is the entire point of the 301 (#38). Both forms are listed now. A build-output test asserts that, andpnpm agents:verifyre-checks it against a deployed host, because the failure lives in whether Cloudflare's asset router reaches the Worker at all — a fact no build artifact describes andpnpm devnever exercises. - Only production is indexable. Every build not explicitly stamped
CLOUDFLARE_ENV=productioncarriesX-Robots-Tag: noindex— in the generated_headers/*block and on everything the Worker renders (robotsTagForinsrc/site/security-headers.ts, one source for both surfaces). It exists because staging serves the same pages with canonicals pointing at production, and Google crawled them all into Search Console's "Alternate page with proper canonical tag" report (Aug 2026): a canonical tag cannot keep a host out of the crawl, onlynoindexcan. The default fails towardnoindex— an unset env is a preview build — so the dangerous direction (a noindex production) is guarded where it can be seen, by thepnpm agents:verifyindexability wire check. Don't addDisallowto staging's robots.txt as an "improvement": Google must be able to crawl a page to see its noindex; blocking the crawl would freeze the URLs in the report instead of draining them. - MD-mirror: a single page-enumerator helper is the source of truth for
*.md.tsendpoints and/llms.txt. Adding a new route extends both surfaces — a CI test asserts coverage. - MCP rate limit:
/mcpis unauthenticated, so it is rate limited by theMCP_RATE_LIMITERbinding (wrangler.jsonc,periodaccepts only 10 or 60).MCP_RATE_LIMITinsrc/mcp/server.tsis the single source for the number: the endpoint enforces it,initializereports it to clients, and/agents.jsonpublishes it. Change the constant and the binding together — a test asserts the advertised limit matches the constant, but nothing can catch the binding drifting from it. Note the limiter is permissive and eventually consistent by design: each isolate checks a locally cached counter, so an instantaneous concurrent burst can exceed the limit before counts propagate, and it is per Cloudflare location rather than global. It bounds sustained abuse, which is the actual threat here; it is not a hard quota. Verify it with sustained sequential requests — a parallel burst will show no 429s and look like a broken limiter./api/csp-reportand/api/resend-webhookare limited the same way (CSP_REPORT_RATE_LIMITER/CSP_REPORT_RATE_LIMITinsrc/csp/report-handler.ts,RESEND_WEBHOOK_RATE_LIMITER/RESEND_WEBHOOK_RATE_LIMITinsrc/resend/webhook-handler.ts) and carry the same caveat: change the constant and the binding together. - Resend delivery webhook:
/api/resend-webhookexists because Resend answers a suppressed send with200 OKand a message id — the identical response a delivered message gets. No amount of logging in/api/contactcan tell the two apart, because the outcome does not exist yet when Resend replies; a contact notification stayed invisibly dead for four days behind that 200 (#PRD component 14). The webhook is the only channel carrying the real outcome, soemail.bounced,email.failed,email.suppressedandsuppression.addedlog aterror— that severity mapping insrc/resend/webhook-handler.tsis the entire point of the endpoint, not decoration. It is signature-verified (Svix: HMAC-SHA256 overid.timestamp.body, keyed on the base64 body of thewhsec_secret, constant-time compare, five-minute replay window) and fails closed — noRESEND_WEBHOOK_SECRETmeans every request is refused, because an unverified sink lets anyone forge delivery events into the log you make on-call decisions from. The secret is issued per webhook endpoint, so it differs per environment; register the endpoint in the Resend dashboard for each env beforepnpm secrets:<env>, which now requires it. - Content Security Policy:
src/site/content-security-policy.tsowns the whole policy and the mode. It ships report-only — flipCSP_MODEto"enforce"once the sink has been quiet through a week of production traffic (#30). One header name serves both delivery surfaces on purpose:_headerscovers everything the asset server answers,withSecurityHeaders()fills the policy in on what the Worker renders itself, and it fills in rather than sets — overwriting a page's own policy would drop the script hashes and refuse every inline block. Inline-script hashes are derived from the emitted HTML byagentDiscoveryHeaders(), never written down: a stale hash fails closed, so a build-output test asserts every inline script indist/has a matching one. Adding an inline<script>needs no action; adding a third-party origin, or a new inlinestylesource, means editing the directives here. JSON-LD is deliberately unhashed (a data block is never CSP-checked), andstyle-srckeeps'unsafe-inline'because Shiki writes colours intostyleattributes, which hashes cannot govern. Watch for violations withpnpm csp:violations— it filterswrangler taildown to thecsp_violationwarnings and summarises on exit, but it streams live, so a quiet run only proves its own window was quiet; query Workers Logs for the period as a whole. Violations post to/api/csp-reportviareport-uri— notreport-to, which needs an absolute URL a static build cannot know per environment, and which Chrome would let silently supersedereport-uri. - Agent-discovery headers: the
agentDiscoveryHeaders()integration (src/site/discovery-headers.ts) generates the_headersfile after the build, advertising/llms.txtand each page's.mdtwin as RFC 8288Linkrelations. It appends to what@astrojs/cloudflarealready wrote, so it must stay after the adapter inintegrations. Don't hand-writepublic/_headersfor these — add the link there instead. - Redirects: static ones are declared in
astro.config.mjs.public/_redirectsis the exception and is hand-written on purpose — the Cloudflare adapter appends its generated rules to that file rather than replacing it, so hand-written rules stay first and win, and a wildcard (/projects/* → /work/:splat) can only live there: a dynamic destination declared in the config gets resolved to the file backing it (/work/:slug/index.html), which is not the canonical URL and 404s for the.mdtwins. Unlike_headers, this file is safe to edit. - Rendered Markdown:
src/styles/prose.cssstyles<Content />output and is imported by the page that renders it, not byglobals.css— the homepage renders no Markdown and has the least headroom under the transfer budget. Import it from any future Markdown-rendering page. Fenced blocks take their background from the Shiki theme (markdown.shikiConfigin astro.config.mjs), because Shiki inlines that colour and no rule here can outrank it. - Projects schema:
provenancedefaults toclient-work, which requiresclientas either{ name, url? }(public/named) or{ sector }(anonymised NDA work).internal-r-and-dforbidsclient. Every project explicitly declares one or more capabilities fromsoftware,security, andapplied-r-and-d; these drive the zero-JavaScript/workfilter and the related-work section on/r-and-d. - Article import:
pnpm import-articlemaps an externally authored launch article (thecontent-launchskill'sarticle.md) onto that schema. Title, slug, summary and technology tags come from the article; publication metadata covers year, provenance, capabilities, client (for client work), and industry, with flags for a non-interactive run. The leading H1 is stripped because/work/<slug>renders the title and summary itself. Article generation and editorial rewriting are outside the importer. - Contact endpoint atomicity:
/api/contactreturns 200 only when both emails (notification + confirmation) dispatched successfully. Partial sends → 502 with structured log. - OSS aggregator: must never fail the build. On GitHub API failure, fall back to cached file, then to empty list. The cache (
.cache/oss-projects.json) is gitignored: everypnpm build, and therefore everypnpm testthroughbuildSite(), rewrote it with fresh stars and timestamps, so a committed copy was permanently dirty.src/oss/projects.tsimports it statically, so it must exist before a typecheck:preparegenerates it on install, and the refresh script writes an empty list when there is neither a fetch nor a cache. CLOUDFLARE_ENVis hidden during prerendering:scopeCloudflareEnvAroundPrerender()(src/site/prerender-env.ts) removes it from Node'sprocess.envbetweenastro:build:ssrandastro:build:generated. The adapter's prerenderer reads the already-flatteneddist/server/.prerender/wrangler.jsonwithout anenvargument, so wrangler fell back to the variable and printed "No environment found in configuration with name …" on every deploy (upstream@cloudflare/vite-pluginbug). Prerendered pages are unaffected, since workerd fills theirprocess.envfrom the Worker's vars. The integration must stay beforeagentDiscoveryHeaders, which reads the restored value inastro:build:done.- Local Worker runtime — use
pnpm preview, notwrangler dev: not a style preference. Two miniflare majors live in this tree, both transitive and neither pinnable: the build runs miniflare 4 (via@cloudflare/vite-plugin←@astrojs/cloudflare),wrangler devruns miniflare 5-alpha. They disagree about theSENTRY_DOschema, so sharing a persist root madepnpm build— and thereforepnpm deploy,deploy:staginganddeploy:production— fail withtable _cf_ALARM has 3 columns but 2 values were supplieduntil.wrangler/statewas deleted by hand and every orphanedworkerdkilled.persistStatein astro.config.mjs now gives the build its own root (src/site/miniflare-state.ts), so the two cannot collide; a contract test fails if that wiring is dropped.pnpm previewgoes through the same miniflare the build does, which is why it was always the right tool for verifying Worker behaviour.
Cloudflare runtime
Access bindings through import { env } from "cloudflare:workers" — this is the only supported pattern in Astro v6 + @astrojs/cloudflare v13 (the old Astro.locals.runtime.env was removed). env is typed against worker-configuration.d.ts. After editing wrangler.jsonc bindings, run pnpm cf-typegen.
wrangler.jsonc ships with three env blocks (dev, staging, production) — each gets its own Worker name. Deploy a specific env with pnpm deploy:<env> (staging → staging.auditmos.com, production → auditmos.com). Full runbook incl. the one-time Turnstile/Resend setup and the cutover from the legacy auditmos-web Worker: docs/deployment.md.
Per-env contact vars live in .dev.vars / .dev.vars.staging / .dev.vars.production locally (never committed). This matches the wrangler convention — .dev.vars.<env> is loaded ahead of .dev.vars when CLOUDFLARE_ENV=<env> is set. Required for the contact form: TURNSTILE_SITE_KEY (public widget key), RESEND_API_KEY, TURNSTILE_SECRET_KEY, CONTACT_TO_EMAIL. Required for OAuth: OAUTH_SIGNING_KEY — cryptographically random and distinct per environment, since it derives every client secret and signs every access token (a shared key would let a staging credential authenticate against production). Optional: GITHUB_TOKEN for the OSS aggregator's build-time rate limit.
Verification
Max 500 lines per source file — split if exceeding.
<important if="you have finished implementing or modifying code">
Run manually before declaring done:
1. `pnpm types` — astro check + tsc --noEmit
2. `pnpm test` — vitest
3. `pnpm lint` — biome
4. `pnpm knip` — no unused files/deps/exports
</important><important if="you are writing or modifying tests">
- Tests live next to source as `*.test.ts`, mirrored name (`foo.ts` ↔ `foo.test.ts`)
- Vitest with globals enabled — no need to import `describe` / `it` / `expect`
- Globals are typed via `"vitest/globals"` in `tsconfig.json` (`types` array)
- Path alias `@` resolves to `src/`
- `src/pages/**` excluded from test discovery — extract endpoint logic into a `src/lib/` or `src/<domain>/` module and test that instead
- **Test only the module's public boundary** (exported functions), not internals — see `.claude/rules/deep-modules.md`
- **Pure functions only** in unit tests. For code that touches fs / network / process, extract a pure helper and test it; cover the side-effecting orchestrator with a separate integration test (none ship by default)
- Reference: `scripts/init-project-lib.test.ts` shows the convention — `describe` per exported function, `it.each` for parametric cases
- **Asserting against build output:** call `buildSite()` from `src/site/build-output.ts` in `beforeAll`. It runs `astro build` *once per test run* behind an on-disk lock (`src/site/build-once.ts`), because vitest runs suites in parallel isolated workers and `astro build` empties `dist/` before writing it — two unsynchronised builds leave every build-output suite intermittently reading a directory the other just wiped. `vitest.global-setup.ts` clears that state at the start of each run (and on each watch re-run) and deliberately never builds, so filtering to an unrelated file still costs nothing. Every suite that reads `dist/` asserts `buildRunCount() === 1`, so a regression here fails loudly instead of going flaky.
</important><important if="you are creating or reviewing design documents">
- `/docs` is the single source of truth for business requirements
- Apply review notes/status updates directly in the corresponding design doc
- Never create separate md files for reviews/audits/analyses unless explicitly asked
</important><important if="you are editing wrangler.jsonc or adding Cloudflare bindings">
- Run `pnpm cf-typegen` immediately to keep `worker-configuration.d.ts` in sync
- Don't edit `worker-configuration.d.ts` by hand — it's auto-generated
- Prefer `custom_domain: true` over `routes` with `zone_name` (see `.claude/rules/cloudflare-deployment.md`)
</important>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.

