Skip to content

feat(qa): Add skill command verification before READY_FOR_MERGE #209

Closed

Description

@admarble

Summary

When QA reviews skill changes (.claude/skills/**/*.md), it should verify that commands referenced in the skill actually work before giving READY_FOR_MERGE.

Problem

Issue #178 added CI status detection to QA using gh pr checks --json name,state,conclusion. QA gave READY_FOR_MERGE, but post-merge integration testing revealed:

Bug Root Cause How Caught
Wrong JSON field (conclusion doesn't exist) Never executed the command Manual gh pr checks test
Missing CI patterns No adversarial review Human "what else?" thinking
No gh availability check Assumed dependency exists Human portability review

QA passed because it reviewed the text, not the behavior.

Current Gap

Skill change = Markdown instructions for Claude
QA checks = Code review, type safety, security scan
Missing = Does the command actually work?

For skill changes, the only real test is execution — which QA doesn't do.

Proposed Solution

1. Skill Command Extraction (Automated)

When .claude/skills/**/*.md files are modified:

# Extract command patterns from skill file
grep -E '^\s*`?(gh|npm|npx|git)\s+[^`]+' <skill-file> | head -10

2. Command Syntax Verification (Automated)

For each extracted command:

  • Run with --help or safe flags to verify syntax
  • For JSON output commands, verify field names exist
# Example: Verify gh pr checks fields
gh pr checks --help | grep -A 20 "JSON FIELDS"
# Or actually run against a real PR
gh pr checks <pr> --json name,state,bucket

3. Adversarial Review Prompts (Manual)

Add to QA self-evaluation for skill changes:

### Skill Change Review

- [ ] **Command verified:** Did you execute at least one referenced command?
- [ ] **Fields verified:** For JSON commands, do field names match actual output?
- [ ] **Patterns complete:** What variations might users write that aren't covered?
- [ ] **Dependencies explicit:** What CLIs/tools does this skill assume are installed?

Acceptance Criteria

  • AC-1: QA detects when .claude/skills/**/*.md files are modified
  • AC-2: QA extracts and lists commands referenced in skill changes
  • AC-3: QA executes at least one command to verify syntax (or flags as unverified)
  • AC-4: QA self-evaluation includes skill-specific adversarial prompts
  • AC-5: Verdict cannot be READY_FOR_MERGE if command verification fails

Evidence

From #178 QA review, the self-evaluation said:

"Verified working: Yes - The implementation is documentation/skill instructions only."

This was incorrect. The command syntax was wrong (conclusion field doesn't exist).

Related Issues

Priority

Medium — Skills are modified less frequently than code, but bugs in skills affect all future workflow runs.


Issue created from post-merge reflection on #178

Activity

  1. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    📋 /spec Plan: Skill Command Verification

    Acceptance Criteria Checklist

    AC Description Verification Method Status
    AC-1 QA detects when .claude/skills/**/*.md files are modified Integration Test ⬜
    AC-2 QA extracts and lists commands referenced in skill changes Integration Test ⬜
    AC-3 QA executes at least one command to verify syntax (or flags as unverified) Integration Test + Manual ⬜
    AC-4 QA self-evaluation includes skill-specific adversarial prompts Manual Test ⬜
    AC-5 Verdict cannot be READY_FOR_MERGE if command verification fails Integration Test ⬜

    Verification Criteria

    AC-1: Given a feature branch with skill file changes → When QA runs detection → Then skills_changed > 0

    AC-2: Given a skill with commands like gh pr checks --json → When extraction runs → Then commands are listed

    AC-3: Given gh pr checks --json conclusion → When syntax check runs → Then "conclusion" flagged as invalid field (doesn't exist)

    AC-4: Given skill changes detected → When self-evaluation generated → Then 4 skill-specific prompts appear

    AC-5: Given command verification = "Failed" → When verdict calculated → Then NOT READY_FOR_MERGE

    Assumptions to Validate

    • Git diff can detect skill file changes in worktree
    • Pattern captures both SKILL.md and reference files
    • Commands in bash code blocks are captured
    • Commands in inline backticks are captured
    • gh CLI is available in the environment
    • --help output is parseable for JSON field validation
    • Skill-specific prompts only shown for skill changes

    Implementation Plan

    Phase 1: Skill Change Detection

    • Add detection logic after existing scripts_changed (line ~693 in QA skill)
    • Pattern: ^\.claude/skills/.*\.md$

    Phase 2: Command Extraction

    • Extract from code blocks and inline backticks
    • Capture gh, git, npm, npx prefixed commands

    Phase 3: Command Syntax Verification

    • Run --help for command types to verify flags/fields exist
    • Mark commands with placeholders as "Skipped - requires substitution"
    • Status: Passed / Failed / Skipped

    Phase 4: Self-Evaluation Prompts

    • Add conditional skill review section with 4 adversarial prompts
    • Only shown when skills_changed > 0

    Phase 5: Verdict Gating

    • Add skill verification to verdict algorithm
    • Failed verification → AC_MET_BUT_NOT_A_PLUS (blocks READY_FOR_MERGE)

    Open Questions

    1. Placeholder handling: Skip commands with <placeholder> or ${VAR}? → Recommended: Yes, with documented reason
    2. Verification scope: All commands or first 3-5 unique types? → Recommended: Sample of 3-5 to limit execution time
    3. Side-effect commands: How to handle gh issue edit? → Recommended: Only use --help, never execute

    Recommended Workflow

    /spec 209 → /exec 209 → /qa 209
    

    Quality Loop: Disabled (clear AC, no complex refactoring)


    Plan generated by /spec — ready for implementation with /exec 209

  2. added
    planned
    on Jan 31, 2026
  3. added a commit that references this issue on Jan 31, 2026
  4. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    🚀 /exec Progress Update

    Implementation Complete

    PR #216 has been created: #216

    AC Coverage

    AC Description Status Evidence
    AC-1 QA detects when .claude/skills/**/*.md files are modified ✅ Implemented Added skills_changed detection in Section 5 and 6a
    AC-2 QA extracts and lists commands referenced in skill changes ✅ Implemented Command extraction with grep patterns for gh, npm, npx, git
    AC-3 QA executes at least one command to verify syntax ✅ Implemented Verification via --help output and JSON field validation
    AC-4 QA self-evaluation includes skill-specific adversarial prompts ✅ Implemented 4 prompts added to Section 5 (Command verified, Fields verified, Patterns complete, Dependencies explicit)
    AC-5 Verdict cannot be READY_FOR_MERGE if command verification fails ✅ Implemented Verdict algorithm updated in Section 7 to gate on skill_verification

    Files Changed

    File Changes
    .claude/skills/qa/SKILL.md +187 lines (new Section 6a, updated Section 5, updated Section 7, updated Output Template)

    Quality Checks

    • ✅ Build passes (npm run build)
    • ⚠️ 12 pre-existing test failures (verified on main branch - unrelated to this PR)

    Self-Evaluation

    • Worked as expected: Yes - all sections added cleanly to existing skill structure
    • Test coverage confidence: N/A - skill markdown files don't have unit tests; behavior verified through manual QA
    • Weakest part: Placeholder handling - may need refinement for edge cases like ${complex.expression}
    • Honest assessment: Implementation follows the spec closely; the core issue (feat(qa): Add CI status awareness to verdict logic #178's conclusion field bug) would be caught

    Next Steps

    1. Run /qa 209 to validate implementation
    2. Manual testing: Modify a skill file and verify QA detects/extracts commands
    3. Merge PR after CI passes

    Progress update by /exec 209

  5. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #209

    AC Coverage

    AC Description Status Notes
    AC-1 QA detects when .claude/skills/**/*.md files are modified ✅ MET Implemented via git diff main...HEAD --name-only | grep -E "^\.claude/skills/.*\.md$" - verified working
    AC-2 QA extracts and lists commands referenced in skill changes ✅ MET Two grep patterns for bash code blocks and inline backticks - verified working
    AC-3 QA executes at least one command to verify syntax (or flags as unverified) ✅ MET Detailed Step 1-4 verification process with JSON field validation examples
    AC-4 QA self-evaluation includes skill-specific adversarial prompts ✅ MET Added "Skill Change Review (Conditional)" section with 4 specific prompts
    AC-5 Verdict cannot be READY_FOR_MERGE if command verification fails ✅ MET Added to verdict algorithm and marked as CRITICAL gate

    Coverage: 5/5 AC items fully met


    CI Status

    Check State Bucket Impact
    build (18.x) SUCCESS pass ✅ MET
    build (20.x) SUCCESS pass ✅ MET
    build (22.x) SUCCESS pass ✅ MET
    validate-skills SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET
    validate-plugin SUCCESS pass ✅ MET

    CI Summary: 6 passed, 0 pending, 0 failed


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 ✅ OK
    Deleted tests 0 ✅ OK
    Files changed 1 ✅ OK
    Lines added +187 -
    Lines deleted -1 -

    Build Verification

    N/A - Build passed (TypeScript compilation successful)


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    .claude/skills/qa/SKILL.md Optional N/A Documentation/skill file

    Coverage: Documentation-only change - no source code tests applicable
    Critical paths without tests: None

    Note: Test failures observed in state-update-cli.test.ts and semgrep.test.ts are pre-existing on main branch - not regressions from this PR.


    Code Review

    Strengths:

    • Well-structured implementation following existing skill patterns
    • Comprehensive step-by-step verification process
    • Excellent documentation with examples (e.g., the JSON field validation example)
    • Properly integrated with verdict algorithm at the right precedence level
    • References the actual bug that motivated this (Issue feat(qa): Add CI status awareness to verdict logic #178 conclusion field)

    Issues:

    • None identified

    Suggestions:

    • Consider adding a quick-reference table summarizing which gh commands have which valid JSON fields (minor, not blocking)

    Test Quality Review

    N/A - No test files modified


    Anti-Pattern Detection

    N/A - No package.json changes, no source code changes


    Execution Evidence

    N/A - No scripts/CLI modified


    Skill Command Verification

    Skill files changed: 1

    File Commands Found Verification Status
    .claude/skills/qa/SKILL.md Multiple ✅ Passed

    Commands Verified:

    • git diff main...HEAD --name-only \| grep -E "^\.claude/skills/.*\.md$" → ✅ Works correctly
    • gh pr checks --json name,state,bucket → ✅ All fields exist
    • gh pr checks --help \| grep -A 30 "JSON FIELDS" → ✅ Works correctly
    • Field validation for name, state, bucket → ✅ All exist
    • Verification that conclusion is NOT a valid field → ✅ Confirmed (as documented)

    Commands with Issues: None

    Verification Status: Passed


    Skill Change Review

    • Command verified: Executed skill detection, command extraction, and JSON field verification commands - all work ✅
    • Fields verified: Confirmed name, state, bucket exist; conclusion does not (matching documentation) ✅
    • Patterns complete: Covers skill detection, command extraction from code blocks and inline, JSON field validation, and placeholder handling ✅
    • Dependencies explicit: Documents gh CLI requirement for verification ✅

    Self-Evaluation

    • Verified working: Yes - Executed the key commands documented in the skill changes and verified they work
    • Test efficacy: Medium - This is documentation; the "test" is whether future QA runs will catch skill command issues
    • Likely failure mode: Edge cases in grep patterns missing some command formats (mitigated by using multiple extraction patterns)
    • Verdict confidence: High - All AC items verified, commands tested, CI passing

    Verdict: READY_FOR_MERGE

    This is a well-implemented documentation enhancement that directly addresses the gap identified in Issue #178. The skill command verification section provides clear, actionable steps for QA to validate commands before giving READY_FOR_MERGE. The verdict algorithm has been properly updated to gate on verification status.

    Documentation

    • N/A - Internal skill documentation (not user-facing docs)

    Next Steps

    1. ✅ Ready to merge - no action items
    2. After merge, this verification process will automatically apply to future skill changes

    QA completed: All AC items met, CI passing, no regressions

  6. added
    ready-for-review
    on Jan 31, 2026
  7. added 2 commits that reference this issue on Jan 31, 2026
  8. added a commit that references this issue on Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions