|
1 | 1 | # CLAUDE.md |
2 | 2 |
|
3 | | -This directory holds the official Pest documentation. When writing or editing any file here, match the established tone of the docs. Consistency of voice matters as much as technical accuracy. |
| 3 | +This directory holds the official Pest documentation. When writing or editing any file here, match the established voice of the docs exactly. Consistency of tone matters as much as technical accuracy — a page that is correct but off-voice still needs rework. |
4 | 4 |
|
5 | | -## Voice & Tone |
| 5 | +The sections below describe that voice in detail. They are derived from how the docs already read; treat them as house style, not suggestions. |
6 | 6 |
|
7 | | -The Pest docs are **warm, welcoming, and confident**. The reader should feel like they're being guided by a knowledgeable friend who wants them to succeed — never lectured at, never overwhelmed. |
| 7 | +## The Voice in One Sentence |
8 | 8 |
|
9 | | -- **Write in second person.** Address the reader directly as "you" and refer to "your test suite", "your project", "your application". Make the docs feel personal. |
10 | | -- **Use the collaborative "we" and "let's".** When walking through an example, invite the reader along: "Next, let's write our first test", "We'll cover each of these in detail". This builds a sense of working through the material together. |
11 | | -- **Stay in the present tense.** Describe what Pest does, not what it will do or would do: "Pest provides", "When you run the command, Pest displays…". |
12 | | -- **Be encouraging and positive.** Pest is a joy to use, and the docs should reflect that. It's natural to describe features as "convenient", "elegant", "powerful", or "beautiful" — but let the quality speak for itself and never oversell. |
13 | | -- **Explain the "why", not just the "how".** Don't only state what a feature does; give the reader a brief sense of when and why they'd reach for it. Motivate each concept before showing the code. |
| 9 | +Write as a **warm, confident expert personally guiding a capable peer** — conversational but precise, encouraging without being cutesy, and relentlessly consistent in sentence scaffolding. The reader is always the protagonist; Pest is the helpful tool doing work on their behalf. |
14 | 10 |
|
15 | | -## Writing Style |
| 11 | +The dominant rhetorical move is: **state the reader's likely need → name the tool → show how → explain what just happened.** |
16 | 12 |
|
17 | | -- **Clarity above cleverness.** Prefer short, direct sentences. If a sentence is hard to follow, split it. The goal is that a newcomer to testing can read a page top to bottom and understand it. |
18 | | -- **Introduce, then demonstrate.** Lead with a sentence or two of prose that sets up an example, present the code, then explain what the reader is looking at afterward. |
19 | | -- **Assume intelligence, not prior knowledge.** The reader is a capable developer, but may be new to Pest or to testing in general. Define terms the first time they appear and avoid unexplained jargon. |
20 | | -- **Keep it concise.** Say what needs to be said and move on. Respect the reader's time — no filler, no padding, no repetition for its own sake. |
21 | | -- **Use American English spelling and conventions.** |
| 13 | +## Point of View |
22 | 14 |
|
23 | | -## Structure & Formatting |
| 15 | +- **Second person ("you" / "your") is the default.** The reader is the actor in nearly every instructional sentence: "you may use", "you should define", "your test suite", "your project", "your expectations". The possessive "your" personalizes ownership relentlessly. |
| 16 | +- **Use "we" / "our" / "let's" for shared walkthroughs.** When walking through an example, reason alongside the reader: "Let's write our first test", "let's imagine your project features a `sum` function", "we'll cover each of these in detail". This mode clusters in introductions and worked examples; the "you" mode dominates instructions and options. The two coexist within a section — set up a scenario with "let's imagine…", then hand control back with "you may…". |
| 17 | +- **Use third person only for the framework acting.** "Pest provides…", "Pest will determine…", "Pest automatically…". Pest-as-helpful-agent is a recurring subject. |
24 | 18 |
|
25 | | -- Every documentation page begins with YAML front matter containing a `title` and a `description`. The `description` is a single, inviting sentence that summarizes the page. |
26 | | -- The page's first heading (`#`) matches the title. Use `##` for major sections and `###` for subsections. |
27 | | -- Wrap inline references to functions, methods, classes, files, and commands in backticks: `expect()`, `it()`, `./vendor/bin/pest`, `Pest.php`. |
28 | | -- Use fenced code blocks with a language hint (```php, ```bash, ```plain). Keep example code realistic, minimal, and focused on the concept being taught — no unrelated noise. |
29 | | -- Link generously to related pages using the `/docs/{page}` convention so readers can explore adjacent topics. |
| 19 | +## Tense & Modality |
| 20 | + |
| 21 | +- **Present tense for behavior and facts:** "The `expect` function returns an expectation instance", "Pest is built on top of PHPUnit". |
| 22 | +- **"will" for outcomes and consequences** of the reader's action: "the test will fail", "Pest will display the description", "the result will be returned". The systematic split is *present for capabilities, "will" for results*. |
| 23 | +- **"you may" is the dominant modal** — softer and more permission-granting than "you can" or "you must". Reach for it constantly: "you may use", "you may also", "you may wish to". Use "should" for recommendations, never harsh imperatives. |
| 24 | + |
| 25 | +## Sentence Rhythm |
| 26 | + |
| 27 | +- **Medium-length declarative sentences** (roughly 15–30 words) dominate. Rarely terse, rarely runaway. |
| 28 | +- **Favor the short-claim-then-qualification rhythm:** a topic sentence stating what something does, followed by a sentence adding a caveat or mechanism, often pivoting on "however" or a semicolon. |
| 29 | +- **Reserve short, punchy sentences for the payoff:** "This is game changing." "Pest makes this simple." |
| 30 | +- **Keep paragraphs to 1–3 sentences** before a code block. Avoid heavy subordination; prefer chaining short clauses with "However,", "In addition,", "Alternatively,". |
| 31 | + |
| 32 | +## Introducing & Explaining Code |
| 33 | + |
| 34 | +- **Prose almost always precedes code.** The near-universal structure is: one or two sentences of setup → **a colon** → the code block. The colon-into-code rhythm is the single most consistent structural signature of these docs. Even one-liners get a lead-in ("For example, consider the following test:"). |
| 35 | +- **Show results as code comments,** not prose: `// true`, `// 3`, `// throws InvalidArgumentException`. |
| 36 | +- **Narrate complex examples after the code** with "In this example, …" or "As you can see, …". |
| 37 | +- **Introduce follow-up variations with a fresh sentence,** then more code: "You may also pass a second argument…". |
| 38 | +- **Use concrete, mildly playful example domains** (a `sum` function, a podcast service, a blog) rather than abstract `Foo` / `Bar`. |
| 39 | + |
| 40 | +## Transition & Framing Vocabulary |
| 41 | + |
| 42 | +These connectives are the fingerprint of the voice. Use them, and use them consistently: |
| 43 | + |
| 44 | +- **"Sometimes you may wish to…" / "Sometimes you may need to…"** — the signature opener for optional or edge-case features. Follow with the solution: "To accomplish this, you may…". |
| 45 | +- **"By default, … However, you may…"** — the default-then-override pairing. Ubiquitous. State the default, then how to change it. |
| 46 | +- **"Of course, …"** — a warm concession or reassurance. |
| 47 | +- **"Thankfully, …"** — signals Pest solving a pain point the reader just felt. |
| 48 | +- **"Typically, you should…"** — recommends best practice gently. |
| 49 | +- **"For example," / "For instance,"** — the standard example lead-in. |
| 50 | +- **"However," / "Alternatively, you may…" / "Or, you may…"** — contrast and second approaches. |
| 51 | +- **"First, … Next, … Then, … Finally, …"** — sequencing steps. |
| 52 | +- **"Once you have…, you may…"** — precondition, then capability. |
| 53 | +- **"As you can see," / "In this example,"** — post-code recap. |
| 54 | +- Establish defaults with **"By default,"**; onboard a feature with **"To get started,"**. |
| 55 | + |
| 56 | +## Descriptive Palette |
| 57 | + |
| 58 | +Editorialize positively, but from a **small, controlled vocabulary**, and almost always about *developer ergonomics* rather than empty hype: |
| 59 | + |
| 60 | +**convenient, simple, powerful, elegant, expressive, fluent, beautiful, robust, painless, helpful, seamless.** |
| 61 | + |
| 62 | +- The **"X, yet Y"** pairing is a hallmark move: "simple, yet powerful". |
| 63 | +- Adverbs stressing that Pest does the work for the reader: "automatically", "gracefully", "seamlessly". |
| 64 | +- Occasional overt enthusiasm is welcome ("This is game changing") but must be earned — let quality speak for itself and never oversell. |
| 65 | + |
| 66 | +## Warmth & Reassurance |
| 67 | + |
| 68 | +- **Grant freedom explicitly:** "you are free to…", "feel free to…". |
| 69 | +- **Reassure around friction:** "Don't worry if…", "there is no need to…", "Pest handles this for you". |
| 70 | +- **Assume competence without condescension:** "As you would expect,", "As you may know,". Never imply something is "obvious" or that the reader should already know it. |
| 71 | +- **Tie features to reader benefit** with trailing clauses: "…, allowing you to…", "…so that you do not have to…". |
| 72 | + |
| 73 | +## Structure & Formatting Conventions (Pest-specific) |
| 74 | + |
| 75 | +- **Every page opens with YAML front matter** containing a `title` and a single, inviting `description` sentence: |
| 76 | + ``` |
| 77 | + --- |
| 78 | + title: Writing Tests |
| 79 | + description: Next let's get a brief overview of how to write tests using Pest. |
| 80 | + --- |
| 81 | + ``` |
| 82 | +- The first heading (`#`) matches the `title`. Use `##` for major sections and `###` for subsections. |
| 83 | +- **Wrap code identifiers in backticks:** functions and methods like `it()`, `expect()`, `test()`, `describe()`, `beforeEach()`; files like `Pest.php`, `phpunit.xml`; and commands like `./vendor/bin/pest`. |
| 84 | +- **Use fenced code blocks with a language hint** (```php, ```bash, ```plain). Keep example code realistic, minimal, and focused on the one concept being taught. |
| 85 | +- **Terminal output is shown via the existing `<div class="code-snippet">` image convention,** not pasted as text — follow the surrounding pages. |
| 86 | +- **Link generously to related pages** with the `/docs/{page}` convention so readers can explore adjacent topics. |
| 87 | +- Use **American English** spelling and conventions throughout. |
30 | 88 |
|
31 | 89 | ## What to Avoid |
32 | 90 |
|
33 | | -- Don't be terse or robotic — this is not an API dump. Prose carries the reader between the code. |
34 | | -- Don't be overly casual, jokey, or use slang, emoji, or exclamation-heavy hype. The tone is friendly and professional, not flippant. |
35 | | -- Don't condescend. Never imply something is "obvious", "simple", or "just" a matter of doing X — what's simple to one reader is new to another. |
36 | | -- Don't assume the reader has read other pages out of order; give each page enough context to stand on its own, then link out for depth. |
| 91 | +- Don't be terse or robotic — this is not an API dump. Prose carries the reader between the code blocks. |
| 92 | +- Don't be overly casual, jokey, or lean on slang, emoji, or exclamation-heavy hype. |
| 93 | +- Don't condescend. Never write "simply", "just", or "obviously" in a way that implies the task is trivial — what's simple to one reader is new to another. |
| 94 | +- Don't assume the reader arrived from a specific other page; give each page enough context to stand on its own, then link out for depth. |
| 95 | +- Don't reach for adjectives outside the established palette or pile them on. One well-placed "convenient" beats three superlatives. |
0 commit comments