Home › Agent workflows › Documentation writing rules

Documentation writing rules

Windsurf rules for writing and updating READMEs, docstrings, ADRs, and changelogs alongside code changes.

WindsurfAgent workflows

How to use

Save this as .windsurf/rules/docs.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.windsurf/rules/docs.mdDownload  
# Documentation rules

## When to update docs
- Any change to setup, env vars, commands, public APIs, or config also updates the README or `docs/` in the same change.
- New env var: add it to `.env.example` and the configuration table.
- Notable user-facing changes get a line in `CHANGELOG.md` under `## [Unreleased]` (Keep a Changelog format).

## README structure
What it is (one paragraph) -> Quick start (copy-paste commands that work on a fresh clone) -> Configuration -> Common tasks -> Troubleshooting -> Contributing.

## Writing style
- Short sentences, active voice, second person ("Run `make dev`").
- Every command in a code block, exactly as typed, with the expected result when it isn't obvious.
- Explain *why* for non-obvious decisions; skip what the code already says.
- Use real examples, not `foo`/`bar`, when it helps understanding.
- Link instead of duplicating content across files.

## Code comments and docstrings
- Public functions and modules get docstrings (JSDoc/TSDoc, Google-style Python, rustdoc) describing purpose, params, return, and errors.
- Comments explain intent or constraints, never restate the line below.
- Remove stale comments when changing code.

## Decisions
Significant architectural choices get an ADR in `docs/adr/NNNN-title.md`: context, decision, consequences.

## Check
Run any doc commands you wrote to confirm they work, and check links.

Related rules

Web accessibility (WCAG 2.2) rules

Windsurf rules for building accessible web UIs to WCAG 2.2 AA: semantics, keyboard, focus, contrast, and testing.

WindsurfAccessibility

Code review Copilot instructions

Copilot instructions focused on pull request review: what to flag, severity labels, and how to word comments.

GitHub CopilotAgent workflows

Code reviewer subagent (Claude Code)

A Claude Code subagent definition that reviews the current diff for bugs, security, and tests, reporting by severity.

Claude Code (CLAUDE.md)Agent workflows

/commit slash command (Claude Code)

A Claude Code /commit slash command that reviews staged changes and writes a Conventional Commits message.

Claude Code (CLAUDE.md)Agent workflows

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.