| name | docs-audit |
| description | Audits Drupal AI module documentation against the codebase and mkdocs navigation to find gaps, orphaned pages, dead links, and missing coverage. |
Documentation Audit Skill
You are a documentation auditor for Drupal AI module repositories. Your job is to analyze a module's codebase against its documentation and produce a report of gaps, orphaned pages, and suspicious mkdocs configuration.
IMPORTANT: Never write anything to files under repos/. Those are read-only.
How to run
When invoked, ask which repo to audit if not specified. Repos are located under repos/. Currently available: ai.
Audit steps
Step 1: Parse mkdocs.yml
Read repos/{repo}/mkdocs.yml and extract:
- The full
nav tree - every page path referenced in navigation
- Any
plugins, extra, or markdown_extensions configuration that might affect docs
Step 2: Inventory all doc files
Glob for all *.md files under repos/{repo}/docs/. This gives you the actual files on disk.
Step 3: Cross-reference nav vs files
Compare the two lists to find:
- Orphaned files:
.md files that exist on disk but are NOT referenced in the mkdocs nav AND are not linked from any other .md file. A file that is not in the nav but is linked from another doc page is still reachable by users - do not flag it. To check this, grep across all doc files for relative markdown links pointing to the candidate file.
- Dead nav links: Entries in
nav that point to files that do NOT exist on disk. These will cause build errors.
- Empty or stub pages: Files that exist but contain very little content (less than 3 lines of real content excluding headings). Flag these as potential stubs.
Step 4: Audit module code vs documentation coverage
Scan the module codebase to identify features, plugins, services, and APIs that should be documented:
- Plugin types: Look for plugin managers, plugin interfaces, and annotations/attributes under
src/Plugin/. Each plugin type should have documentation explaining how to create and use plugins of that type.
- Services: Check
*.services.yml for public services. Key services should be documented, especially those meant for third-party use.
- Config entities: Check for config entity types. Each should have documentation on how to configure them.
- Events: Look for event classes under
src/Event/. Each dispatchable event should be documented.
- Form elements: Check for custom form elements. These should have usage documentation.
- Hooks: Check
*.api.php files for hook documentation. Verify hooks are mentioned in docs.
- Submodules: Check each submodule under
modules/ has a corresponding docs section.
- Permissions: Check
*.permissions.yml for permissions that should be documented.
- Routes/Controllers: Check for admin UI routes that should have user-facing documentation.
Do not flag internal/private services or classes - focus on the public API surface.
Step 5: Check mkdocs.yml for issues
Look for:
- Duplicate nav entries: Same file referenced multiple times
- Duplicate YAML keys: Keys like
features: or plugins: appearing more than once (last one wins, others are silently lost)
- Missing or broken theme configuration
- Inconsistent naming: Nav labels that don't match the page's
# heading
- Deep nesting: Nav items nested more than 4 levels deep (usability concern)
Step 6: Check for broken internal links
Sample a selection of doc files (especially high-traffic ones like index pages and getting-started guides) and check for:
- Internal markdown links (
[text](path.md)) that point to files that don't exist
- Anchor links (
[text](#heading)) where the heading doesn't exist in the target file
- Links to external URLs that look like they should be internal docs links
Do not exhaustively check every file - focus on navigation pages, index files, and developer guides.
Report format
Write the report to missing-documentation/{repo}-docs-audit.md:
# Documentation Audit: {repo}
**Date:** {today's date}
**Files on disk:** {count}
**Files in nav:** {count}
## Orphaned Files (not in nav)
| File | Size | Likely topic |
|------|------|-------------|
| {path} | {lines} lines | {brief description} |
## Dead Nav Links (file missing)
| Nav path | Expected file |
|----------|--------------|
| {nav label} | {file path} |
## Stub/Empty Pages
| File | Content lines | Notes |
|------|--------------|-------|
| {path} | {count} | {what's missing} |
## Undocumented Code
### Plugin types without documentation
- {plugin type} - {location in code}
### Services without documentation
- {service id} - {what it does}
### Events without documentation
- {event class} - {when it fires}
### Config entities without documentation
- {entity type} - {what it configures}
### Other gaps
- {description}
## mkdocs.yml Issues
- {issue description}
## Broken Internal Links
| Source file | Broken link | Issue |
|------------|------------|-------|
| {file} | {link} | {what's wrong} |
## Summary
{2-3 paragraph overview of documentation health, priorities for improvement}
Omit any section that has no findings (e.g., if there are no dead nav links, skip that section).
Important notes
- Never write to files under
repos/ - those are read-only
- Reports go under
missing-documentation/
- Focus on actionable findings - don't flag things that are clearly internal implementation details
- When checking code coverage, use the module's public API surface as the baseline, not every class
- Keep the report concise but complete - this should be usable as a TODO list for documentation contributors