Skip to content

feat(cli): add specify doctor command for project health validation#1893

Closed
mvanhorn wants to merge 1 commit intogithub:mainfrom
mvanhorn:osc/feat-specify-doctor
Closed

feat(cli): add specify doctor command for project health validation#1893
mvanhorn wants to merge 1 commit intogithub:mainfrom
mvanhorn:osc/feat-specify-doctor

Conversation

@mvanhorn
Copy link
Contributor

Summary

Adds specify doctor - a CLI command that validates the internal health of a spec-kit project. Goes beyond specify check (which only validates external tool installations) to validate the project itself: templates, agent config, scripts, constitution, and feature artifacts.

Why this matters

Users hit confusing errors when their spec-kit project is misconfigured, and there's no diagnostic tool to help them.

Source Evidence Engagement
#1866 "specify commands do not work for Codex CLI" - users can't diagnose setup problems 6 comments
#1697 "/speckit.specify not available in CC" - agent config mismatch 1 comment with repro steps
#1705 "AGY projects don't get extension commands registered" 1 comment
#1833 "Vibe and Antigravity agents missing from CommandRegistrar" - config drift 0 comments

All of these share a common diagnostic gap: no way to validate the project's internal configuration without manually inspecting files.

Changes

  • Added specify doctor command to the CLI (src/specify_cli/__init__.py)
  • Five check functions: _check_templates(), _check_agent_config(), _check_scripts(), _check_constitution(), _check_features()
  • Template check: verifies all 5 expected template files exist and have content
  • Agent config check: reads .specify/init-options.json and verifies the agent directory and command files
  • Script check: verifies bash scripts are executable and powershell scripts exist
  • Constitution check: verifies constitution.md exists and has content
  • Feature check: scans specs/NNN-*/ for complete artifact sets (spec, plan, tasks)
  • Health score: 0-10 based on pass/(pass+warn+fail) ratio
  • Options: --json (machine-readable CI output, exits 1 on failures), --fix (auto-fix script permissions), --verbose
  • 16 unit tests in tests/test_doctor.py

Testing

$ .venv/bin/python -m pytest tests/test_doctor.py -v
16 passed in 0.18s

$ .venv/bin/python -m pytest tests/ -v
398 passed in 2.58s

Sample output:

Spec Kit Project Health Check

  Template Integrity
    ✓ spec-template.md: exists and valid
    ✓ plan-template.md: exists and valid
    ✓ tasks-template.md: exists and valid
    ✓ constitution-template.md: exists and valid
    ✓ checklist-template.md: exists and valid

  Agent Configuration (Claude Code)
    ✓ Claude Code directory: .claude/ exists
    ✓ command files: 6 command files found

  Scripts
    ✓ bash scripts: 5 scripts, all executable
    ✓ powershell scripts: 5 scripts present

  Constitution
    ✓ constitution: constitution.md exists (1,247 words)

  Active Features
    ✓ 003-user-auth: spec ✓ plan ✓ tasks ✓
    ⚠ 004-settings: spec ✓ plan ✓ tasks ✗

Health Score: 9/10 (1 warning)

This contribution was developed with AI assistance (Claude Code).

Adds a new CLI command that validates the internal health of a spec-kit
project: template integrity, agent configuration consistency, script
permissions, constitution existence, and feature artifact completeness.
Outputs a health score from 0-10 with pass/warn/fail for each check.

Options: --json (CI-friendly output), --fix (auto-fix permissions),
--verbose (detailed output)

Includes 16 unit tests covering all health check functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mvanhorn mvanhorn requested a review from mnriem as a code owner March 18, 2026 14:56
Copy link
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you deliver this as an extension? See https://github.com/github/spec-kit/tree/main/extensions

@mvanhorn
Copy link
Contributor Author

Got it - will repackage these as an extension. Closing these and will submit a PR with a bundled extension that provides resume, doctor, and validate as extension commands.

@mvanhorn mvanhorn closed this Mar 18, 2026
mvanhorn added a commit to mvanhorn/spec-kit that referenced this pull request Mar 18, 2026
…lidate

Packages three SDD utility commands as an extension per maintainer
feedback on PRs github#1892, github#1893, github#1894.

Commands:
- speckit.speckit-utils.resume: detect feature state, suggest next command
- speckit.speckit-utils.doctor: validate project health (templates, agent
  config, scripts, constitution, feature artifacts)
- speckit.speckit-utils.validate: verify spec-to-task traceability and
  check that completed tasks produced expected files

Hooks into after_specify (doctor) and after_plan (validate) optionally.

This contribution was developed with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants