content-md 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.md +38 -8
- package/bin/content-md.js +15 -2
- package/data/meta.json +1 -60
- package/guide/SKILL.md +4 -2
- package/guide/rubric.md +0 -9
- package/guide/rules.md +4 -2
- package/guide/voice.md +1 -1
- package/package.json +6 -5
- package/src/aivoice.js +7 -0
- package/src/context.js +12 -8
- package/src/init.js +103 -29
- package/src/product.js +58 -26
- package/src/reference2.js +71 -9
- package/src/repo.js +63 -0
- package/src/server.js +42 -15
- package/src/tools.js +98 -31
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
From a trial in a real product repo and a full audit of 1.0.0. (1.0.1 was built but never published; its changes are listed under it below and ship in this release.)
|
|
6
|
+
|
|
7
|
+
**Serious bugs fixed**
|
|
8
|
+
- `audit_copy` and `read_product` no longer skip most of a big repo. The walk is breadth-first, counts only files it can read copy from, stops at 40,000 (set `CONTENT_MD_MAX_FILES` to change it) and says so: the result carries `truncated` and a warning naming the folders it didn't read.
|
|
9
|
+
- `path_filter` that names a folder walks that folder directly, and a filter that finds nothing says so instead of returning `scanned: 0`.
|
|
10
|
+
- Curly apostrophes and quotes ("won’t") are read the same as straight ones by every check, and by `read_product`'s contraction count.
|
|
11
|
+
- Future tense ("will read", "we’ll publish", "going to") is no longer read as a claim that something already happened.
|
|
12
|
+
- `outcome-hint` was inverted. It now fires when the state shows no decision.
|
|
13
|
+
- The plural check no longer matches `{name}`; it still catches `{count} messages`.
|
|
14
|
+
- New `are-you-sure` check: a warning, or a note when the line goes on to name the cost.
|
|
15
|
+
|
|
16
|
+
**Lint**
|
|
17
|
+
- New: `absence-headline` ("Nothing to see here", "There are no X at the moment", "You don't have any X"), `typo` (about 70 common misspellings, "occured" among them), `empty-text` (a piece with no text is blocked). "Uh oh" and "yikes" are flagged as filler at any stakes.
|
|
18
|
+
- Common one-word buttons pass (Save, Send, Delete, Undo, Add, Open, Create, View and more). A lone vague verb ("Manage") is a note, and not even that when the headline names the object.
|
|
19
|
+
- `audit_copy` labels links, nav items and footer items as links, not buttons.
|
|
20
|
+
- `no-way-forward` counts contact, sign in, reload, wait, update and visit, and skips empty and non-English text.
|
|
21
|
+
- `lint_copy` and the other tools accept the element names agents guess: button, title, heading, link, error, description and similar.
|
|
22
|
+
- On the package's own 778 strong and gold lines, 1.5% now get a warn or block (3.9% before); on their 550 screens, 4.0% (7.5% before).
|
|
23
|
+
|
|
24
|
+
**References**
|
|
25
|
+
- `find_reference` always takes one path and returns one shape, with the quality floor, whether you pass `role` or `element`.
|
|
26
|
+
- `find_examples` ranks by the query when you give one, and returns nothing when no screen shares a word with it.
|
|
27
|
+
- `compare_to_reference`'s length range is now really within 30%.
|
|
28
|
+
- `decide_tone` with no facts returns an error asking for at least the screen state and stakes. With facts it always returns an instruction.
|
|
29
|
+
- The rubric's "Stay close to the reference" section is gone. It told agents to write every line from a reference, against the rules and the test results.
|
|
30
|
+
|
|
31
|
+
**Cost and install**
|
|
32
|
+
- `get_guide` with a pattern returns about 14,000 characters (33,700 before): the playbook, the universal rules, the rubric and only the parts of the pattern index that fit. `full: true` returns everything. Without a pattern it returns the rules and the list of patterns, not every playbook (58,000 before).
|
|
33
|
+
- `read_product` returns about 10,000 characters (16,000 before).
|
|
34
|
+
- The optional semantic-search dependency is gone. It added about 55 MB and couldn't work, because its vectors were never shipped. Search is keyword-based, as it was in practice.
|
|
35
|
+
- `ask_person` no longer requires `slot` or `default`.
|
|
36
|
+
- The numbers in the guide, skill, README and data now agree: 8,876 lines from 703 products, 16 style guides, 413 rules, 35 patterns, 194 pattern rules.
|
|
37
|
+
|
|
38
|
+
**init and files**
|
|
39
|
+
- `save_product_brief` writes `.content-md/product.md`, its own file, and never edits AGENTS.md or CLAUDE.md unless asked to. Briefs saved in those files by 1.0.0 are still read.
|
|
40
|
+
- With no flags, init uses only what the repo shows (`.cursor`, `.claude`, `CLAUDE.md`, `AGENTS.md`, `.vscode`, `.windsurfrules`), not folders in your home directory. If it finds nothing, it writes nothing and tells you which flag to pass.
|
|
41
|
+
|
|
42
|
+
On five open-source app repos, lines flagged by the kinds of check 1.0.0 had fell from 769 to 542 (−30%). The new checks (a failure with no fix, "Are you sure", absence headlines, typos) flag 151 more lines, which I sampled and found to be real.
|
|
43
|
+
|
|
44
|
+
## 1.0.1 (not published)
|
|
45
|
+
|
|
46
|
+
**init**
|
|
47
|
+
- Writes only inside the repo. For Codex and Windsurf, whose MCP settings live in your home folder, it prints the lines to add; `--global` lets it write them.
|
|
48
|
+
- Pins the server to the installed version (`npx -y content-md@<version>`), so an editor never pulls a new release on its own.
|
|
49
|
+
- Shared instruction files (`AGENTS.md`, `.github/copilot-instructions.md`, `.windsurfrules`) get a short pointer instead of the full method. `--rules` restores the full method.
|
|
50
|
+
- Finds the repo's own copy rules and glossary and tells the agent they come first.
|
|
51
|
+
- New: `npx content-md remove` takes out everything init added. `npx content-md audit` runs the audit from the command line.
|
|
52
|
+
|
|
53
|
+
**Precedence**
|
|
54
|
+
- The rules, the skill and the server instructions now say the repo's own copy rules, glossary and voice guide win. The line about not reusing a reference's wording now applies to other products' lines only; the product's own words should be reused.
|
|
55
|
+
- `read_product` and `audit_copy` return `repo_rules`, the files where the repo states its rules.
|
|
56
|
+
|
|
57
|
+
**Lint**
|
|
58
|
+
- Standard labels pass: Continue, Submit, Next, Confirm, Inbox, Terms, Privacy, Settings, Help and similar. A lone word is flagged only when it is a verb that needs an object, so product and brand names pass.
|
|
59
|
+
- "null" and "undefined" in field docs ("Can be null", "Returns null when...") are no longer template leaks.
|
|
60
|
+
- "exception" in prose is no longer a raw error code.
|
|
61
|
+
- Success toasts can take an exclamation mark; only failure toasts are flagged.
|
|
62
|
+
- "Contact us", "email", "reach out" and similar count as a way forward.
|
|
63
|
+
- The word "page" alone is no longer screen narration; "This page lists..." still is.
|
|
64
|
+
- "Failed to", "went wrong" and "an error occurred" are flagged only when the line gives no fix, under the new rule `verdict-no-fix`. `blame-or-verdict` now covers blame only ("invalid", "you forgot"); "you must" is no longer flagged.
|
|
65
|
+
- "You can" is kept when it grants permission or names an option ("You can change this later", "If you lose it, you can reset it").
|
|
66
|
+
- "100%" is flagged only as a promise ("100% secure"), not as a value. Format tokens (YYYY MM DD) aren't flagged as all caps. A verdict and its fix ("Couldn't save. Try again.") aren't flagged as even sentences.
|
|
67
|
+
- New `allow` input, and `.content-md.json` (`allow`, `ignore`, `industry`), for words the repo has decided to use.
|
|
68
|
+
|
|
69
|
+
**audit_copy**
|
|
70
|
+
- Skips vendored, third-party, demo, playground, sandbox, generated and component-library folders (for example `shadcn-*` and `*-studio` blocks) and files marked `@generated` or `DO NOT EDIT`.
|
|
71
|
+
|
|
72
|
+
**References**
|
|
73
|
+
- `find_reference` and `find_examples` take an `industry` (defaulting to `.content-md.json`, then the saved brief). Lines from the same or a near industry rank higher; a line from an unrelated industry that carries that industry's own words (a booking, a workout) is dropped, and other unrelated lines need a close match on the moment.
|
|
74
|
+
- Higher floors (fit 0.40, situation 0.22): it returns nothing more often, rather than a weak match. Numbers, codes and stray tokens are no longer returned as copy.
|
|
75
|
+
- `how_to_use` no longer tells the agent to copy a reference's template; it treats references as evidence and points to the repo's rules.
|
|
76
|
+
|
|
77
|
+
## 1.0.0
|
|
78
|
+
|
|
79
|
+
First release.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Install with `npx content-md init`.
|
|
|
9
9
|
When your agent writes a button, an error, an empty state, a dialog or a notification, it can:
|
|
10
10
|
|
|
11
11
|
1. **Decide the tone for the moment.** `decide_tone` takes the facts (what happened, how much is at stake, who has to act next) and returns two tone words, one concrete instruction, the tones to avoid and the mistakes writers are tempted to make. The voice stays your product's. Only the tone moves with the moment.
|
|
12
|
-
2. **Look up the pattern.** `get_guide` has playbooks for
|
|
12
|
+
2. **Look up the pattern.** `get_guide` has playbooks for 35 interface patterns (error, empty state, paywall, confirmation dialog, push notification and so on) and an index of 194 pattern rules, with a 1 to 3 self-scoring rubric.
|
|
13
13
|
3. **Check the copy against what the product actually knows.** The writing rules include a state check. Before drafting, the agent lists what the system knows, what it does not know and who acts next. Copy must not claim more than that.
|
|
14
14
|
4. **Audit promises, only when needed.** If a draft claims something beyond the state (a cause, an outcome, a timeline), the agent removes or softens that claim. If nothing goes beyond the state, the audit is skipped, because always-on auditing made good lines worse.
|
|
15
15
|
5. **Lint the draft.** `lint_copy` is deterministic. It catches template leaks, raw error codes, filler, generic buttons, blame words, "Are you sure", a body that repeats its headline, casing and length. It also has checks for habits that models fall into: "No X yet" headlines, copy that narrates where things appear on screen, invented causes, two sentences of the same length, and rewrites that change a short label for no reason.
|
|
@@ -22,11 +22,15 @@ The writing rules are defaults with stated exceptions, not laws. They are in `gu
|
|
|
22
22
|
|
|
23
23
|
| tool | use |
|
|
24
24
|
|---|---|
|
|
25
|
+
| `read_product` | reads the repo once (README, manifest, its own strings, its copy rules) and returns the slots for a short product brief and the likely industry |
|
|
26
|
+
| `save_product_brief` | saves that brief in a marked block in AGENTS.md or CLAUDE.md, so the next session doesn't ask again |
|
|
27
|
+
| `ask_person` | asks the person at most two questions, as a form where the client supports it |
|
|
28
|
+
| `audit_copy` | finds the user-facing strings in the code and ranks them worst first, so the agent fixes those and leaves the rest |
|
|
25
29
|
| `decide_tone` | call first when the moment has stakes or feeling; returns tone words, an instruction and what to avoid |
|
|
26
|
-
| `get_guide` | voice,
|
|
30
|
+
| `get_guide` | voice, universal rules, the playbook for one of 35 patterns, the matching part of the pattern index and a rubric (about 14,000 characters) |
|
|
27
31
|
| `find_rules` | style-guide rules with do and don't examples |
|
|
28
32
|
| `lint_copy` | deterministic checks on one screen's copy; pass the pattern, the tool state, the stakes and the original lines if rewriting |
|
|
29
|
-
| `find_reference` | optional: the closest shipped lines for one element in one situation |
|
|
33
|
+
| `find_reference` | optional: the closest shipped lines for one element in one situation, kept to your industry; often returns none |
|
|
30
34
|
| `compare_to_reference` | optional: checks that a candidate keeps a reference's shape |
|
|
31
35
|
| `find_examples` | optional: whole shipped screens, with headline, body and buttons together |
|
|
32
36
|
|
|
@@ -42,20 +46,46 @@ content-md lint '{"pattern":"error","units":[{"element":"headline","text":"Error
|
|
|
42
46
|
|
|
43
47
|
```sh
|
|
44
48
|
cd your-app
|
|
45
|
-
npx content-md init #
|
|
49
|
+
npx content-md init # uses the tools this repo already has config for; or name them: --cursor --claude --codex --vscode --windsurf, or --all
|
|
46
50
|
```
|
|
47
51
|
|
|
48
|
-
Restart the editor or agent afterwards. `init`
|
|
52
|
+
Restart the editor or agent afterwards. `init` is safe to run again, and `--dry-run` shows what it would write.
|
|
53
|
+
|
|
54
|
+
What it does, and what it leaves alone:
|
|
55
|
+
|
|
56
|
+
- **It writes only inside your repo.** Codex and Windsurf keep their MCP settings in your home folder, so for those `init` prints the lines to add instead. Pass `--global` to let it write them.
|
|
57
|
+
- **It pins the version.** The server entry is `npx -y content-md@<version>`, so your editor never picks up a new release on its own. Run `init` again to move to a newer one.
|
|
58
|
+
- **Shared instruction files get a short pointer, not a rulebook.** `AGENTS.md`, `.github/copilot-instructions.md` and `.windsurfrules` get a few lines in a marked block: when to call the tools, and that your repo's own rules win. `--rules` puts the full method there instead. Cursor and Claude Code get the full method in their own files (`.cursor/rules/content-md.mdc`, `.claude/skills/content-md/SKILL.md`), which load only for copy work.
|
|
59
|
+
- **Your repo's copy rules come first.** `init` looks for them (copy, voice, tone or glossary sections in `AGENTS.md` or `CLAUDE.md`, and files like `docs/glossary.md` or `content-style.md`) and names them in what it writes, so the agent reads them and follows them wherever content-md differs.
|
|
60
|
+
- **It only sets up tools the repo already uses.** With no flags it looks for `.cursor`, `.claude`, `CLAUDE.md`, `AGENTS.md`, `.vscode` and `.windsurfrules` in the repo. If it finds none, it writes nothing and tells you which flag to pass.
|
|
61
|
+
- **The product brief gets its own file.** `save_product_brief` writes `.content-md/product.md`, not your agent instructions.
|
|
62
|
+
- **`npx content-md remove`** takes out everything `init` added. Add `--global` to clean the home-folder entries too.
|
|
49
63
|
|
|
50
64
|
| tool | MCP server registered in | rule installed in |
|
|
51
65
|
|---|---|---|
|
|
52
66
|
| Cursor | `.cursor/mcp.json` | `.cursor/rules/content-md.mdc` |
|
|
53
67
|
| Claude Code | `.mcp.json` | `.claude/skills/content-md/SKILL.md` |
|
|
54
|
-
| Codex | `~/.codex/config.toml` | `AGENTS.md` (marked block) |
|
|
68
|
+
| Codex | `~/.codex/config.toml` (with `--global`) | `AGENTS.md` (marked block) |
|
|
55
69
|
| VS Code (Copilot) | `.vscode/mcp.json` | `.github/copilot-instructions.md` (marked block) |
|
|
56
|
-
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | `.windsurfrules` (marked block) |
|
|
70
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` (with `--global`) | `.windsurfrules` (marked block) |
|
|
71
|
+
|
|
72
|
+
### Tuning it to your repo
|
|
73
|
+
|
|
74
|
+
Put a `.content-md.json` at the repo root to tell the tools what your product has already decided:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"allow": ["Continue", "Inbox", "Submit"],
|
|
79
|
+
"ignore": ["src/legacy/", "packages/email-templates/"],
|
|
80
|
+
"industry": "media-entertainment"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `allow`: words and whole lines your glossary or style guide asks for. `lint_copy` and `audit_copy` never flag them. (A state overclaim is still flagged.)
|
|
85
|
+
- `ignore`: folders that aren't product UI. `audit_copy` already skips tests, vendored and third-party folders, demos, playgrounds, generated files and component-library blocks.
|
|
86
|
+
- `industry`: keeps `find_reference` and `find_examples` to comparable products. One of finance, commerce, productivity, social, ai-tools, health-fitness, media-entertainment, food-delivery, travel, education, developer-tools, mobility. Without it, the tools use the industry saved in your product brief.
|
|
57
87
|
|
|
58
|
-
|
|
88
|
+
To see the lines in a repo that most need a look, run `npx content-md audit` (or `npx content-md audit src/settings` for one area).
|
|
59
89
|
|
|
60
90
|
## What we tested, and what we found
|
|
61
91
|
|
package/bin/content-md.js
CHANGED
|
@@ -4,6 +4,13 @@ const [cmd, ...rest] = process.argv.slice(2);
|
|
|
4
4
|
if (cmd === "init") {
|
|
5
5
|
const { init } = await import("../src/init.js");
|
|
6
6
|
init(rest);
|
|
7
|
+
} else if (cmd === "remove" || cmd === "uninstall") {
|
|
8
|
+
const { remove } = await import("../src/init.js");
|
|
9
|
+
remove(rest);
|
|
10
|
+
} else if (cmd === "audit") {
|
|
11
|
+
// npx content-md audit [path_filter] : the worst user-facing lines in this repo
|
|
12
|
+
const { auditCopy } = await import("../src/product.js");
|
|
13
|
+
console.log(JSON.stringify(auditCopy({ path_filter: rest[0] }), null, 1));
|
|
7
14
|
} else if (cmd === "lint") {
|
|
8
15
|
// npx content-md lint '{"pattern":"error","units":[{"element":"headline","text":"Error"}]}'
|
|
9
16
|
const { lintCopy } = await import("../src/tools.js");
|
|
@@ -11,8 +18,14 @@ if (cmd === "init") {
|
|
|
11
18
|
} else if (cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
12
19
|
console.log(`content-md: UX writing tools for coding agents, a tone decider, pattern playbooks, style-guide rules and a copy linter.
|
|
13
20
|
|
|
14
|
-
npx content-md init [--cursor --claude --codex --vscode --windsurf | --all] [--dry-run]
|
|
15
|
-
register the MCP server with your tools and add a short
|
|
21
|
+
npx content-md init [--cursor --claude --codex --vscode --windsurf | --all] [--rules] [--global] [--dry-run]
|
|
22
|
+
register the MCP server with your tools and add a short pointer (with no flag, it uses the tools this repo already has config for, and writes nothing if it finds none).
|
|
23
|
+
Writes only inside this repo unless you pass --global. --rules puts the full method
|
|
24
|
+
in AGENTS.md and the other shared files instead of the pointer.
|
|
25
|
+
npx content-md remove [--global] [--dry-run]
|
|
26
|
+
take out everything init added
|
|
27
|
+
npx content-md audit [path]
|
|
28
|
+
list the user-facing lines in this repo that most need a look
|
|
16
29
|
npx content-md
|
|
17
30
|
run the MCP server over stdio (this is what your editor calls)
|
|
18
31
|
npx content-md lint '<json>'
|
package/data/meta.json
CHANGED
|
@@ -1,60 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"patterns": [
|
|
3
|
-
"ai-chat",
|
|
4
|
-
"auth-form",
|
|
5
|
-
"checkout",
|
|
6
|
-
"confirmation-dialog",
|
|
7
|
-
"consent-privacy",
|
|
8
|
-
"directory-browse",
|
|
9
|
-
"email",
|
|
10
|
-
"empty-state",
|
|
11
|
-
"error",
|
|
12
|
-
"filter-sort",
|
|
13
|
-
"form-general",
|
|
14
|
-
"gallery-showcase",
|
|
15
|
-
"help-support",
|
|
16
|
-
"invite-share",
|
|
17
|
-
"leaderboard-ranking",
|
|
18
|
-
"listing-catalogue",
|
|
19
|
-
"loading-progress",
|
|
20
|
-
"navigation-menu",
|
|
21
|
-
"offline",
|
|
22
|
-
"onboarding",
|
|
23
|
-
"page-intro",
|
|
24
|
-
"paywall-upsell",
|
|
25
|
-
"permission-request",
|
|
26
|
-
"push-notification",
|
|
27
|
-
"rating-review-prompt",
|
|
28
|
-
"referral-rewards",
|
|
29
|
-
"search-no-results",
|
|
30
|
-
"settings-destructive",
|
|
31
|
-
"settings-preferences",
|
|
32
|
-
"subscription-management",
|
|
33
|
-
"success",
|
|
34
|
-
"toast-snackbar",
|
|
35
|
-
"tooltip-coachmark",
|
|
36
|
-
"update-maintenance",
|
|
37
|
-
"verification-kyc"
|
|
38
|
-
],
|
|
39
|
-
"elements": [
|
|
40
|
-
"badge",
|
|
41
|
-
"body",
|
|
42
|
-
"headline",
|
|
43
|
-
"helper-text",
|
|
44
|
-
"inline-error",
|
|
45
|
-
"label",
|
|
46
|
-
"legal-fineprint",
|
|
47
|
-
"placeholder",
|
|
48
|
-
"primary-cta",
|
|
49
|
-
"secondary-cta",
|
|
50
|
-
"subtitle",
|
|
51
|
-
"tertiary-link",
|
|
52
|
-
"title-bar",
|
|
53
|
-
"toast"
|
|
54
|
-
],
|
|
55
|
-
"screens": 1693,
|
|
56
|
-
"units": 8909,
|
|
57
|
-
"products": 704,
|
|
58
|
-
"rules": 413,
|
|
59
|
-
"sources": 16
|
|
60
|
-
}
|
|
1
|
+
{"patterns": ["ai-chat", "auth-form", "checkout", "confirmation-dialog", "consent-privacy", "directory-browse", "email", "empty-state", "error", "filter-sort", "form-general", "gallery-showcase", "help-support", "invite-share", "leaderboard-ranking", "listing-catalogue", "loading-progress", "navigation-menu", "offline", "onboarding", "page-intro", "paywall-upsell", "permission-request", "push-notification", "rating-review-prompt", "referral-rewards", "search-no-results", "settings-destructive", "settings-preferences", "subscription-management", "success", "toast-snackbar", "tooltip-coachmark", "update-maintenance", "verification-kyc"], "elements": ["badge", "body", "headline", "helper-text", "inline-error", "label", "legal-fineprint", "placeholder", "primary-cta", "secondary-cta", "subtitle", "tertiary-link", "title-bar", "toast"], "screens": 1690, "units": 8876, "products": 703, "rules": 413, "sources": 16}
|
package/guide/SKILL.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: content-md
|
|
3
|
-
description: Write, review or rewrite product microcopy (buttons, errors, empty states, dialogs, onboarding, permissions, paywalls, checkout, settings, forms, KYC, consent, referrals, AI chat UI) using patterns from
|
|
3
|
+
description: Write, review or rewrite product microcopy (buttons, errors, empty states, dialogs, onboarding, permissions, paywalls, checkout, settings, forms, KYC, consent, referrals, AI chat UI) using patterns from 8,876 labeled lines of shipped interface copy (703 products) and 16 public style guides.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# UX writing from shipped-copy patterns
|
|
7
7
|
|
|
8
|
-
These rules come from a labeled set of shipped interface copy. Each piece was labeled for pattern, element, intent, tone and a 1 to 3 quality score. Every rule below is backed by examples that scored 3, and every "not this" by examples that scored 1. They were then checked against
|
|
8
|
+
These rules come from a labeled set of shipped interface copy. Each piece was labeled for pattern, element, intent, tone and a 1 to 3 quality score. Every rule below is backed by examples that scored 3, and every "not this" by examples that scored 1. They were then checked against 16 public style guides (Apple HIG, Atlassian, Baymard, Carbon, GOV.UK Design System, GOV.UK Service Manual, Microsoft HAX, Intuit, Mailchimp, Material, Microsoft Writing Style Guide, Microsoft Windows guidelines, NN/g, Google PAIR, Polaris, Salesforce). Where a guide adds something screenshots can't show, it's cited in [brackets].
|
|
9
|
+
|
|
10
|
+
**The repo's own copy rules, glossary and voice guide come first.** Look for them in AGENTS.md, CLAUDE.md and the docs before you write, and follow them wherever they differ from anything below. Reuse the product's own words for its own things, even where a rule here would pick another.
|
|
9
11
|
|
|
10
12
|
## How to work
|
|
11
13
|
|
package/guide/rubric.md
CHANGED
|
@@ -11,12 +11,3 @@ Score every string with this rubric, rewrite anything that scores 1, and return
|
|
|
11
11
|
When reviewing, give each original string its score and the reason, then the rewrite.
|
|
12
12
|
|
|
13
13
|
Gather the facts first: the action, the object, numbers, dates, prices, limits, what is lost, what happens next. If one is missing, leave a clear {placeholder} or ask. Never invent prices, dates, policies or legal terms.
|
|
14
|
-
|
|
15
|
-
## Stay close to the reference
|
|
16
|
-
|
|
17
|
-
Write every line from one reference: the closest shipped line for the same element, situation and job (use `find_reference`).
|
|
18
|
-
- **Name its shape** in a few words before writing, e.g. "Get + what + when" or "Name the thing + promise. What you can do."
|
|
19
|
-
- **Keep its opening move, order and sentence count,** and stay within about 30% of its length. Check with `compare_to_reference`.
|
|
20
|
-
- **Keep its words where your facts fit.** Change only what your facts force.
|
|
21
|
-
- **Never copy a claim you can't back,** and never copy the reference's product name, price or numbers.
|
|
22
|
-
- A line that drifts from its reference without a reason scores 1.
|
package/guide/rules.md
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
When you write or review interface copy (buttons, errors, empty states, dialogs, onboarding, permissions, paywalls, checkout, notifications, tooltips, loading states, AI chat UI), including user-facing strings in code:
|
|
4
4
|
|
|
5
|
+
The repo's own copy rules, glossary and voice guide come first. Where they differ from anything here, follow them. Reuse the product's own words for its own things.
|
|
6
|
+
|
|
5
7
|
Write from the rules, the tone decision and the matching pattern rules. They carry the quality. References are evidence for the pattern, not a template to copy; in our tests they did not reliably raise quality, but state-check, patterns and correction examples did cut overclaiming.
|
|
6
8
|
|
|
7
|
-
0. In a codebase, first learn the product. Call `read_product` once per session. If the repo has a saved product brief (a `content-md:product` block in AGENTS.md or CLAUDE.md), use it. Otherwise fill the slots it returns from the README and the product's own strings, check the industry it matched against the sample lines, and write a brief of at most six lines: what the product is, who uses it, the main job, its current voice (quote two or three of its lines), its words for its own things, and what is at stake. Ask the person only what you still can't answer and that would change the copy, at most two questions with options and a default (`ask_person` shows a form where the client supports it); otherwise state your assumption in one line. Save the result with `save_product_brief`. Write for that product and audience, reuse its words, and keep its voice unless asked to change it. When asked to improve existing copy without a named string, call `audit_copy` (with `path_filter` for one area) and work from the worst line down; leave lines it doesn't flag as they are.
|
|
9
|
+
0. In a codebase, first learn the product. Call `read_product` once per session. If the repo has a saved product brief (`.content-md/product.md`, or a `content-md:product` block in AGENTS.md or CLAUDE.md), use it. Otherwise fill the slots it returns from the README and the product's own strings, check the industry it matched against the sample lines, and write a brief of at most six lines: what the product is, who uses it, the main job, its current voice (quote two or three of its lines), its words for its own things, and what is at stake. Ask the person only what you still can't answer and that would change the copy, at most two questions with options and a default (`ask_person` shows a form where the client supports it); otherwise state your assumption in one line. Save the result with `save_product_brief`. Write for that product and audience, reuse its words, and keep its voice unless asked to change it. When asked to improve existing copy without a named string, call `audit_copy` (with `path_filter` for one area) and work from the worst line down; leave lines it doesn't flag as they are.
|
|
8
10
|
1. Call the `content-md` MCP tool `get_guide` with the pattern, and follow it. It ends with a pattern index: pick the two or three rules that fit this moment and name them in your notes.
|
|
9
11
|
2. If the moment has stakes or feeling (an error, money, a deletion, a success), call `decide_tone` first with the facts of the moment. Use its two tone words and instruction, and avoid the tones it lists.
|
|
10
12
|
3. Write every piece the screen needs. Do not drop the headline or a button.
|
|
11
13
|
4. Optional: when you want evidence for a decision, or when copy describes progress or an outcome, call `find_reference` with its `role` (or `element`), the situation in a short clause that says what the line does for the person, and the `brief` of the moment. Pass the old line as `draft` when rewriting, and pass `state` (what the product's tool or API reports about the item) whenever copy describes progress or an outcome: it returns a correction example when the copy could claim more than that state supports. It returns up to 3 pairs (the brief a screen was built for, and the line it got), one weak counter-example and the tones to avoid, ready to read in its `xml` field. It often returns nothing: when no pair clears its quality floor, write from the rules and `decide_tone`, and do not hunt for a weaker one.
|
|
12
|
-
5. If you used references, write a short `<pattern_notes>` before the copy: what the pairs share (structure, word count, what each part carries) and what the counter-example gets wrong. Then write from the pattern and the rules.
|
|
14
|
+
5. If you used references, write a short `<pattern_notes>` before the copy: what the pairs share (structure, word count, what each part carries) and what the counter-example gets wrong. Then write from the pattern and the rules. References come from other products, so don't lift their wording or a claim you can't back; the product's own words and glossary are a different matter, and you should reuse them. List what you BORROWED (structure, order, length) and what you CHANGED (facts, words, tone). Use `compare_to_reference` only if you chose to follow a reference's shape.
|
|
13
15
|
6. State-check before you write: name the screen state (empty, loading, error, success, blocked, partial, first time, returning) and the one thing the person must be able to do next. Copy for the wrong state is wrong however well it reads.
|
|
14
16
|
7. Promise audit, only when the copy describes progress, money, time or an outcome AND a claim in the draft goes beyond what the tool state says (if every claim is already stated, skip this step and leave the copy untouched): list every claim and promise in the draft and tag each as STATED (the tool state says it), IMPLIED (follows directly from it) or INVENTED (a time, step, reassurance or consequence the state does not give). Remove or hedge what is invented; leave every line that passes exactly as it is. Keep a reassurance the state supports ("your money is safe" when the state shows funds held), don't drop a specific the person needs (amounts, times, counts), and prefer a hedge to a deletion when part of a line is supported. Don't make the copy vaguer than the state allows. Also cut these tics: a reason or cause the facts do not give, a line that describes the screen ('shown when...') instead of the situation, a hint at an outcome nobody knows yet, and a hedge that adds no information.
|
|
15
17
|
7b. In a codebase, for explanatory, help, policy or onboarding copy, back every promise or factual claim about how the product works (a time, a rule, a feature, what happens to someone's data or report) with a file and line in the repo or its data. Drop or soften any claim you can't back, and list what you dropped. A page that describes a feature the data doesn't have is worse than a shorter page.
|
package/guide/voice.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# UX writing: voice, workflow and limits
|
|
2
2
|
|
|
3
|
-
You are a senior content designer. You write and review the words inside software: buttons, errors, empty states, dialogs, onboarding, permissions, paywalls, checkout, notifications and AI chat interfaces. Your judgment comes from
|
|
3
|
+
You are a senior content designer. You write and review the words inside software: buttons, errors, empty states, dialogs, onboarding, permissions, paywalls, checkout, notifications and AI chat interfaces. Your judgment comes from 8,876 lines of shipped interface copy from 703 iOS and web products, each labeled for its job and rated weak, solid, strong or gold (most are solid; 778 are strong or gold), and from 413 rules gathered from 16 public style guides. You can search both with your tools.
|
|
4
4
|
|
|
5
5
|
## How you talk to the person you're working with
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "content-md",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "UX writing tools for coding agents (Codex, Cursor, Claude Code, VS Code, Windsurf): a tone decider, playbooks for
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "UX writing tools for coding agents (Codex, Cursor, Claude Code, VS Code, Windsurf): a tone decider, playbooks for 35 UI patterns, 194 pattern rules, 413 style-guide rules and a copy linter, as an MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"content-md": "bin/content-md.js"
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"bin",
|
|
11
11
|
"src",
|
|
12
12
|
"data",
|
|
13
|
-
"guide"
|
|
13
|
+
"guide",
|
|
14
|
+
"CHANGELOG.md"
|
|
14
15
|
],
|
|
15
16
|
"engines": {
|
|
16
17
|
"node": ">=18"
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
30
31
|
"zod": "^3.25.0"
|
|
31
32
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "node --test test/*.test.mjs"
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/aivoice.js
CHANGED
|
@@ -42,6 +42,13 @@ export function aiVoice(text, element) {
|
|
|
42
42
|
if (els && element && !els.includes(element)) continue;
|
|
43
43
|
const m = t.match(re);
|
|
44
44
|
if (!m) continue;
|
|
45
|
+
// "you can" that grants permission or names an option is meaning, not a tic: "You can change this later",
|
|
46
|
+
// "If you lose it, you can reset it". The tic is a sentence-initial "You can" standing in for an instruction.
|
|
47
|
+
if (id === "you-can" && !/feel free/i.test(m[0])) {
|
|
48
|
+
const at = m.index, after = t.slice(at + m[0].length, at + m[0].length + 40);
|
|
49
|
+
const sentenceStart = at === 0 || /[.!?:]\s*$/.test(t.slice(0, at));
|
|
50
|
+
if (!sentenceStart || /^\s+(\w+\s+){0,3}?(later|anytime|any time|always|also|still|now|change|undo|cancel|edit|switch|skip|turn|come back|return|remove|delete|leave|opt out|unsubscribe)\b/i.test(after) || /\b(later|anytime|any time|whenever)\b/i.test(t.slice(at)) || /\bif\b/i.test(t.slice(0, at))) continue;
|
|
51
|
+
}
|
|
45
52
|
const sev = r?.severity || "note";
|
|
46
53
|
const ev = r && r.show_rates !== false ? ` (in ${r.model_pct}% of model lines vs ${r.shipped_pct}% of shipped)` : "";
|
|
47
54
|
out.push({ severity: sev, rule: id === "marketing-filler" ? id : `ai-${id}`, detail: `'${m[0].trim()}': ${msg}${ev}` });
|
package/src/context.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
// Asking policy (from clarification research, see eval/product-awareness/README.md): ask only when the answer would
|
|
5
5
|
// change the copy and the stakes justify interrupting; at most two questions to the person per session; for
|
|
6
6
|
// everything else, check the conversation and repo first, then state the assumption and go on.
|
|
7
|
-
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
8
|
+
import { join, dirname } from "node:path";
|
|
9
9
|
|
|
10
10
|
let IND = {};
|
|
11
11
|
try { IND = JSON.parse(readFileSync(new URL("../data/industries.json", import.meta.url), "utf8")); } catch { /* optional */ }
|
|
12
12
|
|
|
13
13
|
const START = "<!-- content-md:product -->", END = "<!-- /content-md:product -->";
|
|
14
|
-
const BRIEF_FILES = ["AGENTS.md", "CLAUDE.md", ".github/copilot-instructions.md", ".cursor/rules/content-md-product.mdc"];
|
|
14
|
+
const BRIEF_FILES = [".content-md/product.md", "AGENTS.md", "CLAUDE.md", ".github/copilot-instructions.md", ".cursor/rules/content-md-product.mdc"];
|
|
15
15
|
|
|
16
16
|
// parts: [[text, weight]]. The product's own description and UI words count more than a README written for contributors.
|
|
17
17
|
export function inferIndustry(parts) {
|
|
@@ -36,8 +36,9 @@ export function industryProfile(ind, productVoice) {
|
|
|
36
36
|
const d = productVoice[k] - p.voice[k];
|
|
37
37
|
if (Math.abs(d) >= Math.max(3, p.voice[k] * 0.6)) delta[k] = `${productVoice[k]}% here vs ${p.voice[k]}% across ${ind} products`;
|
|
38
38
|
}
|
|
39
|
-
return { industry: ind, lines_in_dataset: p.lines, comparable_products: p.products, industry_voice: p.voice,
|
|
40
|
-
common_tones: p.tone_families, registers: p.registers, audience: p.audience,
|
|
39
|
+
return { industry: ind, lines_in_dataset: p.lines, comparable_products: (p.products || []).slice(0, 8), industry_voice: p.voice,
|
|
40
|
+
common_tones: p.tone_families, registers: p.registers, audience: p.audience,
|
|
41
|
+
examples: Object.fromEntries(Object.entries(p.examples || {}).slice(0, 3).map(([k, v]) => [k, (v || []).slice(0, 2)])),
|
|
41
42
|
voice_differences: Object.keys(delta).length ? delta : "none worth noting",
|
|
42
43
|
note: "Industry norms are a baseline, not a target. Where this product's own voice differs, keep the product's voice; use the industry only to fill gaps." };
|
|
43
44
|
}
|
|
@@ -114,7 +115,9 @@ export function saveProductBrief({ root = process.cwd(), fields, file }) {
|
|
|
114
115
|
for (const [k, v] of Object.entries(fields)) if (!order.includes(k) && v) lines.push(`- **${k}**: ${String(v).replace(/\n/g, " ")}`);
|
|
115
116
|
const block = `${START}\n## Product context for interface copy\n\nWritten by the content-md tools; edit freely. Copy in this repo is written for this product and audience.\n\n${lines.join("\n")}\n${END}`;
|
|
116
117
|
const saved = readSavedBrief(root);
|
|
117
|
-
|
|
118
|
+
// its own file by default, so saving a brief never edits the repo's agent instructions
|
|
119
|
+
const target = join(root, file || saved?.file || ".content-md/product.md");
|
|
120
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
118
121
|
const old = existsSync(target) ? readFileSync(target, "utf8") : "";
|
|
119
122
|
const next = old.includes(START) ? old.replace(new RegExp(`${START}[\\s\\S]*?${END}`), block) : (old.trimEnd() ? old.trimEnd() + "\n\n" : "") + block + "\n";
|
|
120
123
|
writeFileSync(target, next);
|
|
@@ -126,8 +129,9 @@ export async function askPerson(server, questions) {
|
|
|
126
129
|
const caps = server.server.getClientCapabilities?.() || {};
|
|
127
130
|
if (!caps.elicitation) return { asked: false, reason: "This client can't show a question form. Ask these in chat, one message, options included, and say which default you'll use if there's no answer.", questions };
|
|
128
131
|
const properties = {}, required = [];
|
|
129
|
-
for (const q of questions.slice(0, 2)) {
|
|
130
|
-
|
|
132
|
+
for (const [n, q] of questions.slice(0, 2).entries()) {
|
|
133
|
+
q.slot ||= `q${n + 1}`;
|
|
134
|
+
properties[q.slot] = { type: "string", title: q.question, ...(q.why ? { description: q.why } : {}), ...(q.options?.length >= 2 ? { enum: q.options } : {}), ...(q.default ? { default: q.default } : {}) };
|
|
131
135
|
}
|
|
132
136
|
try {
|
|
133
137
|
const r = await server.server.elicitInput({ mode: "form", message: "Two quick questions so the copy fits your product. Skip to use the defaults.", requestedSchema: { type: "object", properties, required } });
|