Skip to content

feat(spec): Add title/body content analysis for phase detection #175

Closed

Description

@admarble

Summary

The /solve skill analyzes issue title and body content to make smart recommendations, but /spec only uses labels. Spec should also analyze content as a fallback.

Problem

From verbose run review:

Current State

Skill Analysis Method Example Detection
/solve Title + body + labels "Extract subcomponents" → UI work
/spec Labels only enhancement → standard workflow

Acceptance Criteria

  • AC-1: Spec analyzes issue title for phase-relevant keywords
  • AC-2: Spec analyzes issue body for phase-relevant patterns
  • AC-3: Content analysis supplements (not replaces) label detection
  • AC-4: If solve comment exists (feat(solve): Persist workflow analysis to issue comments #172), use that instead of re-analyzing

Proposed Detection Patterns

Title Keywords

Pattern Detection Suggested Phase
extract, component, refactor.*ui UI work Add /test
fix.*unused, remove.*variable, typo Trivial Note in output
auth, permission, security Security-sensitive Add /security-review
api, endpoint, route Backend Skip /test

Body Patterns

Pattern Detection
References .tsx files UI work likely
References scripts/ CLI work, needs /verify
Contains "breaking change" Complex, enable quality loop

Relationship to #172

This issue is a fallback if #172 (solve persistence) is not used:

  • If solve comment exists → spec reads it (preferred)
  • If no solve comment → spec does its own content analysis (this issue)

References

  • Solve skill detection: templates/skills/solve/SKILL.md:40-51
  • Spec skill: templates/skills/spec/SKILL.md

Activity

  1. added
    enhancement
    on Jan 23, 2026
  2. admarble commented on Feb 1, 2026

    @admarble
    ContributorAuthor

    📋 Spec Plan for #175

    AC Verification Checklist

    AC Description Verification Method Test Scenario
    AC-1 Spec analyzes issue title for phase-relevant keywords Unit Test + Integration Given title "Extract header component", detect "extract"+"component" → recommend /test
    AC-2 Spec analyzes issue body for phase-relevant patterns Unit Test + Integration Given body with .tsx refs and "breaking change" → detect UI work + complexity
    AC-3 Content analysis supplements (not replaces) label detection Integration Test Labels take precedence; content analysis adds signals
    AC-4 If solve comment exists (#172), use that instead Integration Test Detect solve comment format → extract phases → skip content analysis

    Implementation Plan

    Phase 1: Content Analysis Module

    1. Create src/lib/content-analyzer.ts
      • analyzeTitleForPhases(title) - detect keywords: extract, component, refactor.*ui, auth, security, api, etc.
      • analyzeBodyForPhases(body) - detect patterns: .tsx files, scripts/ refs, "breaking change"
    2. Create src/lib/phase-signal.ts
      • PhaseSignal type with source tracking
      • mergePhaseSignals() with priority: Labels > Solve > Title > Body

    Phase 2: Spec Skill Integration
    3. Update templates/skills/spec/SKILL.md

    • Add "Content Analysis" section after AC extraction
    • Update "Recommended Workflow" to include content analysis reasoning
    1. Add solve comment detection
      • Parse existing comments for "## Solve Workflow" marker
      • Extract phases if found

    Phase 3: Testing
    5. Add src/lib/content-analyzer.test.ts

    • Unit tests for each pattern
    • Edge cases (empty, no matches, multiple matches)

    Open Questions

    1. AC-4 dependency on feat(solve): Persist workflow analysis to issue comments #172: Solve persistence not yet implemented. AC-4 will detect current /solve output format. If feat(solve): Persist workflow analysis to issue comments #172 changes format, update parser.

      • Recommendation: Implement with current format, update later if needed.
    2. Signal conflict priority: If labels say "backend" but title has "component", what wins?

      • Recommendation: Labels take precedence. Content analysis can only ADD phases.

    Recommended Workflow

    spec → exec → qa
    

    Quality Loop: disabled
    Reasoning: Feature enhancement with 4 clear ACs. No UI components. Standard workflow.

    Label Recommendations

    Current: enhancement
    Suggested: Add skill label

    gh issue edit 175 --add-label skill

    📝 Generated by /spec 175

  3. added
    planned
    on Feb 1, 2026
  4. added a commit that references this issue on Feb 1, 2026
  5. admarble commented on Feb 1, 2026

    @admarble
    ContributorAuthor

    🚀 Implementation Complete

    AC Coverage Summary

    AC Description Status Evidence
    AC-1 Spec analyzes issue title for phase-relevant keywords ✅ Implemented src/lib/content-analyzer.ts:analyzeTitleForPhases()
    AC-2 Spec analyzes issue body for phase-relevant patterns ✅ Implemented src/lib/content-analyzer.ts:analyzeBodyForPhases()
    AC-3 Content analysis supplements (not replaces) label detection ✅ Implemented src/lib/phase-signal.ts:mergePhaseSignals() with priority
    AC-4 If solve comment exists, use that instead of re-analyzing ✅ Implemented src/lib/solve-comment-parser.ts:findSolveComment()

    Files Changed

    File Purpose
    src/lib/content-analyzer.ts Title/body analysis for phase signals
    src/lib/phase-signal.ts Signal types and priority-based merging
    src/lib/solve-comment-parser.ts Detect and parse /solve comments
    templates/skills/spec/SKILL.md Added Content Analysis section
    src/lib/*.test.ts 92 unit tests (all passing)

    Test Results

    • ✅ npm test: 92 new tests pass (content-analyzer: 42, phase-signal: 27, solve-comment-parser: 23)
    • ✅ npm run build: TypeScript compilation successful

    PR

    PR #226: #226


    🤖 Generated by /exec 175

  6. admarble commented on Feb 1, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #175

    AC Coverage

    AC Description Status Notes
    AC-1 Spec analyzes issue title for phase-relevant keywords ✅ MET analyzeTitleForPhases() in content-analyzer.ts:345 handles UI, security, and complexity patterns
    AC-2 Spec analyzes issue body for phase-relevant patterns ✅ MET analyzeBodyForPhases() in content-analyzer.ts:371 detects .tsx, scripts/, auth/ patterns
    AC-3 Content analysis supplements (not replaces) label detection ✅ MET mergePhaseSignals() in phase-signal.ts:85 with priority: Labels > Solve > Title > Body
    AC-4 If solve comment exists, use that instead of re-analyzing ✅ MET findSolveComment() and parseSolveWorkflow() in solve-comment-parser.ts

    Coverage: 4/4 AC items fully met


    Quality Plan Verification

    N/A - No quality plan found in issue comments


    CI Status

    Check State Bucket Impact
    build (18.x) SUCCESS pass ✅ MET
    build (20.x) SUCCESS pass ✅ MET
    build (22.x) SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET
    validate-plugin SUCCESS pass ✅ MET
    validate-skills 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 7 ✅ OK
    Lines added +2,230 ⚠️ Large
    Lines deleted -5 -

    Build Verification

    N/A - Build passed


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/lib/content-analyzer.ts Standard ✅ Yes content-analyzer.test.ts (42 tests)
    src/lib/phase-signal.ts Standard ✅ Yes phase-signal.test.ts (27 tests)
    src/lib/solve-comment-parser.ts Standard ✅ Yes solve-comment-parser.test.ts (23 tests)
    templates/skills/spec/SKILL.md Optional N/A Skill documentation

    Coverage: 3/3 changed source files have corresponding tests (92 new tests total)
    Critical paths without tests: None


    Code Review

    Strengths:

    • Well-structured modular design with clear separation of concerns
    • Comprehensive TypeScript types with proper interfaces (ContentSignal, PhaseSignal, SolveWorkflowResult)
    • Priority-based signal merging follows spec (Labels > Solve > Title > Body) - AC-3
    • Thorough pattern coverage for UI, security, and complexity detection
    • Excellent test coverage (92 tests across 3 files)
    • Good documentation with JSDoc comments and examples
    • Format functions provided for display integration

    Issues:

    • None blocking

    Suggestions:

    • Consider adding integration test that exercises the full flow from skill usage

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on function outputs, not internals
    Coverage Depth ✅ OK Edge cases covered (empty inputs, no matches, multiple matches)
    Mock Hygiene ✅ OK No mocking required - pure functions
    Test Reliability ✅ OK Deterministic pattern matching

    Anti-Pattern Detection

    Dependency Audit

    N/A - No dependency changes

    Code Patterns

    No anti-patterns detected:

    • No N+1 patterns (no async in loops)
    • No empty catch blocks
    • No hardcoded secrets
    • No SQL or command injection risks

    Execution Evidence

    N/A - No scripts/CLI modified


    Skill Command Verification

    Skill file changed: templates/skills/spec/SKILL.md

    Command Verification Status
    gh issue view <issue-number> --json comments --jq '.comments[].body' ✅ Valid - standard gh CLI syntax
    gh issue edit <issue> --add-label skill ✅ Valid - standard gh CLI syntax

    Verification Status: Passed (placeholder commands verified for syntax)


    Self-Evaluation

    • Verified working: Yes - Unit tests exercise all functions, patterns match spec requirements
    • Test efficacy: High - Tests cover each pattern category and edge cases
    • Likely failure mode: Regex patterns may not catch all variations (e.g., "UI-refactor" vs "ui refactor")
    • Verdict confidence: High - Implementation matches AC, tests pass, CI green

    Verdict: READY_FOR_MERGE

    All 4 acceptance criteria are fully met:

    1. Title analysis implemented with comprehensive keyword patterns
    2. Body analysis implemented with file reference and pattern detection
    3. Signal merging respects priority (Labels > Solve > Title > Body) - content only ADDs phases
    4. Solve comment detection implemented with proper parsing

    Code quality is high with:

    • 92 passing tests (42 + 27 + 23)
    • No type issues
    • All CI checks passing
    • Clean separation of concerns

    Documentation

    • Skill documentation updated (templates/skills/spec/SKILL.md)
    • N/A - No README changes needed (internal feature)
    • N/A - CHANGELOG entry (not user-facing)

    Next Steps

    1. ✅ Ready to merge
    2. Run /docs 175 to generate admin documentation if needed

    🤖 Generated by /qa 175

  7. added
    ready-for-review
    on Feb 1, 2026
  8. added 2 commits that reference this issue on Feb 1, 2026
  9. admarble commented on Feb 1, 2026

    @admarble
    ContributorAuthor

    ✅ Merged and Verified

    PR: #226
    Commit: 489ef86
    Merged: 2026-02-01T08:06:50Z

    Verification Results

    Check Status
    Unit Tests ✅ 925 passed (92 new)
    Build ✅ TypeScript compilation
    Smoketest ✅ 14/14 passed

    Acceptance Criteria

    AC Description Status
    AC-1 Spec analyzes issue title for phase-relevant keywords ✅
    AC-2 Spec analyzes issue body for phase-relevant patterns ✅
    AC-3 Content analysis supplements (not replaces) label detection ✅
    AC-4 If solve comment exists, use that instead of re-analyzing ✅

    New Exports

    // Content analysis
    analyzeContentForPhases, analyzeTitleForPhases, analyzeBodyForPhases
    
    // Phase signal merging
    mergePhaseSignals, signalsFromLabels, signalFromLabel
    
    // Solve comment parsing
    findSolveComment, parseSolveWorkflow, solveWorkflowToSignals

    🤖 Verified by Claude Code

  10. removed
    ready-for-review
    planned
    on Feb 1, 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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions