From semantic-git-skills
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 /semantic-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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/semantic-git-skills:semantic-gitThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate `*.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.
Generate *.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.
Documentation 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.
| Scope | File name | Example |
|---|---|---|
| Whole repo overview | OVERVIEW.semantic.md at repo root | OVERVIEW.semantic.md |
| Whole repo architecture | ARCHITECTURE.semantic.md at repo root | ARCHITECTURE.semantic.md |
| A directory/module | .semantic.md inside that directory | src/lib/offline/.semantic.md |
| A specific file | <filename>.semantic.md next to that file | src/lib/notes.semantic.md next to notes.ts |
.semantic.md inside that directory. This appears at the top of the file tree for that folder.<filename>.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).OVERVIEW.semantic.md, ARCHITECTURE.semantic.md) go at the repo root..semantic-manifest.json) goes at the repo root. It tracks all generated doc locations.OVERVIEW.semantic.md # Repo entry point
ARCHITECTURE.semantic.md # System architecture
.semantic-manifest.json # Tracks all docs
apps/
├── web/src/lib/
│ ├── notes.ts
│ ├── notes.semantic.md # Explains notes.ts specifically
│ ├── sentence-generation.ts
│ ├── sentence-generation.semantic.md # Explains sentence-generation.ts
│ ├── review.ts
│ ├── review.semantic.md # Explains review.ts
│ └── offline/
│ ├── idb.ts
│ ├── sync.ts
│ └── .semantic.md # Explains the offline module
└── extension/src/
└── .semantic.md # Explains the extension module
These files are committed to the repo (not gitignored) so they render on GitHub and version alongside code.
Scan 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/barrel file, a distinct subdirectory.
Apply these rules:
| Situation | Action |
|---|---|
| Directory with 1-3 small files | Mention in parent directory's .semantic.md |
| Directory with 4-15 files or >500 total lines | Gets a .semantic.md inside that directory |
| Directory with >15 files or >2000 lines | Directory .semantic.md + individual <file>.semantic.md for complex files |
| Single complex file (>300 lines, non-trivial logic) | Gets its own <filename>.semantic.md next to it |
| Config/build files | Document in OVERVIEW.semantic.md unless unusually complex |
| Test directories | Document what is tested and testing approach, not individual test files |
Complexity overrides size. A 50-line file implementing a non-obvious algorithm deserves more explanation than a 500-line file of repetitive CRUD handlers.
For detailed guidance, read references/granularity.md.
Never generate *.semantic.md files for:
Before 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/, dist/, build/, .env, __pycache__/, .next/, coverage/, etc.
These files are self-explanatory or too generic to warrant their own semantic doc:
package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock, go.sum, Gemfile.lock, requirements.txt, poetry.lock.gitignore, .gitattributes, .editorconfig, .prettierrc, .eslintrc, tsconfig.json, jest.config.*, vite.config.*, next.config.*, webpack.config.*, babel.config.*, .env.examplemanifest.json (browser extensions), Dockerfile, docker-compose.yml, .github/, .gitlab-ci.ymlLICENSE, LICENSE.mdThese 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 <filename>.semantic.md.
Never create *.semantic.semantic.md or document .semantic-manifest.json.
Each *.semantic.md file follows this structure. For full templates, read references/output-format.md.
Every generated file starts with this header:
<!-- Generated by semantic-git. Do not edit manually -- regenerate with /semantic-git -->
Always generated first. Lives at the repo root. Contains:
*.semantic.md files to read for which topics, with relative pathsLives at the repo root. The system-level view:
Run this when the user invokes /semantic-git or when no *.semantic.md files exist yet.
.gitignore first and skip all gitignored paths. Also skip .git/ and any *.semantic.md 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.OVERVIEW.semantic.md at the repo root first — this forces you to understand the whole system before diving into parts.ARCHITECTURE.semantic.md at the repo root with system-level diagrams..semantic-manifest.json at the repo root tracking all doc locations and their commit SHAs.Run this when code changes and *.semantic.md files already exist.
python <skill-path>/scripts/diff_analyzer.py or inspect git diff HEAD~1 --name-status to identify changed files..semantic-manifest.json to see what was previously documented.*.semantic.md doc covers it (the manifest maps source paths to doc paths).OVERVIEW.semantic.md and ARCHITECTURE.semantic.md if structural changes occurred (new modules, renamed directories, changed architecture)..semantic-manifest.json with new commit SHAs and any new doc paths.When running for a PR (user opened or is reviewing a PR):
.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.
{
"version": 1,
"last_full_generation": "<commit-sha>",
"generated_by": "semantic-git",
"docs": {
"OVERVIEW.semantic.md": {
"covers": ["."],
"last_updated_commit": "<sha>"
},
"ARCHITECTURE.semantic.md": {
"covers": ["."],
"last_updated_commit": "<sha>"
},
"src/auth/.semantic.md": {
"covers": ["src/auth/"],
"last_updated_commit": "<sha>"
},
"src/lib/notes.semantic.md": {
"covers": ["src/lib/notes.ts"],
"last_updated_commit": "<sha>"
}
}
}
Doc paths in the manifest are relative to the repo root. Compare manifest SHAs against current HEAD to determine which docs are stale.
After generating or updating docs, set up a post-commit hook so future commits trigger incremental updates automatically.
.git/hooks/post-commit exists.#!/bin/sh
# semantic-git: auto-update documentation on commit
echo "[semantic-git] Docs may need updating. Run: claude -p 'update semantic-git docs for the latest commit'"
chmod +x).The 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.
This skill works on any language. Use these heuristics:
index.*, __init__.py, mod.rs, lib.rs indicate module entry points.test/, spec/, __tests__/, *_test.*, *.spec.* are test suites.*.config.*, .env*, docker-compose.*, Makefile, Dockerfile.package.json, Cargo.toml, go.mod, pyproject.toml, pom.xml, build.gradle reveal project structure and dependencies.Before overwriting any *.semantic.md file:
Use mermaid for architecture and data flow diagrams because it renders natively on GitHub.
graph TD (top-down) for hierarchical relationshipsgraph LR (left-right) for data flow / pipelinessequenceDiagram for request/response flowsExample:
graph TD
A[HTTP Request] --> B[Router]
B --> C[Auth Middleware]
C --> D[Controller]
D --> E[Service Layer]
E --> F[(Database)]
For platforms that don't render mermaid, also include a brief ASCII description below the diagram as a fallback.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.
npx claudepluginhub kwosei/semantic-git --plugin semantic-git-skills