You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prevent skill/CLI drift with phase vocabulary docs and optional smoke test #467
The assess skill accumulated three categories of drift from the actual CLI implementation, discovered during a manual audit (commits ba4fc3d, c62c904):
Nonexistent CLI flag:--skip-spec in example commands (actual: --phases exec,qa)
Nonexistent phase name:sec in label→phase table (actual: security-review)
Wrong flag descriptions:--qa-gate and --chain descriptions didn't match actual behavior
Dead parser code:browserTest and skipSpec fields parsed but never generated or consumed
All five were fixed in the audit, but nothing prevents recurrence.
Acceptance Criteria
AC-1: Add a "Valid phases" reference line to the assess skill's Step 4 (Workflow Detection) section listing all phases from PhaseSchema in src/lib/workflow/types.ts
AC-2: Evaluate whether a lightweight smoke test is worth adding — e.g., extract --flags from bin/cli.ts.option() calls and phase names from types.ts, then verify skill SKILL.md examples only reference valid ones
AC-1: Add "Valid phases" reference line to assess skill Step 4
Verification Method: Integration Test
Test Scenario:
Given: .claude/skills/assess/SKILL.md file
When: Reading Step 4 (Workflow Detection)
Then: "Valid phases" reference line lists all 9 phases from PhaseSchema: spec, security-review, exec, testgen, test, verify, qa, loop, merger
AC-2: Evaluate lightweight smoke test for CLI flag/phase drift
Verification Method: Integration Test (implementing the smoke test)
Test Scenario:
Given: PhaseSchema in types.ts and .option() calls in bin/cli.ts
When: Running assess-skill.test.ts
Then: All phase names and CLI flags in assess SKILL.md examples are valid per canonical sources
Evaluation: Worth adding. The testgen-skill.test.ts pattern extends naturally, 5 drift categories were found in manual audit, and test maintenance cost is minimal (only changes when PhaseSchema or CLI flags change — which is exactly when drift occurs).
Assumptions
PhaseSchema contains 9 phases (confirmed from types.ts)
Step 4 insertion point: after label→phase table, before "Skip spec when:" (confirmed)
testgen-skill.test.ts pattern is directly reusable (confirmed)
Lists all 9 PhaseSchema phases in correct order, placed after label→phase table, synced across 3 directories
AC-2
Original
Lightweight smoke test for CLI flag/phase drift
MET
5 tests in assess-skill.test.ts covering phase vocab, CLI flags, and 3-dir sync
Derived ACs
AC-3
Derived (Completeness)
Label→phase table only uses valid phases
NOT_MET
Regex `([a-z-]+)` doesn't match table format `exec → qa` — test passes vacuously with 0 assertions
AC-4
Derived (Code Quality)
3-directory sync
MET
Test confirms .claude/skills/, skills/, templates/skills/ are identical
Coverage: 3/4 AC items fully met Original ACs: 2/2 met Derived ACs: 1/2 met
CI Status
Check
State
Impact
typecheck
SUCCESS
✅ MET
validate-skills
SUCCESS
✅ MET
build (20.x)
SUCCESS
✅ MET
build (22.x)
SUCCESS
✅ MET
Plugin Structure Validation
FAILURE
N/A (pre-existing infra check)
Hooks Validation
FAILURE
N/A (pre-existing infra check)
CI Summary: 4 passed, 2 failed (pre-existing)
Quality Metrics
Metric
Value
Status
Type issues (any)
0
OK
Deleted tests
0
OK
Files changed
4
OK
Lines added
+148
-
Lines deleted
-0
-
Test Coverage Analysis
Changed File
Tier
Has Tests?
Test File
.claude/skills/assess/SKILL.md
Standard
✅ Yes
src/lib/__tests__/assess-skill.test.ts
skills/assess/SKILL.md
Standard
✅ Yes
(same — sync test)
templates/skills/assess/SKILL.md
Standard
✅ Yes
(same — sync test)
src/lib/__tests__/assess-skill.test.ts
Standard
N/A
(is the test)
Coverage: 3/3 changed source files have corresponding tests
Code Review
Strengths:
Clean, focused change: 1 reference line + 1 well-structured test file
Test imports PhaseSchema directly from source of truth — any schema change will immediately flag drift
CLI flag extraction via regex on bin/cli.ts text matches proven testgen-skill.test.ts pattern
3-directory sync test is simple and effective
Good test documentation with AC references and audit commit context
Issues:
Table phase regex is vacuous (AC-3): The test at line 64 uses `([a-z-]+)` to extract phases from the label→phase table. However, the table format is `exec → qa` (multi-word with → separators inside backticks). The regex requires only[a-z-] characters between backticks, so it matches nothing except `-q` (which is then filtered out). The for loop on line 69 executes zero iterations, meaning the test passes without asserting anything. If someone re-introduced a nonexistent phase like sec in the table (the exact drift category from the original audit), this test would not catch it.
"Other flags" regex misses --base: The `(--[a-z][a-z-]*)` regex on line 114 matches --chain and --qa-gate but not `--base <branch>` because the parameter <branch> is inside the backticks. Minor coverage gap.
Suggestions:
Fix the table phase regex to split backtick-quoted workflow strings on →:
Fix "Other flags" regex to handle parameters: extract flag name before space/angle bracket
Test Quality Review
Category
Status
Notes
Behavior vs Implementation
⚠️ WARN
Table phase test asserts on zero items (vacuous pass)
Coverage Depth
⚠️ WARN
CLI flag test misses --base <branch> format
Mock Hygiene
✅ OK
No mocks — reads actual files
Test Reliability
✅ OK
Deterministic file reads
Anti-Pattern Detection
Code Patterns
File:Line
Category
Pattern
Suggestion
assess-skill.test.ts:69
Test Reliability
Vacuous loop — 0 iterations, 0 assertions
Fix regex to match actual table format
Critical Issues: 1 Warnings: 1
Self-Evaluation
Verified working: Yes — ran all 5 tests, confirmed pass. But the table phase test (AC-3) passes without testing anything due to regex mismatch. This was caught by executing the regex against actual content.
Test efficacy: Medium — Phase reference line test (AC-1) and CLI flags test are effective. Table phase test is a false positive. 3-dir sync test is solid.
Likely failure mode: Someone adds an invalid phase to the label→phase table (e.g., sec instead of security-review) and the test doesn't catch it — exactly the drift category this issue was created to prevent.
Verdict confidence: High — the vacuous regex is provably broken by running the extraction against actual content.
CHANGELOG Verification
Check
Status
CHANGELOG.md exists
✅ Found
User-facing changes
Internal (skill docs + test)
[Unreleased] entry
N/A
Result: N/A — internal skill infrastructure, not user-facing
Verdict: AC_NOT_MET
AC-3 (Derived: "Test verifies label→phase table only uses valid phases") is not met. The table phase extraction regex doesn't match the actual table format, causing the test to pass vacuously with zero assertions. This is the exact drift category (#2 in the audit: "Nonexistent phase name sec in label→phase table") that this issue was created to prevent.
Original ACs (AC-1, AC-2) are both met. The fix for AC-3 is straightforward — update the regex to split on → within backtick-quoted strings.
Next Steps
Fix table phase regex in assess-skill.test.ts line 64 — change from `([a-z-]+)` to extracting from `([^`]+)` and splitting on →
Fix "Other flags" regex (line 114) to handle `--base <branch>` format — extract flag name before space
Activity
admarble commentedon Mar 26, 2026
→ PROCEED — Clear ACs, 2 scoped tasks (vocab docs + optional smoke test)
spec → exec → qa · 2 ACs · -q (AC-2 evaluation needs spec)
admarble commentedon Mar 26, 2026
Spec Plan — Issue #467
AC Checklist with Verification Criteria
AC-1: Add "Valid phases" reference line to assess skill Step 4
Verification Method: Integration Test
Test Scenario:
.claude/skills/assess/SKILL.mdfilePhaseSchema:spec,security-review,exec,testgen,test,verify,qa,loop,mergerAC-2: Evaluate lightweight smoke test for CLI flag/phase drift
Verification Method: Integration Test (implementing the smoke test)
Test Scenario:
PhaseSchemaintypes.tsand.option()calls inbin/cli.tsassess-skill.test.tsEvaluation: Worth adding. The
testgen-skill.test.tspattern extends naturally, 5 drift categories were found in manual audit, and test maintenance cost is minimal (only changes when PhaseSchema or CLI flags change — which is exactly when drift occurs).Assumptions
types.ts)testgen-skill.test.tspattern is directly reusable (confirmed).claude/skills/,templates/skills/,skills/(confirmed)Implementation Plan
Phase 1: Valid Phases Reference (AC-1)
**Valid phases (from PhaseSchema):** ...line in Step 4 of assess SKILL.md — after label→phase tabletemplates/skills/assess/SKILL.mdandskills/assess/SKILL.mdPhase 2: Smoke Test (AC-2)
3. Create
src/lib/__tests__/assess-skill.test.tsfollowingtestgen-skill.test.tspattern:PhaseSchemafromtypes.tsto get valid phasesbin/cli.tsas text, extract--flagnames via regexDerived ACs:
Design Decisions
Recommended Workflow
Phases: spec → exec → qa
Quality Loop: disabled — the smoke test itself is the quality mechanism
feat(#467): add phase vocabulary docs and drift smoke test
admarble commentedon Mar 26, 2026
Exec Progress Update
AC Coverage
Key Files Changed
.claude/skills/assess/SKILL.mdskills/assess/SKILL.mdtemplates/skills/assess/SKILL.mdsrc/lib/__tests__/assess-skill.test.tsQuality Gates
npm run buildnpm run lintnpm testQuality Plan Alignment
N/A — No quality plan in issue
PR
✅ Created: #468
admarble commentedon Mar 26, 2026
QA Review for Issue #467
AC Coverage
Coverage: 4/4 AC items fully met
CI Status
Quality Metrics
Code Review
Strengths:
Issues: None
Test Quality Review
Self-Evaluation
Verdict: NEEDS_VERIFICATION
All ACs are met. Code quality is A+. Build CI checks (20.x, 22.x) still in progress - re-run QA after CI completes for READY_FOR_MERGE.
Next Steps
admarble commentedon Mar 26, 2026
QA Review for Issue #467
AC Coverage
assess-skill.test.tscovering phase vocab, CLI flags, and 3-dir sync`([a-z-]+)`doesn't match table format`exec → qa`— test passes vacuously with 0 assertions.claude/skills/,skills/,templates/skills/are identicalCoverage: 3/4 AC items fully met
Original ACs: 2/2 met
Derived ACs: 1/2 met
CI Status
CI Summary: 4 passed, 2 failed (pre-existing)
Quality Metrics
any)Test Coverage Analysis
.claude/skills/assess/SKILL.mdsrc/lib/__tests__/assess-skill.test.tsskills/assess/SKILL.mdtemplates/skills/assess/SKILL.mdsrc/lib/__tests__/assess-skill.test.tsCoverage: 3/3 changed source files have corresponding tests
Code Review
Strengths:
PhaseSchemadirectly from source of truth — any schema change will immediately flag driftbin/cli.tstext matches proventestgen-skill.test.tspatternIssues:
`([a-z-]+)`to extract phases from the label→phase table. However, the table format is`exec → qa`(multi-word with→separators inside backticks). The regex requires only[a-z-]characters between backticks, so it matches nothing except`-q`(which is then filtered out). Theforloop on line 69 executes zero iterations, meaning the test passes without asserting anything. If someone re-introduced a nonexistent phase likesecin the table (the exact drift category from the original audit), this test would not catch it.--base: The`(--[a-z][a-z-]*)`regex on line 114 matches--chainand--qa-gatebut not`--base <branch>`because the parameter<branch>is inside the backticks. Minor coverage gap.Suggestions:
→:Test Quality Review
--base <branch>formatAnti-Pattern Detection
Code Patterns
assess-skill.test.ts:69Critical Issues: 1
Warnings: 1
Self-Evaluation
secinstead ofsecurity-review) and the test doesn't catch it — exactly the drift category this issue was created to prevent.CHANGELOG Verification
Result: N/A — internal skill infrastructure, not user-facing
Verdict: AC_NOT_MET
AC-3 (Derived: "Test verifies label→phase table only uses valid phases") is not met. The table phase extraction regex doesn't match the actual table format, causing the test to pass vacuously with zero assertions. This is the exact drift category (#2 in the audit: "Nonexistent phase name
secin label→phase table") that this issue was created to prevent.Original ACs (AC-1, AC-2) are both met. The fix for AC-3 is straightforward — update the regex to split on
→within backtick-quoted strings.Next Steps
assess-skill.test.tsline 64 — change from`([a-z-]+)`to extracting from`([^`]+)`and splitting on→`--base <branch>`format — extract flag name before space/qa 467to confirm READY_FOR_MERGEadmarble commentedon Mar 26, 2026
admarble commentedon Mar 26, 2026
Documentation Generated
File:
docs/features/skill-cli-drift-prevention.mdSections Included:
Next Steps:
Ready to merge (pending AC-3 regex fix).
docs(#467): add drift prevention documentation
fix(#467): fix vacuous table phase regex and Other flags coverage gap
feat(#467): prevent skill/CLI drift with phase vocabulary docs (#468)
docs(#689): backtest infeasible (both approaches fail) — recommend de…
feat(#467): add phase vocabulary docs and drift smoke test
docs(#467): add drift prevention documentation
fix(#467): fix vacuous table phase regex and Other flags coverage gap