Keep it current

Linked pull requests

The docs change goes with each product change. In-app, it is in the same pull request. With a separate docs repo, it is a linked docs pull request.

The docs stay current because the work happens next to each product change, not in a big rewrite later. The coding agent that builds a feature also runs /docs-update, in the same session. Each docs change covers one product change, so it stays small.

How the docs change travels depends on the layout:

In-app Separate
Where the docs change goes The same branch and pull request as the code A linked pull request in the docs repo
When the agent runs /docs-update Before it opens the feature pull request When the product pull request is ready for review
After the merge Nothing to do. The merge covers both. /docs-update finish completes the docs pull request
Workflow docs-check.yml in the app repo docs-impact.yml in the product repo

What needs docs

Change in the product pull request Docs
A new view, control, label or flow in the UI Needed
A new or changed setting, default or environment variable Needed
A change to the API: endpoints, fields, errors or limits Needed
Deployment, container, cloud services, permissions or sign-in Needed
A change in behaviour that a user can notice, such as limits or costs Needed
A refactor, tests, or an internal fix with no visible effect Not needed

If you are unsure, draft the docs. A small docs change costs less than a wrong page.

In-app: docs in the same pull request

  1. Build the feature

    Work on the feature branch as usual, with Claude Code, Codex or another agent.

  2. Run /docs-update

    Run it on the feature branch, before you open the pull request. The docs-update skill reads the diff, matches the changed files against docs/source-map.json, and changes only the site folder. It commits the docs change last, after the code.

  3. Open the pull request

    The pull request has the code and the docs. If no docs change is needed, add a line Docs: not needed (<reason>) to its body.

  4. Review and merge

    Reviewers read the docs change in the same diff. docs-check.yml attaches the built site to the run. The merge needs no extra step.

The commit that changes a page counts as its check, so in-app pages need no verified commit. Refer to How drift checks work.

Check each pull request automatically

  1. Copy node_modules/driftless-docs/templates/github/docs-check.yml to .github/workflows/docs-check.yml in the app repo.
  2. Set SITE_DIR in the file to the site folder, such as docs-site.

On each pull request, the workflow lists the pages whose sources changed while the page did not. It keeps one comment on the pull request up to date. When the pull request changes docs, it builds the site and attaches dist as an artifact for 14 days. Reviewers download it and open index.html, or serve it with any static server.

The check is advisory. To make it block a merge, set REQUIRE_DOCS to 'true' and make the check required in the branch rules. A Docs: not needed (<reason>) line in the pull request body then lets the check pass. The workflow needs no secrets, because the docs and the code are in one repo.

Separate: a linked docs pull request

The linked pull request flow, with a separate docs repo
  1. Open the product pull request

    Add a Docs: line to the product repo’s pull request template, so that every pull request has one. Leave it empty.

  2. Run /docs-update

    Run it when the pull request is ready for review. The skill reads the diff, matches the changed files against docs/source-map.json, and decides.

  3. Review the result

    Either the Docs: line says not needed with a reason, or it links a draft docs pull request on the branch product/pr-<number>. The draft lists the screenshots and clips to capture again.

  4. Merge the product pull request

    Review and merge it as usual.

  5. Run /docs-update finish

    It sets verified on each changed page to the merge commit, builds the site, and marks the docs pull request ready. Capture images again first if the draft listed any.

Tell the skill where the docs are

/docs-update usually runs in the product repo. Add .driftless.json to the product repo root, so that the skill finds the docs repo:

{ "docsPath": "../my-docs" }

In-app, init writes this file for you, with the site folder’s path.

Check each pull request automatically

This feature is in beta. A workflow in the product repo can list the docs pages that each pull request affects. It does not write docs. It tells the author and the reviewers which pages to check.

  1. Copy templates/github/docs-impact.yml from the driftless-docs package to .github/workflows/docs-impact.yml in the product repo.
  2. Set DOCS_REPO in the file to your docs repo.
  3. If the docs repo is private, add a DOCS_REPO_TOKEN secret to the product repo. Use a fine-grained token with read access to the docs repo contents.

On each pull request, the workflow compares the pull request with its base branch. It writes the list of affected pages to the job summary and keeps one comment on the pull request up to date. If the pull request affects no page, it adds no comment.

The check is advisory. To make it block a merge, set FAIL_ON_IMPACT to 'true' and make the check required in the branch rules. Do this only after the source map is complete, or the check flags pages that do not need a change.

Forks and secrets

Both workflows use the pull_request trigger, so a pull request from a fork gets a read-only token and no secrets. On a fork, the comment step can fail, but the job summary still has the result.

docs-check.yml builds the pull request’s code, like any CI job. docs-impact.yml runs no code from the pull request. It only compares files.

Catch what slips through

Some changes skip the flow. npm run check:drift lists written pages whose product sources changed after the page was last checked. A weekly workflow keeps a “Docs drift” issue up to date with that list. Run /docs-update sweep to fix them in one change. Refer to How drift checks work.

Upstream products

If you document a product that someone else owns, such as an open-source project, use a separate docs repo. The skill only reads the upstream pull requests. It never comments on them or edits them. Each docs pull request links the upstream change instead.