brewcode:rules

SKILL.md

TARGET: Project .claude/rules/ only. NEVER ~/.claude/rules/

Mode Detection

Arguments: $ARGUMENTS

Input Mode
list List mode
<path> <text> Prompt mode
<path-to-file> File mode
(empty) Session mode

List Mode

EXECUTE and STOP:

bash "${CLAUDE_SKILL_DIR}/scripts/rules.sh" list

File / Prompt / Session Mode

Spawn bc-rules-organizer agent via Task tool.

Prepare Knowledge by Mode

Mode Preparation
file Read KNOWLEDGE.jsonl; parse t:"❌" → avoid, t:"✅" → practice
prompt Extract <path> (first arg), <prompt> (rest)
session Extract 5 most impactful findings: errors, fixes, patterns. Format as or

Agent Prompt Template

Update PROJECT .claude/rules/ — NEVER ~/.claude/rules/

Plugin templates: $BC_PLUGIN_ROOT/templates/rules/
Validation: bash "$BC_PLUGIN_ROOT/skills/rules/scripts/rules.sh" validate
Create missing: bash "$BC_PLUGIN_ROOT/skills/rules/scripts/rules.sh" create

Targets: avoid.md, best-practice.md, {prefix}-avoid.md, {prefix}-best-practice.md

MODE: {detected mode}
KNOWLEDGE: {prepared from table above}
DEDUP: 3-Check Protocol:
  1. Within-file similarity (>70% skip, 40-70% merge)
  2. Cross-file antonym (avoid↔best-practice — keep avoid only)
  3. CLAUDE.md duplicate (skip if in CLAUDE.md; "CLAUDE.md" forbidden as Source)

BC_PLUGIN_ROOT injected by pre-task.mjs hook.

Fallback

Agent unavailable → error: bc-rules-organizer not available — install brewcode plugin

Output

Forward agent report to user as-is.

Error Handling

Condition Action
Agent unavailable Error + install instructions
No knowledge found "No new rules extracted"
Plugin not found STOP + install instructions
Weekly Installs
12
GitHub Stars
16
First Seen
14 days ago
Installed on
claude-code12
opencode10
gemini-cli10
github-copilot10
codex10
kimi-cli10