Get the FREE Ultimate OpenClaw Setup Guide →

brewcode:rules

npx machina-cli add skill kochetkov-ma/claude-brewcode/rules --openclaw
Files (1)
SKILL.md
2.0 KB

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

<instructions>

Mode Detection

Arguments: $ARGUMENTS

InputMode
listList 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

ModePreparation
fileRead KNOWLEDGE.jsonl; parse t:"❌" → avoid, t:"✅" → practice
promptExtract <path> (first arg), <prompt> (rest)
sessionExtract 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_ROOT injected by pre-task.mjs hook.

Fallback

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

</instructions>

Output

Forward agent report to user as-is.

Error Handling

ConditionAction
Agent unavailableError + install instructions
No knowledge found"No new rules extracted"
Plugin not foundSTOP + 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

  1. Step 1: Run in mode: bash scripts/rules.sh list (or file|prompt|session)
  2. Step 2: Provide knowledge via KNOWLEDGE.jsonl or specify path/prompt or session findings
  3. 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

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers