Context Engineering For Projects
by @lywhlao2025
Build or initialize team-style project context directories for context engineering. Use when the user says “构建/初始化项目上下文”, “针对该项目构建上下文”, **or** in English phr...
clawhub install context-engineering-for-projects-skill📖 About This Skill
name: context-engineering description: Build or initialize team-style project context directories for context engineering. Use when the user says “构建/初始化项目上下文”, “针对该项目构建上下文”, or in English phrases like “build/initialize project context”, “scaffold project context”, “set up project context docs”, “create project context”, “generate project context docs”, “initialize context engineering project”, “set up team context”, “build context workspace”, or asks to scaffold a project context under a specified target directory (default ~/clawDir/team).
Context Engineering
Overview
Create a consistent project context structure (team navigation + project folder) and link it to a code directory. Default target root is ~/clawDir/team, but allow the user to specify another root path.
Loading Model (L1/L2/L3)
skill.md — global overview, module navigation, environment notes.modules/ + agents/ — task-scoped module docs and agent role docs. Load the module overview first, then specific submodules; load the relevant agent README when working on that role’s tasks.references/ — entrypoints, API indices, migrations, evidence-level docs.Workflow
1. Collect inputs
- project_name (folder name)
- code_dir (absolute path to the code)
- target_root (optional). If not provided, use ~/clawDir/team.
2. Analyze the code structure
- Identify tech stack and main areas (frontend/backend/qa/etc.) from code directory structure and key files.
- Read top-level docs: README*, docs/, tech.md, architecture.md, CHANGELOG* if present.
3. Initialize the context structure - Prefer running the bundled script:
python scripts/init_context_project.py \
--project \
--code-dir \
--target-root
- The script infers module buckets from the codebase and creates module folders dynamically.
- The script is idempotent: it won’t overwrite existing files.4. Populate content (critical)
- Fill skill.md (L1) with project summary, architecture, entrypoints, build/run, module navigation.
- Fill modules/ (overview) and modules/ (detail).
- Fill references/entrypoints.md with code-level entrypoints and indexes.
5. Post-init checks
- Verify the created files exist and are filled under: .
- If the user wants custom content, update modules and references accordingly.
- Record major changes in decisions.md (project-level) or decisions.jsonl (agent-level).
Modules Directory Guidance
modules/ is generated based on the target codebase (not fixed).frontend, backend, qa, reviewer (only if inferred).modules//README.md and a modules//.md for detailed module notes.mobile, data, ops, infra), create that module.Generation Rules (Modules & Agents)
Modules
modules//README.md (overview)
- modules//.md (details: Scope, Key Responsibilities, Important Notes, Interfaces & Dependencies)
A.md, B.md, C.md). In that case, .md becomes an index/summary that describes each sub-file and when to load it.Agents
agents// .reviewer.README.md with Role, Principles, Responsibilities, Deliverables, Working Style, Notes
- tools.md (Markdown)
- memory.md (Markdown)
- decisions.jsonl (JSONL, one decision per line)
- fails.jsonl (JSONL, one failure per line)
Content Extraction Rules (General)
Keep SKILL.md lean. For detailed extraction guidance (entrypoints, flows, data, tests, i18n), load:
references/extraction-rules.mdOutput Templates (Required)
L1 (skill.md)
L2 (modules//README.md)
L2 (modules//.md)
L2 (agents//README.md)
L3 (references/entrypoints.md)
Quality Checklist (Before Finalizing)
Files Created
/readme.md (if missing)/projects/projects.md (index with new project entry)/projects//readme.md /projects//goals.md /projects//skill.md /projects//project_status.md /projects//decisions.md /projects//agents/agents.md /projects//modules/README.md /projects//modules//README.md (modules inferred from code)/projects//modules//.md /projects//references/entrypoints.md Resources
scripts/init_context_project.py — scaffold generator (preferred).