prevent-doc-drift
Per-PR documentation-drift prevention. When a PR adds new code subsystems, scripts, skills, docs, plugin routes, feature flags, or changes architecture…
от grafana★ 24 звезды на GitHub
Установить prevent-doc-drift в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Prevent doc drift
A per-PR doc-quality skill. It compares the PR diff against agent guidance files and updates them in the same PR so future agents are never working from a stale map.
This skill is paired with .cursor/skills/maintain-docs/:
prevent-doc-drift(this skill) — runs on every PR; catches drift at the moment it's introduced.maintain-docs— runs periodically across the whole repo; catches drift that this skill missed.
Together they form a two-tier defence: the per-PR skill is the primary line, the periodic skill is the safety net.
Hard constraints
These constraints are absolute and override any other instructions:
- Only modify documentation files. Allowed:
AGENTS.md,CLAUDE.md,README.mdat repo root; any*.mdor*.mdcunder.cursor/rules/,.cursor/skills/,.claude/skills/, ordocs/developer/. Forbidden: any source file (.ts,.tsx,.js,.jsx,.go,.json,.css,.html), config files, lockfiles, and any file underdocs/design/(design docs are author-curated by humans via thedesign-reviewskill). - Operate on the PR diff only. Do not audit files outside the diff. If you find drift in a file the PR did not touch, add it to
docs/_maintenance-backlog.mdformaintain-docsto handle — do not silently fix it here. - Never fabricate. Only document features, subsystems, services, scripts, and relationships that the diff actually adds. If you cannot confirm something exists from the diff plus a focused code read, omit it.
- Before staging anything, verify the constraint. Run
git diff --name-onlyafter edits and confirm every changed path is in the allowed list above. Abort if any disallowed file appears. - One commit max. All doc updates land as a single follow-up commit on the same PR branch (or, if invoked from
/review, as a recommended diff block in the review output — see "Operating modes" below). - Do not amend the PR's existing commits. Create a new commit.
- Respect the always-on budget.
AGENTS.mdloads into every agent and is capped bysrc/validation/always-on-context-budget.test.ts. Add at most one line there per change, and only for a rule nearly every task needs. Put detail in the enforcing test's failure message, a skill, ordocs/developer/CONTEXT_INDEX.md.
Operating modes
The skill has two modes:
- Apply mode (default when invoked directly): the working tree is the PR branch. Apply edits, stage, commit with a clear message, push.
- Review mode (invoked from
/review): emit one canonical observation with the proposed patch evidence. Do not modify the working tree. The shared review policy decides its disposition.
Decide which mode applies based on context: if a gh pr command can determine the current branch is a PR branch and the user invoked this skill directly, use apply mode. If the parent is /review, use review mode.
Workflow
Phase 0 — Resolve the diff
- Determine the base ref:
- If on a PR branch:
gh pr view --json baseRefName -q .baseRefName - Otherwise:
git merge-base HEAD main(or whatever the repo's main branch is — checkgit symbolic-ref refs/remotes/origin/HEAD).
- If on a PR branch:
- Capture the diff in three forms — you'll use each:
git diff --name-status <base>...HEAD(status flags A / M / D / R)git diff --stat <base>...HEAD(line counts)git log <base>..HEAD --oneline(commit subjects)
- From
package.json, read the current set of npm scripts:jq -r '.scripts | keys[]' package.json(you'll diff this against the table in AGENTS.md).
If the diff is empty or doc-only, exit cleanly with "no source changes — no drift possible."
Phase 1 — Categorize changes
Walk the name-status output and bucket each path into one of these categories. A single file may land in multiple buckets; that's fine.
| Bucket | Matches (path patterns) |
|---|---|
| New frontend subsystem | New directory at src/<dir>/ (any first commit of a path matching src/<name>/...) |
| New backend file | New file at pkg/**/*.go |
| New developer doc | New file at docs/developer/**/*.md |
| New design doc | New file at docs/design/**/*.md (we index it; we do not edit it) |
| New rule | New file at .cursor/rules/*.mdc or .cursor/rules/*.md |
| New skill | New directory at .cursor/skills/<name>/ (look for new SKILL.md) |
| **New npm sc |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл prevent-doc-drift?
Per-PR documentation-drift prevention. When a PR adds new code subsystems, scripts, skills, docs, plugin routes, feature flags, or changes architecture relationships, this skill produces the AGENTS.md, CLAUDE.md, and .cursor/rules/ updates needed in the same PR so agent guidance never falls behind the code. Use this on /review or directly before merge.
Как установить скилл prevent-doc-drift?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл prevent-doc-drift запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…