Agent setup
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.
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:
Here is a real run in a fresh project with --tool all --json:
claude, cursor, copilot, windsurf, codex, gemini, or all. Default: AGENTS.md plus the tools detected in the project.docslit MCP entry.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 withdocslit new --json, check withdocslit validate --format jsonanddocslit lint --format json - the rules that prevent most mistakes: one H1, blank lines around components, close tags explicitly, respect nesting, use
icon(icon-nameis an alias) andlabel
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.mdandGEMINI.mdis 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 underskipped, unless you pass--force. - MCP config files are merged. Other servers in
.mcp.json,.cursor/mcp.jsonand.vscode/mcp.jsonare never touched. Adocslitentry 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.
docslit components, so it cannot drift from the CLI. It also covers frontmatter, the docslit.json options, autogenerated sidebars and the check loop.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:
Example prompts
With the files in place, you can give short instructions.
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.
The agent uses wc-endpoint, wc-fields and wc-field, and checks each attribute with docslit components wc-field --json.
The agent starts with the importer, reads the report, and uses the migrate skill for the rest. See the migration guides.
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
- Connect your tool to the MCP server for typed tools instead of shell commands
- Learn the machine-readable CLI that the instructions point to