agentleFS
cosmixcosmix/loom/skills/loom-documentation/SKILL.md

loom-documentation

Skill58 starsChanged 57 days agoMITView on GitHub

Creates and maintains docs: API docs, READMEs, architecture docs, changelogs, ADRs. Not for: prose style.

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document every public endpoint: method + path, auth requirement, request schema, a concrete request/response example, and *all* error …

    line 152
  2. Very specific:

    Follow Keep a Changelog + SemVer.

    line 204

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Documentation

Overview

Create and maintain documentation artifacts and their required structure: docstrings, inline comments, API references, READMEs, ADRs, changelogs, and architecture docs. This skill owns WHAT each artifact must contain. For prose mechanics (voice, clarity, sentence craft) and the Diátaxis mode framework, see loom-technical-writing. For visuals, see loom-diagramming; for API-spec files (OpenAPI), see loom-api-documentation.

Artifact → structure map

Pick the artifact by audience and Diátaxis mode, then fill its required structure. Never mix modes in one document (a reference is not a tutorial).

ArtifactDiátaxis modeMust contain
READMEhow-to + referenceone-line pitch, install, quick-start, links out
Tutorial / getting-startedtutorialordered steps, a path guaranteed to work, expected output
How-to guidehow-togoal-titled, prerequisites, numbered steps, verification
API referencereferenceevery public symbol: params, returns, errors, ≥1 example
ADRexplanationcontext, decision, consequences, alternatives, status
Changelogreferencechanges grouped per version, dates, breaking changes flagged
Docstringreferencepurpose, params, returns, raises/panics, example
Inline commentexplanationWHY only — never restate the code

First step on any task: identify the audience (developer / end-user / operator / contributor), then read the code so docs match real behavior — never document from assumption.

Code documentation

Docstrings (rustdoc / JSDoc / pydoc / godoc): document the contract, not the implementation. Cover purpose, each param with type and constraints, return, errors/panics/raises, side effects, and a runnable example for any non-trivial API. Public symbols get docs; private ones only when non-obvious.

Inline comments: explain WHY, not WHAT. Reserve for non-obvious business rules, workarounds (link the issue/ticket), invariants, and hazards. Delete comments that restate code — they rot and mislead. TODO/FIXME must reference a tracking issue.

// BAD — restates the code; rots silently
counter += 1; // increment counter

// GOOD — encodes a non-obvious rule the code can't express
counter += 1; // skip row 0: it is always the CSV header

// GOOD — flags a business rule a future reader would violate
if user.is_valid() { // users created before 2020 have no email verification

Python docstring (Google style)

def calculate_shipping_cost(weight: float, destination: str, express: bool = False) -> Decimal:
    """Calculate shipping cost from package weight and destination.

    Applies tiered pricing by weight bracket; surcharges for international
    and express delivery.

    Args:
        weight: Package weight in kg. Must be positive.
        destination: ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB').
        express: Express delivery (2-3 days) vs standard (5-7). Default False.

    Returns:
        Shipping cost in USD as a Decimal.

    Raises:
        ValueError: If weight is not positive.
        InvalidDestinationError: If country code is unrecognized.

    Example:
        >>> calculate_shipping_cost(2.5, 'US')
        Decimal('12.50')
    """

Rust doc comment (with doctest)

Doctests in rustdoc are compiled and run by cargo test — keep them correct and current.

/// Manages authentication and session handling. Tokens are JWTs with a
/// 24-hour expiration.
///
/// # Examples
///
/// ```
/// let auth = AuthService::new(config);
/// let token = auth.login("user@example.com", "password").await?;
/// let user = auth.validate_token(&token)?;
/// ```
///
/// # Errors
///
/// - `AuthError::InvalidCredentials` — login failed.
/// - `AuthError::TokenExpired` — token past expiry.
pub struct AuthService { /* fields */ }

README

Order by decreasing importance — most readers scan the top and leave. Required: project name + one-line description, install, quick-start (working snippet), then links out to deeper docs. Add contributing/license and status badges as needed. Keep the README a launchpad, not a manual; move depth into linked docs.

# Project Name

One-line description of what this does and for whom.

## Install

    npm install project-name

## Quick Start

    const project = require('project-name');
    project.doSomething();

## Documentation

See [full docs](link).

## License

MIT

API reference

Document every public endpoint: method + path, auth requirement, request schema, a concrete request/response example, and all error responses with codes. Tables for params/errors keep it scannable.

## Create User — `POST /api/v1/users`

**Auth:** Required (Admin role)

**Request body:**

| Field | Type   | Required | Description                  |
| ----- | ------ | -------- | ---------------------------- |
| email | string | Yes      | Valid email address          |
| name  | string | Yes      | Full name (2-100 characters) |
| role  | string | No       | User role. Default: "member" |

**Success (201):** returns the created user object with `id` and `createdAt`.

**Errors:**

| Status | Code          | Description               |
| ------ | ------------- | ------------------------- |
| 400    | INVALID_EMAIL | Email format is invalid   |
| 409    | EMAIL_EXISTS  | Email already registered  |
| 403    | FORBIDDEN     | Insufficient permissions  |

ADR

Record significant, hard-to-reverse decisions — the ones a future maintainer will ask "why on earth did they…". One decision per file, numbered, immutable once accepted (supersede with a new ADR rather than editing).

# ADR-001: Use Event Sourcing for Audit Trail

**Status:** Accepted · **Date:** 2024-01-15

**Context:** Regulatory compliance requires a complete audit trail of financial
records. Update-in-place loses historical state.

**Decision:** Store all state changes as immutable events; derive current state
by replaying them.

**Consequences:**
- (+) Complete audit trail by design; time-travel debugging.
- (-) More storage; querying current state is more complex; team learning curve.

**Alternatives considered:**
- DB triggers + audit table — rejected: trigger maintenance burden.
- CDC — rejected: couples to database technology.

Changelog

Follow Keep a Changelog + SemVer. Group by type (Added / Changed / Deprecated / Removed / Fixed / Security); keep an [Unreleased] section at top; date each release; call out breaking changes prominently; use imperative mood consistent with commit style. Prefer generating from conventional commits.

# Changelog

## [Unreleased]

## [1.2.0] - 2024-01-15

### Added
- User profile management (#123)

### Changed
- Improve validation error messages

### Fixed
- Race condition in payment processing (#156)

Anti-patterns

  • Documenting private implementation details that should stay internal.
  • Docs that duplicate what the code already states (comments restating code, docstrings echoing signatures).
  • Vague hedging ("might", "usually", "sometimes") instead of stating actual behavior.
  • Orphaned docs with no inbound/outbound links; untested examples that no longer compile.
  • Skipping error cases and edge conditions.
  • Letting docs drift from code — update docs in the same PR as the code change.

Verify before done

  • Every public API / endpoint / config option is documented.
  • Code examples actually compile and run (rustdoc doctests pass; snippets tested).
  • Errors, edge cases, and side effects are covered — not just the happy path.
  • Correct artifact + single Diátaxis mode; audience-appropriate depth.
  • No orphaned pages; new docs are linked from an index/README.
  • Docs match current code behavior (updated in the same change).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.