|
| 1 | +--- |
| 2 | +name: mdproof-update-docs |
| 3 | +description: >- |
| 4 | + Update skills/ documentation and CHANGELOG to match recent code changes, |
| 5 | + cross-validating every flag and config field against Go source. Use this skill |
| 6 | + whenever the user asks to: update docs, sync docs with code, document a new |
| 7 | + flag or config option, fix stale docs, or refresh the skills reference after |
| 8 | + implementing a feature. This skill covers skills/SKILL.md (main doc), |
| 9 | + skills/references/ (assertions, advanced features), and CHANGELOG.md. If you |
| 10 | + just implemented a feature and need to update documentation, this is the skill |
| 11 | + to use. Never manually edit skills/ docs without cross-validating against Go |
| 12 | + source first. |
| 13 | +argument-hint: "[feature-name | commit-range]" |
| 14 | +targets: [claude, codex] |
| 15 | +--- |
| 16 | + |
| 17 | +Sync skills/ documentation with recent code changes. $ARGUMENTS specifies scope: a feature name (e.g., `step-setup`), commit range, or omit to auto-detect from `git diff HEAD~1`. |
| 18 | + |
| 19 | +**Scope**: This skill updates `skills/`, `CHANGELOG.md`. It does NOT write Go code (use `implement-feature`). |
| 20 | + |
| 21 | +## Workflow |
| 22 | + |
| 23 | +### Step 1: Detect Changes |
| 24 | + |
| 25 | +```bash |
| 26 | +# Auto-detect recently changed code |
| 27 | +git diff HEAD~1 --stat -- cmd/mdproof/ internal/ |
| 28 | + |
| 29 | +# Check config struct changes |
| 30 | +git diff HEAD~1 -- internal/config/config.go |
| 31 | + |
| 32 | +# Check new/changed types |
| 33 | +git diff HEAD~1 -- internal/core/types.go |
| 34 | +``` |
| 35 | + |
| 36 | +Map changed files to affected documentation: |
| 37 | + |
| 38 | +**Main skill doc** (`skills/SKILL.md`): |
| 39 | +- `cmd/mdproof/main.go` → Quick Reference, CLI Flags table |
| 40 | +- `internal/core/types.go` → Writing Runbooks section (new step fields, report structure) |
| 41 | +- `internal/config/config.go` → mention config support in CLI Flags table |
| 42 | +- `internal/executor/` → Persistent Session, Code Blocks, Sub-Commands sections |
| 43 | + |
| 44 | +**Assertions reference** (`skills/references/assertions-guide.md`): |
| 45 | +- `internal/assertion/` → assertion type changes, new matchers |
| 46 | +- `internal/executor/` → changes to how assertions interact with execution |
| 47 | + |
| 48 | +**Advanced features reference** (`skills/references/advanced-features.md`): |
| 49 | +- `internal/executor/session.go` → directives, hooks, retry, sub-commands |
| 50 | +- `internal/config/config.go` → Configuration File section |
| 51 | +- `cmd/mdproof/main.go` → new flags → new sections |
| 52 | +- `internal/report/` → report format changes (plain, JSON, JUnit) |
| 53 | + |
| 54 | +**CHANGELOG** (`CHANGELOG.md`): |
| 55 | +- Any user-visible change → use the `changelog` skill instead |
| 56 | + |
| 57 | +### Step 2: Cross-Validate Flags |
| 58 | + |
| 59 | +For each affected area, verify docs match source: |
| 60 | + |
| 61 | +1. **CLI flags** — extract all flags from `cmd/mdproof/main.go`: |
| 62 | + ```bash |
| 63 | + grep -n 'flag\.' cmd/mdproof/main.go |
| 64 | + ``` |
| 65 | + |
| 66 | +2. **Config fields** — extract from `internal/config/config.go`: |
| 67 | + ```bash |
| 68 | + grep -n 'json:"' internal/config/config.go |
| 69 | + ``` |
| 70 | + |
| 71 | +3. **Report types** — extract from `internal/core/types.go`: |
| 72 | + ```bash |
| 73 | + grep -n 'json:"' internal/core/types.go |
| 74 | + ``` |
| 75 | + |
| 76 | +4. Compare each against what's documented in `skills/SKILL.md` and `skills/references/`: |
| 77 | + - **New flag in code** → add to CLI Flags table + Quick Reference |
| 78 | + - **New config field** → add to Configuration File section in advanced-features.md |
| 79 | + - **Removed flag/field** → remove from docs |
| 80 | + - **Changed behavior** → update description |
| 81 | + - **Every `--flag` / `-flag` in docs** must have a matching hit in source |
| 82 | + |
| 83 | +### Step 3: Update Documentation |
| 84 | + |
| 85 | +Apply changes following the established structure: |
| 86 | + |
| 87 | +#### skills/SKILL.md structure: |
| 88 | + |
| 89 | +| Section | What to update | |
| 90 | +|---------|---------------| |
| 91 | +| Quick Reference | One-liner examples for new flags | |
| 92 | +| Container Safety | Sandbox config changes | |
| 93 | +| Writing Runbooks | New runbook syntax (separators, directives) | |
| 94 | +| Assertions | New assertion types (update count if changed) | |
| 95 | +| CLI Flags | Flag table — must match `cmd/mdproof/main.go` exactly | |
| 96 | +| Advanced Features | Pointer to references/ (add new topics if needed) | |
| 97 | +| Workflow | Rarely changes | |
| 98 | +| Self-Learning | Rarely changes | |
| 99 | +| Rules | Add rules for new features if needed | |
| 100 | + |
| 101 | +#### skills/references/assertions-guide.md structure: |
| 102 | + |
| 103 | +| Section | What to update | |
| 104 | +|---------|---------------| |
| 105 | +| Type sections | New assertion types get their own section | |
| 106 | +| Choosing table | Add rows for new assertion use cases | |
| 107 | +| Tips | New gotchas or best practices | |
| 108 | + |
| 109 | +#### skills/references/advanced-features.md structure: |
| 110 | + |
| 111 | +| Section | What to update | |
| 112 | +|---------|---------------| |
| 113 | +| Directives | New HTML comment directives | |
| 114 | +| Lifecycle Hooks | Per-runbook hooks (`--build`, `--setup`, `--teardown`) | |
| 115 | +| Per-Step Setup/Teardown | Per-step hooks (`-step-setup`, `-step-teardown`) | |
| 116 | +| Sub-Command Separator | `---` execution model, report format | |
| 117 | +| Configuration File | `mdproof.json` fields — must match Config struct | |
| 118 | +| Inline Testing | `--inline` mode | |
| 119 | +| Coverage Analysis | `--coverage` mode | |
| 120 | +| Watch Mode | `--watch` mode | |
| 121 | +| Step Filtering | `--steps`, `--from` | |
| 122 | +| Full Examples | Update or add examples for new features | |
| 123 | + |
| 124 | +### Step 4: Consistency Checks |
| 125 | + |
| 126 | +After updating, verify cross-references are consistent: |
| 127 | + |
| 128 | +1. **Assertion count** — `skills/SKILL.md` says "Six types" → count actual types in assertions-guide.md |
| 129 | +2. **Config example** — JSON example in advanced-features.md must include all Config struct fields |
| 130 | +3. **Flag table** — CLI Flags in SKILL.md must be a complete subset of flags in main.go |
| 131 | +4. **Quick Reference** — examples must use correct flag ordering (flags before file path — Go's `flag` package requirement) |
| 132 | +5. **Report fields** — any jq assertion examples must reference fields that actually exist in the JSON report |
| 133 | + |
| 134 | +### Step 5: Verify |
| 135 | + |
| 136 | +```bash |
| 137 | +# Ensure code still builds (catches any accidental code edits) |
| 138 | +go build ./... |
| 139 | + |
| 140 | +# Ensure tests pass |
| 141 | +go test ./... |
| 142 | +``` |
| 143 | + |
| 144 | +### Step 6: Report |
| 145 | + |
| 146 | +List all changes made with rationale: |
| 147 | + |
| 148 | +``` |
| 149 | +== Documentation Updates == |
| 150 | +
|
| 151 | +Modified: |
| 152 | + skills/SKILL.md |
| 153 | + - Added -step-setup/-step-teardown to CLI Flags table |
| 154 | + - Added sub-command separator section to Writing Runbooks |
| 155 | +
|
| 156 | + skills/references/advanced-features.md |
| 157 | + - Added Per-Step Setup/Teardown section |
| 158 | + - Updated Configuration File example with step_setup/step_teardown |
| 159 | +
|
| 160 | +No code changes. |
| 161 | +``` |
| 162 | + |
| 163 | +## Source-to-Doc Mapping Quick Reference |
| 164 | + |
| 165 | +| Source file | Doc file | What to check | |
| 166 | +|------------|----------|---------------| |
| 167 | +| `cmd/mdproof/main.go` | `skills/SKILL.md` | CLI Flags table, Quick Reference | |
| 168 | +| `internal/config/config.go` | `skills/references/advanced-features.md` | Configuration File section | |
| 169 | +| `internal/core/types.go` | `skills/references/assertions-guide.md` | Report field references in jq examples | |
| 170 | +| `internal/assertion/` | `skills/references/assertions-guide.md` | Assertion types and behavior | |
| 171 | +| `internal/executor/session.go` | `skills/references/advanced-features.md` | Execution model, hooks, sub-commands | |
| 172 | +| `internal/report/plain.go` | `skills/references/advanced-features.md` | Plain text report behavior | |
| 173 | +| `internal/report/junit.go` | `skills/references/advanced-features.md` | JUnit report behavior | |
| 174 | +| `CHANGELOG.md` | (use `changelog` skill) | User-facing release notes | |
| 175 | + |
| 176 | +## Rules |
| 177 | + |
| 178 | +- **Source of truth is Go code** — docs must match what the code actually does |
| 179 | +- **Every flag/config claim must be verified** — grep source before writing docs |
| 180 | +- **No speculative docs** — never document planned but unimplemented features |
| 181 | +- **No code changes** — this skill only touches `skills/` and `CHANGELOG.md` |
| 182 | +- **Preserve style** — match existing doc structure and tone |
| 183 | +- **Flag ordering** — all CLI examples must put flags before file paths |
| 184 | +- **Config field names** — use the exact `json:"..."` tag from Config struct (snake_case) |
0 commit comments