write-rule

Creates and edits path-scoped rules in .claude/rules with validated globs and independent review.

Updated Aug 7, 2026
One-click install
npx skills add https://github.com/sagittaras/agentic-workflow --skill write-rule-sagittaras
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-rule
Source: https://github.com/sagittaras/agentic-workflow/tree/main/skills/write-rule
Command: npx skills add https://github.com/sagittaras/agentic-workflow --skill write-rule-sagittaras

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Claude Code rules by hand often produces files that never load (globs matching nothing), conflict with CLAUDE.md or neighboring rules, or contain unenforceable instructions. This Skill guides the creation and editing of rules in .claude/rules/ through repository exploration, a structured interview, glob verification, and an independent subagent review. ## Core Features & Use Cases - Convention extraction and interview: Mines existing linter configs, representative source files, and folder structure, then confirms scope, rules, and filename with the user before writing. - Glob design and verification: Proposes paths globs and validates each one against the real repository structure so the rule actually loads where intended. - CLAUDE.md decomposition: Splits a bloated CLAUDE.md into path-scoped rules via a confirmed block-to-target table, without rewriting the instructions being moved. - Independent review loop: Sends every touched file to a fresh-context review subagent and iterates until approval, with defined escalation rules. - Use Case: Ask to add a rule for API conventions; the Skill inspects the codebase, confirms enforceable rules with you, writes api-design.md with verified globs, and gets it independently reviewed. ## Quick Start Ask the assistant to create a rule for your project's testing conventions and let it interview you about scope and enforceable rules.

Frequently Asked Questions about write-rule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Claude Code rule for a specific part of my repository?

Invoke the write-rule skill with the rule topic. It explores your repository, interviews you about scope and enforceable rules, writes a file in .claude/rules with verified paths globs, and gets it independently reviewed before finishing.

How do I split a large CLAUDE.md into path-scoped rules?

The skill classifies CLAUDE.md content into keep, move-to-rule, and discard groups, presents a block-to-target table for your confirmation, creates the new rules, and only then removes the moved blocks from CLAUDE.md.

When should content go into a rule instead of CLAUDE.md or a hook?

Rules fit instructions tied to specific files via paths globs. Project-wide instructions belong in CLAUDE.md, multi-step procedures in skills, and anything that must be enforced without exception in hooks, since rules are context the model can overlook.

Why does my Claude Code rule never load?

The most common cause is a paths glob that matches no real files, which fails silently. This skill verifies every glob against the actual repository structure with the Glob tool before writing the rule.

Can I write a rule without user interaction?

No. The skill requires an interview to confirm scope, enforceable rules, and filename, and refuses to write rules from assumptions. If questions cannot be answered, it summarizes what is needed and stops.