mk:project-context
Generates and updates docs/project-context.md, the conventions file that every agent loads.
| Source | .claude/skills/project-context/SKILL.md |
| Owner | docs |
| Runtime | claude-code |
| Risk | medium |
What it does
Creates and maintains docs/project-context.md, the file every agent loads on activation. It holds the tech stack, conventions and anti-patterns, so agents stop inferring conventions on their own and making conflicting choices. If the file is missing, agents work without it. Run it after mk:bootstrap or mk:docs-init, after an architecture change such as a new framework or database, or when agents produce inconsistent code.
When not to use
For the whole documentation suite (README, architecture, code standards) use mk:docs-init. This skill writes only the agent constitution. If docs/project-context.md conflicts with CLAUDE.md, CLAUDE.md wins.
Usage
/mk:project-context [generate|update|init]| Action | What it does | Use when |
|---|---|---|
generate | Scans the codebase and writes a draft docs/project-context.md from templates/project-context-template.md, filling only what a scan can show and leaving judgment sections as prompts | An established project with real code |
update | Rescans and refreshes the file, keeping sections marked <!-- manual --> | The existing file is stale |
init | Writes the same template with its TODO prompts, creating docs/ if needed | An empty project with fewer than five source files |
init refuses to overwrite an existing file. Use update, or delete the file by hand to reset it. generate replaces <!-- manual --> sections, so back them up first.
What generate scans
| Target | Used for |
|---|---|
package.json, Cargo.toml, go.mod, pyproject.toml | Tech stack |
tsconfig.json, eslint.*, prettier.* | Code conventions |
**/test/**, **/*.test.*, **/*.spec.*, **/*.cy.* | Testing patterns |
Existing docs/ | Architecture decisions and prior context |
.env.example | Variable names only, never values |
What belongs in the file
The template favours what agents cannot infer from code: why a framework was chosen, alternatives that were rejected ("use Zustand, not Redux"), anti-patterns specific to the project and testing boundaries (unit versus e2e). Rejected alternatives are the most useful part, so say why. Do not list every file path, since agents can search for those. Stale context is worse than none, so rerun update after major changes.