Documentation Style Guide

This project follows a strict and specific documentation style designed to be helpful, readable, and consistent. It combines the structural clarity of Christopher Alexander’s Pattern Language with the prose style of William Zinsser’s On Writing Well and the usability of the U.S. Federal Plain Language Guidelines.

All agents and contributors must adhere to these standards.

1. Core Philosophy

2. Class Documentation

Every public class must begin with a Context-Problem-Solution narrative.

Structure

  1. Summary Line: A single line explaining the class’s role.

  2. Context (Narrative): A short paragraph establishing the domain or situation.

  3. Problem (Narrative): A sentence or two identifying the specific difficulty, complexity, or “pain” the user faces in this context without the widget.

  4. Solution (Narrative): A sentence explaining how this widget solves that problem, often starting with “This widget…” or “Use it to…”.

  5. Usage (Narrative): A concrete “Use it to…” sentence listing common applications.

  6. Example: A comprehensive, copy-pasteable code example using === Examples. Provide multiple examples to cover different use cases (e.g., basic usage vs. advanced configuration).

Example

Bad (Generic/Descriptive): <!– SPDX-SnippetBegin –> <!– SPDX-FileCopyrightText: 2025 Kerrick Long SPDX-License-Identifier: MIT-0 –>

# A widget for displaying list items.
# It allows the user to select an item from an array of strings.
# Supports scrolling and custom styling.

Good (Alexandrian/Zinsser/Plain Language): <!– SPDX-SnippetBegin –> <!– SPDX-FileCopyrightText: 2025 Kerrick Long SPDX-License-Identifier: MIT-0 –>

# Displays a selectable list of items.
#
# Users need to choose from options. Menus, file explorers, and selectors are everywhere.
# Implementing navigation, highlighting, and scrolling state from scratch is tedious.
#
# This widget manages the list. It renders the items. It highlights the selection. It handles the scrolling window.
#
# Use it to build main menus, navigation sidebars, or logs.

3. Method and Attribute Documentation

Prose Style

Syntax Standards

Example

# The styling to apply to the content.
  attr_reader :style

  # Creates a new List.
  #
  # [items] Array of Strings.
  # [selected_index] Integer (nullable).
  def initialize(items: [], selected_index: nil)
    super
  end

4. RDoc Specifics

5. Checklist for Agents

Before finalizing documentation, ask: 1. Did I explain the problem this code solves? 2. Are my sentences short and active? (Did I remove “allows the user to”?) 3. Is the code example valid and copy-pasteable? 4. Did I use <tt> for symbols and code values? 5. Did I document every attribute and parameter?