agentleFS
avizmarlonavizmarlon/agent-skills/skills/docs-as-code/SKILL.md

docs-as-code

Skill2 starsChanged 6 months agoMITView on GitHub

Documentation accompanies code — no code is done without docs. Enforces a minimum documentation checklist per session, maintains a canonical documentation ledger across projects, and synchronizes documentation rules across all tools and agents. Use when writing code, creating features, modifying APIs, establishing new integrations, asking about documentation requirements, or managing documentation gates.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    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:

    All AI agents and developers working on a project must maintain rule parity across tool configurations:

    line 24
  2. Distinctive:

    Verify sync by grep-checking the rule text appears consistently across all tool config files

    line 29
  3. Very specific:

    Debt visibility principle: If code changes must skip documentation "for now," explicitly record this as doc-debt in a visible location …

    line 31
  4. Distinctive:

    Every non-trivial software project must maintain these living artifacts in the repository.

    line 35
  5. Distinctive:

    Never overwrite prior reports.

    line 87
  6. Distinctive:

    If something was decided in chat and not written to a file in the same session, assume it is lost for the next session.

    line 102
  7. Distinctive:

    Before marking work as done:

    line 108

≈ “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 as Code — Hard Enforcement

Code without documentation is not done. Documentation is context; context is long-term memory for AI agents and future developers. Without it, each new session or developer starts from zero.

Minimum Documentation Checklist (Every Code Session)

For every session involving code changes, this checklist must be satisfied:

  • New feature → specification created before implementation (docs/<feature>-spec.md or dedicated section in existing spec)
  • Feature added or modified → docs/architecture.md updated with structural changes and impacts
  • Any code change → CHANGELOG.md or equivalent with entry for this change
  • Public API modified → README documentation for the module/package updated
  • New external integration → documentation created with validated endpoints, authentication flow, error handling, and troubleshooting steps
  • Non-trivial module logic (caching, retry logic, authentication, scoring/ranking algorithms) → unit tests added before merge
  • Module with external integration → structured logging implemented per project standards

Multi-Tool Documentation Sync Gate

All AI agents and developers working on a project must maintain rule parity across tool configurations:

  • Rules in project .rules/ or documentation directories must be mirrored in all active development tools (editor configs, linter configs, etc.)
  • Global instruction files (e.g., CLAUDE.md, AGENTS.md, etc. when they exist) must stay synchronized
  • Any change to documentation rules in one tool = update in all tools, in the same session
  • Verify sync by grep-checking the rule text appears consistently across all tool config files

Debt visibility principle: If code changes must skip documentation "for now," explicitly record this as doc-debt in a visible location (session-handoff.md, PROGRESS.md, or backlog). Invisible debt is unacceptable; visible debt can be tracked and cleared later.

Required Documentation Ledger

Every non-trivial software project must maintain these living artifacts in the repository. This applies universally to all projects and teams:

Core Artifacts

ArtifactPurposeFormat
Spec / Charter / READMEWhat the project is, scope, non-goals, decided constraintsMarkdown; updated as scope changes
ARCHITECTURE.mdSystem structure, component interfaces, security invariants, extension pointsMarkdown; keep synchronized with code structure
CHANGELOG.mdVersioned record of all changes, using Keep a Changelog formatOne entry per significant change, newest at top
ADRs (Architecture Decision Records)Immutable records of architectural and technology decisionsNumbered files in docs/adr/ (e.g., ADR-001-title.md) or single file ARCHITECTURE-DECISIONS.md; format: Title, Number, Date, Status, Context, Decision, Consequences
SESSION-HANDOFF.mdState transfer between sessions for multi-session or multi-phase projectsMarkdown; preserve unresolved entries; never delete without justification
REVIEW-DECISIONS.mdDecisions made during formal reviews (security, performance, architecture)Markdown; record Decision + Rationale + Approver + Date
docs/review/Version-controlled review reportsNumbered by pass (charter-review-pass-01.md, charter-review-pass-02.md, etc.); never overwrite

Artifact Obligation Matrix

ArtifactRequired When
Spec, CHANGELOG, ARCHITECTUREAny non-trivial project
ADRsAny non-trivial architecture, technology, or process decision
SESSION-HANDOFFMulti-phase, multi-session, or long-running projects
REVIEW-DECISIONSFrom first formal review onward
docs/review/ (numbered)From first review pass onward

ADR Format (Minimal)

# ADR-NNN: [Title]

**Status:** Proposed | Accepted | Superseded | Deprecated

**Date:** YYYY-MM-DD

## Context
[Problem or requirement that prompted this decision]

## Decision
[What was decided and why]

## Consequences
[Expected outcomes, trade-offs, downstream impacts]

Mark superseded ADRs with a reference to the new ADR that replaces it; never delete old ADRs.

Review Report Naming

Each review cycle gets a new numbered file:

  • charter-review-pass-01.md — first review
  • charter-review-pass-02.md — second review (addresses feedback from pass-01)
  • And so on

Never overwrite prior reports. This preserves the audit trail of iterations and deltas.

Anti-Patterns to Avoid

  • Decision in chat only → disappears in next session. Chat decisions are not recorded until written to a project artifact in the same session.
  • Single review report overwritten each cycle → loses delta, loses audit trail. Use versioned filenames.
  • CHANGELOG placeholder while code evolves → invisible debt. Keep CHANGELOG current.
  • "ADR in author's head" → next developer or AI session redoes the decision, possibly incorrectly. Write ADRs.
  • Spec deleted after implementation → next feature lacks context for similar decisions. Keep specs.
  • README outdated after API change → users/developers follow broken instructions. Sync README with code.

The Core Rule

Conversation + decision without a written record in an artifact = did not happen.

If something was decided in chat and not written to a file in the same session, assume it is lost for the next session. This applies universally to all AI agents, team members, and future developers.

New features, architectural decisions, bug fixes, and design trade-offs must all be recorded before work is considered complete. The record is the contract for the next person or AI who picks up the work.

Implementation Checklist for Contributors

Before marking work as done:

  • Spec exists for the feature (if applicable)
  • Code changes are reflected in CHANGELOG
  • ARCHITECTURE.md is updated if structure changed
  • API documentation is updated if API changed
  • New integrations have documented endpoints and auth flows
  • Non-trivial logic has unit tests
  • External integrations include logging per project standard
  • All ADRs for new decisions are written and committed
  • Documentation is in git (not pending a separate PR or forgotten)
  • If multi-session, SESSION-HANDOFF.md is updated with remaining work

Documentation as the Contract

Documentation is not a nice-to-have. It is the binding contract between the implementer (developer or AI) and the maintainer (future developer or AI). Code changes are only complete when they are documented.

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.