Bootstrap project-specific AGENTS.md, CLAUDE.md, task workflow, and review agents by detecting tech stack, structure, and conventions. Run once per project, or with "refresh" to regenerate.
Generate project-tuned configuration and skills by detecting the project's tech stack, structure, and conventions.
All templates and reference files for this plugin are located under:
SKILL_BASE=!`echo "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude}/skills"`
Throughout this document, SKILL_BASE refers to the resolved path printed above.
When instructions say to read a file at SKILL_BASE/..., substitute the actual resolved path.
When spawning Task subagents, pass the resolved SKILL_BASE value so they can locate template and reference files.
/establish-project — generate all missing artifacts/establish-project refresh — regenerate all artifacts (backs up existing files first)/establish-project <artifact> — regenerate only one: agents-md, claude-md, task, plan, pr-review, commit, settingsScan the project root silently. Do NOT ask questions yet.
git rev-parse --show-toplevel 2>/dev/null || pwd
Store as PROJECT_ROOT.
| File/Pattern | Stack | Version hint |
|---|---|---|
| *.csproj, *.sln, global.json | .NET | <TargetFramework> in csproj |
| package.json | Node.js | dependencies: next, react, vue, angular |
| Cargo.toml | Rust | edition field |
| go.mod | Go | go directive |
| pyproject.toml, requirements.txt | Python | requires-python |
| Gemfile | Ruby | ruby version |
| Dockerfile, docker-compose.yml | Containerized | — |
| *.tf, terraform/ | IaC/Terraform | — |
| Stack | Build | Test | Lint |
|---|---|---|---|
| .NET | dotnet build | dotnet test | dotnet format --verify-no-changes |
| Node.js | package.json scripts → build | scripts → test | scripts → lint |
| Rust | cargo build | cargo test | cargo clippy |
| Go | go build ./... | go test ./... | golangci-lint run |
| Python | — | pytest / unittest / tox | ruff / flake8 / mypy |
Look for layered directories: Core, Domain, Application, Infrastructure, Api, Web, Presentation, Services, Handlers, Controllers, Repositories.
Check: src/ vs flat, test directories (Tests, tests, __tests__, spec, test), monorepo indicators (packages/, apps/, libs/, workspace configs).
docs/tasks/, specs/, issues/, .github/ISSUE_TEMPLATE/.mcp.json — note task management MCPs (Linear, Jira, etc.)Scan for available plan tracker adapters:
ls -d SKILL_BASE/*-plan/ 2>/dev/null
Replace SKILL_BASE with the actual resolved path from above.
Extract adapter names (directory basenames, e.g., gh-plan, local-plan). Store as DETECTED_PLAN_ADAPTERS.
git log --oneline -10 for commit message format.editorconfig, .eslintrc*, .prettierrc*, rustfmt.toml, etc..github/workflows/, .gitlab-ci.yml, JenkinsfileCollect all findings into a compact detection summary.
Present what you detected as a summary. Use AskUserQuestion only for what you couldn't confidently detect:
/plan with a tracker? Options: [list detected adapter names], none."
gh-plan: ask "GitHub Project number to add issues to? (optional, press enter to skip)"local-plan: ask "Task directory path? (default: docs/tasks)"If everything is clear from detection, present the summary and ask for a single confirmation.
ALL_ARTIFACTS = [agents-md, claude-md, task, plan, pr-review, commit, settings]
<name>.establish-backup.Run checks only for artifacts and adapters that are in the generation list. Skip silently for artifacts not being generated.
| Condition | Check | Remediation |
|---|---|---|
| Any artifact selected | git rev-parse --git-dir 2>/dev/null | "Not a git repo. Initialize with git init?" |
| commit or pr-review | git log -1 2>/dev/null | "No commits yet — commit and PR commands need git history. Skipping for now." |
| pr-review | gh auth status 2>/dev/null | "gh CLI not authenticated. Run gh auth login to enable PR reviews." |
| PLAN_TRACKER = gh-plan | command -v gh >/dev/null 2>&1 | "gh CLI not found. Install from https://cli.github.com" |
| PLAN_TRACKER = gh-plan | gh auth status 2>/dev/null | "gh CLI not authenticated. Run gh auth login." |
| PLAN_TRACKER = gh-plan | gh repo view --json nameWithOwner -q '.nameWithOwner' 2>/dev/null | "No GitHub remote detected. Push to GitHub first, or switch to local-plan." |
| PLAN_TRACKER = gh-plan + PROJECT_NUMBER set | gh api graphql -f query='query($n:Int!){viewer{projectV2(number:$n){id}}}' -F n=<N> 2>/dev/null | "GitHub Project #N not found or not accessible. Continuing without project integration." |
gh-plan and gh auth fails, offer to fall back to local-plan or none instead of just skipping plan entirely.Update PLAN_TRACKER and the artifact list based on any fallback decisions before proceeding.
For each artifact, spawn a Task subagent. Pass the detection summary as compact text in the prompt. Always include the resolved SKILL_BASE path in every subagent prompt so it can locate templates and references. Run independent subagents in parallel.
SKILL_BASE/establish-project/references/generate-agents-md.md for generation instructions.
Target: {PROJECT_ROOT}/AGENTS.md.
If refreshing, include current file content so the subagent can preserve intentional customizations.SKILL_BASE/establish-project/references/generate-claude-md.md.
Target: {PROJECT_ROOT}/CLAUDE.md.SKILL_BASE/establish-project/references/generate-task-command.md (instructions)SKILL_BASE/establish-project/assets/templates/task-command-template.md (template)
Fill in all {PLACEHOLDERS}, resolve {IF}/{END IF} blocks, and write the result to
{PROJECT_ROOT}/.claude/commands/task.md.
Include task tracking details (format, location, MCP tools).SKILL_BASE/establish-project/references/generate-pr-review.md.
Target: {PROJECT_ROOT}/.claude/agents/pr-review.md.git log)
AND instruct the subagent to read the template at
SKILL_BASE/establish-project/assets/templates/commit-command-template.md.
Fill in all {PLACEHOLDERS}, resolve {IF}/{END IF} blocks, and write the result to
{PROJECT_ROOT}/.claude/commands/commit.md.
Include pre-commit check commands if the project has them (lint, format, etc.).SKILL_BASE/establish-project/references/generate-plan-command.md (instructions)SKILL_BASE/establish-project/assets/templates/plan-command-template.md (template)
Fill in all {PLACEHOLDERS}, resolve {IF}/{END IF} blocks, and write the result to
{PROJECT_ROOT}/.claude/commands/plan.md.
Include:PLAN_TRACKER from Phase 2, or empty if none)PLAN_TRACKER_CONFIG — project number, task dir, etc.).claude/settings.json)Generate this inline — no subagent needed. It's a deterministic mapping from detected stack.
Write {PROJECT_ROOT}/.claude/settings.json with permissions based on the detected stack:
| Stack | Allow rules |
|---|---|
| .NET | Bash(dotnet *), Bash(git *) |
| Node.js | Bash(npm *), Bash(npx *), Bash(node *), Bash(git *) |
| Rust | Bash(cargo *), Bash(git *) |
| Go | Bash(go *), Bash(git *) |
| Python | Bash(python *), Bash(pip *), Bash(uv *), Bash(pytest *), Bash(git *) |
Combine rules if multiple stacks are detected. Always include Bash(git *).
If .claude/settings.json already exists, merge — add missing allow rules without removing existing ones. Show the user the diff before writing.
Only add if a formatter is confidently detected — meaning a config file or explicit dependency exists, not just a guess from the stack. Skip silently otherwise.
Evidence required:
| Formatter | Confident signal |
|---|---|
| Prettier | .prettierrc* exists OR prettier in package.json devDependencies |
| rustfmt | rustfmt.toml exists OR project uses Rust (rustfmt ships with toolchain) |
| gofmt | Project uses Go (gofmt ships with toolchain) |
| dotnet format | Project uses .NET 6+ |
| Ruff | ruff in pyproject.toml dependencies or ruff.toml exists |
| Black | black in pyproject.toml or [tool.black] section exists |
If confident, add to settings under hooks. The hook receives JSON on stdin with the tool input; use jq to extract the file path.
Example for Prettier:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path // .tool_input.file_path' | xargs npx prettier --write 2>/dev/null || true"
}
]
}
]
}
}
Adapt the command for the detected formatter:
| Formatter | Command |
|---|---|
| Prettier | jq -r '.tool_input.file_path' \| xargs npx prettier --write 2>/dev/null \|\| true |
| rustfmt | jq -r '.tool_input.file_path' \| xargs rustfmt 2>/dev/null \|\| true |
| gofmt | jq -r '.tool_input.file_path' \| xargs gofmt -w 2>/dev/null \|\| true |
| dotnet format | jq -r '.tool_input.file_path' \| xargs -I {} dotnet format --include {} 2>/dev/null \|\| true |
| Ruff | jq -r '.tool_input.file_path' \| xargs ruff format 2>/dev/null \|\| true |
| Black | jq -r '.tool_input.file_path' \| xargs black 2>/dev/null \|\| true |
The || true ensures a formatter failure on a non-applicable file doesn't block Claude.
Check if {PROJECT_ROOT}/.gitignore exists. If it does, check whether .claude/ entries are present.
If not, ask the user: "Should .claude/ be committed (team sharing) or gitignored (personal only)?"
If gitignored, append:
# Claude Code local config
.claude/settings.json
.claude/plans/
Note: skills and commands are NOT gitignored by default — the user likely wants to share /task, /commit, and the PR review agent with the team.
After all subagents complete, report:
AGENTS.md — automatically picked up by compatible AI coding toolsCLAUDE.md — automatically picked up by Claude Code/plan <feature> — invoke to plan a feature, decompose into tasks, and sync to tracker/task <reference> — invoke to implement a task/commit — invoke to create a well-formatted commitsettings.json — pre-approved tool permissions, active immediately.claude/commands/ + .claude/agents/ to share with team.Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer