Tutorials & tips
Published:
26 Nov, 2026
How to use AGENTS.md to build better AI documentation workflows (with examples and template)

AI summary
AGENTS.md gives compatible AI coding agents reusable instructions for documentation work. Point it to accurate examples, a style guide, and authoritative product information, then add skills or connected tools where they help with recurring tasks. Review the agentโs output and refine the guidance when you find recurring problems.
AI coding agents are a great tool for writing documentation and updating guides as your product changes. But getting those pages to fit your documentation takes more context: an agent might use the wrong terminology, overlook important prerequisites, or create a new page when it makes more sense to update an existing one.
More detailed prompts can help, but repeating the same guidance for every task gets frustrating. Thatโs where an AGENTS.md file comes in, giving compatible agents reusable project instructions. You can use it to establish writing rules and point agents to existing documentation, product information, and workflows.
This guide will walk you through building an AGENTS.md file for general-purpose coding agents such as Codex and Cursor. Specialized tools like GitBook Agent already have much of the documentation context and functionality built in. Weโll talking more about that option later.
What is AGENTS.md?
AGENTS.md is an open, Markdown-based format for giving AI coding agents instructions about how to work with a project.
Itโs similar to a README.md, but written for agents. A README introduces a project to human contributors; AGENTS.md tells agents how to follow its conventions and workflows.
For software projects, that might include build commands, coding standards, and testing requirements. For documentation, it could explain where your docs live, which writing conventions to follow, and how to review changes.
You typically place the file at the root of your repository, although you can add more specific instructions within subdirectories. How agents discover and apply these files varies by tool, so check your agentโs support before relying on them.
Create an AGENTS.md file for your documentation
Create a file named AGENTS.md in your repository and add a few instructions for common documentation tasks.
Weโre going to use ExampleAPI, a fictional API product, for this guide. A starting file might look like this:
These instructions tell the agent where to work and set basic expectations for editing and review. Some still need supporting context, though. โFollow the structure and formatting of related pages,โ for example, leaves the agent to find a suitable example and decide which conventions to follow. So letโs add some context.
Give your agent better documentation context
You can also use AGENTS.md to direct agents to resources your team already maintains. That keeps the file manageable while giving agents access to detailed writing guidance and product information.

Point to examples of good documentation
Accurate, well-structured documentation gives an agent concrete examples of your standards. A getting-started guide, for instance, shows how your team introduces concepts and presents prerequisites before walking readers through a task.
Tell the agent which pages to consult and what to learn from each:
Make sure you review all the examples before recommending them. Confusing explanations and inconsistent patterns can carry through into the agentโs work, so choose pages that represent the documentation you want it to produce.
Connect your style guide
A style guide makes editorial decisions explicit, including terminology, tone, formatting, and accessibility. Those rules help contributors write consistently across pages, whether theyโre people or AI agents.
If your team already maintains a guide, point to it from AGENTS.md:
The guide establishes the rules; example pages show how your team applies them.
Make authoritative product information available
An agent updating an API guide needs reliable information about how the API works. Depending on your project, that might come from an OpenAPI specification, product requirements, source code, or verified existing documentation.
Tell the agent where to find those sources and what to do when it canโt verify a detail. It needs to distinguish information it can substantiate from questions that require further investigation.
Go further with skills and connected tools
Skills and external tools can help with recurring documentation tasks once you have basic instructions and reliable reference material in place. You can add them as your workflow develops.
Use skills for repeatable documentation tasks
A skill is a reusable set of instructions, commonly packaged in a SKILL.md file, that an AI agent can use for a particular task.
AGENTS.md establishes general project rules. A skill gives the agent more detailed guidance for a workflow, such as checking documentation for missing prerequisites or preparing release notes from product changes.
GitBookโs docs AI toolkit includes free skills designed specifically for documentation workflows, along with tools for checking whether pages are easy for AI systems to understand. You can use them with compatible agents regardless of where your documentation is hosted.
Reference relevant skills in AGENTS.md and explain when to use them. The skills also need to be available in your chosen agent environment, so make sure you add or install them where relevant.
Connect agents to your documentation tools with MCP
The Model Context Protocol (MCP) allows AI agents to connect to external tools and information sources.
With the right MCP connection, an agent can retrieve documentation from a platform and prepare updates using the tools it exposes. This lets it work with content beyond local Markdown files.
For example, GitBook MCP connects external agents to GitBook so they can work with existing content, create pages, restructure documentation, and prepare changes for review, while seeing the full documentation site and built-in style guide for extra context.
Each component has a different job: AGENTS.md supplies project instructions, skills guide specific tasks, and MCP provides access to external systems.
Note: GitBook MCP for editing and updating documentation is different from GitBookโs read-only MCP server for published documentation, which lets AI agents search and retrieve your docs without making changes.
Update an existing guide with this setup
Suppose ExampleAPI introduces automatic API key expiration. The authentication guide needs updating, along with any setup instructions and any examples affected by the change.
If you only gave your agent a short request or prompt, it might add a paragraph about expiration, but miss those related updates. With the supporting resources in place, you can give it this task:
The agent now has a specification to consult, existing pages to examine, and writing conventions to apply. It also has an explicit instruction to check related content.
If the team has installed a documentation review skill, the agent could use it to check the proposed changes for missing prerequisites or unclear explanations.
Donโt forget: youโll still need to review the result. This fictional example describes a workflow, and agents can miss instructions even with these resources available.
Itโs also important to remember that instructions in AGENTS.md arenโt enforceable safeguards. Telling an agent not to publish changes is a good idea, but you should also use your documentation platformโs permissions and review controls to ensure changes are approved before going live.
How GitBook simplifies AI documentation workflows
For documentation hosted in GitBook, GitBook Agent provides a way to work directly within the platform. Itโs built for documentation and understands GitBookโs editor, documentation structure, and surrounding content.
You can also add a configured style guide and custom instructions within the GitBook app for it to follow, so you donโt need to recreate all those writing standards in a separate AGENTS.md file.
GitBook Agent can then draft pages, update content, or review change requests against your documentation and style guide. Your team can always review the changes before publication.
If you prefer an external agent, GitBook MCP gives it access to GitBookโs content and editing tools, including change request workflows. Its ability to find and apply particular standards still depends on the tools and context available to it, but it can see the wider context of your docs site, and understands how to format content to make the most of GitBookโs blocks and editing tools.
Both approaches can reduce the documentation setup you manage yourself while supporting your teamโs established review and publishing processes.
Keep improving your instructions as your documentation evolves
Start with a few rules and references, then use the agentโs work to decide what needs improving. You should keep AGENTS.md focused on guidance the agent needs for your project, and revisit it as your documentation changes.
If you spot regular terminology mistakes in the content output, that may point to gaps in your style guide. At the same time, missing prerequisites could call for a better example or a review skill as part of your agentโs skill set. If itโs making incorrect technical claims, that suggests the agent is missing reliable product information.
Rather than adjusting your prompt, itโs better to adjust the resource that addresses the problem, then check whether the next task goes better. And donโt forget: your team is still responsible for reviewing the work and deciding what gets published. Here at GitBook, weโve enabled merge rules that mean agent-written changes never go live without a human review.
Copyable AGENTS.md template for documentation projects
Below weโve created a simple template that you can adapt for your repository. Replace the example paths and descriptions, remove anything that doesnโt apply, and add instructions for your projectโs needs.
# Documentation instructions ## Project overview - Product: [Product name and description] - Audience: [Primary readers] - Documentation location: [Path to docs directory] - Documentation platform: [Platform, if applicable] ## Documentation structure - Review existing documentation before making changes. - Prefer updating relevant pages over creating duplicates. - Follow the established hierarchy and navigation. - Keep conceptual guides, tutorials, and reference documentation consistent with their existing formats. ## Writing standards - Read [path to style guide] before writing or editing. - Follow approved terminology, tone, and formatting. - Use these pages as examples of good documentation: - [Path to example tutorial] - [Path to example conceptual guide] - Include prerequisites for task-based documentation. - Prioritize clarity and technical accuracy. - Don't copy outdated or incorrect patterns. ## Technical accuracy - Verify technical claims against authoritative sources. - Consult [relevant specifications or source directories]
# Documentation instructions ## Project overview - Product: [Product name and description] - Audience: [Primary readers] - Documentation location: [Path to docs directory] - Documentation platform: [Platform, if applicable] ## Documentation structure - Review existing documentation before making changes. - Prefer updating relevant pages over creating duplicates. - Follow the established hierarchy and navigation. - Keep conceptual guides, tutorials, and reference documentation consistent with their existing formats. ## Writing standards - Read [path to style guide] before writing or editing. - Follow approved terminology, tone, and formatting. - Use these pages as examples of good documentation: - [Path to example tutorial] - [Path to example conceptual guide] - Include prerequisites for task-based documentation. - Prioritize clarity and technical accuracy. - Don't copy outdated or incorrect patterns. ## Technical accuracy - Verify technical claims against authoritative sources. - Consult [relevant specifications or source directories]
# Documentation instructions ## Project overview - Product: [Product name and description] - Audience: [Primary readers] - Documentation location: [Path to docs directory] - Documentation platform: [Platform, if applicable] ## Documentation structure - Review existing documentation before making changes. - Prefer updating relevant pages over creating duplicates. - Follow the established hierarchy and navigation. - Keep conceptual guides, tutorials, and reference documentation consistent with their existing formats. ## Writing standards - Read [path to style guide] before writing or editing. - Follow approved terminology, tone, and formatting. - Use these pages as examples of good documentation: - [Path to example tutorial] - [Path to example conceptual guide] - Include prerequisites for task-based documentation. - Prioritize clarity and technical accuracy. - Don't copy outdated or incorrect patterns. ## Technical accuracy - Verify technical claims against authoritative sources. - Consult [relevant specifications or source directories]
# Documentation instructions ## Project overview - Product: [Product name and description] - Audience: [Primary readers] - Documentation location: [Path to docs directory] - Documentation platform: [Platform, if applicable] ## Documentation structure - Review existing documentation before making changes. - Prefer updating relevant pages over creating duplicates. - Follow the established hierarchy and navigation. - Keep conceptual guides, tutorials, and reference documentation consistent with their existing formats. ## Writing standards - Read [path to style guide] before writing or editing. - Follow approved terminology, tone, and formatting. - Use these pages as examples of good documentation: - [Path to example tutorial] - [Path to example conceptual guide] - Include prerequisites for task-based documentation. - Prioritize clarity and technical accuracy. - Don't copy outdated or incorrect patterns. ## Technical accuracy - Verify technical claims against authoritative sources. - Consult [relevant specifications or source directories]
Your project may need more specific reference material or separate instructions for particular documentation areas, so add those as you discover where the general guidance falls short.
โ Explore GitBookโs AI docs toolkit
โ How to create and publish documentation with AI and MCP
โ How to audit and improve your docs with GitBook Agent and MCP
Share
Read more
Tutorials & tips
Get the GitBook newsletter
Get the latest product news, useful resources and more in your inbox. 130k+ people read it every month.

24 Nov, 2026
Documentation best practices: how to structure, write, and maintain better docs

Steve Ashby
Content Lead


18 Nov, 2026
How to audit and improve your docs with GitBook Agent and MCP

Steve Ashby
Content Lead

11 Nov, 2026
What is WebMCP? How it works and why it matters for AI agents

Steve Ashby
Content Lead
Accurate docs. Better answers.
Your docs are already feeding AI. Are users getting the right answers or the wrong ones?
Accurate docs. Better answers.
Your docs are already feeding AI. Are users getting the right answers or the wrong ones?
Accurate docs. Better answers.
Your docs are already feeding AI. Are users getting the right answers or the wrong ones?
Create & Publish
Solutions
Resources
ยฉ 2026 Copyright GitBook INC.
440 N Barranca Ave #7171, Covina, CA 91723, USA. EIN: 320502699
Get an AI summary

The State of Docs Report 2026
State of Docs brings together insights from documentation experts from across the industry

Create & Publish
Solutions
Resources
ยฉ 2026 Copyright GitBook INC.
440 N Barranca Ave #7171, Covina, CA 91723, USA. EIN: 320502699
Get an AI summary
The State of Docs Report 2026
State of Docs brings together insights from documentation experts from across the industry

Create & Publish
Solutions
Resources
ยฉ 2026 Copyright GitBook INC.
440 N Barranca Ave #7171, Covina, CA 91723, USA. EIN: 320502699
Get an AI summary
The State of Docs Report 2026
State of Docs brings together insights from documentation experts from across the industry

