Guides
Generating documentation with Grok Build
Grok Build reads your code and generates documentation that reflects what the code does: READMEs, API docs, design documents, and architecture overviews. Codebase search helps it capture how components interact across your project, not only within open files.
READMEs and project documentation
See the agent's response
Thought for 2s
CreatedREADME.md+145
# Payment Processing API
A REST API for processing payments with Stripe integration.
## Quick Start
```bash
cp .env.example .env
docker-compose up -d
npm install && npm run dev
```Grok Build can generate READMEs for new projects, update stale READMEs to match current code, or fill in gaps where documentation never existed. The generated docs pull from actual code paths, configuration files, and package dependencies rather than assumptions about how things should work.
For existing projects, ask Grok Build to compare your README against the current codebase and identify what is out of date. This is often faster than reading through docs trying to spot inaccuracies.
Onboarding documentation
New developers spend significant time figuring out how things work: what services exist, how to run them locally, what the common workflows are. Grok Build can generate onboarding docs that answer these questions directly from the codebase.
See the agent's response
Thought for 2s
CreatedGETTING_STARTED.md+185
# Getting Started
Welcome! This guide gets you from zero to running in 15 minutes.
## Prerequisites
- Node.js 18+ (we use 20 in production)
- Docker and Docker Compose
- Access to 1Password vault 'Engineering'
## Step 1: Clone and Install
```bash
git clone [email protected]:company/api.git
cd api && npm install
```New developers can get up to speed faster when accurate documentation exists. See also Understanding Unfamiliar Code for how team members can use Grok Build to explore the codebase directly.
Design documents from code
Sometimes you need to document the design of a system that was never formally designed. The implementation exists, but there is no spec explaining why it works the way it does.
See the agent's response
Thought for 3s
Createdpayment-system.md+210
# Payment System Design Document
## Overview
This document describes the payment processing architecture...
## Key Design Decisions
### Idempotency
All payment operations use idempotency keys to prevent...This is useful when onboarding new team members, preparing for audits, or creating handoff documentation for enterprise customers. The design document captures the intent that is implicit in the code but not written down anywhere.
PRDs and specs for handoffs
Product documentation often needs to be generated from existing implementations, especially when handing off to other teams or creating customer-facing specs.
See the agent's response
Thought for 2s
Createdauthentication.md+156
# Authentication Feature - PRD
## User Stories
### Sign Up
- As a new user, I can sign up with email/password
- As a new user, I can sign up with Google
- As a new user, I receive a verification email
### Sign In
- As a returning user, I can sign in with email/password
- As a returning user, I can request a magic linkThis works well when you need to document what was built for product managers, create Confluence pages for stakeholders, or generate Jira tickets that accurately reflect implementation details. See MCP integrations below for connecting Grok Build to these external systems.
API documentation
See the agent's response
Thought for 2s
Createdopenapi.yaml+425
openapi: 3.0.3
info:
title: E-commerce API
version: 1.0.0
paths:
/api/users:
get:
summary: List usersAPI documentation drifts from implementation faster than almost any other docs. Grok Build can compare your API docs against actual route handlers and flag discrepancies: endpoints that exist but are not documented, documented endpoints that no longer exist, and parameter mismatches.
For internal APIs, this comparison catches breaking changes before they surprise consumers. For external APIs, it ensures your public documentation matches what customers experience.
Keeping documentation current
Documentation drifts from code over time. Grok Build can compare your docs against current implementation and flag what needs updating.
See the agent's response
docs/api/authentication.md - References /api/auth/login but endpoint changed to /api/v2/auth/logindocs/setup.md - Still mentions Node 16, package.json requires Node 18+docs/api/users.md - Missing 3 new endpoints added in last sprintREADME.md - Docker Compose instructions use old service namesdocs/architecture.md - Diagram shows deprecated Worker servicedocs/testing.md - Jest config path changedCONTRIBUTING.md - Branch naming convention outdated/api/webhooks endpointsThe most effective way to keep docs current is to make documentation part of your code review process. Add documentation checks to your Bugbot rules so missing or outdated docs get flagged automatically:
Text
# Documentation checks
When reviewing PRs:
- If public API changes, require API docs update
- If new features are added, require README updates
- Flag outdated code comments that reference changed behavior
- Require JSDoc on new exported functions
This catches documentation debt at the source rather than letting it accumulate.
MCP integrations for documentation workflows
MCP integrations connect Grok Build to external documentation systems. If your team uses Confluence, Notion, or similar tools, you can generate documentation and push it directly to where your team expects to find it.
Browse the Marketplace for integrations with Confluence, Jira, Notion, and other documentation platforms. With these connected, you can:
- Generate a design doc and create a Confluence page in one workflow
- Create Jira tickets from implementation details
- Keep external documentation in sync with code changes
This is especially valuable for enterprise teams where documentation lives outside the repository.
Documentation for compliance and audits
Enterprise customers and regulated industries often require formal documentation of systems: how data flows, what security controls exist, how access is managed.
See the agent's response
Thought for 3s
Createddata-handling.md+178
# Data Handling Documentation
## Personal Data Inventory
| Field | Location | Encrypted | Retention |
|-------|----------|-----------|-----------|
| Email | users.email | No (hashed for lookup) | Account lifetime |
| Password | users.password_hash | Yes (bcrypt) | Account lifetime |
| Name | users.name | No | Account lifetime |Grok Build can trace through your actual implementation to generate documentation that auditors need, grounded in what the code does rather than what a policy document claims it does.
Setting up documentation conventions
Use rules files to ensure consistent documentation across your project.
Create a .cursor/rules/documentation.mdc file:
Text
# Documentation Conventions
## READMEs
- Use sentence case for headings
- Include a "Quick Start" section that gets someone running in 5 minutes
- Code examples should be complete and runnable
## Code comments
- Use JSDoc for all exported functions
- Document "why" not "what" in inline comments
- Don't comment obvious code
## API documentation
- Use OpenAPI 3.0 format
- Include example requests and responses
- Document error responses, not just success cases
Getting started
-
Start with what is missing. Ask Grok Build what documentation your project needs. It will identify gaps based on the code.
-
Generate from code, then edit. The first draft will be accurate but may lack context only you have. Add the "why" that is not obvious from implementation.
-
Set up documentation rules. Specify your conventions so generated docs are consistent.
-
Connect external systems. Use MCP integrations to push documentation to Confluence, Notion, or wherever your team reads docs.
-
Make docs part of code review. Add Bugbot rules so documentation updates are flagged when code changes.
Last updated: November 23, 2026