PLUGIN brewcode / Skills

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

Writes to project .claude/rules/ only, never ~/.claude/rules/.

Quick reference

FieldValue
Command/brewcode:rules
Arguments[prompt] [status|list|create|improve|review], free-form EN/RU prompt or empty
Modelsonnet
Specialistbc-rules-organizer (create, improve); rules.sh list (Bash)
Target dir.claude/rules/ (project only)

When to use

SituationCommand
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

ModeTriggerExecution
status (default)Empty prompt, no keyword hit, any “show me” / health intentOne collector subagent gathers inventory, state, overlaps, health
listExplicit “list” onlyRuns rules.sh list, no agent
createConversational cue or menuAdds rows from a KNOWLEDGE.jsonl or inline knowledge source
improveConversational cue or menuRewrites weak or redundant entries
reviewConversational cue or menuThe 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

  1. Input gate

    The whole $ARGUMENTS is one free-form sentence. Empty means status; the menu appears only on explicit request.

  2. Mode select

    Prints the PLAN — brewcode:rules block first. A .jsonl path or inline prompt is a knowledge source, not a mode.

  3. Dispatch

    create and improve go to bc-rules-organizer, review to the reviewer agent, list runs rules.sh list. If the organizer is unavailable, the run stops with brewcode:bc-rules-organizer not available — install brewcode plugin.

  4. Optimize and validate

    With brewtools installed, written files pass brewtools:text-optimize (medium --allow-dirty), then rules.sh validate runs. Otherwise the skip is reported.

  5. Report

    Per file: rows added, merged, skipped, with the dedup reason.

Knowledge sources

SourceHandling
KNOWLEDGE.jsonl patht:"❌" maps to avoid, t:"✅" to best-practice
File path + inline promptThe 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

Sibling: manage agents

skills

Sibling: manage skills

brewcode

Plugin overview

GitHub source

SKILL.md, rules.sh, references

Update: /brewtools:plugin-update, /reload-plugins, then /brewcode:setup-status upgrade - FAQ