搜索

PythonReactSEOPDF
GitHub Skill

rules-optimizer

Optimize and create Claude Rules (.claude/rules/*.md) following best practices. Use when asked to "create a rule", "optimize my rules", or "review my .claude/rules files".

hairihou☆ 0 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Rules Optimizer

Create and optimize .claude/rules/*.md files for effective AI guidance.

Best Practices

File Structure
.claude/rules/
├── typescript.md        # Language-specific
├── python.md
├── frontend/
│   ├── react.md         # Framework-specific
│   ├── tailwind.md
│   └── component-structure.md
└── backend/
    └── api.md
Rule File Format
---
paths: "**/*.{ts,tsx}" # Glob pattern (quoted)
---

# [Topic] Rules

## [Category]

[Rule statement]

\`\`\`typescript
// ❌ BAD
[anti-pattern]

// ✅ GOOD
[correct pattern]
\`\`\`
Content Guidelines
  1. One topic per file — keep focused
  2. 150-200 lines ideal — enough for examples, not overwhelming
  3. Include examples — 1 BAD/GOOD pair per rule that needs clarity
  4. Skip obvious rules — focus on what AI gets wrong
  5. No "why" explanations — just the rule and example
  6. Use tables for mappings (e.g., v3→v4 migrations)
Path Patterns
Pattern Matches
**/*.ts All TS files
**/*.{ts,tsx} TS and TSX
src/**/* All under src/
components/**/*.tsx Components only
What to Include
  • ❌ Anti-patterns AI commonly generates
  • ✅ Correct patterns with minimal example
  • Migration mappings (old → new)
  • Framework-specific conventions
What to Exclude
  • Self-evident rules (use semicolons, etc.)
  • Long explanations of "why"
  • Multiple examples for same rule
  • Style preferences (let linters handle)

Workflow

  1. Read existing rule file
  2. Identify: redundancy, missing examples, excessive length
  3. Compress to essentials with 1 example per rule
  4. Ensure paths pattern is appropriate
  5. Output optimized version

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!