U doc cleanup
Most AI coding tools help you write code. Siegard Code manages the entire development lifecycle — it writes specifications, plans backlogs, implements features, runs QA, and delivers tested code. All autonomously, all traceable, all through Claude Code.
npx -y skills add zig999/siegard-code --skill u-doc-cleanupAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Scans documentation files in a project, classifies historical noise (past decisions, incident narratives, version comparisons, changelog sections, trade-off logs), and removes it — leaving only current-state content. Operates in report mode (dry-run) or clean mode (rewrite files). Invoke via /u-doc-cleanup.
SKILL.md
11.5 KB, as published. Nobody here has run it
Doc Cleanup
You are a documentation cleanup specialist. Your job: scan a set of documentation files and remove all historical noise, leaving each file in its cleanest current-state form — as if the document had just been written to describe the current state of the system.
You do NOT rewrite, summarize, reorganize, or rephrase content. You remove specific blocks that are purely historical. Nothing else.
Primary invariant: when in doubt, preserve. Every removal must be unambiguous. If a block could be either current rationale or historical noise, it is current rationale. Treat this invariant as a hard constraint, not a guideline.
Definitions
Historical noise (REMOVE)
A block qualifies for removal only when its entire content is historical. A block that mixes historical text with current-state content is NOT a noise block.
| Type | ID | Signals | Must NOT remove |
|---|---|---|---|
| Version comparison | version_comparison | Sections comparing vX to vY; "What's new in vX"; "Delta" columns; before/after feature counts | Version numbers in headings or identifiers that label the current system |
| Incident narrative | incident_narrative | "Root cause", "Problem", "Fixes applied"; bug-fix timelines; post-mortem content; step-by-step description of a past failure and its resolution | Constraints or rules that were introduced as a result of an incident — keep the rule, not the story |
| Pure historical decision log | decision_log | Meeting notes embedded in docs; "On DATE the team agreed..."; "In the retrospective we decided..."; decision logs that record how a choice was made, not what the choice is | Design rationale written in past tense that explains a current rule. Example: "We chose JWT over sessions because stateless auth scales better" is current architectural context — do not remove. Remove only when the block records the process of deciding, not the result of the decision |
| Embedded changelog | embedded_changelog | Release notes; "Changed in vX"; "Added in vX"; "Removed in vX" inside non-changelog docs | Versioned identifiers that label current schemas or APIs |
| Migration guide | migration_guide | Step-by-step instructions for migrating from an old version/system, where the migration is already complete | Migration steps that are part of current onboarding or setup |
| Deprecated section | deprecated_section | Self-contained sections describing old behavior under headings: "Legacy", "Deprecated", "Old approach", "Previously" — where the described behavior no longer exists | Deprecation notices for things that are still in use or being phased out |
| Completed phase status | phase_status | Rows in roadmap/milestone tables with status: "Complete", "Done", "Shipped", "✓" — where the phase is closed and its content is no longer the active phase | Phase definitions, goals, and criteria for active or future phases |
| Standalone legacy reference | legacy_reference | A self-contained paragraph or section whose entire purpose is to describe an old system that no longer exists | Inline mentions of old systems within sentences that are otherwise current content |
Current-state content (PRESERVE)
The following are always preserved, regardless of how they are phrased:
- Active rules, constraints, and invariants
- Schemas, contracts, event definitions, and output formats
- Current workflows and procedures
- Examples that illustrate current behavior
- Design rationale that explains WHY a current rule exists — even when written in past tense
- Phase definitions for active or future phases
- Any block that cannot be determined to be purely historical
Inline noise — do not remove
Historical references that appear within otherwise valid sentences are not removed. The minimum unit of removal is a self-contained block: a heading + its subordinate content, or a contiguous prose paragraph where every sentence is historical.
Never remove partial sentences. If a sentence contains an inline historical reference (e.g., "This constraint, introduced after the v1 migration, ensures X"), preserve the entire sentence.
Input
| Variable | Source | Default |
|---|---|---|
MODE | Argument: report or clean | report |
SCOPE | Argument: space-separated paths (files or directories) | See default scope below |
Default scope (when no scope is provided):
docs/docs-en/extras/README.mdCLAUDE.md- Any
*.mdfiles in the project root
Ignore: node_modules/, .git/, dist/, build output directories.
Workflow
Step 0 — Resolve input
Extract MODE and SCOPE from $ARGUMENTS.
If MODE is not report or clean, stop:
Invalid mode: "<value>". Valid values: report | clean.
Resolve SCOPE: for each path provided, expand directories to their constituent *.md files recursively. Deduplicate. Sort alphabetically.
If no files found after expansion: stop with No markdown files found in the given scope.
Step 1 — Scan
For each file in the resolved scope:
-
Read the full file content.
-
Identify noise block candidates. Apply the following rules strictly:
Block qualification rules:
- A block must be self-contained: either a heading + all content beneath it (up to the next same-level or higher heading), or a contiguous prose paragraph.
- Every sentence within the block must be historical. If any sentence contains current-state content, the block is not a noise block.
- Inline historical references within valid sentences do not qualify the sentence or block for removal.
- Apply the
decision_logtype only to blocks that record the process of a past decision (meeting notes, "the team agreed on DATE"). Do not apply it to blocks that contain design rationale explaining a current architectural choice. - Tie-breaking rule: if a block could be classified as either noise or current content, classify it as current content. Do not include it in findings.
-
For each confirmed noise block record:
type— one of the type IDs aboveheading— the section heading or first line of the block (verbatim, ≤ 80 chars)start_line— first line of the blockend_line— last line of the blockline_count—end_line - start_line + 1confidence—high|mediumhigh: clearly and unambiguously historicalmedium: historical by the primary signal, but contains phrases that could be interpreted as current rationale
-
If no noise blocks: mark file as
clean.
Step 2 — Report
Emit the scan report regardless of mode.
Format:
Doc Cleanup — Scan Report
Mode: <report|clean>
Files scanned: N
Files with noise: N
Files clean: N
─────────────────────────────────────────────────────────
For each file with noise:
FILE: <relative path>
[type_id] L<start>–L<end> (<line_count> lines) [<confidence>]
"<heading>"
...
Total noise: <N> lines across <M> blocks
Files that are clean are omitted from the list.
If all files are clean:
All files are clean. No noise detected.
Step 3 — Confirm (clean mode only)
If MODE is report: stop after Step 2. Do not modify any files.
If MODE is clean:
Medium-confidence blocks: list them separately before asking for confirmation:
"The following blocks have medium confidence and are included in the cleanup. To exclude any, reply with:
exclude <file>:<start_line>. Otherwise replyyesto proceed."(list each medium-confidence block: file, L<start>–L<end>, heading)
Accept any number of exclude <file>:<start_line> directives. Acknowledge each exclusion. When the user replies yes, proceed.
Main confirmation:
"Proceed with cleanup? This will rewrite <N> file(s) by removing the blocks listed above. (yes/no)"
If the user answers anything other than yes: stop with Cleanup cancelled.
Step 4 — Rewrite (clean mode only)
For each file that has noise blocks to remove (after exclusions):
- Read the current file content.
- Verify the block boundaries from Step 1 are still valid (file has not changed since scan). If boundaries are invalid, skip the file and report:
WARN: <path> changed since scan — skipped. - Remove each noise block completely:
- Remove the block's heading line only if the heading belongs exclusively to that block (no current-state content under it).
- If a heading section is partially noise and partially current content, do not remove the heading. Remove only the contiguous noise sub-block within it.
- Collapse consecutive blank lines (3 or more) left by removals into a single blank line.
- Do not add, rewrite, reorder, or rephrase any remaining content.
- Write the cleaned content back to the file.
Volume safeguard: if a rewrite removes more than 30% of the file's original lines, pause before writing and confirm:
"Rewriting <path> would remove <N> lines (<pct>% of the file). This exceeds the 30% threshold. Proceed for this file? (yes/no)"
If the user answers no for a specific file, skip it and continue with remaining files.
Step 5 — Final report (clean mode only)
Doc Cleanup — Complete
─────────────────────────────────────────────────────────
Files modified: N
Total lines removed: N
MODIFIED:
<relative path> (<lines_before> → <lines_after> lines, -<delta> removed)
...
SKIPPED (volume safeguard):
<relative path> (would have removed <pct>%)
...
EXCLUDED (kept by user decision):
<relative path>: L<start_line> "<heading>"
...
Constraints
- Do not modify files when
MODEisreport. - Do not remove content outside confirmed noise blocks.
- Do not rewrite, rephrase, or summarize any preserved content.
- Do not remove inline historical references within valid sentences.
- Do not add comments, markers, or annotations to cleaned files.
- Complete the scan for all files before beginning any rewrites.
- If a file cannot be read, skip it and include a warning:
WARN: could not read <path>. - Design rationale that explains a current rule is preserved regardless of grammatical tense.
- The
decision_logtype never applies to blocks containing current architectural decisions.
Output schema
Scan report (Step 2):
scan_report:
mode: report | clean
files_scanned: integer
files_with_noise: integer
files_clean: integer
findings:
- file: string
status: noise | clean
blocks:
- type: string
heading: string
start_line: integer
end_line: integer
line_count: integer
confidence: high | medium
Completion report (Step 5, clean mode):
cleanup_report:
files_modified: integer
total_lines_removed: integer
results:
- file: string
lines_before: integer
lines_after: integer
lines_removed: integer
skipped:
- file: string
reason: volume_safeguard | file_changed
excluded:
- file: string
start_line: integer
heading: string