[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HZXM49MG074WQ06JVMRA1Q":3,"skill-same:01M6HZXM49MG074WQ06JVMRA1Q":88},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":14,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M6HZXM49MG074WQ06JVMRA1Q","semantic-git",null,"Generate and maintain human-readable documentation that explains what a codebase does, so someone can understand the system without reading code. Use this skill whenever the user commits code, opens a PR, asks to document a repo, asks \"what does this code do\", wants an overview of a codebase, mentions generating docs, says \"explain this repo\", says \"document this\", or runs \u002Fsemantic-git. Also trigger after any commit or PR creation to keep docs up to date. If the user says anything about understanding, explaining, or documenting code, use this skill.","kwosei\u002Fsemantic-git","kwosei","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10491280?v=4","01M6HZXJ43H1SQBM5P4XB1ACA4","Kojo Osei","01M6HZXJ9WWG66YTT11YNM206K",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"semantic git","semantic","git","generating docs","reading","trigger","creation","pr creation","human","maintain","do","commit","up","repo","system","commits","code","generate","pr","documentation","2026-11-10 10:12:30",false,"---\nname: semantic-git\ndescription: >\n  Generate and maintain human-readable documentation that explains what a codebase does,\n  so someone can understand the system without reading code. Use this skill whenever the\n  user commits code, opens a PR, asks to document a repo, asks \"what does this code do\",\n  wants an overview of a codebase, mentions generating docs, says \"explain this repo\",\n  says \"document this\", or runs \u002Fsemantic-git. Also trigger after any commit or PR creation\n  to keep docs up to date. If the user says anything about understanding, explaining, or\n  documenting code, use this skill.\n---\n\n# semantic-git\n\nGenerate `*.semantic.md` documentation that serves as an alternative to reading source code. Someone unfamiliar with the repo should understand the system's purpose, architecture, data flow, and key decisions just from these files.\n\n## Output Location — Colocated with Code\n\nDocumentation files live **next to the code they describe**, not in a separate directory. This makes them discoverable in the IDE file tree — you see the explanation right next to the source.\n\n### Naming Convention\n\n| Scope | File name | Example |\n|-------|-----------|---------|\n| Whole repo overview | `OVERVIEW.semantic.md` at repo root | `OVERVIEW.semantic.md` |\n| Whole repo architecture | `ARCHITECTURE.semantic.md` at repo root | `ARCHITECTURE.semantic.md` |\n| A directory\u002Fmodule | `.semantic.md` inside that directory | `src\u002Flib\u002Foffline\u002F.semantic.md` |\n| A specific file | `\u003Cfilename>.semantic.md` next to that file | `src\u002Flib\u002Fnotes.semantic.md` next to `notes.ts` |\n\n### Placement Rules\n\n1. **If a doc explains a directory** (a group of files working together), place `.semantic.md` inside that directory. This appears at the top of the file tree for that folder.\n2. **If a doc explains a single file**, place `\u003Cfilename>.semantic.md` next to it. This sorts adjacent to the source file in the IDE (e.g., `notes.semantic.md` appears right next to `notes.ts`).\n3. **Repo-wide docs** (`OVERVIEW.semantic.md`, `ARCHITECTURE.semantic.md`) go at the repo root.\n4. **The manifest** (`.semantic-manifest.json`) goes at the repo root. It tracks all generated doc locations.\n\n### Example Layout\n\n```\nOVERVIEW.semantic.md                           # Repo entry point\nARCHITECTURE.semantic.md                       # System architecture\n.semantic-manifest.json                        # Tracks all docs\napps\u002F\n├── web\u002Fsrc\u002Flib\u002F\n│   ├── notes.ts\n│   ├── notes.semantic.md                      # Explains notes.ts specifically\n│   ├── sentence-generation.ts\n│   ├── sentence-generation.semantic.md        # Explains sentence-generation.ts\n│   ├── review.ts\n│   ├── review.semantic.md                     # Explains review.ts\n│   └── offline\u002F\n│       ├── idb.ts\n│       ├── sync.ts\n│       └── .semantic.md                       # Explains the offline module\n└── extension\u002Fsrc\u002F\n    └── .semantic.md                           # Explains the extension module\n```\n\nThese files are committed to the repo (not gitignored) so they render on GitHub and version alongside code.\n\n## How to Decide What Gets Documented\n\nScan the repo and identify logical boundaries. A \"module\" is a directory or group of files serving a cohesive purpose. Signs: shared imports, a clear public API, an index\u002Fbarrel file, a distinct subdirectory.\n\nApply these rules:\n\n| Situation | Action |\n|-----------|--------|\n| Directory with 1-3 small files | Mention in parent directory's `.semantic.md` |\n| Directory with 4-15 files or >500 total lines | Gets a `.semantic.md` inside that directory |\n| Directory with >15 files or >2000 lines | Directory `.semantic.md` + individual `\u003Cfile>.semantic.md` for complex files |\n| Single complex file (>300 lines, non-trivial logic) | Gets its own `\u003Cfilename>.semantic.md` next to it |\n| Config\u002Fbuild files | Document in `OVERVIEW.semantic.md` unless unusually complex |\n| Test directories | Document what is tested and testing approach, not individual test files |\n\n**Complexity overrides size.** A 50-line file implementing a non-obvious algorithm deserves more explanation than a 500-line file of repetitive CRUD handlers.\n\nFor detailed guidance, read `references\u002Fgranularity.md`.\n\n## What NOT to Document\n\nNever generate `*.semantic.md` files for:\n\n### Gitignored files and directories\n\nBefore documenting anything, check the repo's `.gitignore` (and any nested `.gitignore` files). If a file or directory is gitignored, do not create a semantic doc for it. Common gitignored paths include `node_modules\u002F`, `dist\u002F`, `build\u002F`, `.env`, `__pycache__\u002F`, `.next\u002F`, `coverage\u002F`, etc.\n\n### Utility and config files\n\nThese files are self-explanatory or too generic to warrant their own semantic doc:\n\n- **Package manifests**: `package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `Cargo.lock`, `go.sum`, `Gemfile.lock`, `requirements.txt`, `poetry.lock`\n- **Dotfiles and config**: `.gitignore`, `.gitattributes`, `.editorconfig`, `.prettierrc`, `.eslintrc`, `tsconfig.json`, `jest.config.*`, `vite.config.*`, `next.config.*`, `webpack.config.*`, `babel.config.*`, `.env.example`\n- **Manifests and metadata**: `manifest.json` (browser extensions), `Dockerfile`, `docker-compose.yml`, `.github\u002F`, `.gitlab-ci.yml`\n- **Lock files and generated files**: anything auto-generated by tooling\n- **License and legal**: `LICENSE`, `LICENSE.md`\n\nThese files should be **mentioned** in `OVERVIEW.semantic.md` or a parent `.semantic.md` where relevant (e.g., \"the project uses TypeScript — see `tsconfig.json`\"), but they do not get their own `\u003Cfilename>.semantic.md`.\n\n### The semantic docs themselves\n\nNever create `*.semantic.semantic.md` or document `.semantic-manifest.json`.\n\n## Document Content Format\n\nEach `*.semantic.md` file follows this structure. For full templates, read `references\u002Foutput-format.md`.\n\nEvery generated file starts with this header:\n\n```markdown\n\u003C!-- Generated by semantic-git. Do not edit manually -- regenerate with \u002Fsemantic-git -->\n```\n\n### Required Sections\n\n1. **Title and one-paragraph summary** — what this module\u002Fsystem does in plain English\n2. **Why it exists** — the problem it solves or role it plays\n3. **How it works** — step-by-step explanation of the main flow using numbered lists\n4. **Key concepts** — define domain terms or abstractions the code introduces\n5. **Diagram** — mermaid for anything with >3 nodes, ASCII for simple linear flows\n6. **Data flow** — what goes in, how it transforms, what comes out (if relevant)\n7. **Important files** — the 3-7 most important source files with one-line descriptions. These are \"if you must read code, start here\" pointers.\n8. **Edge cases and gotchas** — anything surprising, non-obvious, or historically tricky\n9. **Dependencies** — internal and external dependencies\n\n### OVERVIEW.semantic.md (Special)\n\nAlways generated first. Lives at the repo root. Contains:\n- What the project is and who it's for\n- How to get started (build, run, test)\n- High-level structure map\n- **Reading guide**: which `*.semantic.md` files to read for which topics, with relative paths\n\n### ARCHITECTURE.semantic.md (Special)\n\nLives at the repo root. The system-level view:\n- Mermaid diagram showing all major subsystems and relationships\n- Data flow across the full system\n- Key architectural decisions and rationale (if inferable)\n- Technology choices\n\n## Writing Style\n\n- Explain as if to a new team member on their first day\n- Avoid jargon unless you define it immediately\n- Use concrete examples over abstract descriptions\n- Prefer \"This module takes X and produces Y\" over \"This module is responsible for the transformation pipeline\"\n- Use present tense (\"handles\", \"sends\", \"validates\")\n- Keep paragraphs short (2-4 sentences max)\n\n## Running Modes\n\n### Full Generation (first run or explicit request)\n\nRun this when the user invokes `\u002Fsemantic-git` or when no `*.semantic.md` files exist yet.\n\n1. Scan the entire repo. Read `.gitignore` first and skip all gitignored paths. Also skip `.git\u002F` and any `*.semantic.md` files.\n2. Read project metadata files (`package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `README.md`, etc.) to understand project intent — but do not create semantic docs for these files themselves.\n3. Build a mental model of the repo structure. Identify logical modules using the granularity framework.\n4. Generate `OVERVIEW.semantic.md` at the repo root first — this forces you to understand the whole system before diving into parts.\n5. Generate `ARCHITECTURE.semantic.md` at the repo root with system-level diagrams.\n6. Generate colocated module\u002Ffile docs in dependency order (document dependencies before dependents). Place each doc next to the code it describes per the naming convention.\n7. Generate `.semantic-manifest.json` at the repo root tracking all doc locations and their commit SHAs.\n\n### Incremental Update (on commit)\n\nRun this when code changes and `*.semantic.md` files already exist.\n\n1. Run `python \u003Cskill-path>\u002Fscripts\u002Fdiff_analyzer.py` or inspect `git diff HEAD~1 --name-status` to identify changed files.\n2. Read `.semantic-manifest.json` to see what was previously documented.\n3. For each changed file, identify which `*.semantic.md` doc covers it (the manifest maps source paths to doc paths).\n4. Re-read the changed source files and the existing doc. Update only affected sections.\n5. If new directories\u002Fmodules appeared, decide whether they need a new colocated doc or belong in an existing one.\n6. If a module was deleted, remove its colocated doc.\n7. Update `OVERVIEW.semantic.md` and `ARCHITECTURE.semantic.md` if structural changes occurred (new modules, renamed directories, changed architecture).\n8. Update `.semantic-manifest.json` with new commit SHAs and any new doc paths.\n\n### PR Mode\n\nWhen running for a PR (user opened or is reviewing a PR):\n\n1. Do everything in incremental update mode.\n2. Additionally, output a plain-English summary of what changed and how it affects the documented architecture. This summary goes directly in your response (not in a file).\n\n## The Manifest File\n\n`.semantic-manifest.json` at the repo root enables efficient incremental updates. Since docs are colocated throughout the repo, the manifest is the single index that tracks where all docs live.\n\n```json\n{\n  \"version\": 1,\n  \"last_full_generation\": \"\u003Ccommit-sha>\",\n  \"generated_by\": \"semantic-git\",\n  \"docs\": {\n    \"OVERVIEW.semantic.md\": {\n      \"covers\": [\".\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"ARCHITECTURE.semantic.md\": {\n      \"covers\": [\".\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"src\u002Fauth\u002F.semantic.md\": {\n      \"covers\": [\"src\u002Fauth\u002F\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"src\u002Flib\u002Fnotes.semantic.md\": {\n      \"covers\": [\"src\u002Flib\u002Fnotes.ts\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    }\n  }\n}\n```\n\nDoc paths in the manifest are relative to the repo root. Compare manifest SHAs against current HEAD to determine which docs are stale.\n\n## Git Hook Auto-Setup\n\nAfter generating or updating docs, set up a post-commit hook so future commits trigger incremental updates automatically.\n\n### Setup Steps\n\n1. Check if `.git\u002Fhooks\u002Fpost-commit` exists.\n2. If it does not exist, create it:\n\n```bash\n#!\u002Fbin\u002Fsh\n# semantic-git: auto-update documentation on commit\necho \"[semantic-git] Docs may need updating. Run: claude -p 'update semantic-git docs for the latest commit'\"\n```\n\n3. If it already exists, check if it already contains a semantic-git section. If not, append the reminder block above.\n4. Ensure the hook file is executable (`chmod +x`).\n5. Tell the user the hook was set up and what it does.\n\nThe hook prints a reminder rather than auto-running Claude, since auto-running an AI agent in a git hook could be surprising. The user can upgrade this to auto-run if they prefer.\n\n## Language-Agnostic Analysis\n\nThis skill works on any language. Use these heuristics:\n\n- **File extensions** identify languages, but don't rely on language-specific parsing.\n- **Barrel files**: `index.*`, `__init__.py`, `mod.rs`, `lib.rs` indicate module entry points.\n- **Test directories**: `test\u002F`, `spec\u002F`, `__tests__\u002F`, `*_test.*`, `*.spec.*` are test suites.\n- **Config files**: `*.config.*`, `.env*`, `docker-compose.*`, `Makefile`, `Dockerfile`.\n- **Project metadata**: `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`, `build.gradle` reveal project structure and dependencies.\n- **Import\u002Frequire statements** reveal dependency graphs even without AST parsing.\n- **README files** provide intent context — read them if they exist.\n\n## Protecting Manual Edits\n\nBefore overwriting any `*.semantic.md` file:\n\n1. Check if the file's content differs from what semantic-git last wrote (compare against manifest commit).\n2. If the file was modified outside of semantic-git (manual edits), warn the user and ask before overwriting.\n3. If the user approves, overwrite. If not, skip that file and note it in the manifest as \"manually maintained\".\n\n## Mermaid Diagram Guidelines\n\nUse mermaid for architecture and data flow diagrams because it renders natively on GitHub.\n\n- Use `graph TD` (top-down) for hierarchical relationships\n- Use `graph LR` (left-right) for data flow \u002F pipelines\n- Use `sequenceDiagram` for request\u002Fresponse flows\n- Keep diagrams under 15 nodes — split into multiple diagrams if larger\n- Label edges with the action or data being passed\n- Use subgraphs to group related components\n\nExample:\n\n```mermaid\ngraph TD\n    A[HTTP Request] --> B[Router]\n    B --> C[Auth Middleware]\n    C --> D[Controller]\n    D --> E[Service Layer]\n    E --> F[(Database)]\n```\n\nFor platforms that don't render mermaid, also include a brief ASCII description below the diagram as a fallback.\n","# semantic-git\n\nGenerate `*.semantic.md` documentation that serves as an alternative to reading source code. Someone unfamiliar with the repo should understand the system's purpose, architecture, data flow, and key decisions just from these files.\n\n## Output Location — Colocated with Code\n\nDocumentation files live **next to the code they describe**, not in a separate directory. This makes them discoverable in the IDE file tree — you see the explanation right next to the source.\n\n### Naming Convention\n\n| Scope | File name | Example |\n|-------|-----------|---------|\n| Whole repo overview | `OVERVIEW.semantic.md` at repo root | `OVERVIEW.semantic.md` |\n| Whole repo architecture | `ARCHITECTURE.semantic.md` at repo root | `ARCHITECTURE.semantic.md` |\n| A directory\u002Fmodule | `.semantic.md` inside that directory | `src\u002Flib\u002Foffline\u002F.semantic.md` |\n| A specific file | `\u003Cfilename>.semantic.md` next to that file | `src\u002Flib\u002Fnotes.semantic.md` next to `notes.ts` |\n\n### Placement Rules\n\n1. **If a doc explains a directory** (a group of files working together), place `.semantic.md` inside that directory. This appears at the top of the file tree for that folder.\n2. **If a doc explains a single file**, place `\u003Cfilename>.semantic.md` next to it. This sorts adjacent to the source file in the IDE (e.g., `notes.semantic.md` appears right next to `notes.ts`).\n3. **Repo-wide docs** (`OVERVIEW.semantic.md`, `ARCHITECTURE.semantic.md`) go at the repo root.\n4. **The manifest** (`.semantic-manifest.json`) goes at the repo root. It tracks all generated doc locations.\n\n### Example Layout\n\n```\nOVERVIEW.semantic.md                           # Repo entry point\nARCHITECTURE.semantic.md                       # System architecture\n.semantic-manifest.json                        # Tracks all docs\napps\u002F\n├── web\u002Fsrc\u002Flib\u002F\n│   ├── notes.ts\n│   ├── notes.semantic.md                      # Explains notes.ts specifically\n│   ├── sentence-generation.ts\n│   ├── sentence-generation.semantic.md        # Explains sentence-generation.ts\n│   ├── review.ts\n│   ├── review.semantic.md                     # Explains review.ts\n│   └── offline\u002F\n│       ├── idb.ts\n│       ├── sync.ts\n│       └── .semantic.md                       # Explains the offline module\n└── extension\u002Fsrc\u002F\n    └── .semantic.md                           # Explains the extension module\n```\n\nThese files are committed to the repo (not gitignored) so they render on GitHub and version alongside code.\n\n## How to Decide What Gets Documented\n\nScan the repo and identify logical boundaries. A \"module\" is a directory or group of files serving a cohesive purpose. Signs: shared imports, a clear public API, an index\u002Fbarrel file, a distinct subdirectory.\n\nApply these rules:\n\n| Situation | Action |\n|-----------|--------|\n| Directory with 1-3 small files | Mention in parent directory's `.semantic.md` |\n| Directory with 4-15 files or >500 total lines | Gets a `.semantic.md` inside that directory |\n| Directory with >15 files or >2000 lines | Directory `.semantic.md` + individual `\u003Cfile>.semantic.md` for complex files |\n| Single complex file (>300 lines, non-trivial logic) | Gets its own `\u003Cfilename>.semantic.md` next to it |\n| Config\u002Fbuild files | Document in `OVERVIEW.semantic.md` unless unusually complex |\n| Test directories | Document what is tested and testing approach, not individual test files |\n\n**Complexity overrides size.** A 50-line file implementing a non-obvious algorithm deserves more explanation than a 500-line file of repetitive CRUD handlers.\n\nFor detailed guidance, read `references\u002Fgranularity.md`.\n\n## What NOT to Document\n\nNever generate `*.semantic.md` files for:\n\n### Gitignored files and directories\n\nBefore documenting anything, check the repo's `.gitignore` (and any nested `.gitignore` files). If a file or directory is gitignored, do not create a semantic doc for it. Common gitignored paths include `node_modules\u002F`, `dist\u002F`, `build\u002F`, `.env`, `__pycache__\u002F`, `.next\u002F`, `coverage\u002F`, etc.\n\n### Utility and config files\n\nThese files are self-explanatory or too generic to warrant their own semantic doc:\n\n- **Package manifests**: `package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `Cargo.lock`, `go.sum`, `Gemfile.lock`, `requirements.txt`, `poetry.lock`\n- **Dotfiles and config**: `.gitignore`, `.gitattributes`, `.editorconfig`, `.prettierrc`, `.eslintrc`, `tsconfig.json`, `jest.config.*`, `vite.config.*`, `next.config.*`, `webpack.config.*`, `babel.config.*`, `.env.example`\n- **Manifests and metadata**: `manifest.json` (browser extensions), `Dockerfile`, `docker-compose.yml`, `.github\u002F`, `.gitlab-ci.yml`\n- **Lock files and generated files**: anything auto-generated by tooling\n- **License and legal**: `LICENSE`, `LICENSE.md`\n\nThese files should be **mentioned** in `OVERVIEW.semantic.md` or a parent `.semantic.md` where relevant (e.g., \"the project uses TypeScript — see `tsconfig.json`\"), but they do not get their own `\u003Cfilename>.semantic.md`.\n\n### The semantic docs themselves\n\nNever create `*.semantic.semantic.md` or document `.semantic-manifest.json`.\n\n## Document Content Format\n\nEach `*.semantic.md` file follows this structure. For full templates, read `references\u002Foutput-format.md`.\n\nEvery generated file starts with this header:\n\n```markdown\n\u003C!-- Generated by semantic-git. Do not edit manually -- regenerate with \u002Fsemantic-git -->\n```\n\n### Required Sections\n\n1. **Title and one-paragraph summary** — what this module\u002Fsystem does in plain English\n2. **Why it exists** — the problem it solves or role it plays\n3. **How it works** — step-by-step explanation of the main flow using numbered lists\n4. **Key concepts** — define domain terms or abstractions the code introduces\n5. **Diagram** — mermaid for anything with >3 nodes, ASCII for simple linear flows\n6. **Data flow** — what goes in, how it transforms, what comes out (if relevant)\n7. **Important files** — the 3-7 most important source files with one-line descriptions. These are \"if you must read code, start here\" pointers.\n8. **Edge cases and gotchas** — anything surprising, non-obvious, or historically tricky\n9. **Dependencies** — internal and external dependencies\n\n### OVERVIEW.semantic.md (Special)\n\nAlways generated first. Lives at the repo root. Contains:\n- What the project is and who it's for\n- How to get started (build, run, test)\n- High-level structure map\n- **Reading guide**: which `*.semantic.md` files to read for which topics, with relative paths\n\n### ARCHITECTURE.semantic.md (Special)\n\nLives at the repo root. The system-level view:\n- Mermaid diagram showing all major subsystems and relationships\n- Data flow across the full system\n- Key architectural decisions and rationale (if inferable)\n- Technology choices\n\n## Writing Style\n\n- Explain as if to a new team member on their first day\n- Avoid jargon unless you define it immediately\n- Use concrete examples over abstract descriptions\n- Prefer \"This module takes X and produces Y\" over \"This module is responsible for the transformation pipeline\"\n- Use present tense (\"handles\", \"sends\", \"validates\")\n- Keep paragraphs short (2-4 sentences max)\n\n## Running Modes\n\n### Full Generation (first run or explicit request)\n\nRun this when the user invokes `\u002Fsemantic-git` or when no `*.semantic.md` files exist yet.\n\n1. Scan the entire repo. Read `.gitignore` first and skip all gitignored paths. Also skip `.git\u002F` and any `*.semantic.md` files.\n2. Read project metadata files (`package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `README.md`, etc.) to understand project intent — but do not create semantic docs for these files themselves.\n3. Build a mental model of the repo structure. Identify logical modules using the granularity framework.\n4. Generate `OVERVIEW.semantic.md` at the repo root first — this forces you to understand the whole system before diving into parts.\n5. Generate `ARCHITECTURE.semantic.md` at the repo root with system-level diagrams.\n6. Generate colocated module\u002Ffile docs in dependency order (document dependencies before dependents). Place each doc next to the code it describes per the naming convention.\n7. Generate `.semantic-manifest.json` at the repo root tracking all doc locations and their commit SHAs.\n\n### Incremental Update (on commit)\n\nRun this when code changes and `*.semantic.md` files already exist.\n\n1. Run `python \u003Cskill-path>\u002Fscripts\u002Fdiff_analyzer.py` or inspect `git diff HEAD~1 --name-status` to identify changed files.\n2. Read `.semantic-manifest.json` to see what was previously documented.\n3. For each changed file, identify which `*.semantic.md` doc covers it (the manifest maps source paths to doc paths).\n4. Re-read the changed source files and the existing doc. Update only affected sections.\n5. If new directories\u002Fmodules appeared, decide whether they need a new colocated doc or belong in an existing one.\n6. If a module was deleted, remove its colocated doc.\n7. Update `OVERVIEW.semantic.md` and `ARCHITECTURE.semantic.md` if structural changes occurred (new modules, renamed directories, changed architecture).\n8. Update `.semantic-manifest.json` with new commit SHAs and any new doc paths.\n\n### PR Mode\n\nWhen running for a PR (user opened or is reviewing a PR):\n\n1. Do everything in incremental update mode.\n2. Additionally, output a plain-English summary of what changed and how it affects the documented architecture. This summary goes directly in your response (not in a file).\n\n## The Manifest File\n\n`.semantic-manifest.json` at the repo root enables efficient incremental updates. Since docs are colocated throughout the repo, the manifest is the single index that tracks where all docs live.\n\n```json\n{\n  \"version\": 1,\n  \"last_full_generation\": \"\u003Ccommit-sha>\",\n  \"generated_by\": \"semantic-git\",\n  \"docs\": {\n    \"OVERVIEW.semantic.md\": {\n      \"covers\": [\".\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"ARCHITECTURE.semantic.md\": {\n      \"covers\": [\".\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"src\u002Fauth\u002F.semantic.md\": {\n      \"covers\": [\"src\u002Fauth\u002F\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    },\n    \"src\u002Flib\u002Fnotes.semantic.md\": {\n      \"covers\": [\"src\u002Flib\u002Fnotes.ts\"],\n      \"last_updated_commit\": \"\u003Csha>\"\n    }\n  }\n}\n```\n\nDoc paths in the manifest are relative to the repo root. Compare manifest SHAs against current HEAD to determine which docs are stale.\n\n## Git Hook Auto-Setup\n\nAfter generating or updating docs, set up a post-commit hook so future commits trigger incremental updates automatically.\n\n### Setup Steps\n\n1. Check if `.git\u002Fhooks\u002Fpost-commit` exists.\n2. If it does not exist, create it:\n\n```bash\n#!\u002Fbin\u002Fsh\n# semantic-git: auto-update documentation on commit\necho \"[semantic-git] Docs may need updating. Run: claude -p 'update semantic-git docs for the latest commit'\"\n```\n\n3. If it already exists, check if it already contains a semantic-git section. If not, append the reminder block above.\n4. Ensure the hook file is executable (`chmod +x`).\n5. Tell the user the hook was set up and what it does.\n\nThe hook prints a reminder rather than auto-running Claude, since auto-running an AI agent in a git hook could be surprising. The user can upgrade this to auto-run if they prefer.\n\n## Language-Agnostic Analysis\n\nThis skill works on any language. Use these heuristics:\n\n- **File extensions** identify languages, but don't rely on language-specific parsing.\n- **Barrel files**: `index.*`, `__init__.py`, `mod.rs`, `lib.rs` indicate module entry points.\n- **Test directories**: `test\u002F`, `spec\u002F`, `__tests__\u002F`, `*_test.*`, `*.spec.*` are test suites.\n- **Config files**: `*.config.*`, `.env*`, `docker-compose.*`, `Makefile`, `Dockerfile`.\n- **Project metadata**: `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`, `build.gradle` reveal project structure and dependencies.\n- **Import\u002Frequire statements** reveal dependency graphs even without AST parsing.\n- **README files** provide intent context — read them if they exist.\n\n## Protecting Manual Edits\n\nBefore overwriting any `*.semantic.md` file:\n\n1. Check if the file's content differs from what semantic-git last wrote (compare against manifest commit).\n2. If the file was modified outside of semantic-git (manual edits), warn the user and ask before overwriting.\n3. If the user approves, overwrite. If not, skip that file and note it in the manifest as \"manually maintained\".\n\n## Mermaid Diagram Guidelines\n\nUse mermaid for architecture and data flow diagrams because it renders natively on GitHub.\n\n- Use `graph TD` (top-down) for hierarchical relationships\n- Use `graph LR` (left-right) for data flow \u002F pipelines\n- Use `sequenceDiagram` for request\u002Fresponse flows\n- Keep diagrams under 15 nodes — split into multiple diagrams if larger\n- Label edges with the action or data being passed\n- Use subgraphs to group related components\n\nExample:\n\n```mermaid\ngraph TD\n    A[HTTP Request] --> B[Router]\n    B --> C[Auth Middleware]\n    C --> D[Controller]\n    D --> E[Service Layer]\n    E --> F[(Database)]\n```\n\nFor platforms that don't render mermaid, also include a brief ASCII description below the diagram as a fallback.\n",{"name":5,"description":7},"main","3bbc42dcf4435a3903509c87897511ac39833e07","skills\u002Fsemantic-git","https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git","https:\u002F\u002Fgithub.com\u002Fkwosei","https:\u002F\u002Fkojo.blog\u002F","long humanity, short pessimism. vc @ Matrix","2026-03-26 02:52:42",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add kwosei\u002Fsemantic-git --skill semantic-git",{"tool":58,"command":59},"bunx","bunx skills add kwosei\u002Fsemantic-git --skill semantic-git",{"tool":61,"command":62},"pnpm","pnpm dlx skills add kwosei\u002Fsemantic-git --skill semantic-git","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002FSKILL.md",true,[66,72,78,82],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"LICENSE.txt","LICENSE","许可证",10757,"https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002FLICENSE.txt",{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fgranularity.md","REFERENCE","参考文档",6354,"https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002Freferences\u002Fgranularity.md",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Foutput-format.md",5826,"https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002Freferences\u002Foutput-format.md",{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"scripts\u002Fdiff_analyzer.py","SCRIPT","脚本",5801,"https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Fskills\u002Fsemantic-git\u002Fscripts\u002Fdiff_analyzer.py",[89],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":39},"01M6HZXS67MQD592JV08ERBNNK","template-skill","Replace with a description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002Fkwosei\u002Fsemantic-git\u002Fblob\u002Fmain\u002Ftemplate\u002FSKILL.md",[],[96,97,98,99,100],"template skill","template","use","it","with"]