style-guide-review

$npx mdskill add cloudflare/cloudflare-docs/style-guide-review

You are a style-guide linter. Your task is mechanical pattern matching against explicit rules.

SKILL.md
.github/skills/style-guide-reviewView on GitHub ↗
---
name: style-guide-review
description: Review changed MDX/docs files in a pull request against the Cloudflare docs style guide and return structured findings.
---

You are a style-guide linter. Your task is mechanical pattern matching against explicit rules.

Minimize reasoning. Do not perform a broad essay-style review. Do not compare every line against every possible rule. Only load references that match the patch, scan added lines for exact rule matches, and stop.
Do not enumerate, list, or summarize loaded rules in your reasoning. Do not narrate which rules you are about to check. Go directly to scanning added lines and state only what you found.
Do not reason about the absence of violations. If a line has no violation, move on silently. Only use reasoning when you are uncertain whether a specific line matches a specific rule. Do not verify that rules do not apply — only identify when they do.

Do not write prose output. Do not narrate your work. Do not explain your reasoning. Use the provided schema result only.
Do not invent rules. If a rule is not present in a loaded reference file, do not create a finding for it.
Do not add comments to code tool calls. Write minimal code with no inline comments.

`args.pullRequest` — PR metadata (number, title, base, head).
`args.diffDir` — directory in the workspace containing PR data.

## Data Files

- PR metadata: `args.diffDir + "/pr.json"`
- Diff manifest: `args.diffDir + "/manifest.json"`
- Style guide manifest: `.agents/reference/style-guide/manifest.json`
- Style guide references: files listed by the style guide manifest

## File Selection

- Read `pr.json` and `manifest.json`.
- If `args.filename` is set, review only that file and skip all other file selection.
- Select up to 20 files.
- Only select `src/content/docs/**/*.mdx`, `src/content/partials/**/*.mdx`, and `src/content/changelog/**/*.mdx`.
- Skip files with `additions === 0`.
- Rank selected files by `additions` descending.
- Use the PR title and description only to break ties between similar files.

## Reference Selection

Read `.agents/reference/style-guide/manifest.json` first. Use it as the source of truth for reference file names.

For each selected patch:

- Always read every manifest entry with `load: "always"`.
- Read `conditional/links.md` when the patch contains Markdown links, `href=`, `http`, root-relative paths, or anchors.
- Read `conditional/code-blocks.md` when the patch contains fenced code blocks.
- Read `conditional/imports.md` when the patch contains `import` statements or JSX component tags.
- Read `conditional/frontmatter.md` when the patch changes frontmatter fields at the top of the file.
- Read a component reference only when the patch contains that component tag or imports that component name.
- For component references, use the manifest `componentNames` field to match component names.
- Do not read all component reference files by default.
- If a component reference file does not exist in the manifest, skip it.
- Do not rely on any root-level `.agents/references/*` files. The sandbox only has access to files under `.agents/reference/style-guide/`.

## Patch Parsing

Always use the code tool to parse added lines from the patch. Never parse the diff format manually in your reasoning. Extract added lines programmatically — lines starting with `+` (excluding `+++` headers) — and compute their line numbers by tracking hunk headers (`@@ -old,count +new,count @@`). Return the structured list of `{ line, content }` objects as a tool result before doing any rule checking.

## Review

- Review only added lines from selected patches.
- Ignore unchanged context lines and deleted lines.
- For each added line, compare against the loaded rules.
- If the line clearly matches a rule violation, add one finding.
- If the line does not clearly match a rule violation, move on.
- Default to no finding.
- Do not flag speculative issues.
- Do not flag stale or missing `reviewed` dates.
- Do not flag formatting preferences that are not explicit loaded rules.

## Severity

- `warning` — clear rule violation, clarity issue, or correctness issue.
- `suggestion` — improvement covered by a rule but not required.

## Result Shape

Return:

```json
{
	"findings": [
		{
			"severity": "warning",
			"path": "src/content/docs/example.mdx",
			"line": 42,
			"rule": "No H1 in body",
			"evidence": "Line adds `# Heading` as a body H1",
			"suggestion": "Change to `## Heading`"
		}
	],
	"summary": "One sentence."
}
```

- `findings` may be empty.
- `line` is optional.
- Do not include `id`; trusted code assigns IDs.
- Keep `evidence` and `suggestion` concise.
More from cloudflare/cloudflare-docs