mk-project-context
Generate or update docs/project-context.md — the source of truth for conventions, tech stack, and anti-patterns, loaded by all agents as a constitution.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 16
- Forks
- 3
01 前言 Front Matter
- name
- mk-project-context
- description
- Generate or update docs/project-context.md — the source of truth for conventions, tech stack, and anti-patterns, loaded by all agents as a constitution.
02 资源文件 2
- 参考文档templates/project-context-template.md1.6 KB
- 参考文档templates/skeleton.md1.8 KB
03 SKILL.md 正文
Project Context Generator
Creates docs/project-context.md — the agent "constitution" that every agent loads on activation.
To generate the full documentation suite (README, architecture, code standards, etc.), use
mk:docs-initinstead.mk:project-contextgenerates only the agent constitution.
Purpose
Eliminate context drift between agents. Without a single authoritative file, agents infer conventions independently and make conflicting decisions. Project context solves this by providing one document all agents read first.
Actions
generate
Scan the codebase and create docs/project-context.md from scratch.
Scan targets:
package.json/Cargo.toml/go.mod/pyproject.toml→ tech stacktsconfig.json/eslint.*/prettier.*→ code conventions**/test/**/**/*.test.*/**/*.spec.*/**/*.cy.*→ testing patterns- Existing
docs/→ architecture decisions, prior context .env.example→ environment variables (names only, not values)
Output: docs/project-context.md using templates/project-context-template.md
update
Re-scan codebase and update existing docs/project-context.md. Preserves manual edits in sections marked <!-- manual -->.
init
Write a TODO-filled skeleton to docs/project-context.md for greenfield projects
where generate would produce empty sections (no codebase to scan yet).
Behaviour:
- If
docs/project-context.mdalready exists → refuse with error. Useupdateinstead. - If absent → write
templates/skeleton.mdtodocs/project-context.md. - Creates
docs/directory if it does not exist.
When to use init vs generate:
| Situation | Action |
|---|---|
| Empty or near-empty project, < 5 source files | init — fill manually |
| Established project with real code | generate — auto-derive |
Existing docs/project-context.md is stale |
update — re-scan, preserve manual edits |
When to Run
- First time: After
mk:bootstrapormk:docs-init - After architecture changes: New framework, new database, major refactor
- Periodically: When agents produce inconsistent code (symptom of stale context)
Focus on the Unobvious
The template emphasizes facts agents cannot infer from code:
- WHY a framework was chosen (not just what it is)
- Rejected alternatives ("use Zustand, NOT Redux")
- Anti-patterns specific to this project
- Testing boundaries (what to unit test vs e2e)
Template
See templates/project-context-template.md for the full structure.
Gotchas
- Stale context is worse than no context — re-run
updateafter major architecture changes - The template asks for "rejected alternatives" — this is the highest-value content. If you chose Zustand over Redux, say WHY
- Don't list every file path — agents can Glob for that. Focus on RULES and CONVENTIONS
<!-- manual -->sections surviveupdateaction but NOTgenerate— backup before regenerating from scratch- If project-context.md conflicts with AGENTS.md, AGENTS.md wins (it's the higher-priority document)
initrefuses to overwrite an existingdocs/project-context.md— this is intentional. Delete the file manually if you truly want to reset to a blank skeleton.
Integration
All agents load docs/project-context.md in their Required Context section. If the file doesn't exist, agents behave exactly as before (graceful degradation).
Files in this skill
SKILL.md— you are heretemplates/project-context-template.md— output template used bygenerateactiontemplates/skeleton.md— TODO-placeholder constitution template used byinitaction
04 同仓库更多 Skills
mk-worktree
Manages git worktrees for parallel agent isolation: creates parallel/{name}-{timestamp} branches, merges with conflict detection. NOT for user feature branches (use git worktree directly).
mk-workflow-orchestrator
Auto-invoked 7-phase workflow for complex-feature intent; fasttrack mode for pre-approved specs. NOT for explicit single tasks (mk:cook), green-field builds (mk:autobuild), or simple fixes (mk:fix).
mk-web-to-markdown
Fetch a URL and return clean markdown, for arbitrary external pages (blog, RFC, GitHub issue, vendor doc) not covered by mk:docs-finder. Static-only by default; opt-in JS rendering available.
mk-vulnerability-scanner
Vulnerability analysis: OWASP Top 10, current threat landscape, supply chain security, attack surface mapping, risk prioritization. Use for security audits. NOT for STRIDE/CSO infra audits (mk:cso).
mk-vue
Vue 3 authoring/review: components, composables, reactivity, Pinia, Pinia Colada, file routing, forms. Composition API + script setup. Auto-activates on .vue files. Deep review: mk:vue-best-practices.
mk-vue-testing-best-practices
Vue 3 testing best-practices review: Vitest + Vue Test Utils for components, composables, Pinia, Router, async/Suspense, forms, a11y, plus Playwright E2E strategy. Advisory only.