From harness-claude
Syncs AGENTS.md, API docs, and architecture docs with code changes via git diff after features, bug fixes, or refactors.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.
Detects documentation drift from code using harness check-docs, cleanup, git diff, and graph queries. Run after features, refactoring, code reviews, or periodically.
Implements two-phase workflow to analyze code changes via git diff and update project documentation. Use before merging branches, after features/bugfixes, or when docs stale.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.
on_post_feature or on_post_merge triggers fireRun git diff against the appropriate baseline. Choose the baseline based on context:
git diff main...HEAD)Extract the list of changed files. For each changed file, note:
Run harness check-docs to identify any documentation that already has broken references due to the changes.
When a knowledge graph exists at .harness/graph/, use graph queries for faster, more accurate context:
query_graph — find documents edges pointing to nodes changed in this diffget_impact — auto-suggest which docs need updating after code changesReplaces manual doc-to-code correlation. Fall back to file-based commands if no graph is available.
When invoked by harness-docs-pipeline, check for a pipeline field in .harness/handoff.json:
pipeline field exists: read DocPipelineContext from it
pipeline.driftFindings to know which fixes to apply (pre-classified by safety)pipeline.fixBatch is set, apply only those specific fixes rather than running full detectionDocFix[] back to pipeline.fixesAppliedpipeline field does not exist: behave exactly as today (standalone mode)No changes to the skill's interface or output format — the pipeline field is purely additive.
For each changed file, identify all documentation that references it:
AGENTS.md sections:
API documentation:
Architecture documentation:
Inline code comments:
For each affected documentation location:
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.
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.
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.
Add new sections when needed. If a new module was added, draft a complete documentation section following the existing AGENTS.md structure and style.
Run harness check-docs to verify all links and references resolve correctly after the updates.
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.
Verify no orphaned references remain. Search documentation files for any remaining references to old names, old paths, or deleted features.
Run harness fix-drift to catch any remaining simple drift issues that manual review missed.
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.
harness check-docs — Run before and after updates. Identifies broken references and validates that all documentation links resolve.harness fix-drift — Auto-fix simple drift issues (broken file paths, renamed references) after manual review confirms correctness.harness fix-drift --json — Machine-readable output for tracking what was auto-fixed.harness validate — Run after documentation changes to verify overall project health is maintained.harness check-docs passes with zero errors after documentation updates| 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. |
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"
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"
harness check-docs for automated detection. For manual analysis, search all .md files and code comments for the old name/path. If the change is large, use detect-doc-drift first to get a complete inventory.