GEO Skill Kit
Audits a website for AI search readiness, fixes robots.txt rules, structured data, canonical and Open Graph tags and llms.txt, then proves the result with a zero-dependency check script.
Free, MIT licence
- Free
- MIT licence
- No sign-up
An Agent Skill kit is a SKILL.md workflow plus the scripts, templates and verification script an AI coding agent needs for one job. The agent works through fixed phases and is not done until the script passes. Works in Claude Code, Cursor, Antigravity and other agents that read SKILL.md. Instant download.
Audits a website for AI search readiness, fixes robots.txt rules, structured data, canonical and Open Graph tags and llms.txt, then proves the result with a zero-dependency check script.
Free, MIT licence
Builds a production remote MCP server on Cloudflare Workers with OAuth sign-in, tool design rules, rate limits and tests, then checks it against the MCP spec and the connector directory requirements with a bundled script.
$39 USD, paid once
Adds Stripe Checkout, a signature-checked webhook and idempotent order fulfilment to a Cloudflare Worker with no Stripe SDK, then tests the webhook path with a bundled script.
$19 USD, paid once
Reviews a Cloudflare Workers project before launch: secrets, security headers, rate limits, error handling, observability and wrangler config, fixes what fails and re-runs the bundled checker until it passes.
$15 USD, paid once
Into your agent's skills folder, for example .claude/skills/ in your project. The top folder is the skill.
"Run a GEO audit on this site and fix what fails." The agent loads the skill when your request matches it.
The agent audits first and reports, then changes your source, never build output, and asks before anything that costs money or goes public.
It re-runs the check script until it passes, then reports what changed with the before and after results.
The free kit is shown in full. For the paid kits you see every file in the zip and the first part of the main files, so you can judge the real code.
GEO Skill Kit See the GEO Skill Kit page
Read the files
geo-audit/SKILL.md107 lines---
name: geo-audit
description: Audit and fix a website so AI assistants and search engines can read, understand and cite it. Checks robots.txt rules for AI crawlers, sitemap, llms.txt, JSON-LD structured data, canonical and Open Graph tags, then fixes what failed and proves it with the bundled verify-geo.mjs script. Use when asked for a GEO audit, AI search readiness, AI crawler access, llms.txt, or schema markup on a site or codebase.
license: MIT
metadata:
version: "1.0.0"
author: Red Center Studio
---
# GEO audit and fix
You are making a website readable and citable by AI assistants (ChatGPT, Claude, Perplexity, Google AI Overviews) and search engines. Work in the five phases below, in order. Do not skip Phase 5: the job is done when the script passes, not when the files exist.
Paths in this file are relative to this skill's folder. The script needs Node 18 or newer and has no dependencies.
## Ground rules
1. **Never invent facts.** No made-up ratings, review counts, awards, prices, addresses, phone numbers, founding dates or social profiles. If a value is not on the site or given by the user, leave the property out or ask.
2. **Schema must match the page.** Every claim in JSON-LD (price, FAQ question, rating, name) must be visible to a person on the same page. If it is not on the page, it does not go in the schema.
3. **No leftover template text.** Nothing containing `{{`, TODO, "Your Company" or example.com may ship. The script fails on these.
4. **Change the source, not the output.** Find where the site generates its head tags, robots.txt and sitemap (a layout component, a build script, a CMS setting) and change it there. Do not edit files in a build output folder.
5. **Ask before a business decision.** Whether to allow AI training crawlers is the owner's call. Ask once, then write the answer down in robots.txt.
## Phase 1: Audit
1. Work out what you are checking: a live URL, a built folder (`dist`, `build`, `public`, `out`, `.next`), or both. If the project has a build command, run it first so you check real output.
2. Run the script and keep the output:
```
node scripts/verify-geo.mjs --url https://the-site/
node scripts/verify-geo.mjs --dir ./dist
```
Add `--page path/to/page.html` with `--dir` to check a page other than the home page. Add `--json` if you want to parse the results.
3. Check at least the home page and one page of each main type (product or service page, article, contact). Problems are usually per template, not per page.
4. Read the page source yourself for what the script cannot judge:
- Does the first screen of text say plainly what the business does, for whom and where?
- Is the main content in the HTML, or does it only appear after JavaScript runs? AI crawlers mostly do not run JavaScript. If the HTML is an empty shell, say so: it matters more than everything else here.
- Are headings in order (one H1, then H2, H3) and do they describe the content?
5. Report to the user before changing anything: what failed, what you will change, and any question from Ground rule 5.
## Phase 2: robots.txt and AI crawlers
There are two kinds of AI crawler, and they should be handled separately:
| Kind | User agents | Default |
|---|---|---|
| Search and answer: fetch a page when a person asks about it | `OAI-SearchBot`, `ChatGPT-User`, `PerplexityBot`, `Perplexity-User`, `Claude-SearchBot`, `Claude-User` | Allow |
| Training: collect text to train models | `GPTBot`, `ClaudeBot`, `Google-Extended`, `CCBot` | Ask the owner |
1. Start from `templates/robots.ai.txt`. Keep the site's existing Disallow rules for private paths.
2. Give every crawler in the table its own `User-agent` group with `Allow: /` or `Disallow: /`. An explicit rule shows the choice was deliberate.
3. Blocking a training crawler does not block the search crawlers, so a site can opt out of training and still be cited.
4. Add `Sitemap: https://the-domain/sitemap.xml`.
5. Check the host as well as the file. A firewall or bot protection rule (Cloudflare, Vercel, a WAF) can block AI crawlers even when robots.txt allows them. If you can see that configuration, check it. If you cannot, tell the user to check it.
## Phase 3: Structured data (JSON-LD)
1. Add one `<script type="application/ld+json">` block per page, built where the site builds its `<head>`.
2. Site-wide, on every page: `Organization` and `WebSite` (`templates/schema-organization.jsonld`, `templates/schema-website.jsonld`). Give them stable `@id` values and refer to them from other nodes.
3. Per page type, only where it is true:
- A software product or app: `SoftwareApplication` with an `Offer` (`templates/schema-software-app.jsonld`). `price` is digits only, `priceCurrency` is a three-letter code, and the same price is visible on the page.
- A page with questions and answers shown on it: `FAQPage` (`templates/schema-faq.jsonld`). Copy each question exactly as it appears on the page.
- Articles: `Article` or `BlogPosting` with `headline`, `datePublished`, `dateModified`, `author`.
- A local business: `LocalBusiness` with the real address and opening hours.
4. Generate the schema from the same data the page renders from (the product record, the FAQ array). Two hand-typed copies will drift apart.
5. Do not add `aggregateRating` or `review` unless real reviews are displayed on that page.
6. Delete any property you cannot fill with a real value. A shorter, true block beats a complete, guessed one.
## Phase 4: Canonical, Open Graph and llms.txt
1. Every page gets exactly one `<link rel="canonical">` with its full https URL. Pick one form (with or without the trailing slash, with or without www) and use it in the canonical, `og:url`, the sitemap and internal links.
2. Every page gets `og:title`, `og:description`, `og:url`, `og:image` (absolute URL), `og:type` and `twitter:card`.
3. Every page gets a unique `<title>` (60 characters or fewer) and meta description (about 155), one H1, a `lang` attribute and a `<main>` landmark.
4. The sitemap lists every page that should be found, and nothing that is noindex or redirected.
5. llms.txt: write `/llms.txt` from `templates/llms.template.txt`, following the format at llmstxt.org: one `# Title`, a `> summary` blockquote, then `## Sections` of `- [Name](https://full-url): description` links. Link the pages that best answer the questions a customer would ask. Generate it from the site's own page list if there is one.
6. Be straight with the user about llms.txt: it is cheap to add and harmless, but independent log studies show most AI crawlers do not request it today. Phases 2 and 3 matter more. `llms-full.txt` (the full text of the key pages in one file) is optional; add it only if the user wants it.
## Phase 5: Verify and finish
1. Rebuild the site if it has a build step.
2. Run the script again on the same pages as in Phase 1:
```
node scripts/verify-geo.mjs --dir ./dist
node scripts/verify-geo.mjs --dir ./dist --page pricing/index.html
```
3. Fix every FAIL line and run it again. Repeat until the last line is `PASS`. Each failure prints the file, the line where it can tell, and the fix.
4. Go through the warnings. Fix them or tell the user why one is left (for example, the owner chose not to add llms.txt).
5. Finish with a short report: what you changed and where, the before and after script results, what the user still has to decide or do (firewall rules, a deploy), and anything you could not verify.
Do not report the work as done while the script prints `FAIL`.
## What the script checks
| Area | Fails when | Warns when |
|---|---|---|
| robots.txt | The file is missing, or a search and answer crawler is blocked from the whole site | A crawler has no explicit rule, or there is no Sitemap line |
| llms.txt | The file exists but has no `# Title`, no `> summary`, no `## Section`, or a link that is not a full URL | The file is missing |
| JSON-LD | No block, invalid JSON, missing `@context` or `@type`, leftover template text, an FAQ question or rating that is not on the page, a price that is not a plain number | |
| Canonical | Missing, duplicated, or not an absolute https URL; `og:url` differs from it | It differs from the address being checked |
| Open Graph | `og:title`, `og:description`, `og:url` or `og:image` missing | `og:type` or `twitter:card` missing |
| Page | noindex, no title, no meta description, no H1 | Long title or description, several H1s, no `lang`, no `<main>` |
| Sitemap | The file is not a sitemap | The file is missing |
`--strict` turns warnings into failures. Exit code 0 means pass, 1 means at least one failure.
geo-audit/scripts/verify-geo.mjs393 lines#!/usr/bin/env node
// verify-geo.mjs: checks a website for the basics AI assistants and search engines rely on.
// No dependencies. Needs Node 18 or newer.
//
// node verify-geo.mjs --url https://example.com/
// node verify-geo.mjs --dir ./public
// node verify-geo.mjs --dir ./public --page pricing/index.html
//
// Options:
// --url <url> Check a live page. robots.txt, llms.txt and sitemap.xml are read from the same origin.
// --dir <path> Check a built site on disk. robots.txt, llms.txt and sitemap.xml are read from the top of <path>.
// --page <file> With --dir: the HTML file to check, relative to <path>. Default: index.html.
// --strict Treat warnings as failures.
// --json Print the results as JSON instead of text.
//
// Exit code 0 when nothing failed, 1 when at least one check failed, 2 when the arguments are wrong.
import { readFile } from "node:fs/promises";
import { join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
// Crawlers that fetch pages to answer a person's question. Blocking these removes the site from AI answers.
export const SEARCH_BOTS = ["OAI-SearchBot", "ChatGPT-User", "PerplexityBot", "Perplexity-User", "Claude-SearchBot", "Claude-User"];
// Crawlers that collect training data. Allowing or blocking these is the owner's choice; the choice should be written down.
export const TRAINING_BOTS = ["GPTBot", "ClaudeBot", "Google-Extended", "CCBot"];
// Leftover template text. The marks are case-sensitive so a real "todo list app" description is not flagged.
const PLACEHOLDER_WORDS = /\b(lorem ipsum|your company|your business name|company name here|example\.(com|org|net)|000-?000-?0000|123 main st)/i;
const PLACEHOLDER_MARKS = /\b(TODO|TBD|FIXME|PLACEHOLDER)\b|\{\{[^}]*\}\}/;
const PLACEHOLDER = { test: (s) => PLACEHOLDER_WORDS.test(s) || PLACEHOLDER_MARKS.test(s) };
const REQUIRED_OG = ["og:title", "og:description", "og:url", "og:image"];
// ---------- small HTML helpers (regex based, good enough for well-formed pages) ----------
export function attrs(tag) {
const out = {};
const re = /([a-zA-Z_:][-\w:.]*)\s*=\s*("([^"]*)"|'([^']*)'|([^\s"'>]+))/g;
let m;
while ((m = re.exec(tag))) out[m[1].toLowerCase()] = m[3] ?? m[4] ?? m[5] ?? "";
return out;
}
const decode = (s) =>
s.replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/�?39;|'/g, "'").replace(/&#(\d+);/g, (_, n) => String.fromCodePoint(Number(n)));
export function visibleText(html) {
return decode(
html
.replace(/<!--[\s\S]*?-->/g, " ")
.replace(/<(script|style|template|noscript)\b[\s\S]*?<\/\1>/gi, " ")
.replace(/<[^>]+>/g, " "),
).replace(/\s+/g, " ").trim();
}
const norm = (s) => String(s).toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
const lineOf = (text, index) => text.slice(0, index).split("\n").length;
// ---------- robots.txt ----------
/** Groups of user-agents with their rules, in file order. */
export function parseRobots(text) {
const groups = [];
let current = null;
let lastWasAgent = false;
for (const raw of text.split(/\r?\n/)) {
const line = raw.replace(/#.*/, "").trim();
if (!line) continue;
const i = line.indexOf(":");
if (i < 0) continue;
const key = line.slice(0, i).trim().toLowerCase();
const value = line.slice(i + 1).trim();
if (key === "user-agent") {
if (!lastWasAgent) {
current = { agents: [], rules: [] };
groups.push(current);
}
current.agents.push(value.toLowerCase());
lastWasAgent = true;
} else {
lastWasAgent = false;
if ((key === "allow" || key === "disallow") && current) current.rules.push({ type: key, path: value });
}
}
return groups;
}
/** "named" when the bot has its own group, "wildcard" when only * applies, "none" when no group applies. */
export function robotsFor(groups, bot) {
const own = groups.filter((g) => g.agents.includes(bot.toLowerCase()));
const star = groups.filter((g) => g.agents.includes("*"));
const used = own.length ? own : star;
const rules = used.flatMap((g) => g.rules);
// The site root is blocked when the longest matching rule for "/" is a Disallow.
const matching = rules.filter((r) => r.path === "/" || r.path === "/*" || (r.type === "allow" && r.path === ""));
const blocked = matching.some((r) => r.type === "disallow") && !matching.some((r) => r.type === "allow");
return { scope: own.length ? "named" : star.length ? "wildcard" : "none", blocked };
}
// ---------- the checks ----------
export function checkRobots(text) {
const out = [];
if (text == null) {
out.push({ level: "fail", area: "robots.txt", message: "robots.txt was not found.", fix: "Add /robots.txt. Start from templates/robots.ai.txt." });
return out;
}
const groups = parseRobots(text);
for (const bot of SEARCH_BOTS) {
const r = robotsFor(groups, bot);
if (r.blocked) out.push({ level: "fail", area: "robots.txt", message: `${bot} is blocked from the whole site (${r.scope === "named" ? "its own rule" : "the * rule"}).`, fix: `Add "User-agent: ${bot}" with "Allow: /" so AI assistants can read the site when someone asks about it.` });
}
if (!out.length) out.push({ level: "pass", area: "robots.txt", message: "AI search crawlers can reach the site." });
const unnamed = [...SEARCH_BOTS, ...TRAINING_BOTS].filter((b) => robotsFor(groups, b).scope !== "named");
if (unnamed.length) out.push({ level: "warn", area: "robots.txt", message: `No explicit rule for: ${unnamed.join(", ")}.`, fix: "Name each crawler with Allow or Disallow so the choice is deliberate. See templates/robots.ai.txt." });
else out.push({ level: "pass", area: "robots.txt", message: "Every AI crawler has an explicit rule." });
if (!/^\s*sitemap\s*:/im.test(text)) out.push({ level: "warn", area: "robots.txt", message: "No Sitemap line.", fix: 'Add "Sitemap: https://your-domain/sitemap.xml".' });
return out;
}
export function checkLlms(text) {
const out = [];
const fail = (line, message, fix) => out.push({ level: "fail", area: "llms.txt", line, message, fix });
if (text == null) {
out.push({ level: "warn", area: "llms.txt", message: "llms.txt was not found.", fix: "Optional. If you add one, start from templates/llms.template.txt." });
return out;
}
if (/^\s*<(!doctype|html)/i.test(text)) {
fail(1, "llms.txt returns an HTML page, not Markdown.", "Serve a plain Markdown file at /llms.txt (the request is probably falling through to a 404 or app page).");
return out;
}
const lines = text.split(/\r?\n/);
const first = lines.findIndex((l) => l.trim() !== "");
if (first < 0 || !/^# \S/.test(lines[first])) fail(first + 1 || 1, 'The first line is not a "# Title" heading.', "Start the file with one H1: the site or project name.");
const h1s = lines.map((l, i) => (/^# \S/.test(l) ? i + 1 : 0)).filter(Boolean);
if (h1s.length > 1) fail(h1s[1], "More than one H1 heading.", "Keep one H1. Use ## for sections.");
const quote = lines.findIndex((l) => /^> \S/.test(l));
const firstH2 = lines.findIndex((l) => /^## \S/.test(l));
if (quote < 0) fail(first + 2, 'No "> summary" blockquote.', "Add a one or two sentence summary as a blockquote straight after the title.");
else if (firstH2 >= 0 && quote > firstH2) fail(quote + 1, "The summary blockquote comes after the first section.", "Move the summary to just under the title.");
if (firstH2 < 0) fail(lines.length, 'No "## Section" headings.', "Group links under H2 sections such as ## Docs or ## Products.");
let links = 0;
lines.forEach((l, i) => {
const m = /^\s*[-*]\s*\[([^\]]*)\]\(([^)]*)\)/.exec(l);
if (!m) return;
links++;
if (!m[1].trim()) fail(i + 1, "A link has no name.", "Write links as - [Name](https://...): short description.");
if (!/^https?:\/\//.test(m[2])) fail(i + 1, `Link is not an absolute URL: ${m[2] || "(empty)"}`, "Use full https:// URLs so the file works wherever it is read.");
else if (PLACEHOLDER.test(m[2])) fail(i + 1, `Link looks like a placeholder: ${m[2]}`, "Replace it with a real page.");
});
if (firstH2 >= 0 && links === 0) fail(firstH2 + 1, "No links in list form.", "Under each section list pages as - [Name](https://...): short description.");
if (!out.length) out.push({ level: "pass", area: "llms.txt", message: `Structure is valid (${links} links).` });
return out;
}
/** Every JSON-LD node on the page, flattened out of @graph and arrays. */
export function jsonLdNodes(html) {
const blocks = [];
const re = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
let m;
while ((m = re.exec(html))) {
if ((attrs(m[1]).type || "").toLowerCase() !== "application/ld+json") continue;
const line = lineOf(html, m.index);
try {
blocks.push({ line, data: JSON.parse(m[2]) });
} catch (err) {
blocks.push({ line, error: String(err.message || err) });
}
}
return blocks;
}
const flatten = (data) => {
const nodes = [];
const visit = (v) => {
if (Array.isArray(v)) v.forEach(visit);
else if (v && typeof v === "object") {
nodes.push(v);
if (Array.isArray(v["@graph"])) v["@graph"].forEach(visit);
}
};
visit(data);
return nodes;
};
const typesOf = (node) => [].concat(node["@type"] ?? []).map(String);
function strings(value, path = "", out = []) {
if (typeof value === "string") out.push([path, value]);
else if (Array.isArray(value)) value.forEach((v, i) => strings(v, `${path}[${i}]`, out));
else if (value && typeof value === "object") for (const [k, v] of Object.entries(value)) strings(v, path ? `${path}.${k}` : k, out);
return out;
}
export function checkJsonLd(html) {
const out = [];
const blocks = jsonLdNodes(html);
const fail = (line, message, fix) => out.push({ level: "fail", area: "JSON-LD", line, message, fix });
if (!blocks.length) {
fail(undefined, "No JSON-LD structured data on the page.", "Add at least an Organization or WebSite block. See templates/.");
return out;
}
const text = norm(visibleText(html));
let nodeCount = 0;
for (const b of blocks) {
if (b.error) {
fail(b.line, `JSON-LD does not parse: ${b.error}`, "Fix the JSON. A trailing comma or an unescaped quote is the usual cause.");
continue;
}
const top = [].concat(b.data);
for (const t of top) {
const ctx = [].concat(t?.["@context"] ?? []).map((c) => (typeof c === "string" ? c : c?.["@vocab"] || ""));
if (!ctx.some((c) => /^https?:\/\/schema\.org\/?$/.test(c))) fail(b.line, 'Missing "@context": "https://schema.org".', 'Add "@context": "https://schema.org" at the top of the block.');
}
for (const node of flatten(b.data)) {
const isTop = top.includes(node);
const inGraph = top.some((t) => Array.isArray(t?.["@graph"]) && t["@graph"].includes(node));
if ((isTop && !node["@graph"]) || inGraph) {
nodeCount++;
if (!typesOf(node).length) fail(b.line, 'A node has no "@type".', "Give every top-level node a schema.org @type.");
}
const types = typesOf(node);
if (types.includes("FAQPage")) {
for (const q of [].concat(node.mainEntity ?? [])) {
const name = q?.name;
if (typeof name !== "string" || !name.trim()) fail(b.line, "An FAQ question has no name.", "Every Question needs name and acceptedAnswer.text.");
else if (!text.includes(norm(name))) fail(b.line, `FAQ question is in the schema but not on the page: "${name}"`, "Show the question and its answer on the page, or remove it from the schema.");
if (typeof q?.acceptedAnswer?.text !== "string" || !q.acceptedAnswer.text.trim()) fail(b.line, `FAQ question has no answer text: "${name ?? ""}"`, "Add acceptedAnswer.text.");
}
}
if (node.aggregateRating || types.includes("AggregateRating")) {
const r = node.aggregateRating || node;
const value = String(r.ratingValue ?? "");
if (!value || !text.includes(norm(value))) fail(b.line, "aggregateRating is in the schema but the rating is not shown on the page.", "Only publish ratings that come from real reviews shown on the same page. Otherwise remove aggregateRating.");
}
if (types.includes("Offer") && node.price != null && !/^\d+(\.\d{1,2})?$/.test(String(node.price))) fail(b.line, `Offer price is not a plain number: ${node.price}`, 'Use digits only, for example "29.00", and put the currency in priceCurrency.');
if (types.includes("Offer") && node.price != null && !node.priceCurrency) fail(b.line, "Offer has a price but no priceCurrency.", 'Add priceCurrency, for example "USD".');
}
for (const [path, value] of strings(b.data)) {
if (PLACEHOLDER.test(value)) fail(b.line, `Placeholder value at ${path}: "${value.slice(0, 60)}"`, "Replace it with the real value or remove the property.");
}
}
if (!out.length) out.push({ level: "pass", area: "JSON-LD", message: `${blocks.length} block${blocks.length === 1 ? "" : "s"}, ${nodeCount} node${nodeCount === 1 ? "" : "s"}, all valid and matching the page.` });
return out;
}
export function checkHead(html, pageUrl) {
const out = [];
const head = (/<head\b[^>]*>([\s\S]*?)<\/head>/i.exec(html) || [, html])[1];
const tags = (name) => [...head.matchAll(new RegExp(`<${name}\\b([^>]*)>`, "gi"))].map((m) => ({ a: attrs(m[1]), line: lineOf(html, html.indexOf(m[0])) }));
const metas = tags("meta");
const meta = (key) => metas.find((t) => (t.a.property || t.a.name || "").toLowerCase() === key)?.a.content?.trim();
// Canonical
const canon = tags("link").filter((t) => (t.a.rel || "").toLowerCase().split(/\s+/).includes("canonical"));
if (!canon.length) out.push({ level: "fail", area: "canonical", message: 'No <link rel="canonical">.', fix: "Add one canonical link with the page's full https URL." });
else if (canon.length > 1) out.push({ level: "fail", area: "canonical", line: canon[1].line, message: "More than one canonical link.", fix: "Keep exactly one." });
else {
const href = canon[0].a.href || "";
if (!/^https:\/\//.test(href)) out.push({ level: "fail", area: "canonical", line: canon[0].line, message: `Canonical is not an absolute https URL: ${href || "(empty)"}`, fix: "Use the full address, for example https://your-domain/page/." });
else if (pageUrl && stripSlash(href) !== stripSlash(pageUrl)) out.push({ level: "warn", area: "canonical", line: canon[0].line, message: `Canonical (${href}) differs from the page address (${pageUrl}).`, fix: "Fine if this page is a deliberate duplicate. Otherwise point the canonical at this page." });
else out.push({ level: "pass", area: "canonical", message: href });
const ogUrl = meta("og:url");
if (ogUrl && /^https:\/\//.test(href) && stripSlash(ogUrl) !== stripSlash(href)) out.push({ level: "fail", area: "Open Graph", message: `og:url (${ogUrl}) does not match the canonical (${href}).`, fix: "Set og:url to the canonical URL." });
}
// Open Graph
const missing = REQUIRED_OG.filter((k) => !meta(k));
if (missing.length) out.push({ level: "fail", area: "Open Graph", message: `Missing: ${missing.join(", ")}.`, fix: "Add the missing tags. og:image must be an absolute URL." });
else if (!/^https?:\/\//.test(meta("og:image"))) out.push({ level: "fail", area: "Open Graph", message: `og:image is not an absolute URL: ${meta("og:image")}`, fix: "Use the full https:// address of the image." });
else out.push({ level: "pass", area: "Open Graph", message: "title, description, url and image are set." });
if (!meta("og:type")) out.push({ level: "warn", area: "Open Graph", message: "No og:type.", fix: 'Add og:type, usually "website" or "article".' });
if (!meta("twitter:card")) out.push({ level: "warn", area: "Open Graph", message: "No twitter:card.", fix: 'Add <meta name="twitter:card" content="summary_large_image">.' });
// Page basics
const robots = (meta("robots") || "").toLowerCase();
if (/\bnoindex\b/.test(robots)) out.push({ level: "fail", area: "page", message: "The page is set to noindex.", fix: "Remove noindex if this page should be found." });
const title = decode((/<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(head) || [, ""])[1]).trim();
if (!title) out.push({ level: "fail", area: "page", message: "No <title>.", fix: "Add a title that says what the page is and who it is for." });
else if (title.length > 60) out.push({ level: "warn", area: "page", message: `Title is ${title.length} characters.`, fix: "Keep it to 60 or fewer so it is not cut off." });
const desc = meta("description");
if (!desc) out.push({ level: "fail", area: "page", message: "No meta description.", fix: "Add one or two plain sentences, up to about 155 characters." });
else if (desc.length > 160) out.push({ level: "warn", area: "page", message: `Meta description is ${desc.length} characters.`, fix: "Keep it to about 155." });
if (!/<html\b[^>]*\blang\s*=/i.test(html)) out.push({ level: "warn", area: "page", message: "No lang attribute on <html>.", fix: 'Add lang, for example <html lang="en">.' });
const h1 = (html.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, "").match(/<h1\b/gi) || []).length;
if (h1 !== 1) out.push({ level: h1 === 0 ? "fail" : "warn", area: "page", message: `The page has ${h1} H1 headings.`, fix: "Use exactly one H1 that states the page's subject." });
if (!/<main\b|role\s*=\s*["']?main/i.test(html)) out.push({ level: "warn", area: "page", message: "No <main> landmark.", fix: "Wrap the page's main content in <main>." });
if (!out.some((r) => r.area === "page")) out.push({ level: "pass", area: "page", message: "Title, description, language, one H1 and a main landmark." });
return out;
}
const stripSlash = (u) => u.replace(/[#?].*$/, "").replace(/\/+$/, "");
export function checkSitemap(text) {
if (text == null) return [{ level: "warn", area: "sitemap", message: "sitemap.xml was not found.", fix: "Add /sitemap.xml listing every page that should be found, and name it in robots.txt." }];
if (!/<(urlset|sitemapindex)\b/i.test(text)) return [{ level: "fail", area: "sitemap", message: "sitemap.xml is not a sitemap (no <urlset> or <sitemapindex>).", fix: "Serve a valid XML sitemap at /sitemap.xml." }];
const n = (text.match(/<loc>/gi) || []).length;
return [{ level: "pass", area: "sitemap", message: `${n} address${n === 1 ? "" : "es"} listed.` }];
}
export function verify({ html, robots, llms, sitemap, pageUrl }) {
return [...checkRobots(robots), ...checkLlms(llms), ...checkJsonLd(html), ...checkHead(html, pageUrl), ...checkSitemap(sitemap)];
}
// ---------- loading ----------
async function fetchText(url) {
try {
const res = await fetch(url, { redirect: "follow", headers: { "user-agent": "verify-geo/1.0 (+site check)", accept: "text/html,text/plain,*/*" }, signal: AbortSignal.timeout(15000) });
if (!res.ok) return null;
return await res.text();
} catch {
return null;
}
}
async function readOrNull(path) {
try {
return await readFile(path, "utf8");
} catch {
return null;
}
}
export function parseArgs(argv) {
const o = { strict: false, json: false };
for (let i = 0; i < argv.length; i++) {
const a = argv[i];
if (a === "--strict") o.strict = true;
else if (a === "--json") o.json = true;
else if (a === "--help" || a === "-h") o.help = true;
else if (["--url", "--dir", "--page"].includes(a)) {
if (argv[i + 1] == null || argv[i + 1].startsWith("--")) return { error: `${a} needs a value.` };
o[a.slice(2)] = argv[++i];
} else return { error: `Unknown option: ${a}` };
}
if (o.help) return o;
if (!o.url === !o.dir) return { error: "Give exactly one of --url or --dir." };
if (o.page && !o.dir) return { error: "--page only works with --dir." };
return o;
}
const USAGE = `Usage:
node verify-geo.mjs --url https://example.com/
node verify-geo.mjs --dir ./public [--page pricing/index.html]
Options: --strict (warnings fail), --json`;
export async function main(argv) {
const o = parseArgs(argv);
if (o.help) return console.log(USAGE), 0;
if (o.error) return console.error(`${o.error}\n${USAGE}`), 2;
let input;
let target;
if (o.url) {
let u;
try {
u = new URL(/^https?:\/\//.test(o.url) ? o.url : `https://${o.url}`);
} catch {
return console.error(`Not a valid URL: ${o.url}`), 2;
}
target = u.href;
const [html, robots, llms, sitemap] = await Promise.all([fetchText(u.href), fetchText(`${u.origin}/robots.txt`), fetchText(`${u.origin}/llms.txt`), fetchText(`${u.origin}/sitemap.xml`)]);
if (html == null) return console.error(`Could not load ${u.href}`), 1;
input = { html, robots, llms, sitemap, pageUrl: u.href };
} else {
const dir = resolve(o.dir);
const page = o.page || "index.html";
target = join(dir, page);
const [html, robots, llms, sitemap] = await Promise.all([readOrNull(join(dir, page)), readOrNull(join(dir, "robots.txt")), readOrNull(join(dir, "llms.txt")), readOrNull(join(dir, "sitemap.xml"))]);
if (html == null) return console.error(`Could not read ${target}`), 1;
input = { html, robots, llms, sitemap };
}
const results = verify(input);
const count = (level) => results.filter((r) => r.level === level).length;
const failed = count("fail") + (o.strict ? count("warn") : 0);
if (o.json) {
console.log(JSON.stringify({ target, ok: failed === 0, fail: count("fail"), warn: count("warn"), pass: count("pass"), results }, null, 2));
} else {
console.log(`GEO check: ${target}\n`);
for (const r of results) {
const where = r.line ? `${r.area}:${r.line}` : r.area;
console.log(`${r.level.toUpperCase().padEnd(4)} ${where.padEnd(14)} ${r.message}`);
if (r.fix && r.level !== "pass") console.log(`${" ".repeat(22)}Fix: ${r.fix}`);
}
console.log(`\n${count("pass")} passed, ${count("warn")} warning${count("warn") === 1 ? "" : "s"}, ${count("fail")} failed.${o.strict && count("warn") ? " (--strict: warnings count as failures)" : ""}`);
console.log(failed === 0 ? "PASS" : "FAIL");
}
return failed === 0 ? 0 : 1;
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
main(process.argv.slice(2)).then((code) => process.exit(code));
}
geo-audit/templates/robots.ai.txt47 lines# robots.txt with an explicit rule for each AI crawler.
# Replace {{DOMAIN}} and delete any private paths you do not have. Lines starting with # are comments.
#
# Two kinds of AI crawler:
# 1. Search and answer crawlers fetch a page when a person asks about it. Blocking them removes the site
# from AI answers. Keep these on Allow unless you have a reason not to.
# 2. Training crawlers collect text to train models. Allowing or blocking them is a business choice.
# It does not change whether the search crawlers above can cite the site.
User-agent: *
Allow: /
Disallow: /api/
Disallow: /admin/
# 1. Search and answer crawlers
User-agent: OAI-SearchBot
Allow: /
User-agent: ChatGPT-User
Allow: /
User-agent: PerplexityBot
Allow: /
User-agent: Perplexity-User
Allow: /
User-agent: Claude-SearchBot
Allow: /
User-agent: Claude-User
Allow: /
# 2. Training crawlers: change Allow to Disallow for any you want to opt out of.
User-agent: GPTBot
Allow: /
User-agent: ClaudeBot
Allow: /
User-agent: Google-Extended
Allow: /
User-agent: CCBot
Allow: /
Sitemap: https://{{DOMAIN}}/sitemap.xml
geo-audit/templates/llms.template.txt18 lines# {{SITE_NAME}}
> {{ONE_OR_TWO_SENTENCES: what the site offers, who it is for, and where it operates. Facts only.}}
{{OPTIONAL: a short paragraph of details an assistant needs to answer questions correctly, such as prices, service area, opening hours or how to get support. Delete this block if there is nothing to add.}}
## {{SECTION_NAME, for example Products}}
- [{{PAGE_NAME}}]({{https://your-domain/page/}}): {{what the page covers, in one line}}
- [{{PAGE_NAME}}]({{https://your-domain/page/}}): {{what the page covers, in one line}}
## {{SECTION_NAME, for example Docs}}
- [{{PAGE_NAME}}]({{https://your-domain/page/}}): {{what the page covers, in one line}}
## Optional
- [{{PAGE_NAME}}]({{https://your-domain/page/}}): {{pages an assistant can skip when short on space}}
geo-audit/templates/schema-software-app.jsonld18 lines{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "{{PRODUCT_NAME}}",
"url": "{{https://your-domain/product/}}",
"description": "{{ONE_OR_TWO_SENTENCES_THAT_ALSO_APPEAR_ON_THE_PAGE}}",
"applicationCategory": "{{BusinessApplication, DeveloperApplication or another schema.org category}}",
"operatingSystem": "{{Web, or the systems it runs on}}",
"softwareVersion": "{{1.0.0, or delete this line}}",
"offers": {
"@type": "Offer",
"price": "{{29.00, digits only. Use 0 for a free product}}",
"priceCurrency": "{{USD}}",
"url": "{{https://your-domain/product/}}",
"availability": "https://schema.org/InStock"
},
"publisher": { "@id": "{{https://your-domain/}}#organization" }
}
geo-audit/templates/project-rules.md40 lines# GEO rules for this project
Paste this section into the project's `CLAUDE.md`, `AGENTS.md` or `.cursor/rules/geo.mdc` so every future change keeps the site readable by AI assistants and search engines.
## Head tags
- Every page has exactly one `<link rel="canonical">` with its full https URL.
- One URL form only: the canonical, `og:url`, the sitemap entry and internal links all use the same host and the same trailing-slash style.
- Every page has a unique `<title>` (60 characters or fewer), a unique meta description (about 155), `og:title`, `og:description`, `og:url`, `og:image` (absolute URL), `og:type` and `twitter:card`.
- Head tags are generated in one place (the layout or page helper). Do not hand-write them per page.
## Structured data
- JSON-LD is generated from the same data the page renders. Never keep a second, hand-typed copy of a price, name or FAQ.
- Everything in the schema is visible on the same page. No rating, review, price, award or FAQ question that a visitor cannot see.
- Never invent a value. If it is unknown, leave the property out.
- `Organization` and `WebSite` go on every page with stable `@id` values. Page-specific types (`SoftwareApplication`, `FAQPage`, `Article`, `LocalBusiness`) go only on pages they describe.
- Offer prices are digits only with a separate `priceCurrency`.
## Content
- The main content of a page is in the HTML the server sends. Do not rely on client-side JavaScript to render text that should be found.
- One H1 per page. Headings go in order and describe the content under them.
- The main content sits inside `<main>`. `<html>` has a `lang` attribute.
## Crawlers and discovery
- `robots.txt` names each AI crawler with an explicit Allow or Disallow. Do not block the search and answer crawlers (`OAI-SearchBot`, `ChatGPT-User`, `PerplexityBot`, `Perplexity-User`, `Claude-SearchBot`, `Claude-User`) unless the owner asks.
- New pages are added to the sitemap by the build, never by hand. Pages that are noindex or redirected stay out of it.
- When a page is added, moved or removed, update `llms.txt` if the site has one.
## Before finishing any change that touches pages, head tags, robots.txt or the sitemap
Run the check on the built site and fix every failure:
```
node .claude/skills/geo-audit/scripts/verify-geo.mjs --dir <build-folder>
```
Adjust the path if the skill is installed somewhere else.
geo-audit/README.md113 lines# GEO Skill Kit
Version 1.0.0. Free, MIT licence. By Red Center Studio, https://redcenterstudio.com/
An Agent Skill that audits a website for AI search readiness, fixes what it finds, and proves the result with a script. It works in any agent that reads the open `SKILL.md` format, including Claude Code, Cursor and Antigravity.
It is different from a prompt in one way that matters: the agent is not finished until `verify-geo.mjs` exits with code 0. The script has no dependencies, so you can also run it yourself or in CI.
## What is in the kit
```
geo-audit/
SKILL.md The skill: five phases, from audit to verified fix
README.md This file
LICENSE
scripts/
verify-geo.mjs The check. Node 18 or newer, no dependencies
templates/
robots.ai.txt robots.txt with a rule for each AI crawler
llms.template.txt llms.txt in the llmstxt.org format
schema-organization.jsonld
schema-website.jsonld
schema-software-app.jsonld SoftwareApplication with an Offer
schema-faq.jsonld
project-rules.md Rules to paste into CLAUDE.md, AGENTS.md or Cursor rules
```
## Install
Unzip, then copy the `geo-audit` folder to where your agent looks for skills.
**Claude Code** (one project):
```
mkdir -p .claude/skills
cp -r geo-audit .claude/skills/
```
For every project on your machine, use `~/.claude/skills/` instead.
**Cursor:**
```
mkdir -p .cursor/skills
cp -r geo-audit .cursor/skills/
```
If your Cursor version does not load skills, copy `templates/project-rules.md` to `.cursor/rules/geo.mdc` and ask the agent to follow `geo-audit/SKILL.md`.
**Antigravity:**
```
mkdir -p .agent/skills
cp -r geo-audit .agent/skills/
```
**Any other agent:** keep the folder anywhere in the project and say "follow geo-audit/SKILL.md".
Skill folder locations change between agent versions. If the skill does not show up, check your agent's documentation for the current folder.
## Use
Ask your agent in plain words:
- "Run a GEO audit on this project and fix what fails."
- "Check https://my-site.com for AI search readiness."
- "Add structured data and an llms.txt to this site."
To keep the site in shape afterwards, paste `templates/project-rules.md` into your project's `CLAUDE.md` or `AGENTS.md`.
## Run the check yourself
```
node geo-audit/scripts/verify-geo.mjs --url https://my-site.com/
node geo-audit/scripts/verify-geo.mjs --dir ./dist
node geo-audit/scripts/verify-geo.mjs --dir ./dist --page pricing/index.html
```
| Option | What it does |
|---|---|
| `--url <url>` | Check a live page. robots.txt, llms.txt and sitemap.xml are read from the same site |
| `--dir <path>` | Check a built site on disk |
| `--page <file>` | With `--dir`, the HTML file to check. Default `index.html` |
| `--strict` | Warnings count as failures |
| `--json` | Print results as JSON |
Exit code 0 means pass, 1 means at least one check failed. In CI:
```
node geo-audit/scripts/verify-geo.mjs --dir ./dist --strict
```
## What it checks
- **robots.txt:** AI search crawlers are not blocked, and each AI crawler has an explicit rule.
- **llms.txt:** if present, it follows the format (`# Title`, `> summary`, `## Sections`, full-URL links).
- **JSON-LD:** every block parses, has `@context` and `@type`, has no leftover template text, and every FAQ question and rating in the schema is visible on the page.
- **Canonical and Open Graph:** one absolute https canonical, matching `og:url`, and the four core Open Graph tags.
- **Page basics:** title, meta description, one H1, `lang`, a `<main>` landmark, not noindex.
- **Sitemap:** present and valid.
## What it does not do
- It does not measure whether AI assistants cite you. It checks the technical basics that make citing possible.
- It does not run JavaScript. If your content only appears after scripts run, the check sees what most AI crawlers see: an empty page.
- It cannot see firewall or bot protection rules. A host can block AI crawlers even when robots.txt allows them.
- llms.txt is cheap and harmless, but independent studies show most AI crawlers do not request it yet. Crawler access and structured data matter more.
## Want it done for you
Red Center Studio sets all of this up on your site for a fixed price, with a before and after audit: https://redcenterstudio.com/services/geo-foundation/
A free online version of the audit, no install needed: https://redcenterstudio.com/geo-audit/
Remote MCP Server Kit See the Remote MCP Server Kit page
Preview the files
remote-mcp-server/SKILL.mdLines 1 to 76 of 137---
name: remote-mcp-server
description: Build, secure, test, deploy and list a production remote MCP server on Cloudflare Workers. Designs the tools, scaffolds a stateless Streamable HTTP server from the bundled template with OAuth 2.1 sign-in (a separate authorization server Worker with a consent page), adds scope checks, rate limits and safe errors, runs the tests, and proves the result with the bundled verify-mcp.mjs script. Then prepares the MCP Registry server.json and the connector directory checklist. Use when asked to build a remote MCP server or connector, add OAuth to an MCP server, put an API behind MCP on Workers, fix an MCP server for a connector directory, or check an existing MCP endpoint.
license: Commercial. See LICENSE.
metadata:
version: "1.0.0"
author: Red Center Studio
---
# Remote MCP server on Cloudflare Workers
You are building a remote MCP server that people connect to from Claude, ChatGPT, Cursor and other MCP clients, with OAuth sign-in, on Cloudflare Workers. Work in the eight phases below, in order. Phase 7 is the gate: the job is done when the script passes, not when the code exists.
Paths in this file are relative to this skill's folder. `template/` is a complete, tested project to copy. `scripts/verify-mcp.mjs` needs Node 18 or newer and has no dependencies.
## Ground rules
1. **Copy the template, then change it.** It is pinned to versions that compile and pass together (`agents` 0.33.0, `@modelcontextprotocol/server` 2.4.0, `@cloudflare/workers-oauth-provider` 1.2.4, `zod` 4.6.7). Do not upgrade any of them while building; upgrade later, on purpose, with the tests running.
2. **Read the installed types when the docs and the code disagree.** These packages move fast. If an example does not compile, open the package's `.d.ts` in `node_modules` and follow it.
3. **The entry modules export only `default`.** Workers treats every named export of a Worker's entry file as an entrypoint, and a named export that is not a handler stops the Worker from starting. Unit tests do not catch this. `template/test/entry.test.ts` and the `--dir` check do.
4. **Never invent facts** in tool descriptions, server instructions, the consent page or listing text: no claims about directory approval, security certifications, uptime or customers that the user has not given you.
5. **Secrets live in wrangler secrets only.** Never in `vars`, source, tests, chat or logs. Never ask the user to paste a secret into the chat; give them the `wrangler secret put` command to run.
6. **Ask before anything that costs money, publishes, or touches a live account:** deploying, creating Cloudflare resources, publishing to the registry, submitting to a directory. Prepare everything, then ask.
7. **Tokens are bound to one URL.** `MCP_SERVER_URL` is exactly what clients connect to, identical in both Workers. Decide the final URL (ideally a custom domain) before the first deploy.
## Phase 1: Design the tools
1. Ask the user what people should be able to do through the server, and what data it touches. Write the answers down as a short list of user requests ("find last month's unpaid invoices", "mark an invoice paid").
2. Turn the requests into tools, following `references/tool-design.md`. Aim for the fewest tools that cover the requests. Keep reads and writes in separate tools, and split out anything that sends, pays or deletes.
3. For each tool, write a table row: name, one-line description, inputs with limits, what it returns, and the five annotations (`title`, `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`).
4. Decide the scopes. Default: `mcp:read` for every read tool, `mcp:write` for every write tool. Add a scope only for a group of tools a user might reasonably refuse on its own.
5. Decide how people sign in (Phase 3). The template uses GitHub. If the users are not developers, plan the swap now.
6. Show the user the tool table and the scopes and get a yes before writing code.
## Phase 2: Scaffold from the template
1. Copy `template/` to the project folder (or a subfolder of an existing repository). Do not copy `node_modules` or `.wrangler`.
2. Rename, everywhere it appears:
- `name` in `wrangler.jsonc` and `wrangler.auth.jsonc`, and `services[0].service` in `wrangler.jsonc` (must equal the authorization server's name)
- `SERVER_INFO` in `src/tools.ts`
- `SERVICE_NAME` and `USER_AGENT` in `src/authorize.ts`
- `name` in `package.json`
3. Set `compatibility_date` in both wrangler files to today.
4. Set the URLs. `MCP_SERVER_URL` (both files, identical, ending in the route, default `/mcp`), `AUTH_SERVER_URL` (MCP server) equal to `ISSUER` (authorization server). Replace every `YOUR-SUBDOMAIN`; the `--dir` check fails while any placeholder is left.
5. Replace the example tools in `src/tools.ts` with the tools from Phase 1. Keep: `guard()` around every handler, `ok()` and `toolError()` for results, `scopeChallenge: requireScopes(WRITE_SCOPE)` and the `needsWrite()` check on every write tool, a strict zod schema with limits, and annotations on every tool. Replace the `NOTES` KV binding with the storage the tools need (D1, KV, R2, or an upstream API).
6. Update `INSTRUCTIONS` in `src/index.ts` and the scope wording in `src/consent.ts` (`SCOPE_TEXT`).
7. Run `npm install` and `npm run check`. Fix type errors before going on.
## Phase 3: OAuth
The template's split is the current Cloudflare pattern:
| Worker | Library class | Job |
|---|---|---|
| Authorization server (`src/auth.ts` entry, `src/authorize.ts` logic) | `OAuthAuthorizationServer` | Metadata, client registration, consent page, sign-in, tokens, `validateToken` over RPC |
| MCP server (`src/index.ts`) | `OAuthResourceServer` | Protected resource metadata, 401 challenge, token check over the `AUTH_SERVER` service binding, then `createMcpHandler` |
1. Keep consent before sign-in. `describeConsent`, `beginConsent`, `approveConsent` and `denyConsent` bind the form to the browser with a `__Host-` cookie and block framing; the form carries only the handle. Every client-supplied string on the page is escaped (`escapeHtml` in `src/consent.ts`). Do not remove either.
2. Keep both registration methods on: `clientIdMetadataDocumentEnabled: true` (needs the `global_fetch_strictly_public` flag on the authorization server) and `clientRegistrationEndpoint: "/oauth/register"` for clients that still use Dynamic Client Registration.
3. Sign-in. With GitHub as shipped: the user creates a GitHub OAuth app with callback `ISSUER/callback` and sets `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` with `npx wrangler secret put NAME -c wrangler.auth.jsonc`. `ALLOWED_GITHUB_LOGINS` restricts who may sign in. To use another method, change only `startSignIn()` and `callback()` in `src/authorize.ts`; `template/README.md` explains the options (another OAuth provider, your own sessions, an emailed code).
4. `props` passed to `completeAuthorization()` reach every tool call. Keep `userId` stable per person, do not store tokens unless a tool needs them, and never return or log them.
5. Scopes: `requiredScopes` on the resource server is advertised, not enforced. The template enforces `mcp:read` in `handleMcp` with `insufficientScope()`, and write tools return a `403 insufficient_scope` challenge for `mcp:write` through `scopeChallenge`, so clients can ask the user for more access (step-up).
6. The validator calls the RPC method on the binding: `(env) => (resource, token) => env.AUTH_SERVER.validateToken(resource, token)`. Passing the method itself (`env.AUTH_SERVER.validateToken`), as some examples show, answered 503 to every request through a local service binding.
## Phase 4: Limits and errors
1. Rate limits (Workers Rate Limiting bindings): `TOOL_LIMITER` per signed-in user on every tool call (in `guard()`), `AUTH_LIMITER` per IP on the sign-in pages. Size the limits for real use; the shipped numbers are a starting point. Hosted clients share a few IP addresses, so never rate limit the MCP endpoint per IP alone.
2. Request size: `MAX_REQUEST_BYTES` in `src/tools.ts` caps the body (413). Every string and number in every schema has a limit.
3. Result size: page lists with a cursor, cap page size in the schema, keep large fields out of list results.
4. Errors: tool problems return `isError: true` with a message that says what to do next. `guard()` catches anything thrown, logs it with `console.error` (visible in Workers Logs) and returns a plain message. No stack traces, no internal messages, no SQL in results.
5. Data isolation: every query is scoped to `props.userId` in the query itself, never filtered afterwards.
6. Custom domain: the handler's `allowedHostnames` comes from `MCP_SERVER_URL`. Browser origins are checked by `createMcpHandler`; if a browser-based client on another origin must connect, add it with `corsOptions.origin` or `allowedOriginHostnames`, never with `"*"` unless something else checks origins first.
## Phase 5: Tests
The template's tests run in the Workers runtime (`@cloudflare/vitest-plugin`) and cover the whole path with a fake GitHub: metadata, consent page escaping, forged form, deny, full sign-in, read-only grants, the 401 challenge, protected resource metadata, every tool, per-user isolation, the `insufficient_scope` step-up, schema errors, pagination, the size limit, GET returning 405, errors without stack traces, CORS, and entry module exports.
Preview ends at line 76. The file continues for 61 more lines in the kit.
remote-mcp-server/scripts/verify-mcp.mjsLines 1 to 80 of 763#!/usr/bin/env node
// verify-mcp.mjs: checks a remote MCP server, live or as a Cloudflare Workers project on disk.
// No dependencies. Needs Node 18 or newer.
//
// node verify-mcp.mjs --url https://mcp.example.com/mcp
// node verify-mcp.mjs --url https://mcp.example.com/mcp --token <access token>
// node verify-mcp.mjs --dir ./my-mcp-server
//
// Options:
// --url <url> Check a live MCP endpoint: initialize, tools/list, the 401 challenge, protected resource metadata,
// authorization server metadata, GET on the endpoint, CORS preflight.
// --token <t> With --url: a bearer access token, so the checks behind sign-in run too. Or set MCP_TOKEN.
// The token is never printed.
// --dir <path> Check a Workers project: wrangler config, compatibility date and flags, secrets in vars,
// tool annotations, error handling, .gitignore.
// --strict Treat warnings as failures.
// --json Print the results as JSON instead of text.
//
// Exit code 0 when nothing failed, 1 when at least one check failed, 2 when the arguments are wrong.
import { execFileSync } from "node:child_process";
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
import { dirname, join, relative, resolve } from "node:path";
import { pathToFileURL } from "node:url";
/** Protocol revisions this script knows. A server may answer with any of them. */
export const KNOWN_PROTOCOLS = ["2026-07-28", "2025-11-25", "2025-06-18", "2025-03-26"];
const ASK_PROTOCOL = "2025-11-25";
const TIMEOUT_MS = 15000;
const pass = (area, message) => ({ level: "pass", area, message });
const warn = (area, message, fix, where) => ({ level: "warn", area, message, fix, where });
const fail = (area, message, fix, where) => ({ level: "fail", area, message, fix, where });
// ---------- shared helpers ----------
const lineOf = (text, index) => (index < 0 ? undefined : text.slice(0, index).split("\n").length);
/** Remove // and /* comments and trailing commas from JSONC, leaving strings (and URLs in them) alone. */
export function stripJsonc(text) {
let out = "";
let inStr = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
const n = text[i + 1];
if (inStr) {
out += c;
if (c === "\\") out += text[++i] ?? "";
else if (c === '"') inStr = false;
} else if (c === '"') {
inStr = true;
out += c;
} else if (c === "/" && n === "/") {
while (i < text.length && text[i] !== "\n") i++;
out += "\n";
} else if (c === "/" && n === "*") {
i += 2;
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) {
if (text[i] === "\n") out += "\n";
i++;
}
i++;
} else out += c;
}
// Trailing commas, again outside strings.
let res = "";
inStr = false;
for (let i = 0; i < out.length; i++) {
const c = out[i];
if (inStr) {
res += c;
if (c === "\\") res += out[++i] ?? "";
else if (c === '"') inStr = false;
continue;
}
if (c === '"') inStr = true;
if (c === ",") {
let j = i + 1;
while (j < out.length && /\s/.test(out[j])) j++;
if (out[j] === "}" || out[j] === "]") continue;
}
Preview ends at line 80. The file continues for 683 more lines in the kit.
remote-mcp-server/template/src/index.tsLines 1 to 37 of 83// MCP server (OAuth resource server) on Cloudflare Workers.
//
// Request path:
// client -> OAuthResourceServer (401 + resource metadata without a valid token; token checked over the AUTH_SERVER
// service binding) -> scope and size checks below -> createMcpHandler (stateless Streamable HTTP) -> tools.ts
//
// Stateless: a new McpServer is built for every request, so nothing is kept between requests except what the tools
// store themselves (KV here). GET and DELETE on /mcp answer 405, as the stateless transport has no session stream.
//
// This is the Worker's entry module: it exports only `default`. Workers treats every named export of the entry
// module as an entrypoint, and a named export that is not a handler (a constant, say) stops the Worker from starting.
// Shared values live in tools.ts.
import { OAuthResourceServer, insufficientScope, type OAuthResourceContext } from "@cloudflare/workers-oauth-provider";
import { McpServer } from "@modelcontextprotocol/server";
import { createMcpHandler, getMcpAuthContext } from "agents/mcp/server";
import type { AuthProps, McpEnv } from "./env";
import { MAX_REQUEST_BYTES, READ_SCOPE, SERVER_INFO, registerTools } from "./tools";
/** Sent to the model once per connection. Say what the server is for and the order to use the tools in. */
const INSTRUCTIONS =
"Personal notes for the signed-in user. Use list_notes to find a note, get_note to read it, create_note and update_note to write, " +
"and delete_note only after the user confirms. Write tools need the connection to have write access.";
const rpcError = (status: number, code: number, message: string) =>
Response.json({ jsonrpc: "2.0", id: null, error: { code, message } }, { status, headers: { "cache-control": "no-store" } });
/** Runs for every request that carries a valid token for MCP_SERVER_URL. */
async function handleMcp(request: Request, env: McpEnv, ctx: OAuthResourceContext<AuthProps>): Promise<Response> {
// requiredScopes below is advertised to clients, not enforced. Enforce it here.
if (!ctx.auth.scope.includes(READ_SCOPE)) return insufficientScope(ctx.auth, [READ_SCOPE]);
if (request.method === "POST") {
if (Number(request.headers.get("content-length") ?? 0) > MAX_REQUEST_BYTES) return rpcError(413, -32600, "Request too large.");
const body = await request.arrayBuffer();
if (body.byteLength > MAX_REQUEST_BYTES) return rpcError(413, -32600, "Request too large.");
request = new Request(request, { body });
}
Preview ends at line 37. The file continues for 46 more lines in the kit.
Stripe on Workers Kit See the Stripe on Workers Kit page
Preview the files
stripe-checkout-workers/SKILL.mdLines 1 to 70 of 230---
name: stripe-checkout-workers
description: Add one-off Stripe payments to a Cloudflare Worker with no Stripe SDK. Creates a Checkout session, verifies the webhook signature with the raw body, fulfils each paid order exactly once (idempotent, retry-safe, amount-checked), delivers something automatically, and proves it with unit tests, the Stripe CLI and the bundled verify-stripe.mjs script. Use when asked to take payments, add Stripe Checkout, handle Stripe webhooks, sell a product or deliver after payment on Cloudflare Workers.
license: Commercial. See LICENSE in this folder.
metadata:
version: "1.0.0"
author: Red Center Studio
---
# Stripe one-off payments on a Cloudflare Worker
You are adding a payment flow that takes one-off payments with Stripe Checkout and delivers something automatically after the money arrives. Work through the nine phases below, in order. Do not skip Phase 9: the job is done when the verify script passes and the test-mode run in Phase 7 worked, not when the files exist.
Paths in this file are relative to this skill's folder. The verify script needs Node 18 or newer and has no dependencies. The Worker template targets Cloudflare Workers with D1 and the Email Sending binding, and is written in TypeScript.
## Ground rules
1. **Test mode only until Phase 8.** Every key, secret, endpoint and payment in Phases 1 to 7 is Stripe test mode. Never create, read or use a live-mode key, and never run a `stripe` CLI command that touches live mode. Phase 8 is a checklist the user works through.
2. **Never handle secrets in chat or in files.** Do not ask the user to paste a key into the conversation. Tell them to run `npx wrangler secret put STRIPE_SECRET_KEY` and `npx wrangler secret put STRIPE_WEBHOOK_SECRET` themselves, and to put test values in `.dev.vars` (gitignored) for local work. Do not print, log or echo a secret. If you must use one in a shell, read it from an environment variable.
3. **The webhook is the only thing that fulfils.** The success page, a redirect, a query string or a browser call never grants access, sends the product or marks an order paid. The success page may look the session up on Stripe's servers to show a message, nothing more.
4. **The price lives in one place.** `PRICE_CENTS` in `wrangler.jsonc` (smallest currency unit, for example cents). The checkout code reads it, the amount check reads it, and the page copy that shows a price is generated from or checked against the same value. Never accept a price from the request.
5. **Answer Stripe honestly.** 2xx means "handled or nothing to do". 400 means "bad signature or unreadable". 5xx means "try again later". Never answer 2xx for something that failed and can still succeed.
6. **Fulfilment must be safe to run twice.** Stripe can send an event more than once and can send several different events for one payment. Every side effect goes through `ctx.once(step, fn)` or an equivalent record.
7. **Do not invent Stripe facts.** API version names, CLI flags, dashboard menu names, permission names and test card numbers change. When you are not sure, read Stripe's documentation at https://docs.stripe.com (webhooks, Checkout, API keys, CLI) and say what you checked. If you cannot check, say so in the report.
8. **Change the source, not generated files.** `worker-configuration.d.ts` is generated by `npm run types` after any change to `wrangler.jsonc`. Do not hand-edit it.
9. **Ask before anything that costs money or goes public.** Deploying, creating a Dashboard webhook endpoint, creating Cloudflare resources and every Phase 8 step need the user's yes. Do not run `wrangler deploy` on your own initiative.
10. **No false claims.** Do not promise the user "PCI compliance", tax handling, refunds or fraud protection. Say what the code does and what it does not (see "What this does not cover").
## Phase 1: Decide the product, the price and what is delivered
Ask the user these questions once, in one message, and write the answers down before you touch code:
1. What is sold, in one line (this becomes `PRODUCT_NAME` and `PRODUCT_DESCRIPTION`, shown on Stripe's checkout page)?
2. The price and currency (becomes `PRICE_CENTS` and `CURRENCY`). One product at one price. If they sell several products, this template needs one more step (see Phase 3, "More than one product").
3. What does the buyer get after paying? Pick one:
- an email receipt only (the default `deliver()` does this);
- an email with a link, a licence key or a download;
- access granted in a database, a repository or another API;
- something started on your side (a job, an account, a file).
4. Where do alerts go when an order needs a person (`OWNER_EMAIL`), what is the buyer-facing sender (`MAIL_FROM`, on a domain verified for Email Sending) and the support address (`SUPPORT_EMAIL`)?
5. Where does the buyer land after paying? Default: this Worker's own `/success` and `/cancel` pages. If their own website should show the result, note the origin for `ALLOWED_ORIGIN`.
6. Is this a new Worker, or an existing Worker project that needs payments added?
Do not move on until you have the product name, price, currency and delivery choice. If the buyer needs something that is not a one-off payment (recurring billing, marketplace payouts, tax calculation), stop and say so: see "What this does not cover".
Done when: you can state the product, price, currency, delivery and alert address back to the user in two lines.
## Phase 2: Copy the template
1. New Worker: copy `template/` to the project (for example `cp -r template ./payments`, or the project root if empty). Existing Worker: copy these files in and merge, never overwrite the user's own files without asking: `src/stripe.ts`, `src/fulfil.ts`, `src/crypto.ts`, `src/email.ts`, `src/pages.ts`, `src/env.ts`, the three routes from `src/index.ts`, `migrations/0001_init.sql` (renumber it after the project's own migrations), the bindings and vars in `wrangler.jsonc`, and `test/`.
2. Run, in the project folder: `npm install`, then `npm run types`, then `npm run check`. The template's own tests (about 40) and the type check must pass before you change anything. If they do not, fix the environment first (Node version, install errors), not the code.
3. Keep the pinned versions in `package.json` unless there is a reason to upgrade. If you upgrade, rerun `npm run check`.
4. Edit the `vars` in `wrangler.jsonc` (both the top level and the `test` environment) with the Phase 1 answers: `PRODUCT_TAG` (a short lowercase id for this product), `PRODUCT_NAME`, `PRODUCT_DESCRIPTION`, `PRICE_CENTS`, `CURRENCY`, `MAIL_FROM`, `SUPPORT_EMAIL`, `OWNER_EMAIL`, `SITE_ORIGIN`. Keep `SALES_OPEN` at `"true"` in the test environment and set it to `"false"` for the live environment until Phase 8.
5. Set `STRIPE_API_VERSION` to the API version of the user's Stripe account. Look in Stripe's documentation for where the account version is shown, or ask the user. Do not copy the example value without checking it. An empty value omits the header and uses the account default.
6. Run `npm run types` again, then `npm run check`.
Done when: `npm run check` passes with the user's values in `wrangler.jsonc`.
## Phase 3: The checkout endpoint
`POST /api/checkout` starts a Checkout session and returns `{ "url": "https://checkout.stripe.com/..." }`. The code is `createCheckoutSession` in `src/stripe.ts`. Read it and confirm these properties; do not weaken them:
- It calls Stripe's REST API directly with `fetch`, form-encoded, with `Authorization: Bearer <secret key>` and a `Stripe-Version` header taken from `STRIPE_API_VERSION`.
- `mode=payment`, one line item, `unit_amount` from `PRICE_CENTS`, currency from `CURRENCY`. Nothing in the request body can change the price.
- `metadata[product]` (and the same on `payment_intent_data`) carries `PRODUCT_TAG`, so a webhook shared with other products ignores payments that are not yours.
- `success_url` is `<SITE_ORIGIN>/success?session_id={CHECKOUT_SESSION_ID}` and `cancel_url` is `<SITE_ORIGIN>/cancel`. Stripe replaces `{CHECKOUT_SESSION_ID}`. Confirm in Phase 7 that the address you land on contains a real `cs_test_` id.
- The endpoint refuses to start payments while `SALES_OPEN` is not `"true"`, rate limits per IP (and fails open if the limiter itself breaks), and refuses browser requests from origins other than `SITE_ORIGIN` and `ALLOWED_ORIGIN`.
- It never writes an order. An order exists only after a verified, paid webhook.
Wire the buyer's button to it. A minimal front-end snippet:
Preview ends at line 70. The file continues for 160 more lines in the kit.
stripe-checkout-workers/scripts/verify-stripe.mjsLines 1 to 63 of 576#!/usr/bin/env node
// verify-stripe.mjs: checks a Cloudflare Worker that takes one-off Stripe payments.
// No dependencies. Needs Node 18 or newer.
//
// node verify-stripe.mjs --dir ./my-worker
// node verify-stripe.mjs --url http://localhost:8787/api/stripe/webhook --secret-env STRIPE_WEBHOOK_SECRET
//
// Options:
// --dir <path> Static checks on the project's source, config and .gitignore.
// --url <webhook-url> Live test of a running webhook endpoint (wrangler dev or a test deployment).
// --secret-env <NAME> Name of the environment variable that holds the test-mode signing secret for that
// endpoint. Default STRIPE_WEBHOOK_SECRET. The secret is never taken from the command line
// and never printed.
// --product-tag <tag> The value your Worker expects in session metadata.product. Without it the fake session
// is tagged with nothing, so a Worker that filters by product answers "other product".
// --i-know-this-is-test-mode
// Allow --url to point at a host that is not localhost. Use only with a test-mode secret.
// --strict Treat warnings as failures.
// --json Print the results as JSON instead of text.
//
// Exit code 0 when nothing failed, 1 when at least one check failed, 2 when the arguments are wrong.
import { createHmac, randomBytes } from "node:crypto";
import { readdir, readFile, stat } from "node:fs/promises";
import { dirname, join, relative, resolve, sep } from "node:path";
import { pathToFileURL } from "node:url";
const SKIP_DIRS = new Set(["node_modules", ".git", ".wrangler", "dist", "build", "coverage", ".next", ".turbo", ".svelte-kit", ".output"]);
const SKIP_FILES = new Set(["package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "worker-configuration.d.ts"]);
const TEXT_EXT = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json", ".jsonc", ".toml", ".sql", ".md", ".txt", ".yml", ".yaml", ".html", ".example", ".sh"]);
const CODE_EXT = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
const LOCAL_SECRET_FILE = /^\.(dev\.vars|env)(\.(?!example$)[\w.-]+)?$/; // .dev.vars, .env, .env.local, not the .example copies
// ---------- reading the project ----------
const extOf = (name) => {
const i = name.lastIndexOf(".");
return i < 0 ? "" : name.slice(i).toLowerCase();
};
const isTestPath = (rel) => /(^|\/)(test|tests|__tests__|fixtures)\//.test(rel) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(rel);
async function walk(dir, root, out) {
let entries;
try {
entries = await readdir(dir, { withFileTypes: true });
} catch {
return;
}
for (const e of entries) {
const abs = join(dir, e.name);
if (e.isDirectory()) {
if (!SKIP_DIRS.has(e.name)) await walk(abs, root, out);
} else if (e.isFile() && !SKIP_FILES.has(e.name)) {
const ext = extOf(e.name);
const local = LOCAL_SECRET_FILE.test(e.name);
if (!TEXT_EXT.has(ext) && !e.name.startsWith(".dev.vars") && !e.name.startsWith(".env")) continue;
const info = await stat(abs);
if (info.size > 2_000_000) continue;
const rel = relative(root, abs).split(sep).join("/");
out.push({ rel, abs, ext, local, test: isTestPath(rel), text: await readFile(abs, "utf8") });
}
}
}
Preview ends at line 63. The file continues for 513 more lines in the kit.
stripe-checkout-workers/template/src/stripe.tsLines 1 to 72 of 127// Stripe: verify webhook signatures, start Checkout sessions, look sessions up. Raw REST calls, no SDK.
import { hmacVerifyHex } from "./crypto";
import { type AppEnv, type Deps, priceCents } from "./env";
/** How far the signature timestamp may be from now. Stripe's own libraries default to 5 minutes. */
export const SIGNATURE_TOLERANCE_SECONDS = 300;
/**
* Checks the Stripe-Signature header. Check Stripe's webhook signature documentation if this ever stops matching.
* The scheme: the header looks like t=<unix seconds>,v1=<hex HMAC-SHA256>, and the HMAC is computed over
* "<t>.<raw body>" with the endpoint's signing secret. Rules this code follows:
* - The payload must be the exact raw body string. Parse JSON only after this passes.
* - Several v1 values can appear while a secret is being rolled; any match passes.
* - Unknown entries (v0 on test events, or debug metadata such as secret= and payload=) are ignored. They are not
* signed and must never be used to authenticate anything.
* - Old timestamps are refused, which stops a captured request from being replayed later.
*/
export async function verifyStripeSignature(
payload: string,
header: string | null,
secret: string,
nowMs: number,
toleranceSeconds = SIGNATURE_TOLERANCE_SECONDS,
): Promise<boolean> {
if (!header || !secret) return false;
let timestamp = "";
const signatures: string[] = [];
for (const part of header.split(",")) {
const i = part.indexOf("=");
if (i < 0) continue;
const k = part.slice(0, i).trim();
const v = part.slice(i + 1).trim();
if (k === "t") timestamp = v;
else if (k === "v1") signatures.push(v);
}
const t = Number(timestamp);
if (!/^\d+$/.test(timestamp) || !Number.isFinite(t) || signatures.length === 0) return false;
if (Math.abs(nowMs / 1000 - t) > toleranceSeconds) return false;
for (const sig of signatures) {
if (await hmacVerifyHex(secret, `${timestamp}.${payload}`, sig)) return true;
}
return false;
}
/** The parts of a Checkout Session this Worker uses. */
export interface CheckoutSession {
id: string;
object: "checkout.session";
payment_status: "paid" | "unpaid" | "no_payment_required";
status?: string;
amount_total: number | null;
currency: string | null;
payment_intent?: string | { id?: string } | null;
metadata?: Record<string, string> | null;
customer_details?: { email?: string | null; name?: string | null } | null;
livemode?: boolean;
}
export interface StripeEvent {
id: string;
type: string;
livemode?: boolean;
data: { object: unknown };
}
function stripeHeaders(env: AppEnv): Record<string, string> {
if (!env.STRIPE_SECRET_KEY) throw new Error("STRIPE_SECRET_KEY is not set");
const headers: Record<string, string> = { Authorization: `Bearer ${env.STRIPE_SECRET_KEY}` };
// Pin the API version your code was written and tested against. Set STRIPE_API_VERSION to your account's version.
if (env.STRIPE_API_VERSION) headers["Stripe-Version"] = env.STRIPE_API_VERSION;
return headers;
}
Preview ends at line 72. The file continues for 55 more lines in the kit.
Workers Launch Check Kit See the Workers Launch Check Kit page
Preview the files
workers-launch-check/SKILL.mdLines 1 to 77 of 179---
name: workers-launch-check
description: Review a Cloudflare Workers project before it goes to production, fix what fails and prove it with the bundled verify-launch.mjs script. Covers wrangler config, secrets, input handling, auth on write routes, CORS, rate limits, body size caps, outbound timeouts, error handling, logging and observability, security headers and caching, D1 and R2 data safety, and a rollback plan. Use when asked to check, review, harden or launch a Workers API, site or app, especially one that was written or scaffolded by an AI.
license: Proprietary. See LICENSE in this folder.
metadata:
version: "1.0.0"
author: Red Center Studio
---
# Workers launch check
You are getting a Cloudflare Workers project ready to face the public. Work through the ten phases below in order. The job is done when `scripts/verify-launch.mjs` passes and you have filled in the report, not when the code looks fine to you.
Paths in this file are relative to this skill's folder. The script needs Node 18 or newer and has no dependencies. Commands that touch Cloudflare use `npx wrangler`.
## Ground rules
1. **Read before you change.** Phases 1 and 2 are read-only. Tell the user what you found before Phase 3 edits anything.
2. **Never print, log, commit or paste a secret.** If you find one in code, config or git history, say where it is, say it must be rotated (it has been exposed), and move it to a Wrangler secret. Do not repeat the value in your reply.
3. **No deploys, no remote writes without a yes.** Do not run `wrangler deploy`, `wrangler secret put`, `wrangler d1 migrations apply --remote`, `wrangler d1 time-travel restore` or anything that changes the live account unless the user has said so in this session. Local commands and `--dry-run` are fine.
4. **Change the smallest thing that fixes the finding.** This is a launch review, not a rewrite. Keep the project's style and framework (plain Workers, Hono, itty-router and so on).
5. **Do not invent wrangler keys.** If you are unsure a key exists, check the current Cloudflare docs (developers.cloudflare.com/workers/wrangler/configuration/) before adding it.
6. **Ask before a product decision.** Which origins may call the API, how many requests per minute is fair, whether a bucket is meant to be public: these are the owner's calls. Propose a default, ask once, write the answer down in config or code comments.
7. **Do not weaken a check to make it pass.** A suppression comment (`launch-check-ignore: reason`) is allowed for a real false positive, with the reason written next to it. It is not a way to hide a finding.
## Phase 1: Inventory
Read the project and write down, before running anything:
1. Wrangler config (`wrangler.jsonc`, `wrangler.json` or `wrangler.toml`): name, `main`, `compatibility_date`, routes or custom domains, `workers_dev`, environments under `env`.
2. Bindings: D1, KV, R2, Durable Objects, Queues, service bindings, Workers AI, email, rate limiters, static assets.
3. Vars versus secrets. Vars are plain text in config. Secrets are set with `wrangler secret put` and are only ever read from `env`. List every `env.NAME` the code reads that is not a binding or a var: those are the secrets the deployment needs. The script prints this list as "likely secrets".
4. Entry points: HTTP routes, `scheduled` (cron), `queue` consumers, `email` handlers, Durable Object classes. For HTTP, list each route with its method and whether it is public, signed-in only, or machine-to-machine.
5. Every route that writes (POST, PUT, PATCH, DELETE) or spends money or quota (calls a paid API, sends email, runs AI). These get the most attention in Phases 4 and 5.
6. How the project is deployed (manual `wrangler deploy`, CI, Git integration) and whether there is a staging environment.
Keep this inventory. It goes into the report.
## Phase 2: Run the checker
```
node scripts/verify-launch.mjs --dir .
```
Keep the output as the "before" result. If the project is already deployed or has a preview address, also run the live checks (four polite requests):
```
node scripts/verify-launch.mjs --dir . --url https://the-worker.example.com/
```
Every FAIL and WARN prints what is wrong, where (file and line when it can tell) and the fix. The script is a set of static heuristics and a few live requests. It does not replace your reading in Phases 3 to 9, and a PASS is not a security audit. Phase 10 lists what it cannot see.
## Phase 3: Secrets and config
1. **Secrets out of config.** Nothing secret-looking in `vars`, in any `env.*.vars`, or in source. Keys, tokens, signing secrets, webhook secrets and private keys go in `npx wrangler secret put NAME` (add `--env name` for each environment, because secrets are per environment). If one was ever committed, tell the user to rotate it. Removing it from the latest commit does not un-leak it.
2. **Local secrets stay local.** `.dev.vars` and `.env` (and `.dev.vars.*`) are in `.gitignore` and not tracked by git. Provide a `.dev.vars.example` with names and fake values so the next developer knows what to set. If a real file was tracked, `git rm --cached` it and rotate its contents.
3. **Typed env.** Run `npx wrangler types` so `Env` matches the config. Fail fast if a required secret is missing: check it at the top of the request path and return a generic 500 (and log the missing name, never a value), not a confusing crash later.
4. **Compatibility date.** Set `compatibility_date` to a recent date you have tested with. The checker warns when it is more than 12 months old. Moving it forward changes runtime behaviour, so run the tests after.
5. **Observability on.** `"observability": { "enabled": true }`. On a busy Worker lower `head_sampling_rate` (0 to 1) to control volume. Without logs you cannot debug the first bad hour of a launch.
6. **Source maps.** `"upload_source_maps": true` so stack traces in logs point at your code.
7. **Where it answers.** If the Worker has routes or a custom domain, set `workers_dev` on purpose: `false` if only your domain should serve it, `true` if the workers.dev address is wanted. A forgotten workers.dev address is a second public front door that skips any zone rules (WAF, bot rules, rate limits) you set on the domain.
8. **Environments.** Bindings and vars are not inherited by `env.*` sections. Check that staging and production each declare what they need, and that staging does not point at production data.
## Phase 4: Input handling, auth on every write route, CORS
1. **Validate at the edge of every route.** Check type, length and allowed values of each field you use before using it. Reject with 400 and a short message. Do not trust `content-type`, query strings, path parameters or headers.
2. **SQL.** D1 queries use fixed SQL with `?` placeholders and `.bind(...)`. Never build SQL with template literals or `+`. The checker fails on this. For a column or table name that must vary, map the user's input through an allowlist object and use the mapped constant, then add `launch-check-ignore: allowlisted` on that line.
3. **No code from strings.** No `eval`, `new Function`. Do not pass user text to `fetch` as a URL without checking the host (server-side request forgery): allow only the hosts you mean to call.
4. **Auth on every route that writes or spends.** Walk the list from Phase 1 one route at a time and write down how each is protected: session or token check, signed webhook (verify the signature over the raw body with a constant-time compare, and reject old timestamps), Turnstile for public forms (verify server-side with the secret), or Cloudflare Access for admin paths. A route that is public on purpose says so in a comment. The checker cannot tell whether a handler checks auth, so this is your job: read each handler.
5. **Check ownership, not just login.** A signed-in user must only reach their own records: filter by the user id from the verified session, never from the request body.
6. **Compare secrets safely.** Compare tokens and signatures with `crypto.subtle.timingSafeEqual` on equal-length digests, not `===`. Generate tokens with `crypto.getRandomValues` or `crypto.randomUUID`, never `Math.random`.
7. **CORS.** Decide who calls the API from a browser. Same-origin only: send no CORS headers. Public read-only API: `Access-Control-Allow-Origin: *` is fine with no credentials. Anything with cookies or an Authorization header: compare the request `Origin` with an explicit list, echo it only on a match, add `Vary: Origin`, and never combine `*` or an echoed origin with `Access-Control-Allow-Credentials: true` without that list. Answer `OPTIONS` yourself with 204.
8. **Cookies.** Session cookies are `Secure; HttpOnly; SameSite=Lax` (or `Strict`), with a bounded `Max-Age`. State-changing routes that rely on cookies need a CSRF defence: `SameSite`, an Origin check, or a token.
## Phase 5: Abuse limits
1. **Rate limiting binding.** Put a limiter in front of every public route that writes, sends email, calls a paid API or checks a password. In `wrangler.jsonc`:
Preview ends at line 77. The file continues for 102 more lines in the kit.
workers-launch-check/scripts/verify-launch.mjsLines 1 to 80 of 906#!/usr/bin/env node
// verify-launch.mjs: a launch check for a Cloudflare Workers project.
// No dependencies. Needs Node 18 or newer.
//
// node verify-launch.mjs --dir ./my-worker
// node verify-launch.mjs --url https://my-worker.example.com/
// node verify-launch.mjs --dir . --url https://my-worker.example.com/ --strict
//
// Options:
// --dir <path> Static check of a project folder: wrangler config, git hygiene, source code (src/).
// --url <url> Live check of a deployed Worker: HTTPS, security headers, 404 behaviour, CORS preflight.
// Four requests in total: the page, its plain-HTTP twin, an unknown path, one OPTIONS.
// --strict Treat warnings as failures.
// --json Print the results as JSON instead of text.
//
// Exit code 0 when nothing failed, 1 when at least one check failed, 2 when the arguments are wrong.
//
// This is a set of static heuristics and a few polite live requests. It is not a penetration test and it does
// not prove a project is secure. A finding can be suppressed on one line with a comment containing
// "launch-check-ignore: <reason>" on the same line or the line above.
//
// wrangler.toml support: a small parser for tables, arrays of tables, strings, numbers, booleans, arrays and
// inline tables. It does not read multi-line strings or dates. Prefer wrangler.jsonc if a key is not found.
import { readFile, readdir, stat } from "node:fs/promises";
import { existsSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { join, resolve, relative, sep } from "node:path";
import { pathToFileURL } from "node:url";
export const AREAS = [
["inventory", "Inventory"],
["config", "Wrangler config"],
["secrets", "Secrets"],
["input", "Input, database and code"],
["cors", "CORS"],
["abuse", "Abuse limits"],
["errors", "Errors and logging"],
["data", "Data safety"],
["live", "Live checks"],
];
const UA = "verify-launch/1.0 (launch check)";
const R = (level, area, message, fix, extra = {}) => ({ level, area, message, ...(fix ? { fix } : {}), ...extra });
// ---------- wrangler config parsing ----------
/** Remove // and /* comments and trailing commas outside strings. */
export function stripJsonc(text) {
let out = "";
let inStr = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
const d = text[i + 1];
if (inStr) {
out += c;
if (c === "\\") out += text[++i] ?? "";
else if (c === '"') inStr = false;
continue;
}
if (c === '"') { inStr = true; out += c; continue; }
if (c === "/" && d === "/") { while (i < text.length && text[i] !== "\n") i++; out += "\n"; continue; }
if (c === "/" && d === "*") { const e = text.indexOf("*/", i + 2); const stop = e < 0 ? text.length : e + 2; out += text.slice(i, stop).replace(/[^\n]/g, " "); i = stop - 1; continue; }
out += c;
}
// trailing commas: a comma followed only by whitespace and a closing bracket, outside strings
let res = "";
inStr = false;
for (let i = 0; i < out.length; i++) {
const c = out[i];
if (inStr) { res += c; if (c === "\\") res += out[++i] ?? ""; else if (c === '"') inStr = false; continue; }
if (c === '"') { inStr = true; res += c; continue; }
if (c === ",") { let j = i + 1; while (j < out.length && /\s/.test(out[j])) j++; if (out[j] === "}" || out[j] === "]") continue; }
res += c;
}
return res;
}
export function parseJsonc(text) {
return JSON.parse(stripJsonc(text));
}
Preview ends at line 80. The file continues for 826 more lines in the kit.
| Agent Skill kit | Single-file prompt | |
|---|---|---|
| Verification | A bundled check script with an exit code. The agent is not done until it passes. | None. The agent decides when it is done. |
| Templates | Ready-made files to start from: robots.txt and JSON-LD templates, tested Workers. | The agent writes everything from scratch each run. |
| Tests | The paid kits ship tests for their check scripts, and for their templates where they include one. | None. |
| Process | Numbered phases in a fixed order, with ground rules on secrets, deploys and invented facts. | Whatever order the model picks on the day. |
| Your own runs | The check script runs by itself, in CI or by hand, with no agent. | Needs the agent every time. |
| Updates | Versioned. Updates within version 1 are free on request. | Whatever you copied, as it was. |
$49 USD
Remote MCP Server Kit, Stripe on Workers Kit and Workers Launch Check Kit, paid once. Bought one by one they cost $73 USD, so the bundle saves $24 USD. One zip holds every skill folder: unzip it into your skills folder the same way.
A folder with a SKILL.md file: a name, a description that tells the agent when to use it, and step by step instructions. Agents that support skills load it when your request matches the description. Each kit adds the scripts, templates and references that its instructions point to.
Any agent that reads the SKILL.md format, including Claude Code, Cursor and Antigravity. In an agent without skill support, keep the folder in your project and ask the agent to follow its SKILL.md. The check scripts also run on their own with Node 18 or newer.
A prompt tells the agent what to do. A kit also gives it tested files to start from and a check script with a pass or fail result. The agent works through numbered phases and is not done until the script passes, so you can see whether the job was finished.
One purchase covers one person or one company. Use the kit on as many projects as you like, your own and your clients'. What you build with it is yours. You may not resell, share or publish the kit itself, or hand a client the kit's folder to reuse.
The MIT licence. Use it, change it and share it, in your own work and your clients'. It downloads straight from this page with no sign-up.
Pay once through Stripe Checkout. You land on a download page with your zip, and the same download link is emailed to you. It works for 30 days and up to 10 downloads.
Each kit has a version number. Updates within version 1 are free: email Hello@redcenterstudio.com with your order id and you get a new download link.
If a kit has a major problem we cannot fix, you can ask for a refund. Your rights under Australian Consumer Law apply in full. Email Hello@redcenterstudio.com.
No. The scripts run on your machine with no dependencies and read your project folder. With a URL option they make a few requests to the address you give them, and nothing else.
From $3,500 USD
Red Center Studio builds custom MCP (Model Context Protocol) servers that connect AI assistants such as Claude and ChatGPT to a business's own tools and data, with sign-in, per-user permissions and an activity log, hosted on Cloudflare Workers in the client's own account. It covers internal connectors for a team, public servers and Claude plugins for a product, and ChatGPT apps built on MCP. Builds start from $3,500 USD and usually take 2 to 6 weeks.
From $499 USD
Red Center Studio sets up paid access for AI crawlers and AI agents on Cloudflare: a crawler policy that keeps AI search assistants welcome while charging or blocking the rest, Cloudflare's paid crawler access where your account has it (pay per crawl is being replaced by Pay Per Use, in beta since 30 September 2026), and pay-per-call APIs that AI agents pay for in USDC using the x402 standard. The x402 option runs on Cloudflare Workers and is not limited to the United States. Setup starts from $499 USD and usually takes 1 to 2 weeks.
$499 USD
The GEO Foundation Package is a $499 USD done-for-you setup from Red Center Studio of the technical signals AI assistants and search engines read: structured data on up to 10 key pages, llms.txt, robots.txt rules for AI crawlers, a checked sitemap submitted to Google and Bing, and clear titles and descriptions, with a before-and-after GEO audit. Usually 3 to 5 business days.