Skip to content

Commit be1e8e0

Browse files
committed
feat(docs-copy): add advisory review heuristics
Add the advisory phrase-mapping reference, tighten human review-gate criteria, and expand copy lint coverage for descriptions, comparative headings, and coined shorthand warnings.
1 parent cbe2676 commit be1e8e0

10 files changed

Lines changed: 323 additions & 3 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Phrase Mapping Reference
2+
3+
Human-maintained guidance for recurring weak constructions.
4+
This file is advisory. It is not a one-to-one thesaurus and it does not auto-promote entries into the banned lists.
5+
6+
Use it when a review pass identifies a repeated failure mode that is real, but still needs judgement and multiple acceptable rewrite shapes.
7+
8+
<CustomDivider />
9+
10+
## How To Use This File
11+
12+
For each recurring pattern, capture:
13+
14+
- the pattern or opening shape
15+
- why it fails
16+
- rewrite shapes that usually work
17+
- any accuracy caveat that should prevent blind substitution
18+
19+
Prefer rewrite families over a single mandatory replacement.
20+
21+
<CustomDivider />
22+
23+
## Comparative Openings
24+
25+
| Pattern | Why it usually fails | Rewrite shapes |
26+
|---|---|---|
27+
| `What changes from X` | Starts from comparison before the thing itself is defined | `What this option does`; `When to choose this path`; `What the operator gains here` |
28+
| `Unlike X` | Defines value by contrast | `This option gives you ...`; `Choose this when ...`; `This path is for ...` |
29+
| `Compared to X` | Assumes the reader already has a baseline | `This path keeps ...`; `This design separates ...`; `Use this when ...` |
30+
| `The key difference is` | Signals comparison-led framing | `The primary outcome is ...`; `The operational trade-off is ...` |
31+
32+
Accuracy caveat:
33+
Use comparison after the concept is established if the comparison materially helps the decision.
34+
35+
<CustomDivider />
36+
37+
## Announcement And Throat-Clearing
38+
39+
| Pattern | Why it usually fails | Rewrite shapes |
40+
|---|---|---|
41+
| `This section walks you through` | Announces instead of delivering | Delete and start with the content; `Use this path when ...`; `Do X by ...` |
42+
| `Before we begin` | Preamble instead of prerequisite | `Prerequisites`; `You need ... before ...` |
43+
| `Now that you understand X` | Patronising and unnecessary | Delete; move directly to the next point |
44+
| `It is worth noting that` | Throat-clearing | Delete; state the fact |
45+
| `In order to` | Verbose | `To ...` |
46+
47+
<CustomDivider />
48+
49+
## Mechanism-First Openings
50+
51+
| Pattern | Why it usually fails | Rewrite shapes |
52+
|---|---|---|
53+
| `[tool] runs [flag] against [address]` as the first sentence | Leads with internals before fit or outcome | `Use this path to ...`; `Choose this when ...`; `This option lets you ...` |
54+
| `[component] handles [list of operations]` as the first sentence | Describes machinery before why the reader should care | `The operator keeps ...`; `This setup offloads ...`; `This model is for ...` |
55+
| `The [thing] separates what [other thing] runs together` | Defines only by structural difference | `This split lets you ...`; `Use this separation when ...`; `This setup isolates ...` |
56+
57+
Accuracy caveat:
58+
If the mechanism itself is the irreducible fact, keep it and document why the normal benefit-first rewrite would be misleading.
59+
60+
<CustomDivider />
61+
62+
## Decision Language
63+
64+
| Pattern | Why it usually fails | Rewrite shapes |
65+
|---|---|---|
66+
| `Use this when:` followed by a long checklist | Delays the primary fit condition | `Use this when [single strongest fit]`; follow with constraints or checks |
67+
| `This may be appropriate if` | Hedged recommendation | `Use this when ...`; `Choose this if ...` |
68+
| `It depends on your situation` | Refuses the decision | `The deciding factor is ...`; `Choose A when ... Choose B when ...` |
69+
| `There are several options` | Vague quantity, no orientation | Name the options immediately |
70+
71+
<CustomDivider />
72+
73+
## First-Use Terminology
74+
75+
| Pattern | Why it usually fails | Rewrite shapes |
76+
|---|---|---|
77+
| Abbreviation in a heading before definition | Reader has no referent | Define in prose first, then reuse the shorthand |
78+
| Coined term in a table before prose introduction | Scan order beats comprehension | Add a short prose definition before the table |
79+
| Flag name as the grammatical subject of the opening sentence | Assumes prior command knowledge | Name the capability first, then introduce the flag |
80+
81+
<CustomDivider />
82+
83+
## Description Field Anti-Patterns
84+
85+
| Pattern | Why it usually fails | Rewrite shapes |
86+
|---|---|---|
87+
| `The X alternatives to ...` | Announces page contents, not reader value | `Choose the right ...`; `Pick the ... path for ...`; `Decide between ... based on ...` |
88+
| `How to configure X` | Repeats page type, not outcome | `Configure X so you can ...`; `Set up X for ...` |
89+
| `Overview of X, Y, and Z` | Table of contents in one sentence | `Understand how X affects ...`; `Learn when to use ...` |
90+
91+
<CustomDivider />
92+
93+
## Maintenance Rule
94+
95+
Add a new row only when:
96+
97+
- the pattern recurs across reviews
98+
- a single banned phrase would be too blunt
99+
- human judgement is still required to choose the right rewrite
100+
101+
If a pattern truly becomes non-negotiable, promote it explicitly into the canonical banned list with human approval.

‎ai-tools/ai-skills/docs-copy/skills/review-gate.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,31 @@ Confirm CI passes before starting the human checklist.
3636
## Human review required
3737

3838
### Sequence (L2)
39-
- [ ] Page opens with operator outcome - kept value, one sentence, no conditionals
39+
- [ ] Page opens with the most useful fact for the intended reader; for option/decision pages that is usually the operator outcome or fit
4040
- [ ] Majority operator path is fully described before variants appear
4141
- [ ] Every introduced path is developed on-page or linked
42+
- [ ] Any deliberate mechanism-first opening has a documented accuracy reason
4243

4344
### Completeness (L3)
4445
- [ ] Every decision aid is complete - no placeholders, no REVIEW flags
4546
- [ ] Every warning or consequence is followed by a prevention action and link
4647
- [ ] Primary actions and URLs appear in body copy, not only inside accordions or Notes
48+
- [ ] Coined terms and local shorthand are defined before readers meet them in headings, tables, or diagrams
4749

4850
### Tone (L4)
4951
- [ ] No sentence ends on a hedge, disclaimer, or restatement
5052
- [ ] No section ends with a Note that apologises rather than forward-points
5153
- [ ] No diagram and table carry identical information
54+
- [ ] Comparison is not the entry point unless the page has already defined the thing being compared
5255

5356
### Brief compliance
5457
- [ ] L0 Q1-Q4 was completed before drafting (check brief)
5558
- [ ] L1 persona mapping table was completed before drafting (check brief)
5659

60+
### Manual acceptance
61+
- [ ] Canonical terminology is confirmed, or disputed terms are explicitly routed to SME/research review
62+
- [ ] Review sign-off notes any accepted exception where product or research truth overrides a normal copy heuristic
63+
5764
<CustomDivider />
5865

5966
## Fail escalation
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"fixture": "comparative-heading.mdx",
3+
"errors": [
4+
{ "id": "COMPARATIVE_HEADER", "required": true }
5+
]
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fixture": "description-heuristics.mdx",
3+
"errors": [
4+
{ "id": "DESCRIPTION_ANNOUNCES_CONTENT", "required": true },
5+
{ "id": "DESCRIPTION_TOO_LONG", "required": true }
6+
]
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"fixture": "undefined-heading-term.mdx",
3+
"errors": [
4+
{ "id": "UNDEFINED_HEADING_TERM", "required": true }
5+
]
6+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: 'Setup Options'
3+
description: 'Choose a deployment path based on your staking and compute responsibilities.'
4+
pageType: guide
5+
audience: orchestrator
6+
purpose: orientation
7+
status: current
8+
lastVerified: '2026-03-15'
9+
---
10+
11+
Choose the setup that matches your operational model.
12+
13+
## What changes from the single-process deployment
14+
15+
This split changes where the operator runs services and where the node advertises capacity.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: 'Setup Options'
3+
description: >-
4+
Overview of the three alternatives to running an Orchestrator so operators can
5+
understand the differences, compare trade-offs, review setup mechanics, and
6+
decide which deployment path to follow next.
7+
pageType: guide
8+
audience: orchestrator
9+
purpose: orientation
10+
status: current
11+
lastVerified: '2026-03-15'
12+
---
13+
14+
Choose a deployment path based on how much staking, hardware separation, and
15+
operational complexity you want to manage.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: 'Setup Options'
3+
description: 'Choose a deployment path for separated Orchestrator and transcoder responsibilities.'
4+
pageType: guide
5+
audience: orchestrator
6+
purpose: orientation
7+
status: current
8+
lastVerified: '2026-03-15'
9+
---
10+
11+
Choose a deployment path before separating services.
12+
13+
## O-T Split
14+
15+
This pattern separates the services across hosts.

‎tests/unit/copy-lint.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function buildCopyFindings(content, filePath) {
8686
return [
8787
...phraseFindings,
8888
...lintCopy.checkBannedWords(content, filePath, { suppressedLines: phraseHitLines }),
89-
...lintCopy.checkTier2Patterns(content, filePath)
89+
...lintCopy.checkAdvisoryHeuristics(content, filePath)
9090
];
9191
}
9292

‎tools/scripts/lint-copy.js‎

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
const fs = require('fs');
1717
const path = require('path');
1818
const { execSync } = require('child_process');
19+
const matter = require('gray-matter');
1920

2021
const COPY_GOVERNANCE_DIR = path.resolve(__dirname, '../lib/copy-governance');
2122

@@ -77,6 +78,17 @@ const TIER2_PATTERNS = [
7778
}
7879
];
7980

81+
const DESCRIPTION_ANNOUNCE_PATTERNS = [
82+
/^this\s+(page|section)\b/i,
83+
/^overview of\b/i,
84+
/^how to\b/i,
85+
/^the\s+(?:\d+|two|three|four|five)\s+alternatives?\s+to\b/i,
86+
/^the\s+alternatives?\s+to\b/i
87+
];
88+
89+
const COMPARATIVE_OPENING_REGEX = /^(what changes from|compared to|unlike|differences from|the key difference is)\b/i;
90+
const COINED_HEADING_TOKEN_REGEX = /\b[A-Z](?:-[A-Z])+\b/g;
91+
8092
function readFileListFromEnv() {
8193
const listPath = String(process.env.LINT_FILE_LIST || '').trim();
8294
if (!listPath || !fs.existsSync(listPath)) {
@@ -247,6 +259,139 @@ function checkTier2Patterns(content, filePath) {
247259
return warnings;
248260
}
249261

262+
function findFrontmatterLine(lines, key) {
263+
const pattern = new RegExp(`^${key}:\\s*`);
264+
for (let index = 0; index < lines.length; index += 1) {
265+
if (!inFrontmatter(lines, index)) {
266+
break;
267+
}
268+
if (pattern.test(lines[index].trim())) {
269+
return index + 1;
270+
}
271+
}
272+
return 1;
273+
}
274+
275+
function checkDescriptionHeuristics(content, filePath) {
276+
const warnings = [];
277+
let parsed;
278+
279+
try {
280+
parsed = matter(content);
281+
} catch (_error) {
282+
return warnings;
283+
}
284+
285+
const description = String(parsed.data?.description || '')
286+
.replace(/\s+/g, ' ')
287+
.trim();
288+
289+
if (!description) {
290+
return warnings;
291+
}
292+
293+
const lines = getLines(content);
294+
const line = findFrontmatterLine(lines, 'description');
295+
296+
if (DESCRIPTION_ANNOUNCE_PATTERNS.some((pattern) => pattern.test(description))) {
297+
warnings.push({
298+
tier: 2,
299+
file: filePath,
300+
line,
301+
id: 'DESCRIPTION_ANNOUNCES_CONTENT',
302+
label: 'Description announces page contents — lead with reader outcome instead',
303+
text: description.slice(0, 120)
304+
});
305+
}
306+
307+
if (description.length > 160) {
308+
warnings.push({
309+
tier: 2,
310+
file: filePath,
311+
line,
312+
id: 'DESCRIPTION_TOO_LONG',
313+
label: `Description exceeds 160-character target (${description.length}) — tighten the outcome statement`,
314+
text: description.slice(0, 120)
315+
});
316+
}
317+
318+
return warnings;
319+
}
320+
321+
function checkHeadingHeuristics(content, filePath) {
322+
const warnings = [];
323+
const lines = getLines(content);
324+
let headingCount = 0;
325+
326+
lines.forEach((line, index) => {
327+
if (inFrontmatter(lines, index)) {
328+
return;
329+
}
330+
331+
const trimmed = line.trim();
332+
const headingMatch = trimmed.match(/^#{1,6}\s+(.+)$/);
333+
const boldLeadInMatch = trimmed.match(/^\*\*(.+?)\*\*:?\s*$/);
334+
const headingText = headingMatch ? headingMatch[1].trim() : '';
335+
const boldLeadInText = boldLeadInMatch ? boldLeadInMatch[1].trim() : '';
336+
337+
if ((headingText && COMPARATIVE_OPENING_REGEX.test(headingText)) || (boldLeadInText && COMPARATIVE_OPENING_REGEX.test(boldLeadInText))) {
338+
warnings.push({
339+
tier: 2,
340+
file: filePath,
341+
line: index + 1,
342+
id: 'COMPARATIVE_HEADER',
343+
label: 'Comparative heading/opening — define the thing before comparing it',
344+
text: trimmed.slice(0, 120)
345+
});
346+
}
347+
348+
if (!headingText) {
349+
return;
350+
}
351+
352+
headingCount += 1;
353+
if (headingCount > 3) {
354+
return;
355+
}
356+
357+
const coinedTokens = headingText.match(COINED_HEADING_TOKEN_REGEX) || [];
358+
if (coinedTokens.length === 0) {
359+
return;
360+
}
361+
362+
const priorBody = lines
363+
.slice(0, index)
364+
.filter((entry, entryIndex) => !inFrontmatter(lines, entryIndex))
365+
.filter((entry) => !/^#{1,6}\s+/.test(entry.trim()))
366+
.join(' ');
367+
368+
coinedTokens.forEach((token) => {
369+
if (priorBody.includes(token)) {
370+
return;
371+
}
372+
373+
warnings.push({
374+
tier: 2,
375+
file: filePath,
376+
line: index + 1,
377+
id: 'UNDEFINED_HEADING_TERM',
378+
label: `Coined shorthand "${token}" appears in a heading before definition — define it in body prose first`,
379+
text: trimmed.slice(0, 120)
380+
});
381+
});
382+
});
383+
384+
return warnings;
385+
}
386+
387+
function checkAdvisoryHeuristics(content, filePath) {
388+
return [
389+
...checkTier2Patterns(content, filePath),
390+
...checkDescriptionHeuristics(content, filePath),
391+
...checkHeadingHeuristics(content, filePath)
392+
];
393+
}
394+
250395
function run() {
251396
const args = process.argv.slice(2);
252397
const warnOnly = args.includes('--warn-only');
@@ -271,7 +416,7 @@ function run() {
271416
...checkBannedWords(content, filePath, { suppressedLines: phraseHitLines })
272417
];
273418

274-
const tier2Warnings = tier1Only ? [] : checkTier2Patterns(content, filePath);
419+
const tier2Warnings = tier1Only ? [] : checkAdvisoryHeuristics(content, filePath);
275420

276421
const allTier1 = [...tier1Errors, ...tier2Warnings.filter((warning) => warning.tier === 1)];
277422
const allTier2 = tier2Warnings.filter((warning) => warning.tier === 2);
@@ -318,6 +463,9 @@ module.exports = {
318463
checkBannedWords,
319464
checkBannedPhrases,
320465
checkTier2Patterns,
466+
checkDescriptionHeuristics,
467+
checkHeadingHeuristics,
468+
checkAdvisoryHeuristics,
321469
getFiles,
322470
run
323471
};

0 commit comments

Comments
 (0)