<!--
Sitemap:
- [What is Vocs](/introduction/what-is-vocs): Learn why Vocs exists and when to use it
- [Getting Started](/introduction/getting-started): Install Vocs and create your first documentation site
- [Project Structure](/introduction/project-structure): Overview of the structure of a Vocs project
- [Writing Docs with AI](/introduction/writing-docs-with-ai): Use an AI agent to create and maintain Vocs documentation
- [Markdown Extensions](/writing/markdown-extensions): Features and syntax of Markdown in Vocs
- [Code & Syntax Highlighting](/writing/syntax-highlighting): Rich markup and annotations for code
- [Twoslash](/writing/twoslash): Add type-aware annotations to code examples
- [Code Snippets](/writing/code-snippets): Include and reuse code in Markdown
- [Markdown Snippets](/writing/markdown-snippets): Include other Markdown files in MDX
- [React in Markdown](/writing/react): Compose MDX pages with React components
- [Mermaid Diagrams](/writing/mermaid): Render diagrams from text using Mermaid
- [Assets](/writing/assets): Manage images, fonts, icons, and other docs assets
- [Frontmatter](/writing/frontmatter): Configure page metadata, layouts, search, and UI visibility
- [Navigation](/features/navigation): Keep docs navigation synced with routes
- [Search](/features/search): Built-in client-side search powered by MiniSearch
- [Layouts](/features/layouts): Choose and customize page shells for your docs
- [Slots](/features/slots): Inject custom components into the docs shell
- [Theming](/features/theming): Customize colors, typography, spacing, logos, and code themes
- [Tailwind CSS](/features/tailwind): Use Tailwind utilities in Vocs pages and components
- [Dynamic OG Images](/features/dynamic-og-images): Generate social preview images from page metadata
- [Page Feedback](/features/feedback): Collect page-level feedback from readers
- [Redirects](/features/redirects): Preserve old URLs and route legacy paths to new locations
- [API Routes](/features/api-routes): Add server-rendered endpoints to your docs site
- [Agent Support](/features/agent-support): Serve documentation in machine-readable form for AI agents
- [Ask AI](/features/ask-ai): Built-in AI assistant menu on every page
- [MCP Server](/features/mcp-server): Expose your docs and source code to AI assistants
- [Changelog Generation](/features/changelog-generation): Fetch release notes and render a changelog page
- [Site Configuration](/reference/site-config): Reference for options accepted by defineConfig
- [Frontmatter Reference](/reference/frontmatter): All frontmatter fields accepted by a Vocs MDX page
- [Components](/reference/components): Reference for the public React components exported from Vocs
- [Hooks](/reference/hooks): Reference for the React hooks exported from Vocs
- [Changelog](/changelog): Release history for Vocs
-->

# Writing Docs with AI \[Use an AI agent to create and maintain Vocs documentation]

Vocs is designed to work well with AI agents. The best results come from giving the agent a clear docs task, the Vocs guides it should read, the files it should edit, and the command it should run to verify the site.

## Start with a Prompt

For a new docs site, ask your agent to read the Getting Started guide first:

```txt
Read https://vocs.dev/introduction/getting-started and set up Vocs for my project.
```

For an existing project, give the agent a tighter task:

```txt
Read https://vocs.dev/introduction/getting-started, https://vocs.dev/introduction/project-structure, and https://vocs.dev/writing/markdown-extensions.

Then audit this project and add Vocs documentation. Edit the docs source files, update navigation, and run the docs build when you are done.
```

## Files Agents Usually Edit

| File | Purpose |
| --- | --- |
| `vocs.config.ts` | Site title, description, navigation, integrations, and theme config. |
| `src/pages/**/*.md` | Markdown-only documentation pages. |
| `src/pages/**/*.mdx` | Documentation pages that use imports, JSX, or Vocs components. |
| `src/pages/_root.css` | Global docs styles and theme token overrides. |
| `public/**` | Static assets such as logos, images, favicons, and fonts. |

Ask agents to avoid generated files, build output, and unrelated application code unless the docs task explicitly requires them.

## Add a Page

When asking an agent to add a page, include the route, audience, and outcome:

```txt
Add a Vocs page at src/pages/guide/authentication.mdx for developers integrating authentication.

Explain the happy path first, include one minimal code example, add a troubleshooting section, and add the page to the sidebar.
```

For pages that should work well in `llms.txt`, ask for clear headings and a short description:

```txt
Use a descriptive H1 with bracketed subtext, keep sections task-based, and avoid placeholder examples.
```

## Update Navigation

Vocs navigation lives in `vocs.config.ts`. When an agent adds, removes, or renames pages, ask it to update the sidebar in the same change.

```txt
After creating the page, update the Vocs sidebar so the new route appears in the right section.
```

## Verify the Result

End every docs prompt with a verification step. The exact command depends on your package manager and scripts, but most Vocs projects expose a build script.

```txt
Run the docs build, fix any broken links or MDX errors, and tell me the local URL I can open.
```

If the agent changes code examples, ask it to check that imports, filenames, and snippet paths match the project.

## Useful Follow-Up Prompts

```txt
Audit these docs as if you are a first-time developer using this SDK. List missing pages, unclear examples, and navigation problems.
```

```txt
Rewrite this page to be easier for an AI agent to retrieve. Keep headings task-based, add a concise description, and remove placeholder examples.
```

```txt
Find code examples in the docs that do not match the current source code and update them.
```
