|
| 1 | +--- |
| 2 | +name: doc-audit-update |
| 3 | +description: > |
| 4 | + Use this skill to apply documentation updates based on structured audit findings. |
| 5 | + Trigger when the user asks to fix, implement, or apply audit results. |
| 6 | +--- |
| 7 | + |
| 8 | +## Objective |
| 9 | + |
| 10 | +Apply audit findings to documentation with minimal necessary changes, preserving: |
| 11 | + |
| 12 | +- original tone |
| 13 | +- structure |
| 14 | +- formatting conventions |
| 15 | +- audience level |
| 16 | + |
| 17 | +This is a surgical update pass, not a rewrite. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Non-goals |
| 22 | + |
| 23 | +- Do not rewrite entire sections unless explicitly required |
| 24 | +- Do not “improve” writing beyond the finding |
| 25 | +- Do not standardize style across files |
| 26 | +- Do not fix unrelated issues you notice |
| 27 | +- Do not introduce new abstractions or restructure content |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Input |
| 32 | + |
| 33 | +- findings.yaml from the audit skill |
| 34 | +- Documentation files in repo |
| 35 | + |
| 36 | +Only act on findings where: |
| 37 | +- status is open or unspecified |
| 38 | +- edit_instructions are present |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Core principles |
| 43 | + |
| 44 | +### 1. Minimal diff rule |
| 45 | + |
| 46 | +Make the smallest possible change that resolves the issue. |
| 47 | + |
| 48 | +- Prefer replace over rewrite |
| 49 | +- Prefer augment over restructure |
| 50 | +- Preserve surrounding text verbatim whenever possible |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +### 2. Inline markup preservation |
| 55 | + |
| 56 | +When applying edits inside Markdown/MyST/rst inline constructs, preserve the existing markup unless the finding explicitly instructs otherwise. |
| 57 | + |
| 58 | +Examples of inline constructs: |
| 59 | + |
| 60 | +- markdown links: [text](url) |
| 61 | +- inline code: `value` |
| 62 | +- emphasis/bold |
| 63 | +- reference-style links |
| 64 | +- MyST roles/directives used inline |
| 65 | + |
| 66 | +Rules: |
| 67 | + |
| 68 | +- If correcting linked text, update only the visible label by default. |
| 69 | +- Do not replace a link with plain text unless the finding explicitly says to remove the link. |
| 70 | +- If the cited source should change, replace the URL while preserving link structure. |
| 71 | +- Prefer the smallest edit that keeps surrounding punctuation and markup intact. |
| 72 | + |
| 73 | +### 3. Style preservation |
| 74 | + |
| 75 | +Match the existing doc: |
| 76 | + |
| 77 | +- sentence structure |
| 78 | +- terminology |
| 79 | +- formatting (MyST, rst, markdown) |
| 80 | +- code block style |
| 81 | +- heading patterns |
| 82 | + |
| 83 | +If the doc uses inconsistent style, follow the local section, not global consistency. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +### 4. Locality |
| 88 | + |
| 89 | +Only modify the exact location defined by: |
| 90 | + |
| 91 | +- doc_locator |
| 92 | +- edit_instructions.target |
| 93 | + |
| 94 | +Do not move content unless explicitly required. |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +### 5. Deterministic edits |
| 99 | + |
| 100 | +Each finding should result in a clear, traceable change. |
| 101 | + |
| 102 | +No interpretation beyond what is needed to implement: |
| 103 | + |
| 104 | +- expected_behavior |
| 105 | +- recommended_update |
| 106 | +- edit_instructions |
| 107 | + |
| 108 | +If unclear → skip and flag. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Tool usage |
| 113 | + |
| 114 | +- Read — load doc files |
| 115 | +- Grep — locate text_match or fallback targets |
| 116 | +- Glob — confirm file paths |
| 117 | +- Bash — optional diff/validation |
| 118 | + |
| 119 | +Do not scan unrelated files. |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +## Update process |
| 124 | + |
| 125 | +1. Load findings.yaml |
| 126 | +2. Group findings by doc_file |
| 127 | +3. For each file: |
| 128 | + |
| 129 | + a. Open file |
| 130 | + b. Apply findings sequentially (stable order: by line proximity if possible) |
| 131 | + |
| 132 | +4. For each finding: |
| 133 | + |
| 134 | + - Resolve locator: |
| 135 | + - anchor → heading → text_match → semantic |
| 136 | + - Locate target text |
| 137 | + - Apply edit_type |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## Edit type behavior |
| 142 | + |
| 143 | +### replace |
| 144 | +Replace only the specified text span. |
| 145 | + |
| 146 | +### insert_before / insert_after |
| 147 | +Add text without modifying existing content. |
| 148 | + |
| 149 | +### augment |
| 150 | +Extend existing sentence/paragraph (do not rewrite). |
| 151 | + |
| 152 | +### delete |
| 153 | +Remove only the incorrect fragment. |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +## Conflict handling |
| 158 | + |
| 159 | +If multiple findings touch the same region: |
| 160 | + |
| 161 | +- Apply in order |
| 162 | +- Re-resolve locator after each change |
| 163 | + |
| 164 | +If conflict cannot be safely resolved: |
| 165 | + |
| 166 | +- skip |
| 167 | +- record in report |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +## Validation |
| 172 | + |
| 173 | +After applying changes: |
| 174 | + |
| 175 | +- Ensure file still parses (MyST / rst / markdown structure intact) |
| 176 | +- Ensure no broken code blocks or directives |
| 177 | +- Ensure links and anchors still valid (including GitHub line-specific links) |
| 178 | + |
| 179 | +### GitHub line-link validation |
| 180 | + |
| 181 | +For any GitHub URL that targets specific lines (for example `#L10-L24`): |
| 182 | + |
| 183 | +- Verify the linked lines still contain the referenced symbol, variable, function, or relevant content the documentation is citing. |
| 184 | +- Do not treat HTTP success or page existence as sufficient validation. |
| 185 | +- If the line range no longer points to the intended content: |
| 186 | + - update the URL to the correct line range if the same source location still exists |
| 187 | +- Preserve existing inline markup when updating the URL. |
| 188 | + |
| 189 | +Prefer the smallest change that keeps the citation accurate. |
| 190 | + |
| 191 | +--- |
| 192 | + |
| 193 | +## Output |
| 194 | + |
| 195 | +### 1. Updated files (in-place) |
| 196 | + |
| 197 | +Modify files directly in repo. |
| 198 | + |
| 199 | +--- |
| 200 | + |
| 201 | +### 2. Change report (required) |
| 202 | + |
| 203 | +Write: |
| 204 | + |
| 205 | +audit-results/{timestamp}/applied-updates.md |
| 206 | + |
| 207 | +Contents: |
| 208 | + |
| 209 | +```markdown |
| 210 | +## Update Summary |
| 211 | + |
| 212 | +**Files modified:** X |
| 213 | +**Findings applied:** X |
| 214 | +**Findings skipped:** X |
| 215 | + |
| 216 | +### Applied |
| 217 | + |
| 218 | +- F-001 — docs/api/authentication.md |
| 219 | +- F-002 — docs/tutorials/send-funds.md |
| 220 | + |
| 221 | +### Skipped |
| 222 | + |
| 223 | +- F-005 — locator not found |
| 224 | +- F-009 — ambiguous edit_instructions |
| 225 | +``` |
| 226 | + |
| 227 | +--- |
| 228 | + |
| 229 | +### 3. Optional: patch output |
| 230 | + |
| 231 | +If requested: |
| 232 | + |
| 233 | +audit-results/{timestamp}/changes.diff |
| 234 | + |
| 235 | +--- |
| 236 | + |
| 237 | +## Safety rules |
| 238 | + |
| 239 | +- Never fabricate missing context |
| 240 | +- Never guess correct values without evidence |
| 241 | +- If new_text is null: |
| 242 | + - derive text strictly from expected_behavior + recommended_update |
| 243 | +- If ambiguity remains: |
| 244 | + - skip and report |
| 245 | + |
| 246 | +--- |
| 247 | + |
| 248 | +## Update grouping (optional optimization) |
| 249 | + |
| 250 | +If update_group is present: |
| 251 | + |
| 252 | +- Apply grouped findings together |
| 253 | +- Maintain consistency within the group |
| 254 | +- Still follow minimal-change rule |
| 255 | + |
| 256 | +--- |
| 257 | + |
| 258 | +## When to stop |
| 259 | + |
| 260 | +Stop after all actionable findings are processed. |
| 261 | + |
| 262 | +Do not continue scanning for new issues. |
| 263 | + |
| 264 | +--- |
| 265 | + |
| 266 | +## Example behavior |
| 267 | + |
| 268 | +Finding: |
| 269 | +- Replace /v1/auth → /v2/auth |
| 270 | + |
| 271 | +Correct action: |
| 272 | +- Replace only the endpoint string |
| 273 | +- Do not rewrite surrounding paragraph |
| 274 | + |
| 275 | +--- |
| 276 | + |
| 277 | +## Mental model |
| 278 | + |
| 279 | +- Audit skill = detect + explain |
| 280 | +- Update skill = apply + preserve |
| 281 | + |
| 282 | +If the audit is precise, this should feel almost mechanical. |
0 commit comments