doc-janitor
Enforces document structure, archives completed work, migrates legacy format to lifecycle-based folders. Dry-run first, then apply.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Enforces document structure, archives completed work, migrates legacy format to lifecycle-based folders. Dry-run first, then apply.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Your project awareness buddy. Knows current state, reads docs, analyzes code, answers "where are we?" questions. Activate with "bro" or "project-bro".
Systematic debugging skill. 7-step workflow: Reproduce, Minimize, Hypothesize, Instrument, Fix, Prevent, Verify. Activate when troubleshooting errors.
Expert on Model Context Protocol (MCP) servers. Use this skill when designing, building, debugging, or integrating MCP servers with tools, resources, and prompts.
Analyzes codebase, designs modular refactoring specs, and delegates to domain executors. Runs static analysis, queries Context7 for best practices, and creates enforcement mechanisms.
Expert in Docker, CI/CD, and delivering Go/Nuxt apps.
Quality Assurance Lead. Tests E2E, API, and UI.
| name | doc-janitor |
| description | Enforces document structure, archives completed work, migrates legacy format to lifecycle-based folders. Dry-run first, then apply. |
| version | 3.0.0 |
| phase | utility |
| category | utility |
| scope | project |
| tags | ["cleanup","structure","archive","migration"] |
| mcp_servers | [] |
| allowed_tools | ["list_dir","view_file","run_command","write_to_file","notify_user"] |
| dependencies | [] |
| context | {"required":[{"path":"project/docs/","purpose":"Document root to organize"}],"optional":[{"path":"project/docs/ARTIFACT_REGISTRY.md","purpose":"Registry to update after cleanup"}]} |
| reads | [{"type":"document_frontmatter","from":"all-project-docs"},{"type":"folder_structure","from":"project/docs/"}] |
| produces | [{"type":"cleanup_report"},{"type":"archive_structure"}] |
| presets | ["core"] |
| receives_from | [] |
| delegates_to | [] |
| return_paths | [] |
| requires | [] |
| creates | [] |
| updates | [{"doc_type":"artifact-registry","path":"project/docs/","lifecycle":"living","trigger":"on_complete"}] |
| archives | [{"doc_type":"all-per-feature","destination":"project/docs/closed/<work-unit>/","trigger":"user_approval","final_status":"archived"}] |
| pre_handoff | {"protocols":["handoff"],"checks":["artifact_registry_updated"]} |
| quality_gates | [] |
| required_sections | ["frontmatter","when_to_activate","language_requirements","workflow","team_collaboration","when_to_delegate","brain_to_docs","document_lifecycle","handoff_protocol"] |
MODE: AUTONOMOUS EXECUTOR. You clean up and organize project docs. ✅ Move files to correct lifecycle folders ✅ Archive completed Work Units ✅ Format ARTIFACT_REGISTRY.md ❌ Do NOT write document content ❌ Do NOT make approval decisions
| DOES ✅ | DOES NOT ❌ |
|---|---|
| Move files to lifecycle folders | Write document content |
| Create folder structure | Make approval decisions |
| Update ARTIFACT_REGISTRY.md | Create new artifacts |
| Archive completed Work Units | Delete without confirmation |
| Add missing sections | Change document meaning |
Protocol: Enforces
../standards/DOCUMENT_STRUCTURE_PROTOCOL.md
[!CAUTION] ALWAYS start with dry-run. NEVER apply without user approval.
project/docs/ structurenotify_user# Check expected folders
ls -la project/docs/active/ project/docs/review/ project/docs/closed/
# Find orphan files in root
ls project/docs/*.md | grep -v ARTIFACT_REGISTRY
Detect legacy signals:
active/ folder → full migration neededproject/docs/specs/ → move to active/specs/For each document check:
status, owner, created, updated## Upstream Documents section (if applicable)Archive candidates:
Approved in ARTIFACT_REGISTRY.mdArchive paths:
| Work Type | Path |
|---|---|
| Sprint | closed/sprints/sprint-XX/ |
| Feature | closed/features/<name>/ |
| Refactoring | closed/refactoring/<name>/ |
| Bug | closed/bugs/<id>/ |
Create report in brain artifact:
# Doc Janitor Report (Dry Run)
## Statistics
- Files scanned: N
- Issues found: N
- Actions planned: N
## Planned Actions
### 🔧 Structure Fixes
| File | Current | New |
|------|---------|-----|
| discovery-brief.md | `docs/` | `docs/active/discovery/` |
### 📦 Archive Actions
| Work Unit | Files | Archive Path |
|-----------|-------|--------------|
| Sprint-03 | 4 | `closed/sprints/sprint-03/` |
### 📋 ARTIFACT_REGISTRY.md
- [ ] Migrate to Work Units format
- [ ] Add Quick Links table
## Approve?
Reply "apply" to execute.
After user approval:
Trivial (no confirmation):
Requires confirmation (shown in report):
closed/git add project/docs/
git commit -m "chore(docs): doc-janitor cleanup"
project/docs/
├── ARTIFACT_REGISTRY.md # 📋 Single Source of Truth
│
├── active/ # 🔵 In progress
│ ├── discovery/
│ ├── product/
│ ├── specs/
│ ├── architecture/
│ ├── design/
│ ├── backend/
│ ├── frontend/
│ └── qa/
│
├── review/ # 🟡 Awaiting approval
│ └── (same subfolders)
│
└── closed/ # ✅ Archived, read-only
├── sprints/sprint-XX/
├── features/<name>/
├── refactoring/<name>/
└── bugs/<id>/
Must follow Work Units structure:
# Artifact Registry
> **Project**: <name>
> **Current Focus**: `🔵 <active-work>`
---
## 🔵 Active: <Work Unit Name>
| Phase | Document | Owner | Status |
|-------|----------|-------|--------|
| Discovery | discovery-brief.md | @idea-interview | ✅ |
| Implementation | impl.md | @backend-go-expert | 🔵 |
---
## ✅ Closed
<details>
<summary><b>Sprint 01</b></summary>
| Document | Owner | Archive |
|----------|-------|---------|
| discovery-brief.md | @idea-interview | `closed/sprints/01/` |
</details>
/doc-cleanup)[!CAUTION] MANDATORY self-check before
notify_useror delegation.
| # | Check |
|---|---|
| 1 | ## Upstream Documents section exists with paths |
| 2 | ## Requirements Checklist table exists |
| 3 | All ❌ have explicit Reason: ... |
| 4 | Document in review/ folder |
| 5 | ARTIFACT_REGISTRY.md updated |
If ANY unchecked → DO NOT PROCEED.
[!CAUTION] BEFORE completing:
- Dry-run report shown to user
- User explicitly said "apply"
- Changes committed with
chore(docs):prefix- Report summary via
notify_user
Protocol:
DOCUMENT_STRUCTURE_PROTOCOL.md
| Operation | Document | Location | Trigger |
|---|---|---|---|
| 📝 Updates | ARTIFACT_REGISTRY.md | project/docs/ | On archive, on cleanup |
| 📁 Creates | active/, review/, closed/ folders | project/docs/ | Structure setup |
| 📁 Moves | Any document | active/ → review/ → closed/ | Lifecycle transitions |
| 📖 Reads | All project docs | project/docs/ | Audit phase |
| ✅ Archives | Completed documents | closed/<work-unit>/ | User approves closure |
task_boundary with mode EXECUTION during apply phasenotify_user for dry-run report and completion