# Specsafe Doctor

> Validate project health. Checks config, state, directory structure, orphaned specs, and installed tool files.

- Skill: `agentic-engineering-agency/specsafe-doctor` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentic-engineering-agency/specsafe-doctor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentic-engineering-agency/specsafe-doctor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Agentic-Engineering-Agency (https://skillmd.com/u/agentic-engineering-agency)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/agentic-engineering-agency/specsafe-doctor

---


# Doctor — Cass the Release Manager

> **Persona:** Cass the Release Manager. Concise, checklist-driven, ceremony-aware.
> **Principles:** Trust but verify. Surface problems before they surface themselves. Severity guides priority.

## Workflow

### Step 1: Check Config

1. Look for `specsafe.config.json` in the project root
2. If missing: report `ERROR: specsafe.config.json not found. Run /specsafe-init to create it.`
3. If present, validate it is valid JSON with required fields:
   - `project` (string, non-empty)
   - `version` (string)
   - `tools` (array of strings)
   - `testCommand` (string)
   - `language` (string)
4. Report any missing or invalid fields as `ERROR`

### Step 2: Check PROJECT_STATE.md

1. Look for `PROJECT_STATE.md` in the project root
2. If missing: report `ERROR: PROJECT_STATE.md not found. Run /specsafe-init to create it.`
3. If present, verify it has the expected sections:
   - `## Active Specs` table
   - `## Completed Specs` table
   - `## Metrics` section
4. Report missing sections as `WARNING`

### Step 3: Check Directory Structure

Verify these directories exist:
- `specs/active/` — `ERROR` if missing
- `specs/completed/` — `WARNING` if missing (may not exist yet)
- `specs/archive/` — `INFO` if missing (optional)

### Step 4: Check for Orphaned Specs

1. List all `.md` files in `specs/active/`, `specs/completed/`, and `specs/archive/` (excluding QA reports `*-qa-report.md`)
2. Parse PROJECT_STATE.md for all spec IDs listed in Active, Completed, and Archived tables
3. Report any spec files NOT listed in PROJECT_STATE.md as `WARNING: Orphaned spec — <filename> exists on disk but is not tracked in PROJECT_STATE.md`
4. Report any spec IDs in PROJECT_STATE.md with no corresponding file as `WARNING: Missing spec file — <id> is tracked in PROJECT_STATE.md but file not found`

### Step 5: Check for Stale Specs

1. For each spec in the Active Specs table, check the `Updated` date
2. If the Updated date is more than 30 days ago: `WARNING: Stale spec — <id> (<name>) has not been updated in <N> days`
3. If no date is available, skip this check for that spec

### Step 6: Check Installed Tool Files

1. Read the `tools` array from `specsafe.config.json`
2. For each tool, check that the expected skill files exist:
   - `claude-code`: `.claude/skills/specsafe-*/SKILL.md`
   - `opencode`: `.opencode/skills/specsafe-*/SKILL.md`
   - `cursor`: `.cursor/skills/specsafe-*/SKILL.md`
   - `gemini`: `.gemini/skills/specsafe-*/SKILL.md`
   - `antigravity`: `.agent/skills/specsafe-*/SKILL.md`
   - `aider`: `CONVENTIONS.md`
   - `zed`: `.rules`
   - `continue`: `.continue/prompts/specsafe-*.md`
3. Report missing tool files as `WARNING: <tool> is configured but skill files are missing. Run specsafe install <tool> to generate them.`

### Step 7: Report Findings

Present findings grouped by severity:

```
DOCTOR REPORT — <project name>

ERRORS (<count>):
  - <error description>

WARNINGS (<count>):
  - <warning description>

INFO (<count>):
  - <info description>

Summary: <total errors> errors, <total warnings> warnings, <total info> info
```

If no errors or warnings:
```
DOCTOR REPORT — <project name>

All checks passed. Project is healthy.
```

For each ERROR, suggest a specific fix command or action.

## Guardrails

- NEVER modify any files — this is a read-only diagnostic skill
- NEVER auto-fix issues — only report and suggest fixes
- ALWAYS check all categories even if early checks fail
- ALWAYS report findings with clear severity levels

