Document release

From indigoai-us/hq-core · View interactive version

Document release is an AI agent skill from the GitHub repository indigoai-us/hq-core. Update in-repo docs (README, CLAUDE.md, architecture, INDEX) to match what shipped. Use after a merge, project, or release.

How to use this skill

Skill file

Post-Ship Documentation Sync

You are a technical writer performing a post-ship documentation audit. Your job: make every doc reflect what actually shipped — no more, no less.

Critical rules:

Codex/Handoff Mode

Codex /handoff runs this skill in a visible subagent, not through core/scripts/handoff-post.sh or claude -p. In that mode:

Legacy Headless Mode

If $CLAUDE_HEADLESS=1 (legacy detached launchers only), this skill runs non-interactively:

```

PROPOSED ({file}): {one-line summary}


{unified diff or before/after snippet}


```

stdout is captured by the caller; the user reviews next session.

Shell check at the top of the run:

if [[ "${CLAUDE_HEADLESS:-0}" = "1" ]]; then
  echo "[document-release] headless mode — AskUserQuestion disabled, ASK changes will be logged"
fi

Step 0: Company + Project Resolution

Same company anchor pattern as all HQ commands:

  1. Resolve via hq core resolve-company --prompt "{input}" (session bind first, then a whole-token scan of the input — not the first word alone)
  2. If matched: set {co}, load policies
  3. Resolve project: find companies/{co}/projects/{slug}/prd.json or infer from recent git activity

If no project slug provided:

Announce: Documenting release for: {project title} ({co})

Step 1: Diff Analysis

Determine what changed since the project started:

# If project has a known start commit or date
git log --oneline --since="{prd.createdAt}" -- {repo paths}
git diff {start_ref}..HEAD --stat -- {repo paths}

# If no clear start ref, use the PRD creation date
git log --oneline --since="{prd.metadata.createdAt}" -- {repo paths}

Identify and categorize:

Present summary:

Diff analysis:
- Files added: {N}
- Files removed: {N}
- APIs changed: {list}
- New env vars: {list}
- New dependencies: {list}

Step 2: Doc Audit

Scan for all documentation files in scope. For each, classify the update strategy:

| File | Strategy | Rationale |

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

| README.md | ASK | User-facing, voice matters. Present proposed changes for approval |

| CLAUDE.md | AUTO | Machine-consumed, factual accuracy is critical |

| .claude/CLAUDE.md (repo-level) | AUTO | Machine-consumed |

| Architecture docs (docs/*.md, ARCHITECTURE.md) | AUTO | Must match code reality |

| INDEX.md files | AUTO | Structural, regenerable |

| CHANGELOG.md | POLISH ONLY | Never rewrite. Only fix typos, formatting, or broken links in existing entries |

| prd.json status | AUTO | Set to "completed" if all stories done |

| board.json status | AUTO | Set to "completed" |

| API docs (openapi.yaml, route comments) | AUTO | Must match implementation |

| Setup/install guides | ASK | User-facing, may affect onboarding |

For each doc file found:

  1. Read current content
  2. Cross-reference against the diff (Step 1)
  3. Identify stale references (files/functions/APIs that no longer exist)
  4. Identify missing references (new files/functions/APIs not yet documented)
  5. Classify each needed change as AUTO or ASK

Step 3: Apply Updates

AUTO updates (apply directly)

Use Edit tool with exact string matches. Make minimal, targeted edits:

ASK updates (present for approval)

Interactive mode (default): For each user-facing doc change, present via AskUserQuestion:

README.md update needed:

Current: {relevant section}
Proposed: {updated section}

A) Apply this change
B) Skip — I'll update manually
C) Modify — let me adjust the wording

Headless mode ($CLAUDE_HEADLESS=1): Do NOT call AskUserQuestion. Log the proposal to stdout and continue:

PROPOSED (README.md): {one-line summary}
---
--- before
{current snippet}
+++ after
{proposed snippet}
---

Counts as "logged, not applied" in the final report. User addresses these next session.

CHANGELOG rules

Step 4: Cross-Doc Consistency Check

After all updates are applied, verify consistency:

  1. Internal links — grep for [...](path) markdown links, verify targets exist
  2. Code references — grep for backtick-quoted function/file names, verify they still exist in the codebase
  3. Env var references — verify all documented env vars exist in .env.example or equivalent
  4. Import paths — verify documented import examples match actual file locations
  5. Stale examples — flag code examples that reference removed or renamed APIs

For each broken reference:

Consistency issue: {file}:{line}
References: {stale reference}
Current: {what it should be, or "removed"}
Action: {AUTO-FIX / FLAG}

Auto-fix simple renames. Flag removals for user review.

Step 5: Cleanup + Status Sync

Project status updates

If all stories in prd.json are done:

Reindex

qmd update 2>/dev/null || true

Final report

Document release complete: {project title}

Updated:
  AUTO: {N} files ({list})
  ASK:  {N} files ({list})
  SKIPPED: {N} files ({list})

Consistency:
  Links verified: {N}
  Issues found: {N} ({N} auto-fixed, {N} flagged)

Status:
  prd.json: {completed/unchanged}
  board.json: {completed/unchanged}

Rules

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.