AGENT SKILL

drift-detection

Compare implementation diff against task acceptance criteria and ADRs to surface drift. Use when a task is in review state before transitioning to done, when integrating a worktree spanning two or more sessions, during a pre-merge audit when the diff exceeds the task description, or after a sub-agent reports completion.

License 许可
MIT
所属仓库
muratovv/ai-hats
最近更新
2026-11-05
Stars
★ 3
Forks
1

01 前言 Front Matter

name
drift-detection
license
MIT
description
Compare implementation diff against task acceptance criteria and ADRs to surface drift. Use when a task is in review state before transitioning to done, when integrating a worktree spanning two or more sessions, during a pre-merge audit when the diff exceeds the task description, or after a sub-agent reports completion.

03 SKILL.md 正文

Drift Detection

Verify that what was implemented matches what was asked. Surfaces silent scope creep, missing acceptance criteria, and architectural drift before a PR is merged or a long-running worktree is integrated.

When to Use

Compares what was asked vs what was built — the implementation diff against the task's acceptance criteria and ADRs — to catch silent scope creep at review, on long-lived worktrees, or after a sub-agent reports done. Distinct from domain-reviewer, which judges the quality of the code as written; drift-detection asks whether it's the right scope at all. (This is task-vs-impl drift, not IaC config drift.)

Procedure

  1. Extract requirements. Acceptance Criteria from task.yaml, linked ADRs in <ai_hats_dir>/tracker/decisions/, GitHub Issue body, and any updates logged via rack transition --log.
  2. Extract changes. git diff --stat <base>...HEAD — categorize files (source / test / config / doc) and note added vs modified vs deleted.
  3. Semantic matching. For each AC, locate the implementing artifact (function, file, test, doc paragraph) and cite it by path:line. "The diff has it somewhere" is not acceptance.
  4. Drift report. Classify findings: missing (AC without artifact), extra (artifact without AC), mismatch (partial / differing semantics), out-of-scope (unrelated module touched).
  5. Decision. For each finding: (a) update AC with rationale; (b) split into follow-up task; (c) revert the diff segment; (d) accept with explicit waiver in the PR description.

Completion

  • Every AC has either a matching artifact (path:line) or an explicit decision
  • Drift report attached to PR description or task work-log
  • No silent extras — every "extra" is either accepted, deferred, or removed before merge

Example

Task AC: "add pagination to /users endpoint". Diff also modifies /orders and adds a Redis client. Drift report: pagination on /users — users.go:42 ✓ matches; /orders change — out-of-scope, split to follow-up; Redis client — extra, no AC, revert (cache feature was a different ticket).

Anti-Patterns

  • Treating green CI as drift-free — tests pass on extras too
  • Updating AC after the fact to retroactively justify the diff — log the change with reason, do not silently rewrite
  • Reviewing only added lines — deletions and renamed symbols cause the most drift
  • Skipping drift check on "small" PRs — small PRs that touch unexpected files are exactly where drift hides

04 同仓库更多 Skills

muratovv
muratovv/ai-hats

tool-evaluation-protocol

Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.

★ 3
muratovv
muratovv/ai-hats

systematic-debugging

4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.

★ 3
muratovv
muratovv/ai-hats

skill-template

Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.

★ 3
muratovv
muratovv/ai-hats

skill-optimization

Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.

★ 3
muratovv
muratovv/ai-hats

silent-fallback-gate

PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.

★ 3
muratovv
muratovv/ai-hats

retro-to-framework

Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.

★ 3