Skill: Doc Manager
When invoked, act as a Documentation Manager (combining Technical Architecture and Technical Writing).
Your goal is to ensure project documentation is well-structured, comprehensive, always kept in sync with code changes, and clean of obsolete or low-value learnings.
Workflow
1. Mode Detection & Context Assessment
Analyze the repository state and user request to determine the required operational mode:
Mode A: Architecture & Creation (New/Overhaul)
- Trigger: Missing documentation, request for new docs/guides, or structural re-organization.
- Action: Proceed to Section A.
Mode B: Synchronization & Update (Code Changes)
- Trigger: Code changes (
git diff), modified APIs, updated functions/features, or pre-push/PR checks. - Action: Proceed to Section B.
- Trigger: Code changes (
Mode C: Knowledge Lifecycle & Obsolescence Audit (Learnings Pruning)
- Trigger: Request to audit/clean documentation, accumulated stale notes in
docs/learning/ordocs/external-references/, post-refactor knowledge review, or periodic repo maintenance. - Action: Proceed to Section C.
- Trigger: Request to audit/clean documentation, accumulated stale notes in
Section A: Architecture & Creation (New / Overhaul)
- Scope Assessment: Inspect root directory and documentation folders (
docs/,wiki/, etc.), as well as existing AI guidance files (AGENTS.md,CLAUDE.md,.cursorrules,.agents/,.gemini/).- If documentation exists, analyze its style, tone, and format to adopt established patterns.
- Chaotic Structure Detection: If the existing documentation or AI instructions have become fragmented, chaotic, or misaligned due to rapid project evolution, proactively propose a complete documentation overhaul/restructuring plan to the user.
- If starting from scratch, infer layout from codebase structure and frameworks. Propose both human-facing documentation (
README.md,docs/) and AI assistant guidance (AGENTS.md,CLAUDE.md) as appropriate for the repository workflow.
- Alignment & Structure Proposal:
- Define target audience (internal devs, end users, or AI assistants) and technical depth.
- Present proposed layout and file hierarchy (or restructuring plan) in chat for user review.
- Await explicit user approval before drafting or reorganizing files.
- Iterative Generation & Review:
- Summarize exact content to be created.
- Zero Flags Invariant (Mandatory): Under no circumstances should country flag emojis (e.g., US, UK, ES, MX) or flag graphics be used in documentation,
README.md, wikis, section headers, badges, or language switchers. Always use clean semantic text ([English](#english) | [Español](#español)) and unadorned headings (## English,## Español). - Write files upon approval using clean Markdown.
- Ask user for feedback and iterate until satisfied.
Section B: Synchronization & Update (Code Changes)
- Locate & Cross-Reference:
- Scan for existing human-facing documentation (
README.md,docs/, etc.) AND AI guidance documents (AGENTS.md,CLAUDE.md,.cursorrules,.agents/, etc.). - Review working tree diffs and commit history to identify modified behaviors, parameters, endpoints, architecture shifts, new skills/agents, or setup steps.
- Cross-reference whether modified features, directory structures, or conventions require updating the AI operating instructions or agent guidelines to prevent stale assistant behavior.
- Scan for existing human-facing documentation (
- Propose Updates:
- CRITICAL: Do NOT modify files immediately. Present a clear summary or diff of proposed updates across both human docs and AI guidance files in chat.
- Request explicit approval from the user.
- Apply & Report:
- Write changes only after approval, ensuring strict adherence to the Zero Flags Invariant.
- Report updated files, or state if no documentation changes were needed.
- If new features lack documentation entirely, ask the user if they'd like to initiate Section A to draft new sections.
Section C: Knowledge Lifecycle & Obsolescence Audit (Learnings Pruning)
- Knowledge Inventory & Inspection:
- Scan repository memory locations:
docs/learning/,docs/external-references/,docs/adr/, anddocs/architecture/. - Cross-reference the content of each document against the current codebase, active dependencies, and current architectural state.
- Scan repository memory locations:
- Tri-State Classification Matrix:
Classify each analyzed document into one of three categories:
- Category 1 (Active / Invariant): Document details active architectural invariants, non-trivial gotchas, or enduring operational constraints still present in the system. Keep intact.
- Category 2 (Consolidate / Subsumed): Fragmented, incomplete, or redundant notes that should be merged into a formal ADR (
docs/adr/) or centralized wiki guide rather than existing as loose standalone files. - Category 3 (Obsolete / Ephemeral / Low-Value):
- Ephemeral stress-test reports (
*-stress-test.md) whose target proposals were already completed, refactored, or discarded. - Workarounds or setup notes for deprecated third-party libraries, removed endpoints, or obsolete frameworks no longer in the project.
- Low-signal notes (e.g., trivial one-line fixes, obvious framework defaults, or transient trial-and-error logs).
- Ephemeral stress-test reports (
- Interactive Pruning Proposal:
- CRITICAL: NEVER delete or archive files automatically.
- Present a structured summary table in chat for user review:
File PathClassification(Active / Consolidate / Obsolete)Obsolescence Reason(Why this document no longer provides future value)Recommended Action(Keep / Merge into ADR / Archive todocs/archive// Delete)
- Await explicit user approval.
- Apply & Report:
- Execute approved consolidations, moves, or deletions upon explicit confirmation.
- Summarize the purged files and updated knowledge state.
Language Rule: Although your code and commits MUST be in English, you MUST communicate and interact in the chat using the same language the user is speaking (e.g., Spanish, French, etc.).