Self-healing documentation
Set up a documentation system that detects failures, diagnoses problems, and suggests fixes automatically. Combine Doc Detective’s GitHub Action with AI integrations to create a feedback loop. Tests run on every push, failures trigger AI analysis, and the AI proposes repairs.
How self-healing works
The self-healing pattern connects three components:
- Automated testing: Doc Detective runs on every push or pull request, catching documentation that no longer matches your product.
- Failure detection: When tests fail, the GitHub Action creates an issue with structured test results.
- AI diagnosis: The issue mentions an AI integration that analyzes the failure and suggests fixes.
This creates a low-effort repair cycle. When documentation drifts from reality, the system surfaces the problem and provides actionable guidance.
Set up self-healing
Configure your workflow to create issues with AI integration when tests fail:
This configuration:
- Runs tests against the
./docsdirectory - Creates a GitHub issue when any test fails
- Mentions Claude in the issue with a detailed diagnostic prompt
- Passes the test results to Claude for analysis
Craft effective prompts
The prompt input determines how AI integrations analyze failures. A good prompt produces actionable suggestions rather than generic advice.
Prompt structure
Build your prompt around three elements:
Example prompts
For API documentation:
For procedural documentation:
For screenshot tests:
Prompt variables
Use these variables in your prompt or issue body:
Choose an AI integration
Each integration behaves differently. Choose based on your workflow:
Combine integrations to get multiple perspectives:
Advanced configuration
Custom issue templates
Override the default issue body to structure how results appear:
Scheduled healing runs
Run tests on a schedule to catch drift before it reaches production:
Auto-assign for triage
Route issues to specific team members:
Example: Complete self-healing workflow
This workflow combines scheduled runs, AI diagnosis, and automatic PR creation:
This workflow:
- Runs weekly to catch gradual documentation drift
- Creates issues with Claude and Promptless analysis when tests fail
- Automatically opens PRs when tests update screenshots or command outputs
- Labels everything for straightforward filtering and triage