API Docs Sync
Automatically synchronizes API documentation with the codebase to ensure no drift occurs between implementation and documented interfaces. This loop detects discrepancies, generates necessary updates, and applies them while respecting guardrails to maintain consistency and quality.
Goal
Keep API docs current
How to Run
Run this loop to automatically detect and resolve documentation drift in your API specs.
- 01
Prepare Environment
Ensure your project has a 'docs diff' command available that can identify discrepancies between code and documentation.
- 02
Initiate Loop
Use the kickoff prompt to start the loop agent in your preferred IDE or CLI tool.
- 03
Review & Approve
Monitor each iteration. The agent will propose changes; approve or adjust as needed until exit condition is met.
Workflow Steps
- 01
Detect Documentation Drift
Run 'docs diff' to identify any mismatches between code and current documentation.
- 02
Generate Update Plan
Based on detected drift, create a plan to update affected documentation sections.
- 03
Apply Proposed Changes
Present changes to the user for approval and apply them to the documentation files.
- 04
Recheck for Drift
After applying changes, re-run the check command to confirm resolution or further action.
Kickoff Prompt
Start the "API Docs Sync" loop. Goal: Keep API docs current Max iterations: 10 Between iterations run: docs diff Exit when: No documentation drift Please synchronize the API documentation with the current codebase state. Use the 'docs diff' command to detect any discrepancies between the implemented endpoints and their corresponding documentation. For each detected drift, generate the necessary updates to bring the docs in line with the code, ensuring all changes are non-destructive and preserve existing context. Once you've applied the updates, recheck using 'docs diff'. Continue this process until there's no remaining drift, up to 10 iterations. Self-pace this loop. After each iteration, run `docs diff` and evaluate the output, and only continue if the exit condition is not met (No documentation drift). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Only modify documentation files, never source code
- ·Preserve existing comments and annotations during updates
- ·Require explicit user approval before applying changes
- ·Detect conflicting changes and flag for manual resolution
- ·Limit modifications to within project scope and known endpoints
Flow Diagram
Related loops — Docs
Docs
Changelog Generator
Automatically generates and maintains a project's CHANGELOG.md file by analyzing code changes, commits, or version control history to produce structured release notes.
Docs
Example Coverage Builder
Automatically identifies areas in your codebase lacking usage examples and iteratively adds them to improve documentation coverage. The agent focuses on generating practical, copy-paste-friendly examples for functions, methods, and components that currently lack adequate documentation.
Docs
Docs Until Complete
This loop identifies and documents all missing features in a codebase to achieve full documentation coverage. It systematically audits the existing documentation, finds gaps, and fills them with appropriate documentation until the audit passes.