---
title: Agent setup prompts
description: Copyable prompts that let a coding agent wire Leadtype into your
  app — local docs, external/multi-repo docs, or a package bundle — adapting to
  your real layout.
related:
  - title: CLI
    href: /docs/reference/cli
    description: leadtype init scaffolds the local-docs case directly.
  - title: Configure docs sources
    href: /docs/sources/configure-sources
    description: Local folder, mounted folders, or remote git collections.
---
`leadtype init` scaffolds the common case — a greenfield app with a **local
`docs/` folder**. But docs often live elsewhere: another repository pulled in
via [collections](/docs/sources/configure-sources), an existing site with its
own structure, or a Fumadocs app. For those, hand a coding agent one of the
prompts below. The agent reads your actual layout and wires Leadtype to fit,
instead of dropping in a fixed file tree.

When to use which:

* **Local docs, fresh app** → run `leadtype init --framework <fw>`. Fastest, no agent needed.
* **Local docs, existing app with custom structure** → the *Wire into an app* prompt.
* **Docs in another repo / multi-repo** → the *External docs* prompt (`init` does not fit — it scaffolds a local folder).
* **Shipping docs inside an npm package** → the *Bundle for a package* prompt.

## Wire Leadtype into an app

**Add Leadtype to this app (local docs)**

Use for an existing app whose docs live in a local folder.

```prompt
You are integrating Leadtype into this app so one MDX source renders for
humans and is also exposed to agents (llms.txt, markdown mirrors, search,
JSON-LD).

Inspect first:

- The framework (check `package.json`): Next, Astro, Nuxt, SvelteKit, TanStack Start, or a Fumadocs app.
- Where docs MDX lives, or where it should live.
- Whether a `docs.config.ts` or `leadtype.config.ts` already exists.

Implement:

- Create `docs/docs.config.ts` with `defineDocsConfig({ product, navigation })`. Put real `product.tagline` and `llms.sections` (an `## Overview` markdown block and a `Best Starting Points` links block) so `llms.txt` is useful. Use `navigation` for structure, not frontmatter `group`.
- Create a source loader that calls `createDocsSource({ contentDir, nav: docsConfig.navigation, baseUrl })` from `leadtype`.
- Add the docs route and a markdown route using the matching adapter: `leadtype/next`, `leadtype/astro`, `leadtype/nuxt`, or `leadtype/sveltekit`. The markdown route handles `Accept: text/markdown`, AI user-agents, and `.md` URLs via the generated `agent-readability.json` manifest (load it with `normalizeAgentReadabilityManifest`).
- Render JSON-LD in the docs page head with `createDocsJsonLd` from `leadtype/llm/readability`.
- Add a `docs:generate` script: `leadtype generate --src . --out <public-or-static> --base-url <url>`. Use `public/` for Next/Astro/Nuxt, `static/` for SvelteKit. Run it in `prebuild`/`predev` so the manifest always exists.

Match the patterns in the [Use the source primitive](/docs/build/use-the-source-primitive) recipe for this framework. Do not invent leadtype exports — use only documented ones.

Validation:

- Run `docs:generate`, then start the app.
- `curl http://localhost:<port>/llms.txt` lists `.md` URLs that resolve.
- `curl -H "Accept: text/markdown" http://localhost:<port>/docs/<page>` returns `Content-Type: text/markdown`.
- The docs HTML head contains one `application/ld+json` script.
```

## External / multi-repo docs

**Set up Leadtype for docs that live in another repo**

Use when the UI repo is separate from the docs source (the multi-repo / collections shape).

```prompt
You are setting up Leadtype in a docs **UI** repository whose content is
authored in a **different** repository. Do not scaffold a local `docs/`
folder and do not run `leadtype init` — the source is remote.

Inspect first:

- The docs source repository URL and the ref (branch, tag, or commit) it should pin to.
- Whether multiple content areas exist (e.g. `docs` and `changelog`).
- The UI framework in this repo.

Implement:

- Create `leadtype.config.ts` at the repo root using `defineDocsConfig` with a `collections` map. Each collection uses `defineCollection({ repository, ref, cacheDir, dir, prefix })`. Pin `ref` to a reviewed revision; share one `cacheDir` clone across collections of the same repo.
- Give each collection its own `navigation` (and `schema` if the source uses custom frontmatter).
- Add a generate script that syncs the remote source first: `leadtype generate --src . --out <public-or-static> --base-url <url> --sync`. Use `--refresh` to fast-forward the pinned cache and `--offline` to prove the cache is sufficient (air-gapped CI).
- Wire the docs route, markdown route, and JSON-LD exactly as for local docs — the runtime side is identical once artifacts exist.

Reference [Collections](/docs/sources/collections) and [Sync docs across repositories](/docs/build/sync-docs-across-repos) for the config fields and the cross-repo pin-update workflow.

Validation:

- First run clones the source into `cacheDir` (gitignore it).
- `leadtype generate --offline` succeeds against the cache without network.
- Generated `llms.txt` and markdown mirrors resolve, scoped under each collection's `prefix`.
```

## Bundle docs for a package

**Bundle Leadtype docs into this npm package**

Use to ship AGENTS.md + per-topic markdown inside the tarball.

```prompt
You are configuring this npm package to ship agent-readable docs inside its
tarball, so coding agents read version-matched docs from `node_modules`.

Inspect first:

- Where the package's docs MDX lives.
- The `package.json` `files` array and any existing prepack/build scripts.

Implement:

- Ensure a `docs.config.ts` (or `leadtype.config.ts`) describes `product` and `navigation`.
- Add a script that runs bundle mode: `leadtype generate --bundle --src . --out .`. This writes `AGENTS.md` at the package root and `docs/*.md` with relative links that still work after install. It skips website-only artifacts (llms.txt, search, sitemap, robots).
- Run it in `prepack`/`prepublishOnly` so the bundle is fresh on publish.
- Add `AGENTS.md` and `docs` to the `files` array so they ship in the tarball. If they are gitignored build outputs, that is fine — `files` still includes them at pack time.

Reference [Bundle docs into a package](/docs/package-docs/bundle).

Validation:

- `AGENTS.md` exists at the package root and links to `./docs/*.md` files that exist.
- `npm pack --dry-run` lists `AGENTS.md` and `docs/`.
```
