brewcode:rules
npx machina-cli add skill kochetkov-ma/claude-brewcode/rules --openclaw<instructions>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 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}
BC_PLUGIN_ROOTinjected 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 |
Source
git clone https://github.com/kochetkov-ma/claude-brewcode/blob/main/brewcode/skills/rules/SKILL.mdView on GitHub Overview
brewcode:rules syncs KNOWLEDGE.jsonl or session learnings into your project rules. It targets the .claude/rules/ folder to capture anti-patterns and best practices, keeping rules up to date with fresh insights. Use it to update rules, extract learnings, and organize patterns across sessions.
How This Skill Works
The tool detects the working mode (list, file, prompt, or session) and prepares knowledge accordingly: file mode maps t:"❌" to avoid and t:"✅" to practice; prompt mode extracts the target path and prompt; session mode collects the five most impactful findings. It then invokes bc-rules-organizer via the Task tool using the plugin templates and a validation script to update the rules under .claude/rules/.
When to Use It
- You need to update or extend rules in the project by syncing fresh knowledge into .claude/rules/
- You want to convert knowledge from KNOWLEDGE.jsonl into avoid or practice entries
- You are extracting concrete learnings from a session to form new rules
- You are organizing anti-patterns and best practices into avoid.md and best-practice.md
- You want a structured audit by mode to generate or fix missing rule files with bc-rules-organizer
Quick Start
- Step 1: Run in mode: bash scripts/rules.sh list (or file|prompt|session)
- Step 2: Provide knowledge via KNOWLEDGE.jsonl or specify path/prompt or session findings
- Step 3: Let bc-rules-organizer update .claude/rules/ and review the agent report
Best Practices
- Choose the correct mode (file, prompt, or session) to prepare the knowledge
- Map t:"❌" to avoid and t:"✅" to practice in KNOWLEDGE.jsonl
- Keep all outputs under .claude/rules/; never target ~/.claude/rules/
- Use the provided plugin templates and the validation script to verify updates
- Review the agent output and adjust rules accordingly based on the forward report
Example Use Cases
- Run list mode to audit current rules in .claude/rules/
- Update avoid.md with new ❌ patterns extracted from KNOWLEDGE.jsonl
- In prompt mode, update a file at path 'rules/security' with a targeted prompt
- Process a session to extract five findings and convert them into best-practice entries
- Organize anti-patterns by generating {prefix}-avoid.md and {prefix}-best-practice.md