# For coding agents

> The repo, the commands and the setup steps, for an agent that sets up Driftless for a user.

This page is for a coding agent that a user asked to set up Driftless. Follow the steps in order. Ask the user only for what you cannot find.

| Item | Value |
|---|---|
| Framework repo | `MitchStares/driftless` on GitHub |
| Package | `driftless-docs`, installed from the repo's release tags |
| Licence | MIT |
| Needs | Node.js 24 or later, git |
| Agent instructions | `AGENTS.md` at the repo root, and in each new site folder |
| Skills | `plugin/skills/<name>/SKILL.md` |

## 1. Choose the layout

A Driftless site is a folder with `driftless.config.ts`. It can live in one of two places. Ask the user once. Recommend in-app unless a reason for a separate repo applies.

| Layout | Where the site folder goes | Choose it when |
|---|---|---|
| **In-app** (recommended) | A folder in the app repo: `apps/docs` if the repo has an `apps/` folder, otherwise `docs-site` | The user owns the app and builds it with a coding agent. The docs change in the same pull request as the code. |
| **Separate** | A repo of its own, usually beside the app: `../<app>-docs` | The app is someone else's open-source project, another team owns the docs, or one site covers several products. |

## 2. Create the site folder

The same command creates both layouts. It finds the layout from git.

```bash
# In-app: run in the app repo
npx github:MitchStares/driftless init docs-site
cd docs-site && npm install
```

```bash
# Separate: run beside the app repo
npx github:MitchStares/driftless init ../my-app-docs
cd ../my-app-docs && git init && npm install
```

In-app, `init` sets `product.path` to the repo root. It also writes `.driftless.json` at the repo root, so that other agents find the docs. In a separate repo, set `product.repo`, `product.path` and `product.ref` in `driftless.config.ts`.

The site folder holds only content. The framework is in `node_modules/driftless-docs`.

## 3. Install the skills

| Agent | Command |
|---|---|
| Claude Code | `/plugin marketplace add MitchStares/driftless`, then `/plugin install driftless@driftless` |
| Codex | `codex plugin marketplace add MitchStares/driftless`, then `codex plugin add driftless@driftless` |
| Other agents | Read `AGENTS.md`. It names the skill file for each task. |

## 4. Find the user's product

Find these facts before you run the setup skill. Ask the user only for the ones you cannot find.

- The product repo: its GitHub `owner/name` and a local checkout path. In-app, this is the repo you are in.
- The branch or tag that the docs follow, for example `origin/main`.
- The agent that the user works with.
- Where the user will host the docs: a static host, or a container behind a sign-in.
- If the product has a UI that can run locally with demo data, for screenshots.

## 5. Run driftless-init

Run the `driftless-init` skill in the site folder. It reads the product code, sets `driftless.config.ts`, proposes the page structure in `docs/nav.ts`, and drafts the first pages. Show the user the proposed structure before you write pages.

In-app, read the product code only. Write only in the site folder, `.driftless.json` and `.github/workflows/docs-check.yml`.

## 6. Check and hand over

```bash
npm run build
npm run check:sources
```

Then tell the user how to keep the docs current.

- **In-app:** run `/docs-update` before you open each feature pull request, so that the docs change goes in the same pull request. Copy `node_modules/driftless-docs/templates/github/docs-check.yml` to the app's `.github/workflows/` and set `SITE_DIR`.
- **Separate:** run `/docs-update` on each product pull request. Copy `docs-impact.yml` from the same folder to the product repo, and `drift.yml` to the docs repo.

Refer to [Linked pull requests](/linked-prs).

## Rules

- Do not add telemetry, analytics or calls to other hosts. Refer to `PRIVACY.md`.
- Keep the user's brand in `theme` in `driftless.config.ts`. The defaults are neutral.
- Edit diagrams in place. Do not regenerate a `.drawio` file over manual edits.
- Do not assume a host. The site is static files in `dist/`.
