Agent setup

AI and agents•6 min read|
|

docslit agents init writes the instruction files an AI coding tool needs to write correct DocsLit pages in your project. It reads your docslit.json, so the instructions name your real sidebar groups, versions and locales.

npx docslit agents init

New projects already have an AGENTS.md. docslit init writes it unless you pass --no-agents.

What it writes

AGENTS.md is always written. It is the cross-tool convention, and Codex reads it directly. Other files are written for the tools it detects in your project, or for the tools you name with --tool.

Tool Detected when the project has Files written
Claude Code .claude/ or CLAUDE.md .claude/skills/docslit-author/SKILL.md, .claude/skills/docslit-migrate/SKILL.md, CLAUDE.md, .mcp.json
Cursor .cursor/ .cursor/rules/docslit.mdc, .cursor/mcp.json
GitHub Copilot .github/ .github/instructions/docslit.instructions.md, .vscode/mcp.json
Windsurf .windsurf/ .windsurf/rules/docslit.md
Gemini CLI GEMINI.md or .gemini/ GEMINI.md, which imports AGENTS.md
Codex not detected nothing extra: Codex reads AGENTS.md

Pass --tool all to write every tool's files, or a comma-separated list:

docslit agents init --tool all docslit agents init --tool claude,cursor docslit agents init ./my-docs --tool copilot --json

Here is a real run in a fresh project with --tool all --json:

{ "tools": ["claude", "cursor", "copilot", "windsurf", "codex", "gemini"], "detected": [], "written": [ ".claude/skills/docslit-author/SKILL.md", ".claude/skills/docslit-migrate/SKILL.md", "CLAUDE.md", ".mcp.json", ".cursor/rules/docslit.mdc", ".cursor/mcp.json", ".github/instructions/docslit.instructions.md", ".vscode/mcp.json", ".windsurf/rules/docslit.md", "GEMINI.md" ], "updated": ["AGENTS.md"], "unchanged": [], "skipped": [], "notes": [ "Codex reads AGENTS.md directly; no extra files needed.", "GEMINI.md imports AGENTS.md with Gemini CLI's `@file` syntax.", "MCP is configured where the tool supports a project-level file (Claude Code, Cursor, VS Code Copilot); Windsurf, Codex and Gemini MCP settings are user-level, add `npx -y docslit mcp` there yourself." ] } Comma-separated list from claude, cursor, copilot, windsurf, codex, gemini, or all. Default: AGENTS.md plus the tools detected in the project. Overwrite generated files that you changed, and replace a customized docslit MCP entry. Print the result as JSON. The keys are tools, detected, written, updated, unchanged, skipped and notes. On failure the output is { "error": "..." } and the exit code is 1.

The optional first argument is the project directory. It defaults to the current directory.

What is in AGENTS.md

The block between <!-- docslit:start --> and <!-- docslit:end --> holds a short, project-specific brief:

  • where pages live and how a page id maps to a file
  • whether the sidebar is explicit, autogenerated or mixed, and the names of your groups
  • your versions and locales, if you use them
  • the authoring loop: discover with docslit components --json, create with docslit new --json, check with docslit validate --format json and docslit lint --format json
  • the rules that prevent most mistakes: one H1, blank lines around components, close tags explicitly, respect nesting, use icon (icon-name is an alias) and label

Safe to re-run

Run the command again after you upgrade DocsLit or change your sidebar. It is designed not to destroy your edits:

  • Your own text in AGENTS.md, CLAUDE.md and GEMINI.md is kept. Only the marked block is replaced. If the file has no block yet, one is appended.
  • Skill and rule files carry a <!-- docslit:generated --> marker. DocsLit updates files with the marker. It skips a file without the marker and reports it under skipped, unless you pass --force.
  • MCP config files are merged. Other servers in .mcp.json, .cursor/mcp.json and .vscode/mcp.json are never touched. A docslit entry you customized is skipped unless you pass --force. A config file that is not valid JSON is skipped too.

The skills

The Claude Code files are skills. Claude loads a skill when a task matches its description.

How to write and edit DocsLit pages. Its component reference is generated from the same manifest as docslit components, so it cannot drift from the CLI. It also covers frontmatter, the docslit.json options, autogenerated sidebars and the check loop. How to migrate Mintlify, Fern, GitBook and MkDocs docs, and other MDX-based docs, into DocsLit. It starts with docslit import, works through the MIGRATION.md report and the --json output, and uses the MCP tool convert_mdx for single pages. See Migrate with your AI agent.

Print either skill, or the AGENTS.md block, without writing files. This is useful for tools that take a system prompt instead of a file:

docslit agents print # the author skill (default) docslit agents print migrate # the migrate skill docslit agents print agents-md # the AGENTS.md block

Example prompts

With the files in place, you can give short instructions.

Write a DocsLit page for our REST API authentication flow. Include steps for getting an API key, making a first request, and handling errors. Use code examples in curl, Python and JavaScript. Run validate and lint when you are done.

The agent runs docslit new, writes wc-steps for the flow and wc-code-group for the languages, then fixes whatever validate and lint report.

Create an API reference page for our /users endpoints: GET /users, POST /users, GET /users/:id and DELETE /users/:id. Document every parameter.

The agent uses wc-endpoint, wc-fields and wc-field, and checks each attribute with docslit components wc-field --json.

Migrate the MDX files in ../old-docs into this project. Run docslit import with --dry-run first, then fix what the report flags by hand.

The agent starts with the importer, reads the report, and uses the migrate skill for the rest. See the migration guides.

Say who the page is for, what the reader should be able to do afterwards, and which components to use. "A getting-started page for backend developers, with steps and a code group" gives better results than "write a page about auth".

Previous skill install method

Earlier versions of these docs told you to download skill files with curl. You do not need that any more. docslit agents init writes the same content from the version of DocsLit you have installed, so the instructions always match the CLI.

Next steps