Docs / How-to guides

Bring repository health to another repo

Check a repository against the five repository health principles, then adopt them one at a time — with Otto, or by hand with plain git.

Before you start

Nothing here rewrites history. Each practice applies to new commits and new files from the day you adopt it; old commits keep their messages and old files their length. Start with the practice the check marks worst, not with all five.

With Otto: run the check

  1. Open a session in the repository

    Any Otto session whose working directory is inside the repository, on a Mac or on your server.

  2. Run the check

    /otto:health-check

    It reads the main branch's history and the tree, changes nothing, and writes REPO-HEALTH.md at the repository's root. Pass --out <path> to write it somewhere else. The report is not committed; delete it or add it to .gitignore.

  3. Read the verdicts

    Each principle gets ✅, ⚠️ or ❌ (or — when it doesn't apply, such as scopes in a repository that ships one thing), the evidence behind it, and one step to start on. First moves at the end orders the three that matter most.

  4. Go deeper on the docs

    For a per-directory plan to thin instruction files into an index, rules and specs, run /otto:analyze-specs [path]. It is the detailed version of the check's third principle.

By hand: adopt the practices

Each step stands alone. Do them in the order your check — or your own reading of the repository — says hurts most.

  1. Give the landing commit a why

    Add a template and use it for the commit that lands on the main branch — the squash-merge message, or a local squash:

    # .gitmessage
    type(scope): subject
    
    Why: the cause or the motivation, 1–3 lines. Not a list of edits.
    
    Proven: what you actually ran or checked.
    
    See docs/decisions/NNN-slug.md   (only when a decision changed)
    git config commit.template .gitmessage

    If you land through pull requests, put the same three parts in the pull request template and use the description as the squash commit's body.

  2. Start a decisions folder

    Create docs/decisions/README.md with a table — number, decision, status, date — and write the next decision you make as docs/decisions/001-<slug>.md: the decision, its rationale, what was rejected, and its consequences. A later change is a dated Addendum at the end of the same file; once there are several, open the file with a short Current state.

    Don't backfill history. If the repository already has one large decisions file, split it one record per heading, keep the numbers, and leave the old file as a stub that points to the folder, so old links still land.

  3. Thin the instruction file

    Keep the root CLAUDE.md or AGENTS.md to orientation: what the repository is, its commands, and where to read more. Move always-apply rules to .claude/rules/<topic>.md, with a paths: glob in its front matter when a rule applies to one area. Move what a module guarantees to a SPEC.md beside it.

  4. Cap file length

    In a JavaScript or TypeScript repository, ESLint's built-in rule is a start:

    "max-lines": ["error", {
      "max": 500,
      "skipBlankLines": false,
      "skipComments": false
    }]

    Turn it off for the files already over the limit, list them, and remove each entry once the file is split below 500. Never trim blank lines or comments to fit; split along a seam instead.

  5. Fix the scope list

    If the repository ships more than one thing, write one scope per shipping unit — plus docs, test, ci and tools for what ships nowhere — and enforce it with commitlint:

    // commitlint.config.mjs
    export default {
      extends: ['@commitlint/config-conventional'],
      rules: {
        'scope-enum': [2, 'always', ['app', 'api', 'worker', 'docs', 'test', 'ci', 'tools']],
        'header-max-length': [2, 'always', 100],
      },
    }

    A repository that ships one thing can skip scopes; keep the subject short.

You're done when the check — or a reader new to the repository — finds the why of a recent change in git log, today's state of a decision in one file, and no file it has to read in pieces.