/brewcode:rules [prompt] [status|list|create|improve|review]from brewcode
Syncs KNOWLEDGE.jsonl or session learnings to project rules. Supports create, improve, review, list, and status modes with auto-mode selection.
Ships in brewcode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
TARGET: Project
.claude/rules/only. NEVER~/.claude/rules/
$ARGUMENTS is one free-form RU/EN prompt; mode tokens and flags may sit anywhere in it.
AskUserQuestion; with status -> status; of two
mutating modes -> the keyword that comes first. No hit or empty -> status.AskUserQuestion (max 4 questions), before
work. Use prompt/history answers; never repeat resolved questions or routine approval calls.
Read-only asks nothing except an explicitly requested menu.Print once, before the first action (labels and plan values English, INPUT verbatim):
PLAN — brewcode:rules
INPUT: <arguments verbatim, or "(empty)">
MODE: <resolved> — <explicit | matched keyword: X | default>
SCOPE: <resolved paths / target / level / flags>
DO: <2-5 imperative bullets>
RESULT: <what the user ends up holding>
| Const | Value |
|---|---|
| SPECIALIST | brewcode:bc-rules-organizer |
| LIST_CMD | bash "${CLAUDE_SKILL_DIR}/scripts/rules.sh" list |
Empty -> status; explicit menu request -> Step 3; else Step 2.
Classify the prompt + recent context into ONE mode:
| Mode | EN keywords | RU keywords | Mutates? |
|---|---|---|---|
status | (empty), status, show me, health, overview | статус, что есть, состояние | no |
list | list | список, перечисли | no |
create | create, new, scaffold, add | создай, добавь | yes |
improve | improve, refactor, fix | улучши, почини | yes |
review | review, validate | ревью, проверь корректность | no |
improve also matches a bare existing rule name/path. Plural, "все"/"all" or several names/paths ->
batch: one specialist spawn per item. Print the PLAN, then Step 4.
One AskUserQuestion, two questions, 2-4 options each (tool cap; "Other" is automatic):
What do you want to do with rules?: Status (rules) (Recommended), Create new rules,
Improve existing rules, Review rulesVariant?: As chosen (Recommended), Status (all: agents+rules+skills),
List (plain); a non-default Q2 replaces Q1Dismissed or cancel via Other -> stop. Else take target and params from the choice plus prompt/history, no follow-up: safe
gap -> stated default; write-critical gap -> report the missing decision before writing. Print PLAN,
then Step 4.
Main owns every spawn; delegates return results, never nest or accept their own output. One subagent = one bounded unit: one knowledge source -> its avoid/best-practice pair (cross-file dedup needs both), ~<=5 files, ~<=10 steps; bigger work splits into N tasks spawned in one message.
Every spawn brief carries six labeled fields, since a subagent starts with an empty context: GOAL (task + why), ROLE (owns, must not touch), SCOPE (paths/commands in and out), CONTEXT (done, by whom, in parallel), CONSUMER (who uses the result + its shape), DONE (acceptance + return: verdict first, evidence, bounded; long output to a file, path returned).
A bare one-line task is never enough.
status / Status (all) -> Step 5 (all: one collector for agents + rules + skills).list -> run LIST_CMD, print its inventory, STOP.create / improve -> resolve targets and params; spawn SPECIALIST, one per item, a batch in
one message.review -> the project's reviewer agent from .claude/agents/, else general-purpose: review ->
double-check findings -> report.brewtools:text-optimize
skill is available in this session (--allow-dirty: this run just wrote them):
Skill(skill="brewtools:text-optimize", args="<written rule paths> medium --allow-dirty preserve every table row, frontmatter key, name, number, negation and scope").
It owns snapshot, RUN_DIR, one optimizer per file and its verify gate; then run
rules.sh validate. Delegates never spawn optimizers.
Skill unavailable (
brewtoolsnot installed) -> skip the pass and report the skip, not a blocker; the rules stay as written, with their validation evidence.
One Explore/Bash subagent collects; main assembles:
.claude/) / global (~/.claude/): counts, names, load path.<name>.disabled parking); legacy _SKILL.md/_<name>.md markers; model.Bash nor Glob/Grep in tools:;
LLM-invocable skills with weak triggers; rules duplicated in CLAUDE.md.list)# rules [<mode>]
## Detection
| Input | <prompt or "(empty -> status)"> |
| Mode | <mode> |
| Reason | <why this mode> |
| Targets| <names/paths> |
## Result
(create/improve/review: each output path + specialist agent + scope/model)
## Status
(status mode: full table from Step 5; else short "what changed" for touched artifacts)
## Next Steps
(recommendations; always name the project docs a created/changed artifact made stale)
Take source and slice from prompt/history; material gaps go into the one question batch. Sources: (a) KNOWLEDGE.jsonl path (t:"❌"->avoid, t:"✅"->practice), (b) + text in the prompt, (c) session learnings (the 5 most impactful findings as ❌/✅).
Brief for SPECIALIST; it returns a question instead of rows when the source or a prefix's paths
is missing, so pass both:
.claude/rules/..claude/reports/YYYYMMDD-HHMMSS_rules-organizer/; never
CLAUDE.md..claude/rules/, NEVER ~/.claude/rules/. Targets avoid.md, best-practice.md,
{prefix}-avoid.md, {prefix}-best-practice.md. Commands:
bash "${CLAUDE_SKILL_DIR}/scripts/rules.sh" create | create-specialized <prefix> '<paths>' |
validate. Templates (read-only): ${CLAUDE_PLUGIN_ROOT}/templates/rules/..claude/rules/*.md = dedup
baseline; no sibling touches them.paths: when Claude reads, writes or edits a matching file.validate exits 0; return the File | Paths | Change table (per file new: N added or
updated: N added, N merged, N skipped) + the summary line ending rules.sh validate: rc N;
detail in the report dir, path returned.Agent unavailable -> error "brewcode:bc-rules-organizer not available — install brewcode plugin".
A {prefix}- file covers one repo slice. Resolve it from authorized context or the one question
batch before create-specialized; unresolved -> return the missing decision, write nothing. Pass it
as paths, a YAML flow list, e.g. '["src/payment/**", "**/payment/**"]'. Omitted -> the script
derives a glob from the prefix and prints it with a confirm-me warning. ["**/*"] is refused: it
would load into every request.
rules.sh fills the templates/rules/ tokens at creation; after paths: (specialized files only) a
file carries:
doc_type: llm
version: "{PLUGIN_VERSION}"
generated_by: "{GENERATED_BY}"
last_updated: "{LAST_UPDATED}"
{PLUGIN_VERSION} from .claude-plugin/plugin.json (script self-location), {GENERATED_BY} =
brewcode:rules, {LAST_UPDATED} = date +%F; never hardcode them. validate gates on
^doc_type: llm$ (unquoted, doc_type: "llm" fails; the other three quoted), exits non-zero on a
missing, misspelled or misformatted key, so run it after every write. It checks avoid.md,
best-practice.md (both required) and {prefix}- files only. create writes the main files
without paths:; a project that scopes one on purpose gets a ! warning, never an error: keep it.
What SKILL.md sets; muted values are Claude Code's defaults
sonnetnpx claudepluginhub kochetkov-ma/claude-brewcode --plugin brewcode9 skills in this plugin
/agentsCreates, improves, syncs Claude Code subagents. Triggers: create agent, improve agent, sync agents, memory sync./convention-setupInstalls project conventions and reversible loading guidance; extracts representative implementations, patterns, architecture, and accepted rules. Triggers: convention setup, extract conventions, etalon classes./e2eOrchestrates e2e testing: BDD scenarios, Playwright autotests. Triggers: e2e tests, BDD scenarios, write autotest./semble-setupInstalls, audits, repairs, updates, enables, reindexes or removes the semble_code semantic code-search MCP for a project. Triggers: semble, semantic code search, semble status, настрой semble, статус semble, переиндексируй, удали semble./setup-statusReports which brewcode setup skills are installed, stale, partial or missing in this project, compares the version each installed artifact was generated under against the installed plugin, prints the exact command to run for each, and upgrades the stale ones on request, one fresh subagent per setup, re-probed after each. Triggers: setup status, what is installed, upgrade setups, что установлено, обнови сетапы./skillsLists, improves, creates, syncs Claude Code skills. Triggers: create skill, improve skill, sync skills, memory sync.Other plugins' skills for the same job