rules-optimizer

Create and optimize Claude Rules Markdown files with structured BAD/GOOD examples.

Updated Jan 10, 2025
One-click install
npx skills add https://github.com/hairihou/dotfiles --skill rules-optimizer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rules-optimizer
Source: https://github.com/hairihou/dotfiles/tree/main/src/.claude/skills/rules-optimizer
Command: npx skills add https://github.com/hairihou/dotfiles --skill rules-optimizer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps you create and optimize Claude Rules files to guide AI behavior with clear structure and examples.

Core Features & Use Cases

  • One-topic-per-file rules for maintainability.
  • Best-practice guidelines including example BAD/GOOD snippets.
  • Migration mappings for version upgrades.

Quick Start

Create a new rule file under .claude/rules/typescript.md that enforces not using eval and include a short BAD/GOOD example.

Frequently Asked Questions about rules-optimizer

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

FAQPage Schema
How do I create Claude Rules files to guide AI behavior?

Claude Rules files are Markdown documents stored in .claude/rules/ that define coding standards and AI behavior guidelines. Create one rule per file with a front matter header listing applicable paths, structure it with BAD/GOOD code examples, and keep it to 150-200 lines following framework-specific conventions for your tech stack.

What's the best way to organize rules for TypeScript and backend projects?

Organize rules under .claude/rules/ with separate files for TypeScript, frontend, and backend concerns—one topic per file for maintainability. Use Markdown front matter to specify which paths each rule applies to, include concrete BAD/GOOD examples, and follow framework conventions to enforce consistent AI-guided behavior across your codebase.

Can I include anti-patterns and best practices in a single rule file?

Yes. Each rule file should include one BAD example showing the anti-pattern to avoid and one GOOD example showing the correct approach. This structure helps Claude understand both what not to do and the preferred pattern, making your rules actionable and concrete.

Do I need to follow a specific format for Claude Rules files?

Yes. Use a defined output format with Markdown front matter containing paths, maintain one topic per file, target 150-200 lines, include one BAD/GOOD example pair per rule, and apply framework-specific conventions for TypeScript, frontend, or backend contexts to ensure consistency and clarity.

How do I optimize existing rule files for better AI guidance?

Optimize by restructuring files to cover one topic each, adding clear BAD/GOOD code examples if missing, ensuring front matter headers list correct paths, removing redundancy, and applying framework-specific best practices. Aim for 150-200 lines per file with concrete, actionable patterns.

What should I do when upgrading rule files between versions?

Use migration mappings provided for version upgrades to update your .claude/rules/ files. Review each rule's front matter paths, verify BAD/GOOD examples still reflect current best practices, and restructure as needed to maintain the one-topic-per-file standard and defined output format.