PLUGIN brewcode / Skills
On this page
rules sonnet
Turns session learnings, KNOWLEDGE.jsonl files and review notes into table-row rules in .claude/rules/. Claude Code loads a rule without paths: at session start and a path-scoped rule when it works with a matching file.
Project scope only
.claude/rules/ only, never ~/.claude/rules/. Quick reference
| Field | Value |
|---|---|
| Command | /brewcode:rules |
| Arguments | [prompt] [status|list|create|improve|review], free-form EN/RU prompt or empty |
| Model | sonnet |
| Specialist | bc-rules-organizer (create, improve); rules.sh list (Bash) |
| Target dir | .claude/rules/ (project only) |
When to use
| Situation | Command |
|---|---|
| Inspect which rules exist | /brewcode:rules |
| After fixing a bug: capture the pattern | /brewcode:rules capture what we learned fixing the auth bug |
| After a long session, before compaction | /brewcode:rules add session learnings |
| Import structured knowledge | /brewcode:rules path/to/KNOWLEDGE.jsonl add new entries |
Modes
| Mode | Trigger | Execution |
|---|---|---|
status (default) | Empty prompt, no keyword hit, any “show me” / health intent | One collector subagent gathers inventory, state, overlaps, health |
list | Explicit “list” only | Runs rules.sh list, no agent |
create | Conversational cue or menu | Adds rows from a KNOWLEDGE.jsonl or inline knowledge source |
improve | Conversational cue or menu | Rewrites weak or redundant entries |
review | Conversational cue or menu | The project’s reviewer agent (else general-purpose) audits and double-checks |
Several names, “all” or a plural fan out to one specialist per item, all in one message.
Delegation
create and improve spawn one bc-rules-organizer per target rule file, all in one message. The organizer edits only the target rule files, never CLAUDE.md or global rules. Full table: Delegation.
Flow, sources, output files, dedup, status, menu #
Flow
- Input gate
The whole
$ARGUMENTSis one free-form sentence. Empty meansstatus; the menu appears only on explicit request. - Mode select
Prints the
PLAN — brewcode:rulesblock first. A.jsonlpath or inline prompt is a knowledge source, not a mode. - Dispatch
createandimprovego tobc-rules-organizer,reviewto the reviewer agent,listrunsrules.sh list. If the organizer is unavailable, the run stops withbrewcode:bc-rules-organizer not available — install brewcode plugin. - Optimize and validate
With brewtools installed, written files pass
brewtools:text-optimize(medium --allow-dirty), thenrules.sh validateruns. Otherwise the skip is reported. - Report
Per file: rows added, merged, skipped, with the dedup reason.
Knowledge sources
| Source | Handling |
|---|---|
KNOWLEDGE.jsonl path | t:"❌" maps to avoid, t:"✅" to best-practice |
| File path + inline prompt | The organizer reads the file and follows the prompt |
| Session learnings (no path) | The 5 most impactful findings become ❌/✅ pairs |
Output files in .claude/rules/: avoid.md (table #, Avoid, Instead, Why), best-practice.md (#, Practice, Context, Source), {prefix}-avoid.md, {prefix}-best-practice.md (domain files, e.g. sql-avoid.md). Domain files carry paths: globs and load only for matching files.
Validation. rules.sh validate checks these four kinds (frontmatter metadata and table header); other files are not checked. create writes avoid.md and best-practice.md without paths:. A project that scopes one on purpose gets a ! warning (exit 0, not an error); a domain file without paths: still fails.
3-check dedup. Within-file similarity: over 70% skip, 40-70% merge. Cross-file antonym: a pattern in both avoid and best-practice keeps the avoid entry. CLAUDE.md duplicate: skip. "CLAUDE.md" is forbidden as a Source value. The skill never updates CLAUDE.md.
Status blocks. Inventory, State, Overlaps (same name across scopes, duplicate triggers), Health (missing frontmatter, weak triggers, rules duplicated in CLAUDE.md).
Menu (on request only). One AskUserQuestion with two questions. Q1: Status (rules), Create, Improve, Review. Q2: As chosen, Status (all: agents + rules + skills), List (plain); a non-default Q2 replaces Q1. Cancel via Other stops.
agents
skills
brewcode
GitHub source
Update: /brewtools:plugin-update, /reload-plugins, then /brewcode:setup-status upgrade - FAQ