Align documentation

From Intense-Visions/harness-engineering · View interactive version

Align documentation is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.

How to use this skill

Skill file

Align Documentation

Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.

When to Use

Process

Phase 1: Detect — Identify What Changed

  1. Run git diff against the appropriate baseline. Choose the baseline based on context:
  1. Extract the list of changed files. For each changed file, note:
  1. Run harness check-docs to identify any documentation that already has broken references due to the changes.

Graph-Enhanced Context (when available)

When a knowledge graph exists at .harness/graph/, use graph queries for faster, more accurate context:

Replaces manual doc-to-code correlation. Fall back to file-based commands if no graph is available.

Pipeline Context (when orchestrated)

When invoked by harness-docs-pipeline, check for a pipeline field in .harness/handoff.json:

No changes to the skill's interface or output format — the pipeline field is purely additive.

Phase 2: Map — Connect Code Changes to Documentation

For each changed file, identify all documentation that references it:

AGENTS.md sections:

API documentation:

Architecture documentation:

Inline code comments:

Phase 3: Generate — Draft Documentation Updates

For each affected documentation location:

  1. Draft the specific text change. Show the old text and the new text. Keep the existing style and tone — documentation updates should be invisible in terms of voice.
  1. Preserve context. When updating a section, do not just change the specific reference — read the surrounding paragraph and ensure it still makes sense. A renamed function may require updating the explanatory text around it, not just the function name.
  1. Handle deletions carefully. When code is deleted, do not just delete the documentation reference. Consider whether the section should be removed entirely, replaced with information about the replacement, or noted as deprecated.
  1. Add new sections when needed. If a new module was added, draft a complete documentation section following the existing AGENTS.md structure and style.

Phase 4: Validate — Verify Documentation Accuracy

  1. Run harness check-docs to verify all links and references resolve correctly after the updates.
  1. Cross-check each update against the actual code. Read the updated documentation and verify every claim by looking at the code. Documentation that is wrong is worse than documentation that is missing.
  1. Verify no orphaned references remain. Search documentation files for any remaining references to old names, old paths, or deleted features.
  1. Run harness fix-drift to catch any remaining simple drift issues that manual review missed.

Graph Refresh

If a knowledge graph exists at .harness/graph/, refresh it after code changes to keep graph queries accurate:

harness scan [path]

Skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.

  1. Commit the documentation update. Use a commit message that references the original change: "docs: update AGENTS.md for notification service refactoring" or "docs: sync API docs after auth module rename."

What to Update

AGENTS.md Knowledge Map

Inline Code Comments

Documentation Pages (docs/)

Harness Integration

Success Criteria

Rationalizations to Reject

| Rationalization | Why It Is Wrong |

| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |

| "The code change is small, so docs probably do not need updating" | A single function signature change changes the contract for every consumer. Map every code change to its documentation impact regardless of diff size. |

| "I updated the main reference -- the other mentions can wait" | Orphaned references in AGENTS.md and tutorials actively mislead agents and developers. Phase 4 requires verifying no orphaned references remain. |

| "I will match the new documentation to what I think the code does" | Phase 4 requires cross-checking each update against the actual code. Documentation that is wrong is worse than documentation that is missing. |

| "The existing doc style is inconsistent, so I will improve it while aligning" | Follow the existing style. Documentation alignment is about accuracy, not style improvement. Style changes should be a separate effort. |

Examples

Example: Syncing docs after a module rename

Code change: src/services/mailer.ts renamed to src/services/email-service.ts. Functions sendMail() and formatMailBody() renamed to sendEmail() and formatEmailBody().

Documentation impact map:

AGENTS.md:34      — "mailer.ts handles email delivery" → update path and description
AGENTS.md:78      — "Use sendMail() for all outbound email" → update function name
docs/api.md:156   — sendMail() API reference → update name and import path
docs/arch.md:45   — architecture diagram lists "mailer" → update to "email-service"
src/controllers/user-controller.ts:12 — comment "// delegates to mailer" → update

Updates applied:

Validation: harness check-docs passes. All references resolve. Commit: "docs: sync documentation after mailer rename to email-service"

Example: Syncing docs after adding error handling

Code change: createUser() in src/services/user-service.ts now throws ValidationError instead of returning null on invalid input.

Documentation impact map:

docs/api.md:89    — "Returns null if validation fails" → update to describe thrown error
AGENTS.md:52      — No mention of error handling → add note about ValidationError
src/services/user-service.ts:15 — JSDoc @returns tag → update, add @throws tag

Updates applied:

Validation: harness check-docs passes. Commit: "docs: update documentation for createUser error handling change"

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.