docguard-fix
Automates the repair and generation of project documentation by analyzing the actual codebase.
Install
mkdir -p .claude/skills/docguard-fix && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15583" && unzip -o skill.zip -d .claude/skills/docguard-fix && rm skill.zipInstalls to .claude/skills/docguard-fix
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
AI-driven documentation repair with structured research workflow, template-awareKey capabilities
- →Apply mechanical fixes to documentation using docguard-cli.
- →Diagnose current documentation state to identify issues.
- →Prioritize documentation issues by type and impact.
- →Research codebase to gather project-specific content for documentation.
- →Generate or fix document content based on research findings.
- →Validate documentation against DocGuard's guard suite in an iterative loop.
How it works
This skill first applies mechanical fixes, then diagnoses the documentation state, prioritizes issues, and researches the codebase for content. It then generates or fixes document content and iteratively validates it against DocGuard's suite.
Inputs & outputs
When to use docguard-fix
- →Fixing broken documentation
- →Generating API references
- →Validating doc accuracy
- →Automating doc generation
About this skill
DocGuard Fix Skill
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
If user specifies --doc <name>, focus on that single document.
If no arguments, fix ALL issues found by docguard diagnose.
Goal
Research the actual codebase to generate or repair canonical documentation that passes DocGuard's 19-validator guard suite. This skill replaces generic templates with real, project-specific content and iterates until quality checks pass.
Operating Constraints
- NEVER use placeholder content — every section must reference real files, real modules, real dependencies
- ALWAYS back up before overwriting — use
safeWrite()pattern or create.bakfiles - Maximum 3 validation iterations — if still failing after 3 rounds, report remaining issues and stop
- Research before writing — understand the codebase first, then generate documentation
Execution Flow
Step 0: Apply Mechanical Fixes First (no AI needed)
npx docguard-cli fix --write 2>&1
Removes endpoints documented in docs-canonical/API-REFERENCE.md that the OpenAPI
spec confirms no longer exist (table row + detail block). Only edits
docguard:generated docs, idempotent, prints what changed. Don't hand-edit these.
Step 1: Diagnose Current State
Run the diagnostic to identify all issues (each tagged mechanical or agent):
npx docguard-cli diagnose 2>&1
Parse the output to build an issue inventory:
| Issue ID | Severity | Category | File | Description | Autofix? |
|---|---|---|---|---|---|
| I001 | ERROR | Structure | SECURITY.md | Missing file | Yes |
| I002 | WARN | Freshness | ARCHITECTURE.md | 5 commits behind | Yes |
| ... | ... | ... | ... | ... | ... |
If $ARGUMENTS contains --doc <name>, filter to only issues affecting that document.
Step 2: Prioritize Fix Order
Sort issues by fix dependency and impact:
- Structure first (missing files must exist before checking sections)
- Doc Sections second (sections must exist before checking quality)
- Doc-Quality third (readability and language improvements)
- Freshness fourth (update
last-revieweddates) - Metadata-Sync fifth (ensure headers are consistent)
- Everything else last
Step 3: Research the Codebase (Per Document)
For each document that needs fixing, execute a targeted research pass. Research must be thorough — read actual code, not just filenames.
For ARCHITECTURE.md:
- Read
package.jsonfor project name, description, dependencies, scripts - List top-level directory structure (
ls -la, focus onsrc/,lib/,cli/,app/) - Identify entry points — check
main,bin,exportsin package.json - For each major directory, read 2-3 representative files to understand purpose
- Map the import graph — which modules import which
- Identify external dependencies and their roles
For SECURITY.md:
- Check
.gitignorefor security-related patterns (.env, secrets, keys) - Search for auth patterns:
grep -r "auth\|token\|jwt\|session\|password\|secret" src/ lib/ --include="*.js" --include="*.mjs" - Check
package.jsonfor auth dependencies (passport, jwt, bcrypt) - Look for middleware, guards, or permission checks
- Check for
.envfiles (document variable names only, NEVER values) - Look for CORS, rate limiting, input validation
For TEST-SPEC.md:
- Read
package.jsonscripts for test commands - Find test files:
find . -name "*.test.*" -o -name "*.spec.*" | head -20 - Read test configuration (jest.config, vitest.config, etc.)
- Read 2-3 test files to understand patterns
- Check for E2E setup (playwright, cypress)
- Look for CI config that runs tests
For DATA-MODEL.md:
- Search for schema definitions:
grep -r "Schema\|model\|Table\|Entity\|interface\|type " src/ lib/ - Check for ORM configs (prisma, sequelize, mongoose, drizzle)
- Look for migration files
- Check for TypeScript interfaces/types defining data shapes
- Look for Zod schemas, JSON schemas, validation files
- If no database: document config file formats
For ENVIRONMENT.md:
- Read
package.jsonfor engines, scripts, dependencies - Check for
.nvmrc,.node-version,.tool-versions - Search for
process.envusage:grep -r "process.env" src/ lib/ cli/ - Check for
.env.exampleor.env.template - Check for Docker/docker-compose files
- Look for setup scripts
Step 4: Generate or Fix Document Content
For each document, follow this strict writing protocol:
-
Load the metadata header template:
# [Document Title] <!-- docguard:version X.X.X --> <!-- docguard:status active --> <!-- docguard:last-reviewed YYYY-MM-DD --> -
Write each mandatory section using research findings:
- Use actual file paths, module names, and dependency names
- Use markdown tables for structured data (fields, types, constraints)
- Use code blocks for command examples (with actual working commands)
- Keep language positive (avoid negation — "MUST use" not "MUST NOT avoid")
- Write at Flesch-Kincaid grade level 8-10 (clear, professional, not academic)
-
Validate mandatory sections exist. Each canonical doc requires:
- ARCHITECTURE.md: System Overview, Component Map, Layer Boundaries, Data Flow, Technology Choices
- SECURITY.md: Auth Mechanism, Secrets Inventory, Secrets Storage, Permissions, Security Boundaries
- TEST-SPEC.md: Test Framework, Test Structure, Test Commands, Critical Flows, Coverage
- DATA-MODEL.md: Data Structures/Schemas, Field Types/Constraints, Relationships, Indexes
- ENVIRONMENT.md: Prerequisites, Setup Steps, Environment Variables
- REQUIREMENTS.md: Functional Requirements (FR-IDs), Non-Functional Requirements
-
Apply DocGuard quality rules:
- Section count ≥ 3 per document
- No TODO/placeholder text in final output
- Positive language (IEEE 830 §4.3 compliance)
- Each section has substantive content (not just a heading)
Step 5: Format Compliance
Ensure every generated document follows CDD format rules:
- Metadata header: Must include
docguard:version,docguard:status,docguard:last-reviewed - Heading hierarchy: Single
# H1, then## H2sections, then### H3subsections - Tables: Use markdown tables for structured data (pipes aligned, header separators with 3+ dashes)
- Code blocks: Use fenced blocks with language identifier for all commands/code
- Line length: Keep lines under 120 characters for readability
- No trailing whitespace
Step 6: Validation Loop (Max 3 Iterations)
After writing/fixing each document:
-
Run guard on the specific validator:
npx docguard-cli guard 2>&1 -
Parse results for the affected validators
-
If still failing:
- Identify exactly which checks are still failing
- Apply targeted fixes (not a full rewrite)
- Re-run guard
-
If passing after iteration: Move to next document
-
If still failing after 3 iterations: Report remaining issues with specific error details
Step 7: Completion Report
After all fixes are applied, output:
## DocGuard Fix Report
### Documents Fixed
| Document | Action | Checks Before | Checks After | Status |
|----------|--------|:------------:|:------------:|--------|
| SECURITY.md | Created | 0/2 | 2/2 | ✅ |
| ARCHITECTURE.md | Updated sections | 6/8 | 8/8 | ✅ |
### Guard Score
- **Before**: [X]/[Y] checks passed
- **After**: [X]/[Y] checks passed
- **Improvement**: +[N] checks
### Remaining Issues (if any)
- [Issue description] — [Why it couldn't be auto-fixed]
### Suggested Next Steps
- Run `/docguard.guard` to verify full compliance
- Review generated content for accuracy
- Commit with: `docs: fix CDD documentation [list of docs fixed]`
Behavior Rules
- Research FIRST, write SECOND — never generate content without reading the codebase
- Be specific to THIS project — don't add generic boilerplate for features the project doesn't have
- Back up before overwriting — if file exists, create
.bakfirst or usesafeWrite() - Respect existing content — when updating, preserve user-written sections and only add/fix missing parts
- Log deviations — if you deviate from canonical expectations, add
// DRIFT: reasonin DRIFT-LOG.md - Never include secrets — document variable/secret NAMES only, never actual values
Integration with Spec Kit
If .specify/ directory exists:
- Check
constitution.mdfor project principles before generating docs - Align documentation language with constitutional requirements
- If
specs/*/spec.mdexists, cross-reference requirements with TEST-SPEC.md
Context
$ARGUMENTS
When not to use it
- →When the user does not want to fix or generate documentation.
- →When the user does not want to use DocGuard validation.
- →When the user wants to use placeholder content.
Prerequisites
Limitations
- →The skill must never use placeholder content.
- →It must always back up before overwriting files.
- →It has a maximum of 3 validation iterations before reporting remaining issues.
How it compares
This skill provides a structured, iterative workflow for documentation repair and generation, directly integrating with a validation tool and researching the actual codebase, unlike manual documentation efforts.
Compared to similar skills
docguard-fix side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| docguard-fix (this skill) | 0 | 1mo | Review | Advanced |
| documentation-review | 11 | 5mo | No flags | Beginner |
| docs-review | 10 | 8mo | No flags | Beginner |
| workthrough | 10 | 9mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
documentation-review
stacklok
Reviews documentation for factual accuracy
docs-review
metabase
Review documentation changes for compliance with the Metabase writing style guide. Use when reviewing pull requests, files, or diffs containing documentation markdown files.
workthrough
bear2u
Automatically document all development work and code modifications in a structured workthrough format. Use this skill after completing any development task, bug fix, feature implementation, or code refactoring to create comprehensive documentation.
claude-md-improver
anthropics
Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project memory optimization".
anti-slop
rand
Comprehensive toolkit for detecting and eliminating "AI slop" - generic, low-quality AI-generated patterns in natural language, code, and design. Use when reviewing or improving content quality, preventing generic AI patterns, cleaning up existing content, or enforcing quality standards in writing, code, or design work.
agent-md-refactor
davila7
Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.