AgentSkillsCN

drift

扫描整个代码库,排查偏差——包括违反黄金法则、陈旧的工作树、卡住的任务,以及孤立的目录。

SKILL.md
--- frontmatter
name: drift
description: Scan the full codebase for drift — golden rule violations, stale worktrees, stuck tasks, and orphaned directories.
allowed-tools: Read, Glob, Grep, Bash, TodoWrite
model: sonnet

/drift — Codebase Drift Detection

Run python3 scripts/detect-drift.py and report results to the user.

What It Checks

  1. Golden rule violations — file size, function length, magic numbers, print(), TODO without issue, import boundaries (reuses pre-commit hook scripts on the full repo)
  2. Stale worktrees — git worktrees with no commits in >7 days
  3. Stuck state filestasks/*/state.json stuck in a stage for >24 hours
  4. Orphaned task directoriestasks/*/ dirs with no matching task/* branch

Steps

  1. Run: python3 scripts/detect-drift.py
  2. Parse the stdout output (format: filepath:line: message)
  3. Report to the user:
    • Summary count by category
    • Each violation with file path and line number
    • Path to the markdown report in tasks/_drift/
  4. Suggest fixes but do NOT auto-fix without user approval

Suppression

  • Inline: # drift:ignore on a line skips it
  • File-level: .drift-ignore at repo root with gitignore-style patterns

Exit Codes

  • 0 = clean, no violations
  • 1 = violations found
  • 2 = configuration error