Back to Nx

Nx Documentation Style Guide

astro-docs/STYLE_GUIDE.md

22.7.116.2 KB
Original Source

Nx Documentation Style Guide

This document defines the standards for Nx documentation on nx.dev, including voice, grammar, formatting, and terminology.

For automated enforcement, see the Vale configuration section below.

Information architecture

When creating or reorganizing documentation, follow these five principles to determine where content belongs.

1. Progressive disclosure (the "journey" rule)

Don't overwhelm the user. Reveal complexity only as they advance in their journey.

The test: Is this for the first 30 minutes (Getting Started), the first 30 days (Features), or forever (Reference)?

2. Category homogeneity (the "scan" rule)

Items in a list must be of the same "type" (noun, verb, or concept) to reduce cognitive load.

The test: Does this list mix concepts (mental model), tasks (update Nx), and products (React)? If yes, split it.

3. Type-based navigation (the "intent" rule)

Separate learning (narrative/guides) from looking up (reference/API).

The test: Is the user here to learn a workflow (guide) or look up a flag syntax (reference)?

4. The pen and paper test (the "theory" rule)

Distinguish architecture from features to keep "core concepts" pure.

The test: Can I explain this using only a pen and paper?

  • Yes: It goes in How Nx Works (architecture).
  • No (I need a terminal): It goes in Platform Features (feature).

5. Universal vs. specific (the "placement" rule)

Distinguish platform features from ecosystem tools to prevent "Features" from becoming a junk drawer.

The test: Does this feature apply to every user (e.g., caching, Nx Agents)?

  • Yes: Platform Features.
  • No (only React users): Technologies.

The sidebar has four top-level sections that follow the user journey:

  1. Getting Started - Essential setup, tutorials, and core concepts (How Nx Works, Platform Features)
  2. Technologies - Framework and tool-specific guides (React, Angular, Node, build tools, test tools)
  3. Knowledge Base - Recipes, troubleshooting, and topic-specific guides
  4. Reference - Exhaustive facts, no narrative (CLI commands, configuration, API docs)

The Nx voice

Nx documentation is direct, practical, and confident. We write like a knowledgeable colleague pairing with you — not like a textbook, not like a marketing page, and not like a chatbot.

The voice should be:

  • Conversational but efficient. Use contractions. Get to the point. Don't pad sentences.
  • Second person. Write "you" — address the reader directly.
  • Action-oriented. Lead with what the reader can do, not what Nx is.
  • Honest about tradeoffs. Don't oversell. If something has limitations, say so.

Voice do's and don'ts

DoDon't
"You can speed up builds by enabling remote caching.""Nx allows you to speed up builds."
"Run nx build to build your project.""In order to build your project, you can run the nx build command."
"This works best with fewer than 50 projects.""This feature can easily scale to any number of projects."
"Nx reads your vite.config.ts and infers build targets automatically.""Nx provides a robust and comprehensive mechanism for inferring build targets."
"If the cache is stale, delete .nx/cache and retry.""Should you encounter issues with caching, you may want to consider clearing your cache directory."

Anti-AI language

Documentation must not read like it was generated by an AI assistant. Even when AI tools are used in the writing process, the output must be edited to sound like a human wrote it.

Never use these phrases:

  • "It's important to note that..."
  • "It's worth noting that..." / "It should be noted that..."
  • "In this section, we will explore..."
  • "Let's dive into..." / "Let's take a closer look at..."
  • "Whether you're a beginner or an experienced developer..."
  • "In today's fast-paced development environment..."
  • "Unlock the power of..." / "Harness the power of..."
  • "Take your workspace to the next level"
  • "Streamline your workflow" (as a generic claim without specifics)
  • "This comprehensive guide will..."
  • "Without further ado..."
  • "In conclusion..." / "To summarize..." / "As we've seen..."
  • "Game-changer" / "Cutting-edge" / "Groundbreaking"
  • "Seamless" / "Seamlessly" (unless describing an actual integration)

Avoid hedging words unless genuinely needed:

  • "Essentially" / "Basically" / "Effectively"
  • "Generally speaking"
  • "It is worth mentioning"
  • "Arguably"
  • "Needless to say"
  • "As a matter of fact"

Watch for AI-style sentence patterns:

  • Sentences that start with "This allows you to..." or "This enables you to..." — rewrite to lead with the reader's action.
  • Paragraphs that start with a general claim and then restate it slightly differently. Say it once.
  • Excessive use of "robust", "leverage", "utilize", "facilitate", "comprehensive", "aforementioned."
  • Lists where every item starts with the same grammatical structure repeated 5+ times with slight variation. Vary your phrasing.

Self-referential writing

Don't write about the document itself.

Do:

  • "Nx uses a project graph to determine task dependencies."

Don't:

  • "This page explains how Nx uses a project graph."
  • "In this guide, we'll walk through..."
  • "This document covers..."

Get right to the point. The reader already knows they're on a page — they want the information.

Building trust

Don't use filler words that undermine the reader's trust.

  • Don't use "easily", "simply", "just", or "straightforward" — if something were truly simple, you wouldn't need to document it. These words also make readers feel bad when they struggle.
  • Don't use marketing language: "This feature will save you hours" or "Nx makes CI effortless."
  • Be specific instead: "Remote caching can reduce CI times from 45 minutes to under 5 minutes for cache-hit builds."

Customer perspective

Focus on what the reader can do, not what Nx does.

Do:

  • "Use nx affected to run tasks only for projects impacted by your changes."

Don't:

  • "Nx allows you to run affected tasks."
  • "Nx provides the ability to run tasks selectively."

Words like "allow" and "enable" are signals you're writing from the product's perspective instead of the reader's.

Language

Write in US English.

Active voice

Use active voice in most cases.

Do: "Nx caches the build output." Don't: "The build output is cached by Nx."

Exception: When "Nx" as the subject sounds awkward, passive voice is fine. "The output is stored in .nx/cache" is better than "Nx stores the output in .nx/cache" if Nx isn't the focus of the sentence.

Contractions

Use contractions. They make the text feel natural.

  • "You'll need to configure..." not "You will need to configure..."
  • "It doesn't support..." not "It does not support..."

Don't contract for emphasis in warnings or error descriptions:

  • "Do not delete the nx.json file."
  • "Requests to localhost are not allowed."

Don't contract proper nouns: "the Vite plugin is..." not "Vite's a plugin..."

Capitalization

Use sentence case for headings. Capitalize proper nouns only.

  • # Use remote caching to speed up CI
  • ## Configure the Vite plugin

Feature names are lowercase unless they are a proper product name:

CorrectIncorrect
remote cachingRemote Caching
project graphProject Graph
Nx Cloudnx cloud
Nx Consolenx console
Nx Agentsnx agents
Nx Replaynx replay

Acronyms

Spell out acronyms on first use per page. Don't spell out widely-known ones: CI, CD, API, URL, CLI, PR, IDE.

Don't make acronyms plural with apostrophes. Use APIs, not API's.

Numbers

Spell out zero through nine. Use numerals for 10 and above. Always use numerals with units: "5 minutes", "3 projects."

Possessives

Don't use possessives on product names. "the Docker CLI", not "Docker's CLI." "the Nx configuration", not "Nx's configuration."

Text

Headings

  • Don't skip heading levels (e.g., ## to ####).
  • Don't use code in headings unless it's essential (like a CLI command).
  • Don't use bold text in headings.
  • Keep headings short and scannable. Lead with keywords.

Line length

  • Wrap lines at approximately 100 characters for readability in diffs.
  • Start each new sentence on a new line.
  • Exception: Don't break links across lines.

Punctuation

  • Use serial (Oxford) commas: "React, Angular, and Vue."
  • Use one space between sentences.
  • Don't use semicolons. Use two sentences instead.
  • Don't use em dashes or en dashes. Use commas or separate sentences.

Placeholder text

Use < and > for values the reader must replace:

shell
nx run <project-name>:build

If the placeholder is inline, wrap it in a single backtick: <your-project>.

Bold

Use bold for:

  • UI elements: "Select Add Connection."
  • Navigation paths: "Go to Settings > Workspace."

Don't use bold for emphasis or keywords. If you need emphasis, rewrite the sentence to be clearer.

Inline code

Use inline code (single backticks) for:

  • Commands and CLI arguments: nx build, --parallel
  • File names and paths: nx.json, .nx/cache
  • Configuration keys: targetDefaults, namedInputs
  • Short outputs and values: true, false, success

Code blocks

Use triple backticks with a language identifier:

markdown
```json
{
  "targetDefaults": {
    "build": {
      "cache": true
    }
  }
}
```
  • Always specify a syntax language. Use plaintext if nothing else fits.
  • Add a blank line before and after code blocks.
  • For long config files, show only the relevant section and use comments to indicate omitted parts:
json
{
  // ... other config
  "targetDefaults": {
    "build": {
      "cache": true
    }
  }
}

Links help readers find related information, but too many links make text hard to read.

General rules

  • Don't duplicate links. If you link to a page once, don't link to it again on the same page.
  • Don't use links in headings.
  • Avoid more than 15 links to other pages on any single page.
  • Avoid multiple links in a single paragraph when possible.

Use descriptive text, not "here" or "this page."

Do:

Don't:

Standard patterns:

  • For more information, see [link text](url).
  • To <do this thing>, see [link text](url).

Minimize external links. They break over time and are hard to maintain. When you must link externally, prefer official documentation (e.g., Vite docs, Webpack docs) over blog posts or third-party guides.

Lists

  • Use ordered lists for sequences of steps.
  • Use unordered lists when order doesn't matter.
  • Use dashes (-) for unordered lists.
  • Start ordered list items with 1. (Markdown auto-increments).
  • Make list items parallel in structure.
  • Add a colon after the introductory phrase.
  • Don't use list items to complete an introductory sentence.

Do:

markdown
You can clear the cache in the following ways:

- Delete the `.nx/cache` directory manually.
- Run `nx reset` to clear all cached results.

Don't:

markdown
You can clear the cache by:

- Deleting the `.nx/cache` directory manually.
- Running `nx reset`.

Tables

Use tables for structured data that benefits from a matrix layout. For simple lists of items with descriptions, use a regular list instead.

  • Don't leave cells empty. Use "N/A" or "None."
  • Use sentence case for headers.
  • Keep the header and delimiter rows the same length.

Nx-specific terminology

Use these terms consistently. When writing about Nx concepts, use the exact term from this list.

TermUsage notes
workspaceThe root directory managed by Nx. Not "repo" or "monorepo" when referring to Nx's context.
projectAn app or library within the workspace.
targetA task that can be run for a project (e.g., build, test, lint).
executorThe implementation behind a target. Not "builder."
generatorCode scaffolding tool. Not "schematic."
pluginAn Nx plugin that provides executors, generators, or graph inference.
taskA specific invocation of a target for a project (e.g., myapp:build).
project graphThe dependency graph between projects.
affectedProjects impacted by a code change.
cache / cachedNot "memoized" or "stored results."
remote cachingSharing cached results across machines. Specific product: "Nx Replay."
Nx CloudThe hosted CI/CD product. Always capitalized.
Nx ConsoleThe IDE extension. Always capitalized.
Nx AgentsDistributed task execution product. Always capitalized.
Nx ReplayRemote caching product. Always capitalized.
nx.jsonAlways in code style.
project.jsonAlways in code style.

Vale configuration

Vale enforces many of the rules in this style guide automatically. Configuration lives in astro-docs/:

  • .vale.ini — Main config. Scopes rules to src/content/docs/**/*.{mdoc,mdx,md}.
  • .vale/styles/Nx/ — Custom rules for Nx documentation.

Running Vale

shell
# Via Nx target (recommended)
nx vale astro-docs

# Directly (from astro-docs/ directory)
vale src/content/docs/

Installing Vale

Vale is managed via mise. Run mise install from the repo root to install it. You can also install directly via brew install vale (macOS) or apt-get install vale (Linux).

Rule tiers

TierSeverityRules
1 - MechanicalerrorBanned phrases, product capitalization
2 - StructuralwarningHeading case, terminology, product possessives, self-referential writing, sentence patterns
3 - VoicesuggestionTrust-undermining words, marketing language, passive voice, serial commas

Adding new rules

Create a new .yml file in .vale/styles/Nx/. Vale supports several extension points: existence, substitution, occurrence, repetition, consistency, conditional, capitalization, and metric.

Set level to match the tier: error for mechanical rules, warning for structural, suggestion for voice/judgment.