smart-rules
2
总安装量
2
周安装量
#69986
全站排名
安装命令
npx skills add https://github.com/cantagestudio/cosmicatlaspacker --skill smart-rules
Agent 安装分布
amp
2
gemini-cli
2
github-copilot
2
codex
2
kimi-cli
2
cursor
2
Skill 文档
Smart Rules
A skill that analyzes user prompts and efficiently loads only relevant rule/guide documents.
Key Features
- Auto-initialization: Scans project documents and auto-generates config file on first invocation
- Config-based: Category-document mapping defined in project-specific
smart-rules.yaml - Efficient loading: Skips if no match, loads only what’s needed
- Dual invocation: Auto-execute before tasks or manual
/smart-rulescommand - Post-TodoWrite trigger: Analyzes todo content and loads relevant rules after TodoWrite
â CRITICAL: Auto-Invocation Rules
AI MUST automatically invoke smart-rules in these situations:
1. After TodoWrite Tool Usage
When AI uses the TodoWrite tool, AI MUST invoke smart-rules to analyze the todo content and load relevant rules:
[AI uses TodoWrite tool]
â
[Analyze todo content keywords]
â
[Smart Rules] Loaded documents for: [matched categories based on todo content]
Example:
TodoWrite: "Export ë¤ì´ì¼ë¡ê·¸ UI 구í"
â
Keywords: Export, ë¤ì´ì¼ë¡ê·¸, UI, 구í
â
[Smart Rules] Loaded 3 documents for categories: [ui, design, patterns]
- Docs/UX/IA.md
- Docs/UX/DesignSystem/Components.md
- Docs/Patterns/Flutter-Desktop-Window-Management-Pattern.md
Why? ìì´ì í¸ê° ìì í todoì ê´ë ¨ë ê·ì¹ì 미리 ìì§íì¬ ì¬ë°ë¥¸ í¨í´ê³¼ 컨벤ì ì ë°ë¥´ëë¡ í©ëë¤.
2. Before Implementation Tasks
When user requests feature implementation, bug fix, or code changes:
[User requests implementation]
â
[Smart Rules] Analyzing keywords...
[Smart Rules] Loaded documents for: [coding, patterns, ...]
Auto-Invocation Triggers
| Trigger | Action |
|---|---|
| TodoWrite ì¬ì© ì§í | Todo ë´ì© í¤ìë ë¶ì â ê´ë ¨ ê·ì¹ ë¡ë |
| 구í ìì² | ì¬ì©ì ìì² í¤ìë ë¶ì â ê´ë ¨ ê·ì¹ ë¡ë |
| ë²ê·¸ ìì ìì² | ì¬ì©ì ìì² í¤ìë ë¶ì â ê´ë ¨ ê·ì¹ ë¡ë |
| 리í©í ë§ ìì² | ì¬ì©ì ìì² í¤ìë ë¶ì â ê´ë ¨ ê·ì¹ ë¡ë |
Commands
| Command | Description |
|---|---|
/smart-rules init |
Scan project and generate config file |
/smart-rules rescan |
Delete existing config and rescan |
/smart-rules |
Load documents based on current context |
/smart-rules [category] |
Load specific category documents only |
/smart-rules all |
Load all category documents |
Workflow
1. Initialization (init) – When config file missing
[1. Detect Missing Config]
ââ Check if smart-rules.yaml exists
â
[2. Scan Project Documents]
ââ Scan standard paths:
- .claude/rules/*.md
- Docs/**/*.md
- .claude/CLAUDE.md, CLAUDE.md
- README.md
â
[3. Analyze & Categorize]
ââ Classify discovered documents by category
â
[4. Extract Keywords]
ââ Extract keywords from document titles/headers
â
[5. Generate Config]
ââ Create smart-rules.yaml file
ââ Report generated config to user
2. Document Loading – When config file exists
[1. Load Config]
ââ Read smart-rules.yaml
â
[2. Analyze Prompt]
ââ Extract keywords from user prompt
â
[3. Match Categories]
ââ Match keywords â categories
ââ Check composite categories
â
[4. Skip if No Match]
ââ Skip if no matches found
â
[5. Load Documents]
ââ Load matched category documents
ââ Remove duplicates, apply max_documents limit
â
[6. Report]
ââ Output loaded document list
Auto-categorization Rules
Documents are auto-classified by filename/path patterns during scanning:
| Pattern | Category |
|---|---|
| architecture, arch, structure | architecture |
| coding, convention, style, lint | coding |
| UX, UI, screen, layout, component | ui |
| design, color, theme, typography | design |
| task, todo, backlog | task |
| spec, prd, requirement | spec |
| pattern | patterns |
| security, critical | security |
| others | misc |
Excluded Categories
AI MUST NOT scan or load documents for these categories:
| Pattern | Reason |
|---|---|
| label, labeling | ë¼ë²¨ë§ ìì¤í – íìì ìë ì¡°í |
| history | íì¤í 리 ë¡ê¹ – ìì ìë£ ìë§ ì¬ì© |
| brain, canvas | Brain ìºë²ì¤ – ë³ë ì¤í¬ë¡ ê´ë¦¬ |
These files should be excluded from scanning:
.claude/rules/labeling.md.claude/rules/history.mdDocs/Labels/**/*.mdDocs/History/**/*.mdDocs/Brain/**/*
Config File Schema (smart-rules.yaml)
version: 1
# ì¤ìºë 문ì ê²½ë¡ (ìë ìì± ì 기ë¡)
scanned_paths:
- .claude/rules/
- Docs/
# ìµì
options:
max_documents: 5 # ìµë ë¡ë 문ì ì
auto_invoke: true # ìì
ìì ì ìë ì¤í ì¬ë¶
show_loaded_report: true # ë¡ëë 문ì ëª©ë¡ ì¶ë ¥ ì¬ë¶
# ì¹´í
ê³ ë¦¬ ì ì
categories:
category_name:
keywords:
- í¤ìë1
- keyword2
documents:
- path/to/document1.md
- path/to/document2.md
# ë³µí© ì¹´í
ê³ ë¦¬ (ì¬ë¬ ì¹´í
ê³ ë¦¬ ì¡°í©)
composites:
composite_name:
keywords:
- ë³µí© í¤ìë
includes:
- category1
- category2
Usage Examples
Example 1: Feature Implementation Request
User: "ë¡ê·¸ì¸ íë©´ì 구íí´ì¤"
AI Analysis:
- Keywords: ë¡ê·¸ì¸, íë©´, 구í
- Matched: ui, design, coding
[Smart Rules] Loaded 3 documents for categories: [ui, design, coding]
- Docs/UX/IA.md
- Docs/UX/DesignSystem/Components.md
- Docs/Index/CODING_CONVENTIONS.md
Example 2: Specific Category Load
User: "/smart-rules task"
[Smart Rules] Category 'task' loaded:
- .claude/rules/task-management.md
Example 3: No Match
User: "git commit í´ì¤"
[Smart Rules] No matching rules for this task. Proceeding without rule documents.
Output Format
On Match Success
[Smart Rules] Loaded N documents for categories: [cat1, cat2]
- path/to/doc1.md
- path/to/doc2.md
On No Match
[Smart Rules] No matching rules for this task. Proceeding without rule documents.
On Initialization
[Smart Rules] Initializing...
Scanned paths: .claude/rules/, Docs/
Found N documents across M categories.
Generated: .smart-rules.yaml
Categories created:
- architecture (2 docs)
- coding (2 docs)
- ui (3 docs)
...
Limitations
| Item | Default | Description |
|---|---|---|
| max_documents | 5 | Maximum documents to load at once |
| Keyword matching | Case-insensitive | Supports both Korean and English |
| No config file | Auto init | Auto-initializes if smart-rules.yaml missing |
Config File Location
IMPORTANT: Config file is stored in project root, SEPARATELY from skill definition.
.smart-rules.yaml â Project-specific config (generated at root)
.claude/skills/smart-rules/SKILL.md â Skill definition only (do NOT touch)
| File Type | Location | Purpose |
|---|---|---|
| Skill Definition | .claude/skills/smart-rules/SKILL.md |
Read-only skill spec (managed by Droid) |
| Project Config | .smart-rules.yaml (project root) |
Project-specific category mappings |
Why Separate?
- Skill folder is managed by Droid (synced, updated, reset)
- Config file is project-specific and persists across skill updates
- Prevents “folder already exists” conflicts during
init
Init Behavior
/smart-rules initchecks for.smart-rules.yamlin project root- If missing â scans project and creates
.smart-rules.yamlat root - If exists â uses existing config (no conflict with skill folder)
/smart-rules rescandeletes.smart-rules.yamland rescans