Fast Onboard
Rapidly analyzes new projects and generates comprehensive CLAUDE.md documentation.
Prerequisites
Required: jq (Fatal if missing)
Recommended: scc, fd, tree
Subagent: .claude/agents/repo-analyzer.md
Workflow
Step 1: Parallel Data Collection
Execute these Bash commands in parallel (single message with multiple Bash tool calls):
| # |
Command |
Output |
| 1 |
command -v jq && echo ok |
jq check (abort if missing) |
| 2 |
scc --format json --by-file --no-cocomo --no-size --exclude-dir node_modules,dist,build,target,.git,vendor,venv,__pycache__,.next,coverage,.claude . 2>/dev/null || echo null |
Code stats |
| 3 |
git rev-parse --git-dir >/dev/null 2>&1 && jq -n --arg r "$(git remote get-url origin 2>/dev/null || echo none)" --arg b "$(git branch --show-current)" --arg c "$(git log -1 --format='%h - %s' 2>/dev/null)" '{remote:$r,branch:$b,lastCommit:$c}' || echo null |
Git info |
| 4 |
fd -t f -E node_modules -E dist -E build -E target -E .git -E vendor -E venv -E __pycache__ -E .next -E coverage -E .claude . 2>/dev/null | wc -l | tr -d ' ' |
Total files |
| 5 |
fd -e js -e jsx -e ts -e tsx -t f -E node_modules -E dist -E build -E .git -E .next -E coverage -E .claude 2>/dev/null | wc -l | tr -d ' ' |
JS/TS files |
| 6 |
fd -e py -t f -E node_modules -E .git -E venv -E __pycache__ -E .claude 2>/dev/null | wc -l | tr -d ' ' |
Python files |
| 7 |
fd -e go -t f -E node_modules -E .git -E vendor -E .claude 2>/dev/null | wc -l | tr -d ' ' |
Go files |
| 8 |
fd -e rs -t f -E node_modules -E target -E .git -E .claude 2>/dev/null | wc -l | tr -d ' ' |
Rust files |
| 9 |
fd -d 3 -t f -E node_modules -E .git -E .claude 'package\.json$|requirements\.txt$|go\.mod$|Cargo\.toml$|pyproject\.toml$' . 2>/dev/null | jq -R . | jq -sc . |
Deps |
| 10 |
fd -d 2 -t f -i -E node_modules -E .git -E .claude 'readme|changelog|license' . 2>/dev/null | jq -R . | jq -sc . |
Docs |
| 11 |
{ fd -d 3 -t f -E node_modules -E .git 'Dockerfile|docker-compose|Makefile' .; fd -d 4 -t f -g '.github/workflows/*.yml' .; } 2>/dev/null | sort -u | jq -R . | jq -sc . |
Infra |
| 12 |
tree -L 2 -d -J -I 'node_modules|dist|build|target|.git|vendor|venv|__pycache__|.next|coverage|.claude' . 2>/dev/null || echo '[]' |
Structure |
Step 2: Assemble JSON
Combine results into .claude/.onboard-cache.json:
mkdir -p .claude && jq -n \
--arg name "$(basename "$PWD")" \
--arg path "$PWD" \
--argjson git '<result_3>' \
--argjson codeStats '<result_2>' \
--argjson total <result_4> \
--argjson js <result_5> \
--argjson py <result_6> \
--argjson go <result_7> \
--argjson rust <result_8> \
--argjson deps '<result_9>' \
--argjson docs '<result_10>' \
--argjson infra '<result_11>' \
--argjson structure '<result_12>' \
'{
meta: {generatedAt: (now | strftime("%Y-%m-%dT%H:%M:%SZ"))},
project: {name: $name, path: $path},
git: $git,
codeStats: $codeStats,
files: {total: $total, javascript: $js, python: $py, go: $go, rust: $rust},
dependencyFiles: $deps,
docs: $docs,
infrastructure: $infra,
structure: $structure
}' > .claude/.onboard-cache.json
Step 3: Launch repo-analyzer
Task(
subagent_type: "repo-analyzer",
prompt: "Analyze .claude/.onboard-cache.json and generate CLAUDE.md"
)
Error Handling
| Condition |
Behavior |
jq missing |
Fatal - Abort workflow |
scc/fd/tree missing |
Use null/0/[], continue |
| repo-analyzer missing |
Report error |
References
1---2name: fast-onboard3description: Analyzes repository structure and generates CLAUDE.md documentation. Use when user mentions "onboard", "analyze project", "understand codebase", "project structure", or when working with new/unfamiliar repositories.4---56# Fast Onboard78Rapidly analyzes new projects and generates comprehensive CLAUDE.md documentation.910## Prerequisites1112**Required**: `jq` (Fatal if missing)13**Recommended**: `scc`, `fd`, `tree`14**Subagent**: `.claude/agents/repo-analyzer.md`1516## Workflow1718### Step 1: Parallel Data Collection1920Execute these Bash commands **in parallel** (single message with multiple Bash tool calls):2122| # | Command | Output |23|---|---------|--------|24| 1 | `command -v jq && echo ok` | jq check (abort if missing) |25| 2 | `scc --format json --by-file --no-cocomo --no-size --exclude-dir node_modules,dist,build,target,.git,vendor,venv,__pycache__,.next,coverage,.claude . 2>/dev/null \|\| echo null` | Code stats |26| 3 | `git rev-parse --git-dir >/dev/null 2>&1 && jq -n --arg r "$(git remote get-url origin 2>/dev/null \|\| echo none)" --arg b "$(git branch --show-current)" --arg c "$(git log -1 --format='%h - %s' 2>/dev/null)" '{remote:$r,branch:$b,lastCommit:$c}' \|\| echo null` | Git info |27| 4 | `fd -t f -E node_modules -E dist -E build -E target -E .git -E vendor -E venv -E __pycache__ -E .next -E coverage -E .claude . 2>/dev/null \| wc -l \| tr -d ' '` | Total files |28| 5 | `fd -e js -e jsx -e ts -e tsx -t f -E node_modules -E dist -E build -E .git -E .next -E coverage -E .claude 2>/dev/null \| wc -l \| tr -d ' '` | JS/TS files |29| 6 | `fd -e py -t f -E node_modules -E .git -E venv -E __pycache__ -E .claude 2>/dev/null \| wc -l \| tr -d ' '` | Python files |30| 7 | `fd -e go -t f -E node_modules -E .git -E vendor -E .claude 2>/dev/null \| wc -l \| tr -d ' '` | Go files |31| 8 | `fd -e rs -t f -E node_modules -E target -E .git -E .claude 2>/dev/null \| wc -l \| tr -d ' '` | Rust files |32| 9 | `fd -d 3 -t f -E node_modules -E .git -E .claude 'package\.json$\|requirements\.txt$\|go\.mod$\|Cargo\.toml$\|pyproject\.toml$' . 2>/dev/null \| jq -R . \| jq -sc .` | Deps |33| 10 | `fd -d 2 -t f -i -E node_modules -E .git -E .claude 'readme\|changelog\|license' . 2>/dev/null \| jq -R . \| jq -sc .` | Docs |34| 11 | `{ fd -d 3 -t f -E node_modules -E .git 'Dockerfile\|docker-compose\|Makefile' .; fd -d 4 -t f -g '.github/workflows/*.yml' .; } 2>/dev/null \| sort -u \| jq -R . \| jq -sc .` | Infra |35| 12 | `tree -L 2 -d -J -I 'node_modules\|dist\|build\|target\|.git\|vendor\|venv\|__pycache__\|.next\|coverage\|.claude' . 2>/dev/null \|\| echo '[]'` | Structure |3637### Step 2: Assemble JSON3839Combine results into `.claude/.onboard-cache.json`:4041```bash42mkdir -p .claude && jq -n \43 --arg name "$(basename "$PWD")" \44 --arg path "$PWD" \45 --argjson git '<result_3>' \46 --argjson codeStats '<result_2>' \47 --argjson total <result_4> \48 --argjson js <result_5> \49 --argjson py <result_6> \50 --argjson go <result_7> \51 --argjson rust <result_8> \52 --argjson deps '<result_9>' \53 --argjson docs '<result_10>' \54 --argjson infra '<result_11>' \55 --argjson structure '<result_12>' \56 '{57 meta: {generatedAt: (now | strftime("%Y-%m-%dT%H:%M:%SZ"))},58 project: {name: $name, path: $path},59 git: $git,60 codeStats: $codeStats,61 files: {total: $total, javascript: $js, python: $py, go: $go, rust: $rust},62 dependencyFiles: $deps,63 docs: $docs,64 infrastructure: $infra,65 structure: $structure66 }' > .claude/.onboard-cache.json67```6869### Step 3: Launch repo-analyzer7071```72Task(73 subagent_type: "repo-analyzer",74 prompt: "Analyze .claude/.onboard-cache.json and generate CLAUDE.md"75)76```7778## Error Handling7980| Condition | Behavior |81|-----------|----------|82| `jq` missing | **Fatal** - Abort workflow |83| `scc`/`fd`/`tree` missing | Use `null`/`0`/`[]`, continue |84| repo-analyzer missing | Report error |8586## References8788- [reference.md](./reference.md) - JSON schema, prompt template