5. Team Assembly
The N × M × P Problem
At team scale, context engineering faces a combinatorial challenge:
- N developers: different roles, tools, communication preferences
- M projects: different stacks, conventions, deployment targets
- P configurations: each developer × each project needs a configuration
Maintaining N × M individual CLAUDE.md files manually is not sustainable. When a shared convention changes, you update N × M files. When a new project is created, you build from scratch. When a developer changes roles, you rebuild their configurations.
The solution is profile-based assembly: a single shared base of modules, with individual profiles that specify which modules to include and what personal preferences to overlay.
N × M × P becomes N profiles × 1 shared module base, a manageable structure.
Profile YAML Structure
Each team member has a profile YAML that declaratively specifies their configuration:
# profiles/alice.yaml
profile:
name: "Alice"
role: "frontend"
tools:
- typescript
- react
- tailwind
conventions:
- atomic-design
- accessibility-first
communication:
language: "en"
verbosity: "concise"
modules:
include:
- shared/core-rules.md
- shared/git-conventions.md
- shared/security-baseline.md
- frontend/react-patterns.md
- frontend/tailwind-conventions.md
- frontend/testing-rtl.md
- frontend/accessibility-checklist.md
exclude:
- backend/database-rules.md
- backend/api-design.md
- devops/deployment-procedures.md
overrides:
- "Prefer named exports over default exports"
- "Use Radix UI primitives before writing custom components"# profiles/bob.yaml
profile:
name: "Bob"
role: "backend"
tools:
- typescript
- nodejs
- postgresql
- prisma
communication:
language: "en"
verbosity: "detailed"
modules:
include:
- shared/core-rules.md
- shared/git-conventions.md
- shared/security-baseline.md
- backend/api-design.md
- backend/database-rules.md
- backend/error-handling.md
- backend/performance-patterns.md
exclude:
- frontend/react-patterns.md
- frontend/tailwind-conventions.md
overrides:
- "Use structured logging (pino) with request context IDs"
- "Always measure before optimizing; profile first"Module Library Structure
The shared module library lives in the repository and is version-controlled:
.claude/
├── modules/
│ ├── shared/
│ │ ├── core-rules.md # Universal team standards
│ │ ├── git-conventions.md # Commit and PR conventions
│ │ ├── security-baseline.md # Non-negotiable security rules
│ │ └── testing-standards.md # Coverage and test quality rules
│ ├── frontend/
│ │ ├── react-patterns.md
│ │ ├── tailwind-conventions.md
│ │ ├── testing-rtl.md
│ │ └── accessibility-checklist.md
│ ├── backend/
│ │ ├── api-design.md
│ │ ├── database-rules.md
│ │ ├── error-handling.md
│ │ └── performance-patterns.md
│ └── devops/
│ ├── deployment-procedures.md
│ ├── monitoring-conventions.md
│ └── infrastructure-rules.md
├── profiles/
│ ├── alice.yaml
│ ├── bob.yaml
│ └── carol.yaml
└── scripts/
└── assemble-context.shAssembly Script
The assembly script reads a profile and concatenates the specified modules into a CLAUDE.md:
#!/usr/bin/env bash
# scripts/assemble-context.sh
set -euo pipefail
PROFILE="${1:-}"
CHECK_MODE="${2:-}"
if [[ -z "$PROFILE" ]]; then