Run when you have a docs analysis artifact and want to generate or update documentation structure and content. Creates a branch, applies approved changes, and optionally opens a PR.
Generate or update documentation files from a docs analysis artifact, with explicit approval and branch-based workflow.
.oat/repo/analysis/.oat-docs-analyze first.jq available in PATH for tracking updates.gh available if a PR should be opened automatically.OAT MODE: Docs Apply
Purpose: Apply approved documentation changes derived from a docs analysis artifact.
BLOCKED Activities:
ALLOWED Activities:
mkdocs.yml when approved.oat docs nav sync after approved structural changes.Treat the docs analysis artifact as the source of truth for what should be changed and why.
Apply may:
Apply must not:
Self-Correction Protocol: If you catch yourself:
oat docs nav sync should be used -> STOP and switch to the CLI helper.Recovery:
When executing this skill, provide lightweight progress feedback so the user can tell what’s happening.
Print a phase banner once at start:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ OAT ▸ DOCS APPLY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Use step indicators:
[1/7] Loading analysis artifact…[2/7] Building recommendation plan…[3/7] Reviewing approvals…[4/7] Creating branch…[5/7] Applying docs changes…[6/7] Running nav sync + verification…[7/7] Committing, tracking, and summary…Locate the most recent docs analysis artifact:
ls -t .oat/repo/analysis/docs-*.md 2>/dev/null | head -1
If none exists, stop and instruct the user to run oat-docs-analyze.
Validate that each recommendation in the artifact includes:
link_onlyIf the artifact is missing that detail, stop and tell the user to re-run oat-docs-analyze.
Read the analysis artifact and build the plan from its recommendations. Do not rediscover conventions from scratch during this step.
Common docs actions:
index.md## Contentsoverview.md usage to the index.md contractdocs/contributing.md plugin guidanceoat docs nav sync after approved structural changesCarry forward the artifact's evidence refs, confidence, disclosure mode, and link targets into the apply plan.
Coverage-gap recommendations may also be:
omitask_userIf evidence is missing, stale, or contradicts the current docs tree, stop and ask for a fresh analysis instead of guessing.
Use references/apply-plan-template.md and preserve the exact presented markdown as APPLY_PLAN_MARKDOWN for commit/PR summary use.
Present the full recommendation plan first, then ask which review mode they want:
apply allapply interactivelydiscussFor review-mode and follow-up decisions, use host-aware prompting:
AskUserQuestionIf the user chooses apply all:
If the user chooses apply interactively, ask for each recommendation:
approvemodifyskipIf the user chooses discuss, answer questions, revise the plan if needed, and then ask again:
apply allapply interactivelydiscussIf all recommendations are skipped, stop without changing files.
Build an APPLIED_PLAN_DETAILS block from approved or modified recommendations with:
approved_via_apply_all / approved / modified)After approvals:
TIMESTAMP=$(date -u +"%Y-%m-%d-%H%M")
BRANCH="oat/docs-${TIMESTAMP}"
git checkout -b "$BRANCH"
If branch creation fails because of unrelated local changes, ask the user to resolve that state before continuing.
For each approved recommendation:
inline -> keep the essential guidance in the target pagelink_only -> add a concise pointer to the canonical doc/config/exampleomit -> do not encode the item in the docs changeask_user -> require explicit user confirmation before writingWhen approved actions involve docs app creation or nav updates:
oat docs init for scaffolding when appropriate.oat docs nav sync instead of manually editing nav when the CLI helper can generate it.Negative rules:
link_only.Run the smallest relevant verification set based on what changed:
oat docs nav syncpnpm --dir <docs-app> docs:lint (no-op when no linter is configured)pnpm --dir <docs-app> docs:format:checkpnpm --dir <docs-app> docs:buildIf no docs app exists yet, use file-level verification and confirm the structural contract manually in the summary.
Commit the approved changes:
git add {approved-files}
git commit -m "docs: apply approved docs recommendations"
Offer to open a PR:
After committing, proactively ask the user if they'd like to open a pull request. Frame this as the recommended next step:
Changes committed. Would you like me to push and open a pull request?
The PR will include the applied plan summary and the full analysis artifact for reference.
For the PR-choice prompt, use host-aware prompting:
AskUserQuestionIf creating PR:
git push -u origin "$(git rev-parse --abbrev-ref HEAD)"
gh pr create --base main \
--title "docs: apply approved docs recommendations" \
--body "$(cat <<'PRBODY'
## Summary
- Applied docs recommendations from analysis artifact
- Source: {analysis-artifact-path}
- Result: {N} created, {N} updated, {N} skipped
## Applied Plan
{APPLY_PLAN_MARKDOWN}
## Verification
- {commands run and results}
---
## Full Analysis Artifact
The complete analysis that produced these recommendations is included below for reviewer reference.
<details>
<summary>Click to expand full analysis</summary>
{full contents of the analysis artifact markdown file}
</details>
PRBODY
)"
If gh is not available or fails:
PR creation failed. To create manually:
1. Push: git push -u origin {branch}
2. Open PR at your repository's web interface
3. Use the structure above in the PR body, including the full analysis in a collapsible section
Update shared tracking:
TRACKING_SCRIPT=".oat/scripts/resolve-tracking.sh"
ROOT_TARGET=$(bash "$TRACKING_SCRIPT" root)
ROOT_HASH=$(echo "$ROOT_TARGET" | jq -r '.commitHash')
ROOT_BRANCH=$(echo "$ROOT_TARGET" | jq -r '.baseBranch')
bash "$TRACKING_SCRIPT" write \
docsApply \
"$ROOT_HASH" \
"$ROOT_BRANCH" \
"apply"
Output:
Apply complete.
Files created: {N}
Files updated: {N}
Files skipped: {N}
Docs target: {path}
Verification: {commands run}
Next step: Re-run oat-docs-analyze if you want a post-apply verification artifact.
references/apply-plan-template.md.oat/scripts/resolve-tracking.sh