agentleFS
dkpapadopoulosdkpapadopoulos/auto-claude-skills/skills/implementation-drift-check/SKILL.md

implementation-drift-check

Skill6 starsChanged 51 days agoMITView on GitHub

Use when verifying an implementation still matches its spec or plan — during REVIEW or SHIP, or on demand to check drift, confirm you are still on plan, or run a spec check — surfacing spec deviations, unvalidated assumptions, and untested code paths against Intent Truth

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 11 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Mode selection is LLM-evaluated: When the hook emits the entry (artifacts exist), this SKILL.md guides mode selection:

    line 38
  2. Distinctive:

    Assumptions-only mode: No spec/plan artifacts exist (e.g., explicit invocation during implementation without a written spec), or only eval …

    line 41
  3. Distinctive:

    Read in priority order using canonical retrieval precedence.

    line 45
  4. Distinctive:

    After gathering, select mode:

    line 100
  5. Distinctive:

    If any spec or plan artifact was found (Priority 1-5): use full drift mode (Steps 2 + 3 + 4 + 5).

    line 102
  6. Distinctive:

    If only eval packs or nothing was found: use assumptions-only mode (Steps 3 + 4 + 5, skip Step 2).

    line 103
  7. Distinctive:

    When comparison material exists, run git diff against the relevant base (main branch or last reviewed commit) and cross-reference against …

    line 107
  8. Distinctive:

    Before the model-judged Plan Alignment below, run the owned deterministic check (advisory.

    line 122
  9. Very specific:

    Use the newest matching plan from the comparison material gathered in Step 1 (e.g.

    line 129
  10. Distinctive:

    If code review findings were addressed (check for review-round commits or explicit review feedback in conversation), identify whether fixes …

    line 154
  11. Very specific:

    If eval packs exist in tests/fixtures/evals/*.json, identify:

    line 181
  12. Distinctive:

    Always emit the report to terminal.

    line 245
  13. Very specific:

    When drift is found (any modified-from-spec, added-without-spec, specified-not-implemented, modified-from-plan, added-without-plan, …

    line 249
  14. Distinctive:

    If the document already has a "Post-Implementation Notes" section, append to it rather than creating a duplicate.

    line 265
  15. Distinctive:

    Before reporting "no drift", confirm:

    line 269

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Implementation Drift Check

Detect spec drift, surface unvalidated assumptions, and identify coverage gaps by comparing the current implementation against its Intent Truth (specs, plans, eval packs).

When to Use

  • Auto-co-selection (REVIEW + SHIP): Fires automatically during REVIEW phase (parallel) and SHIP phase (sequential) when comparison material exists.
  • Explicit invocation (IMPLEMENT): Invoke directly during implementation with prompts like "check drift", "am I still on plan", "spec check". When no comparison material exists, degrades to assumptions-only mode.

Comparison Sources (any of these triggers auto-fire)

  • openspec/changes/<feature>/specs/ (active OpenSpec change)
  • docs/plans/*-design.md, docs/plans/*-plan.md, docs/plans/*-spec.md (canonical live intent)
  • openspec/specs/<capability>/spec.md (post-ship canonical)
  • docs/superpowers/specs/*-design.md, docs/superpowers/plans/*.md (legacy fallback)
  • tests/fixtures/evals/*.json (eval pack scenarios)

Auto-Co-Selection Guard

The hook enforces an artifact-presence gate mechanically before this skill is emitted into the composition chain. This is a cheap filesystem glob check (~5ms) in the post-jq Bash filter. If no artifacts match, the composition entry is suppressed -- the LLM never sees it.

Glob patterns checked (canonical first, legacy fallback):

  1. openspec/changes/*/ (any active OpenSpec change)
  2. docs/plans/*-design.md (canonical design artifact)
  3. docs/plans/*-plan.md (canonical plan artifact)
  4. docs/plans/*-spec.md (canonical spec artifact)
  5. openspec/specs/*/spec.md (any canonical spec)
  6. docs/superpowers/specs/*-design.md (legacy design spec)
  7. docs/superpowers/plans/*.md (legacy plan)
  8. tests/fixtures/evals/*.json (any eval pack)

Mode selection is LLM-evaluated. When the hook emits the entry (artifacts exist), this SKILL.md guides mode selection:

  • Full drift mode: At least one spec or plan artifact is available for cross-referencing against the implementation diff.
  • Assumptions-only mode: No spec/plan artifacts exist (e.g., explicit invocation during implementation without a written spec), or only eval packs are available. Degrades gracefully to surfacing assumptions and gaps without drift analysis.

Step 1: Gather Comparison Material

Read in priority order using canonical retrieval precedence. Stop reading duplicates -- if a source was already consumed at a higher priority level, skip it.

Priority 1: Active OpenSpec Changes (highest authority)

openspec/changes/<feature>/specs/

Active work-in-progress specs from OpenSpec. These represent the most current intent and override all other sources when present.

Priority 2: Canonical Live Intent

docs/plans/*-design.md
docs/plans/*-plan.md
docs/plans/*-spec.md

The canonical location for live design documents, implementation plans, and specifications. These are the primary Intent Truth for features that have not yet shipped.

Priority 3: OpenSpec Canonical Specs (post-ship)

openspec/specs/<capability>/spec.md

Post-ship authoritative specifications. These represent the as-built state of shipped capabilities and serve as the baseline for incremental work.

Priority 4: Archived Intent (optional)

docs/plans/archive/

Shipped intent history. Not required for drift analysis, but useful for understanding the evolution of a feature when the current implementation diverges from original intent.

Priority 5: Legacy Superpowers (deprecated fallback)

docs/superpowers/specs/*-design.md
docs/superpowers/plans/*.md

Legacy location for design specs and plans. These paths are deprecated in favor of docs/plans/ but are checked as a fallback for older features that have not been migrated.

Priority 6: Eval Pack Scenarios

tests/fixtures/evals/*.json

Behavioral eval packs committed as test fixtures. These define example-based behavioral expectations and are cross-referenced for coverage gaps in both modes.

Determine Mode

After gathering, select mode:

  • If any spec or plan artifact was found (Priority 1-5): use full drift mode (Steps 2 + 3 + 4 + 5).
  • If only eval packs or nothing was found: use assumptions-only mode (Steps 3 + 4 + 5, skip Step 2).

Step 2: Analyze Drift (Full Mode)

When comparison material exists, run git diff against the relevant base (main branch or last reviewed commit) and cross-reference against gathered material across three drift dimensions.

Spec Alignment

For each requirement or acceptance scenario found in specs, check whether the implementation addresses it.

FlagMeaning
implemented-as-specifiedImplementation matches the spec requirement
modified-from-specImplementation addresses the requirement but differs from spec (include evidence of what changed and why)
added-without-specImplementation includes behavior not described in any spec
specified-not-implementedSpec requirement has no corresponding implementation in the diff

Scope Conformance (deterministic pre-pass)

Before the model-judged Plan Alignment below, run the owned deterministic check (advisory; never blocks):

bash '<PLUGIN_ROOT>/scripts/scope-conformance.sh' <plan-file>

Use the newest matching plan from the comparison material gathered in Step 1 (e.g. docs/plans/*-plan.md). Map the exit code into the report:

ExitVerdictReport as
0cleanOne line: scope conformance clean. Before reporting it, eyeball the plan's Allow: entries — an over-broad glob (e.g. a bare *) makes a clean verdict meaningless; flag it as a finding instead.
1violationSurface each listed file as an added-without-plan candidate finding with the script output as evidence. The reviewer judges intent — plans legitimately evolve; an out-of-scope file is a finding to explain, not an automatic defect.
2unverifiedNote scope conformance unverified (no manifest); proceed with model-judged alignment only.

This is branch-level conformance (whole diff vs the plan's declared scope), not per-agent attribution.

Plan Alignment

For each task in the implementation plan, check whether the git diff includes changes to the expected files and scope.

FlagMeaning
completed-as-plannedTask completed with expected files and scope
modified-from-planTask completed but files or scope differ from plan
added-without-planChanges exist that correspond to no planned task
planned-not-implementedPlanned task has no corresponding changes in the diff

Review-Induced Drift

If code review findings were addressed (check for review-round commits or explicit review feedback in conversation), identify whether fixes changed the behavioral contract -- not just code quality improvements.

Flag any scope changes introduced by review feedback. This dimension catches drift that is invisible to spec/plan alignment because it was introduced after the original implementation.

Step 3: Surface Assumptions and Gaps (Always Runs)

This step runs in both full drift mode and assumptions-only mode.

Assumptions Made

What does the implementation assume about inputs, environment, dependencies, or user behavior that is not validated by tests? List each assumption with the file and line range where it appears.

Untested Paths

What code paths in the diff have no test exercise? Cross-reference test files against implementation files. Flag:

  • Functions/methods with no corresponding test
  • Conditional branches (error handlers, fallbacks, edge cases) not covered
  • Integration boundaries (API calls, file I/O, external services) without mocks or integration tests
  • Test-weakening (gate-gaming): if project-verification reported gate_gaming_status: suspect — or the diff deleted assertions, added skip/xfail/disabled markers, or loosened a fixture to make a previously-failing gate pass — flag it as a blocking drift finding. A path that was tested and is now un-tested is drift, not coverage.
  • Coverage gap (test-adequacy): if project-verification reported coverage_adequacy_status: suspect (new code below the changed-line coverage floor), surface it as a blocking coverage-gap drift signal, mirroring the gate-gaming treatment above — this catches new code shipping untested, whereas gate-gaming catches existing tests getting weaker. unverified or an absent status is not itself drift (fail-open, no coverage tooling present) and MUST NOT be surfaced as a finding on that basis alone.

Edge Cases Identified

What boundary conditions does the implementation handle that are not explicitly specified? These represent implicit assumptions that may or may not be correct.

Eval Pack Gaps

If eval packs exist in tests/fixtures/evals/*.json, identify:

  • Scenarios defined in eval packs that have no corresponding test implementation
  • Implementation behavior not covered by any eval pack scenario
  • Eval pack scenarios whose expected values conflict with the actual implementation

Step 4: Report

Terminal output always. Two report shapes depending on mode.

Full Drift Mode Report

Title: ## Implementation Drift Check

Six sections:

## Implementation Drift Check

### Spec Alignment
| Requirement | Status | Evidence |
|-------------|--------|----------|
| [requirement from spec] | [flag] | [file:line or diff reference] |

### Plan Alignment
| Task | Status | Notes |
|------|--------|-------|
| [task from plan] | [flag] | [file changes or scope note] |

### Review-Induced Changes
- [behavioral contract changes introduced by review feedback, if any]

### Assumptions
- [unvalidated assumption] (file:line)

### Untested Paths
- [code path without test coverage] (file:line)

### Recommended Actions
- [ ] [actionable item to resolve drift or close gaps]

Assumptions-Only Mode Report

Title: ## Assumptions & Gaps

Three sections:

## Assumptions & Gaps

### Assumptions
- [unvalidated assumption] (file:line)

### Untested Paths
- [code path without test coverage] (file:line)

### Recommended Actions
- [ ] [actionable item to close gaps]

Step 5: Persistence

Terminal Output

Always emit the report to terminal. This is the primary output channel.

Spec/Design Document Annotation

When drift is found (any modified-from-spec, added-without-spec, specified-not-implemented, modified-from-plan, added-without-plan, planned-not-implemented flag, or Review-Induced changes), append a concise "Post-Implementation Notes" section to the relevant spec or design document:

## Post-Implementation Notes

_Added by implementation-drift-check on YYYY-MM-DD_

- [concise summary of each drift finding]
- [recommended follow-up actions]

Append to the first matching document in priority order:

  1. docs/plans/*-design.md (canonical)
  2. openspec/changes/<feature>/specs/ (active OpenSpec)
  3. docs/superpowers/specs/*-design.md (legacy)

If the document already has a "Post-Implementation Notes" section, append to it rather than creating a duplicate.

Verification

Before reporting "no drift", confirm:

  • The comparison ran against the highest-authority source available (active OpenSpec change > canonical live intent > archived), and which source was used is stated.
  • Each spec/plan requirement was checked against the actual implementation -- not assumed aligned.
  • Assumptions and untested paths are listed explicitly; an empty list means "verified none", not "did not look".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.