Crew Init - Project Analysis & Team Setup
Full project initialization that transforms any codebase into a CodeCrew workspace with indexed code, profiled architecture, and a configured agent team.
When to Activate
- User runs
/crew init - User runs
/crewwithinitargument - First time using CodeCrew in a project
Initialization Pipeline
Phase 1: Project Discovery
Scan the project to understand what we're working with:
1.1 Detect project type and languages:
Use Glob to check for:
- package.json, tsconfig.json → Node.js / TypeScript
- requirements.txt, pyproject.toml, setup.py → Python
- go.mod → Go
- Cargo.toml → Rust
- pom.xml, build.gradle → Java / Kotlin
- Gemfile → Ruby
- composer.json → PHP
- Makefile, CMakeLists.txt → C/C++
- pubspec.yaml → Dart/Flutter
- *.sln, *.csproj → .NET/C#
1.2 Detect frameworks:
Read package.json (or equivalent) for:
- react, next, vue, angular, svelte → Frontend framework
- express, fastify, koa, django, flask, gin, actix → Backend framework
- playwright, jest, pytest, mocha → Testing framework
- eslint, prettier, black, gofmt → Linting/formatting
- docker, kubernetes → Container/orchestration
1.3 Map project structure:
Use Glob for directory layout:
- src/, lib/, app/ → Source code
- test/, tests/, __tests__, spec/ → Tests
- docs/, doc/ → Documentation
- .github/, .gitlab-ci.yml → CI/CD
- Dockerfile, docker-compose.yml → Docker
- scripts/, bin/ → Build/deploy scripts
1.4 Read existing context:
- Read CLAUDE.md if it exists (project-specific instructions)
- Read README.md for project description
- Check git log for recent activity areas (if git repo)
Phase 2: Build Codebase Index
Invoke the codebase-index skill in full-build mode:
- Discover all source files (excluding node_modules, dist, build, etc.)
- For each file: read, hash, extract metadata (exports, imports, functions, classes, line count)
- Build call graph from import/export relationships
- Write
.claude/crew-index.json(Layer 1 - compact) - Write
.claude/crew-symbols.json(Layer 2 - symbols)
This enables the Index-First Protocol for all future agent interactions.
Phase 3: Generate Project Profile
Write .claude/crew-profile.md with:
# Crew Profile: {project-name}
## Overview
- **Type**: {web-app | api | cli | library | scraper | mobile | etc.}
- **Languages**: {detected languages}
- **Frameworks**: {detected frameworks}
- **Size**: {total files} files, {total lines} lines
## Architecture
- **Entry Point**: {main file}
- **Pipeline/Flow**: {data flow description}
- **Patterns**: {MVC, pipeline, event-driven, microservice, etc.}
## Key Directories
- **Source**: {src paths}
- **Tests**: {test paths}
- **Config**: {config files}
- **Docs**: {doc paths}
## Tech Stack
- **Runtime**: {node, python, go, etc.}
- **Package Manager**: {npm, pip, cargo, etc.}
- **Testing**: {jest, pytest, etc.}
- **Linting**: {eslint, prettier, etc.}
- **CI/CD**: {github actions, gitlab ci, etc.}
- **Deployment**: {docker, k8s, vercel, etc.}
## Index Status
- **Files Indexed**: {count}
- **Symbols Mapped**: {count}
- **Last Indexed**: {timestamp}
- **Index Files**: .claude/crew-index.json, .claude/crew-symbols.json
Phase 4: Configure Agent Team
Based on detected stack, determine which agents are active and what skills they need.
Write .claude/crew-team.json:
{
"project": "project-name",
"configured": "2026-04-04T12:00:00Z",
"agents": {
"ceo": {
"model": "opus",
"active": true,
"role": "Task triage, decomposition, delegation, architecture decisions"
},
"vp-engineering": {
"model": "sonnet",
"active": true,
"role": "Tech decisions, architecture review, complex planning"
},
"vp-quality": {
"model": "sonnet",
"active": true,
"role": "Quality gates, test strategy, review coordination"
},
"senior-dev": {
"model": "sonnet",
"active": true,
"role": "Complex implementation, multi-file changes"
},
"junior-dev": {
"model": "haiku",
"active": true,
"role": "Simple fixes, formatting, small changes"
},
"code-reviewer": {
"model": "sonnet",
"active": true,
"role": "Code review, quality assessment"
},
"debugger": {
"model": "sonnet",
"active": true,
"role": "Bug investigation, root cause analysis"
},
"security-analyst": {
"model": "sonnet",
"active": false,
"activateWhen": "security-related tasks or pre-deploy review"
},
"devops-engineer": {
"model": "haiku",
"active": false,
"activateWhen": "Docker/CI/CD/deployment tasks detected"
},
"doc-writer": {
"model": "haiku",
"active": true,
"role": "Documentation, comments, READMEs"
},
"test-engineer": {
"model": "sonnet",
"active": false,
"activateWhen": "test directory detected or testing tasks"
}
},
"activationRules": {
"hasDocker": ["devops-engineer"],
"hasTests": ["test-engineer"],
"hasSecurity": ["security-analyst"],
"always": ["ceo", "vp-engineering", "senior-dev", "junior-dev", "code-reviewer", "debugger", "doc-writer"]
}
}
Activate conditional agents based on detected stack:
- Found
Dockerfileordocker-compose.yml→ activatedevops-engineer - Found
test/or testing framework → activatetest-engineer - Found
.envor security configs → activatesecurity-analyst
Phase 5: Suggest Custom Agents
Based on Phase 1 detection results (languages, frameworks, tools), suggest project-specific custom agents that extend the built-in team. The number of suggestions is dynamic — more frameworks/tools detected = more suggestions.
Step 0: Detect Project Domain
Analyze available project signals to classify the project domain:
- Project directory name — check for keywords (e.g., "trading", "shop", "health", "game")
- README.md — read first 50 lines for project description keywords
- package.json / pyproject.toml — check
descriptionandkeywordsfields - Directory names — scan for domain-specific folders (e.g.,
strategies/,orders/,cart/,patients/) - Import patterns — check for domain-specific libraries (e.g.,
ccxt,alpaca-trade-api,stripe,hl7)
Classify into ONE primary domain:
| Domain | Detection Signals |
|---|---|
trading/finance | "trading", "bot", "strategy", "backtest", "portfolio", "hedge", "quant", ccxt, alpaca, binance, ta-lib, quantlib |
e-commerce | "shop", "store", "cart", "checkout", "product", stripe, shopify, woocommerce, snipcart |
healthcare | "patient", "health", "medical", "clinical", "ehr", hl7, fhir, dicom |
education | "course", "student", "learning", "lms", "quiz", "classroom" |
gaming | "game", "player", "score", "level", "sprite", phaser, unity, godot, pixi.js |
ai-ml | "model", "training", "inference", "prediction", tensorflow, pytorch, scikit-learn, transformers, langchain |
iot | "sensor", "device", "mqtt", "firmware", "embedded", mqtt.js, johnny-five, raspberry |
media | "stream", "video", "audio", "media", "content", ffmpeg, hls, webrtc |
saas | "tenant", "subscription", "billing", "dashboard", "admin", "onboarding", "workspace" |
devtools | "cli", "plugin", "extension", "lint", "compiler", "bundler", "sdk" |
data-pipeline | "pipeline", "etl", "ingest", "warehouse", "transform", airflow, prefect, dagster, dbt |
social | "chat", "message", "feed", "notification", "real-time", "presence", socket.io, pusher |
general | No strong domain signals detected |
If domain is general, skip domain-specific suggestions. Otherwise, include domain-specific agents in Step 1 below.
Step 1: Match Detected Stack + Domain to Suggested Agents
Check Phase 1 results and Step 0 domain against these mappings. Only include agents whose detection conditions mat