{"data":{"slug":"discovered-e6d5e1f67cddaad34c3fc06e128acb3d66d180ca977e308d","title":"Docs Tracker \u2014 File \u2192 Domain Mapping Rules (v2.0.0)","summary":"Detects modified files via `git diff-tree`, classifies them via `.claude\/config\/domain-mapping.json`, and emits actions for `documenter` to apply (Edit known anchors, never Write over existing files; bidirectional connections; cap commit log at 20).","url":"https:\/\/skillshunter.net\/skills\/discovered-e6d5e1f67cddaad34c3fc06e128acb3d66d180ca977e308d","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-e6d5e1f67cddaad34c3fc06e128acb3d66d180ca977e308d","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-e6d5e1f67cddaad34c3fc06e128acb3d66d180ca977e308d.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-e6d5e1f67cddaad34c3fc06e128acb3d66d180ca977e308d\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Always invoke this skill after `commit-manager` succeeds to ensure the commit hash is real. Use `git diff-tree --no-commit-id --name-status -r HEAD` to detect files in the last commit. Bidirectional connections must be updated atomically, and any failure in one edit should roll back the other.","instructions":"---\nname: docs-tracker\nversion: 2.0.0\ndescription: \"File \u2192 domain mapping rules and changelog templates consumed by `documenter` v2.0.0. Detects modified files via `git diff-tree`, classifies them via `.claude\/config\/domain-mapping.json`, and emits the actions documenter must apply (Edit known anchors, never Write over existing files; bidirectional connections; cap commit log at 20).\"\n---\n\n# Docs Tracker \u2014 File \u2192 Domain Mapping Rules (v2.0.0)\n\n**ALWAYS invoke AFTER `commit-manager` succeeds (so the commit hash is real).**\n\nThis skill is the **rule set** consumed by `documenter` v2.0.0. It does not write files itself \u2014 it tells documenter what to do with each changed file.\n\n## Detection (one git call, not many)\n\n```bash\n# Files in the LAST commit (after commit-manager pushed)\ngit diff-tree --no-commit-id --name-status -r HEAD\n```\n\nStatus codes: `A` = added, `M` = modified, `D` = deleted, `R` = renamed, `C` = copied. Treat `R` and `C` as `M` for mapping purposes plus a \"renamed from\" note in the destination domain.\n\n## File \u2192 Domain mapping\n\nSource of truth: `.claude\/config\/domain-mapping.json` (shipped with this CLI; project may override). A path may map to \u22651 domain. Unmatched paths \u2192 `general`.\n\nSkip the entire pass if every changed path matches one of:\n\n| Skip pattern | Reason |\n|---|---|\n| `.claude\/**` | meta \u2014 does not belong to any product domain |\n| `docs\/**` | docs commit \u2014 no code drift |\n| `.github\/**` | CI \u2014 handled by `infrastructure` domain only if pattern is added |\n| `CHANGELOG*`, `*.md` (root only) | release docs |\n| `package.json`, `composer.json`, `pyproject.toml` (deps only \u2014 not scripts) | bumps tracked elsewhere |\n\n## Action matrix (applied by `documenter`)\n\n| Git status | Domain file state | Action |\n|---|---|---|\n| `A` | exists | `Edit`: append row to `## Files`, prepend row to `## Recent Commits`, increment `files_count` in frontmatter |\n| `A` | missing | `Write`: create from `TEMPLATE.md`, fill TL;DR, add the file row, add the commit row |\n| `M` | exists | `Edit`: prepend row to `## Recent Commits`; if file's role description changed, update its row in `## Files` |\n| `M` | missing | unusual \u2014 investigate; usually means mapping rule was added but file existed before. Treat as `A` |\n| `D` | exists | `Edit`: strike-through (`~~path~~`) row in `## Files`, decrement `files_count`. Prune at the next pass |\n| `R src\u2192dst` | exists | `Edit`: replace `src` row with `dst` row, add note `(renamed from src in <short-sha>)` to Attention Points |\n\n## Bidirectional connections (mandatory)\n\nWhen a session adds `auth \u2192 api` to `auth.md`, **also** add `api \u2190 auth` to `api.md`. The two edits must succeed atomically \u2014 if the second fails, roll back the first. The `security-auditor` flags dangling links as a MEDIUM finding.\n\n## Cap and archive (size guard)\n\nAfter any edit, check the live file:\n\n```bash\n[ \"$(wc -c < domains\/<slug>.md)\" -gt 8192 ] && trigger_archive\n```\n\nWhen triggered, move the **oldest 5 rows** of `## Recent Commits` (and oldest 2 Problems & Solutions, oldest 3 Attention Points) into `<slug>.archive.md`. Live file must stay \u2264 8 KB.\n\n## Index regeneration (after every pass)\n\n```bash\n# Regenerate _index.json from frontmatter of every domain file\nfor f in .claude\/skills\/codebase-knowledge\/domains\/*.md; do\n  # parse YAML frontmatter, compute summary_sha = sha256(TL;DR block), emit one record\ndone | jq -s '{schema_version:1, generated_at:(now|todate), domain_count:length, domains:.}' \\\n     > .claude\/skills\/codebase-knowledge\/_index.json\n\n# Then derive _INDEX.md from _index.json\n```\n\n`_index.json` is the source of truth \u2014 `_INDEX.md` is human-readable derivative.\n\n## Pre-commit hook (CI integration)\n\nA repository can add this check to fail builds when documenter forgot to run:\n\n```bash\nHEAD_SHA=$(git rev-parse --short HEAD)\nLAST_INDEXED=$(jq -r '.domains | map(.last_commit) | unique[]' \\\n  .claude\/skills\/codebase-knowledge\/_index.json)\necho \"$LAST_INDEXED\" | grep -qx \"$HEAD_SHA\" || {\n  echo \"ERROR: _index.json is stale. Run documenter before pushing.\"\n  exit 1\n}\n```\n\n## Rules\n\n1. **AFTER `commit-manager`** \u2014 never before; the hash must be real.\n2. **DETECT VIA GIT** \u2014 `git diff-tree -r HEAD`, never guess from session memory.\n3. **EDIT KNOWN ANCHORS** \u2014 `documenter` uses `Edit` \/ `StrReplace` on existing domain files; never `Write` over them.\n4. **BIDIRECTIONAL** \u2014 both ends of every connection updated atomically.\n5. **CAP AT 8 KB \/ 20 commits \/ 10 attention \/ 5 P&S** \u2014 archive overflow into `<slug>.archive.md`.\n6. **REGENERATE `_index.json` EVERY PASS** \u2014 derived; never hand-edited.\n7. **SKIP META PATHS** \u2014 `.claude\/**`, `docs\/**`, `.github\/**` do not get domain entries.\n\n## See Also\n\n- `documenter` v2.0.0 \u2014 applies the actions defined here\n- `codebase-knowledge` v2.0.0 \u2014 reads what documenter wrote\n- `domain-updater` v2.0.0 \u2014 appends session wisdom AFTER documenter\n- `.claude\/config\/domain-mapping.json` \u2014 pattern \u2192 domain rules\n","use_cases":["Automatically update domain files based on git changes","Maintain bidirectional connections between domains","Cap commit logs and archive overflow content","Regenerate index files after each pass"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/0x57-1\/start-vibing-stacks\/blob\/6e398b34c4dfe73ac8f809216b218856b8e02ff4\/stacks\/_shared\/skills\/docs-tracker\/SKILL.md","source_commit":"6e398b34c4dfe73ac8f809216b218856b8e02ff4","license":null,"version":null,"listing_approved_at":"2026-12-03","created_at":"2026-12-02T09:11:10.000000Z","updated_at":"2026-12-03T16:20:08.000000Z","seo_title":"Docs Tracker \u2014 File to Domain Mapping Rules","seo_description":"A tool for mapping modified files to domains and generating changelog actions for documenter. Ensures bidirectional connections, caps commit logs, and regenerates index.","seo_keywords":["git diff-tree","file to domain mapping","documenter actions","bidirectional connections","commit log capping","index regeneration"]}}