From brewcode
Installs prerequisites like brew, timeout, and jq, scans project structure, and generates adapted templates in .claude/tasks/templates/.
npx claudepluginhub kochetkov-ma/claude-brewcode --plugin brewcodeThis skill is limited to using the following tools:
<instructions>
LICENSEREADME.mdscripts/install.shscripts/setup.shtemplates/KNOWLEDGE.jsonl.templatetemplates/PLAN.md.templatetemplates/SPEC.md.templatetemplates/brewcode.config.json.templatetemplates/phase-final-review.md.templatetemplates/phase-fix.md.templatetemplates/phase-verify.md.templatetemplates/phase.md.templateCreates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Agent: developer | Action: Verify and install required tools
Context: This phase auto-checks prerequisites. If all required components are present, it skips to Phase 1 silently.
EXECUTE using Bash tool:
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" state && echo "✅ state" || echo "❌ state FAILED"
STOP if ❌ — verify install.sh exists in scripts/.
Parse the state output table. Check required components: brew, timeout, jq.
EXECUTE using Bash tool:
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" check-timeout && echo "✅ timeout-check" || echo "❌ timeout-check FAILED"
If TIMEOUT_EXISTS=false → ASK (AskUserQuestion):
timeout command is missing. Create symlink to gtimeout? This is REQUIRED for brewcode."If cancel → STOP: "Setup cancelled. timeout command is required for brewcode."
EXECUTE using Bash tool:
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" required && echo "✅ required" || echo "❌ required FAILED"
STOP if ❌ — required components must be installed before continuing.
If timeout still missing → EXECUTE: bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" timeout
If grepai not installed → ASK (AskUserQuestion):
If Yes → EXECUTE: bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" grepai
EXECUTE using Bash tool:
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" summary && echo "✅ summary" || echo "❌ summary FAILED"
Agent: Explore | Action: Scan project and gather intelligence
Context: BC_PLUGIN_ROOT is available in your context (injected by pre-task.mjs hook).
EXECUTE using Bash tool — gather project info:
bash "scripts/setup.sh" scan && echo "✅ scan" || echo "❌ scan FAILED"
STOP if ❌ — check script exists and plugin is installed.
Agent: Plan | Action: Consolidate findings and create adaptation strategy
# Adaptation Plan
## Tech Stack
- Language: [Java/Node.js/Python/Go/Rust]
- Framework: [Spring Boot/Express/Django/etc]
- Build: [Maven/Gradle/npm/pip/cargo]
## Testing
- Framework: [JUnit 5/pytest/Jest/Go testing]
- Assertion: [AssertJ/Hamcrest/Chai/assert]
- Mocking: [Mockito/unittest.mock/Sinon]
- Data: [DBRider/Testcontainers/fixtures]
## Database
- Type: [PostgreSQL/MySQL/MongoDB/Redis/ClickHouse]
- Access: [JOOQ/JPA/Hibernate/Sequelize/SQLAlchemy]
## Project Agents
- agent-name: purpose (model)
## Key Patterns (from CLAUDE.md)
- Pattern 1
- Pattern 2
- Pattern 3
## Template Adaptations
- Update AGENTS section with project agents
- Add tech-specific constraints
- Customize verification checklists
- Add database-specific final review agent
Agent: developer | Action: Generate adapted template at .claude/tasks/templates/PLAN.md.template
EXECUTE using Bash tool:
bash "scripts/setup.sh" structure && echo "✅ structure" || echo "❌ structure FAILED"
STOP if ❌ — verify .claude/tasks directory is writable.
EXECUTE using Bash tool — sync templates from plugin (always overwrites if changed):
bash "scripts/setup.sh" sync && echo "✅ sync" || echo "❌ sync FAILED"
STOP if ❌ — verify plugin templates exist.
Note: Templates synced from plugin. Rules created once (never overwritten). Review skill adapted by AI.
| Section | Adaptation |
|---|---|
| Agents | Add project-specific agents from .claude/agents/ |
| Reference Examples | Fill with project's reference files (controllers, services, tests) |
| Phase V agents | Customize reviewer focus for detected testing/code patterns |
| Final Review | Add project agents (db_expert, etc.) if relevant tech detected |
Preserve universal structure. Key sections to adapt:
## Agents — Add project agents above Core Agents
## Reference Examples — R1..RN with project's canonical files
## Phases — Each phase has: Agent, Status, Context (C#), Refs (R#)
## Phase NV: Verification — 2+ agents, one checks patterns compliance
## Final Review — 3+ agents parallel
## Context Index — C1..CN task-specific files
Agent: developer | Action: Copy review skill template and adapt for project
EXECUTE using Bash tool — create directory and copy review skill template:
bash "scripts/setup.sh" review && echo "✅ review" || echo "❌ review FAILED"
STOP if ❌ — verify review template exists in plugin.
Replace placeholders based on Phase 2 analysis:
| Placeholder | Source | Example |
|---|---|---|
{PROJECT_AGENTS_TABLE} | .claude/agents/ scan | | db_expert | PostgreSQL | DB layer | |
{TECH_SPECIFIC_CHECKS} | Detected tech stack | See Tech-Specific Checks below |
{PROJECT_RULES} | CLAUDE.md patterns | AssertJ rules, Lombok, logging |
{MAIN_AGENT} | Project agent or reviewer | reviewer |
{TEST_AGENT} | Project agent or tester | tester |
{DB_AGENT} | Project agent or sql_expert | db_expert |
{CUSTOM_GROUPS} | Additional review groups | Security, API validation |
{CODEBASE_BLOCKS} | Detected source patterns | src/main/**, src/test/** |
Java/Spring:
| Category | Checks |
|----------|--------|
| DI | Constructor injection, no field injection, @RequiredArgsConstructor |
| Transactions | @Transactional scope, rollback rules, isolation levels |
| Null-safety | Optional usage, @NonNull/@Nullable, null checks |
| N+1 | Eager vs lazy loading, batch fetching, entity graphs |
| Security | @PreAuthorize, input validation, SQL injection |
| Lombok | @Value, @Builder, @Slf4j usage |
Node.js/TypeScript:
| Category | Checks |
|----------|--------|
| Async | Promise handling, unhandled rejections, async/await |
| Types | Strict null checks, type guards, generics |
| Validation | Input sanitization, schema validation (Zod/Joi) |
| Security | XSS prevention, CSRF tokens, helmet.js |
| Imports | ESM vs CJS, barrel exports, circular deps |
Python:
| Category | Checks |
|----------|--------|
| Type hints | Function signatures, return types, generics |
| Exceptions | Specific exception types, context managers |
| Async | asyncio patterns, event loop handling |
| Security | SQL parameterization, input validation |
| Style | PEP8, docstrings, comprehensions |
Go:
| Category | Checks |
|----------|--------|
| Error handling | Error wrapping, sentinel errors, error types |
| Concurrency | Goroutine leaks, channel patterns, sync primitives |
| Memory | Slice capacity, pointer semantics, defer usage |
| Security | SQL injection, input validation |
| Interfaces | Small interfaces, composition |
EXECUTE using Bash tool — verify review skill:
test -f .claude/skills/brewcode-review/SKILL.md && echo "✅ Review skill created" || echo "❌ Review skill MISSING"
grep -q "Tech-Specific\|tech-specific\|Category.*Checks" .claude/skills/brewcode-review/SKILL.md && echo "✅ Tech checks" || echo "❌ Tech checks MISSING"
STOP if any ❌ — review skill must be created before continuing.
Agent: developer | Action: Copy configuration template for runtime settings
EXECUTE using Bash tool — copy/update config template:
bash "scripts/setup.sh" config && echo "✅ config" || echo "❌ config FAILED"
STOP if ❌ — verify .claude/tasks/cfg directory exists.
| Setting | Default | Description |
|---|---|---|
knowledge.maxEntries | 100 | Max KNOWLEDGE.jsonl entries after compaction |
knowledge.maxTokens | 500 | Max tokens in ## K block injected to agents |
knowledge.priorities | ["❌","✅","ℹ️"] | Priority order for knowledge entries |
stop.maxAttempts | 20 | Stop attempts before escape mechanism triggers |
agents.system | [...] | System agents (don't receive ## K injection) |
Hooks-only architecture: No external runtime. All context management via Claude Code hooks.
Agent: developer | Action: Verify template structure
EXECUTE using Bash tool — ALL must pass:
bash "scripts/setup.sh" validate && echo "✅ validate" || echo "❌ validate FAILED"
STOP if any ❌ — go back to "Copy Templates" step and fix.
| Check | Status |
|---|---|
| PLAN template | .claude/tasks/templates/PLAN.md.template |
| SPEC template | .claude/tasks/templates/SPEC.md.template |
| KNOWLEDGE template | .claude/tasks/templates/KNOWLEDGE.jsonl.template |
| Config file | .claude/tasks/cfg/brewcode.config.json |
| Project agents | [N] from .claude/agents/ |
| Reference Examples | [N] canonical files populated |
| Tech-specific adaptations | Testing framework, DB patterns |
| Review skill | .claude/skills/brewcode-review/SKILL.md |
Agent: developer | Action: Update agents section in global CLAUDE.md
EXECUTE using Bash tool:
bash "scripts/setup.sh" agents > /tmp/agents-section.md && cat /tmp/agents-section.md
Output = Ready-to-insert content. Script collects system + global + plugin agents. Internal agents (bc-coordinator, bc-grepai-configurator, bc-knowledge-manager) are automatically excluded.
READ ~/.claude/CLAUDE.md using Read tool.
LLM Analysis — find ALL agent-related sections:
## Agents, ## Agent Selection, ### Core Agents, ### Global Utility AgentsAgent | Model | PurposeIdentify boundaries:
ASK USER with AskUserQuestion:
CRITICAL: Use EXACTLY the content from
/tmp/agents-section.md. DO NOT add agents manually — the script already filters internal agents. Internal agents (bc-coordinator, bc-grepai-configurator, bc-knowledge-manager) are excluded by design.
Using Edit tool:
/tmp/agents-section.md to get the exact replacement content## Agents — DELEGATE! section in ~/.claude/CLAUDE.md/tmp/agents-section.md### Global Skills subsection if it exists (append after agents table)Key: LLM determines section boundaries, not grep. Content comes from script output.
# Template Adaptation Complete
## Detection
| Field | Value |
|-------|-------|
| Arguments | `{received args or empty}` |
| Mode | `full` |
## Tech Stack
| Category | Value |
|----------|-------|
| Language | [detected] |
| Framework | [detected] |
| Testing | [framework] |
| Database | [type/access] |
| Project Agents | [N]: `agent1`, `agent2` |
## Adaptations
| Section | Changes |
|---------|---------|
| Agents | +[N] project agents |
| Reference Examples | [N] canonical files |
| Phase V | Reviewers for [tech] patterns |
| Final Review | +[db_expert/project agents] |
| Review Skill | Tech-specific checks, project rules |
## Templates
**Plan template:** `.claude/tasks/templates/PLAN.md.template`
**Review skill:** `.claude/skills/brewcode-review/SKILL.md`
## Usage
/brewcode:spec "Implement feature X"
/brewcode:review "Check null safety"