Logo Eval Rules

Eval Rules

Cộng đồngPhổ biến
FlorianBruniaux
eval-rules

Audit .claude/rules/ files for structural correctness, glob validity, and real-world usefulness. Resolves each paths: pattern against actual project files, then asks the user whether each rule is still relevant and useful. Can update rules in-place based on answers. Use when setting up rules for the first time, debugging rules that fire too often or never, or doing a periodic rules hygiene pass.

Tổng quan

Nhà phát hànhFlorianBruniaux
Kho mãclaude-code-ultimate-guide
Tên kỹ năngeval-rules
Sao
6K
Bản fork
782
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépCC-BY-SA-4.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được FlorianBruniaux công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Eval Rules trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/FlorianBruniaux/claude-code-ultimate-guide/tree/main/examples/skills/eval-rules
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/FlorianBruniaux/claude-code-ultimate-guide.git /tmp/claude-code-ultimate-guide
mkdir -p .claude/skills
cp -r /tmp/claude-code-ultimate-guide/examples/skills/eval-rules .claude/skills/eval-rules
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Eval Rules trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Eval Rules ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Eval Rules không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Rules Evaluator

Discover all rule files, validate their structure and glob patterns against the real project, then run an interactive session to confirm (or improve) each rule with the user.

The goal is not just to score; it is to leave the rules directory in better shape than it was.

When to Use

  • First time writing .claude/rules/ files (validate before committing)
  • A rule seems to never trigger, or fires on every file
  • Migrating @ imports from CLAUDE.md to path-scoped rules
  • Periodic hygiene: "are these rules still relevant to how we work?"
  • After onboarding to a new codebase

Key Concepts

MechanismWhen it loadsNotes
@file in CLAUDE.mdSession start, alwaysEven inside a conditional sentence
No paths: in ruleSession start, alwaysSame cost as @import
paths: frontmatterWhen Claude reads a matching fileTrigger = Read tool on a matched file
User-level rule (~/.claude/rules/)Session start, alwaysApplies to all projects on the machine

The paths: field is the main lever for keeping rules contextual. An always-on rule with 80 lines loads on every session even if you're fixing a typo in README.md.

Glob patterns in paths: support brace expansion: "src/**/*.{ts,tsx}" matches both .ts and .tsx files with one entry.


Scoring Criteria (12 pts per rule)

#CriterionMaxWhat is checked
1frontmatter block1File has YAML frontmatter (--- delimited)
2paths: field2Present (1pt) + at least one pattern listed (1pt)
3pattern validity3Each pattern matches >= 1 file in project (up to 3 patterns checked)
4scope2Not dead (>= 1 match) + not too broad (<30% of project source files)
5content quality3Has clear header/title (1pt) + rules are specific/actionable (1pt) + under 150 lines (1pt)
Bonusfocus+1Under 15 rules in file

Thresholds:

  • Good: >= 10/12 (>= 83%)
  • Needs work: 7-9/12 (58-82%)
  • Fix: < 7/12 (< 58%)

Always-on rules (no paths: field): skip criteria 2, 3, 4. Score on 5 pts max. Flag with a blue marker and go through the interactive step to decide if scoping is needed.


Execution Instructions

Step 1: Discovery

Use Glob to find all rule files:

.claude/rules/**/*.md

If an argument was passed (e.g., /eval-rules ./my-rules/), use that path instead.

Also scan ~/.claude/rules/ for user-level rules if the user asks for a full picture (these are always-on and apply to all projects on the machine).

Also count total source files for scope % calculation:

bash
find . \( -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.go" -o -name "*.rs" \) \
  ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" \
  2>/dev/null | wc -l

If no .claude/rules/ directory exists, report it and stop.

Step 2: Parse each rule

For each .md file found:

  1. Read the full file
  2. Extract YAML frontmatter (content between first --- and second ---)
  3. Parse paths: field: collect all glob patterns as a list
  4. Classify: conditional (has paths:), always-on (no frontmatter or no paths:), or user-level (from ~/.claude/rules/)
  5. Read the body: line count, presence of a clear title/header, whether rules are specific

Step 3: Resolve glob patterns

For each rule with paths:, use Glob to resolve each pattern against the project:

  • Collect total matched files per pattern
  • Show up to 10 sample paths
  • Flag dead patterns (0 matches) and broad patterns (>30% of source files)

Step 4: Interactive review (core of the skill)

Process rules one by one. Do not batch and skip the interaction.

For each conditional rule (has paths:):

Show:

Rule: payments.md [conditional]
paths: ["**/payments/**", "src/billing/**"]
Matches: 12 files
  - src/payments/stripe.py
  - src/payments/webhook.py
  - src/billing/invoice.py
  ... (9 more)

Ask three questions:

  1. "Is this scope right? (y = yes / n = needs adjustment)"
  2. "Is this rule still useful day-to-day? (y / n / unsure)"
  3. "Anything to add, remove, or update in the rule content? (describe or skip)"

For each always-on rule (no paths:):

Show:

Rule: database.md [always-on, loads every session]
Content: 91 lines, 8 rules

Ask:

  1. "This rule loads at every session. Should it stay always-on, or be scoped to specific files? (keep / scope / skip)"
  2. "Is the content still accurate and useful? (y / n)"

If the user says scope: help them define a paths: pattern based on the rule content (e.g., database rules -> **/models/**, **/migrations/**, **/*.sql). Propose the frontmatter block and ask for confirmation before editing.

If the user provides corrections or updates during the interaction: apply them directly using Edit, confirm each change, then move to the next rule.

Step 5: Output report

After all rules are reviewed:

# Rules Audit: [project name or path]
Date: [today] | Scanned: N rules (X conditional, Y always-on)

## Summary

| Status | Count |
|--------|-------|
| Good (>= 83%) | N |
| Needs work (58-82%) | N |
| Fix (< 58%) | N |
| Always-on (no paths:) | N |
| User confirmed useful | N |
| User flagged for update | N |
| User marked as stale | N |

---

## Per-Rule Results

### payments.md (11/12) [conditional]

paths: `**/payments/**`, `src/billing/**`
Matches: 12 files (3.5% of 340 source files)

| Criterion | Score | Notes |
|-----------|-------|-------|
| frontmatter | 1/1 | ok |
| paths: field | 2/2 | 2 patterns |
| pattern validity | 3/3 | All match >= 1 file |
| scope | 2/2 | 3.5%, well-scoped |
| content quality | 2/3 | 158 lines (over 150) |

User feedback: scope confirmed ("fires exactly when we work on Stripe")
Content: no changes needed

---

### database.md (3/5) [always-on]

No paths: field; loads at every session.

| Criterion | Score | Notes |
|-----------|-------|-------|
| frontmatter | 0/1 | No frontmatter block |
| content quality | 3/3 | 91 lines, specific rules, clear header |
| focus | 1/1 | 8 rules |

User feedback: scope -> added paths: ["**/models/**", "**/migrations/**", "**/*.sql"]
Edit applied

---

Step 6: Fix Summary

## What Changed This Session

database.md:
  - Added frontmatter with paths: ["**/models/**", "**/migrations/**", "**/*.sql"]

testing.md:
  - User confirmed useful, no changes

git-workflow.md:
  - User flagged as stale (marked for deletion, not deleted yet, awaiting confirmation)

---
N rules audited / N edits applied / N rules flagged as stale

For any rule the user marked as stale or outdated: ask for explicit confirmation before deleting. Never delete without a clear "yes, delete it".


Edge Cases

  • Subdirectory rules (e.g., .claude/rules/frontend/react.md): discovered and processed normally
  • Symlinked files or directories in .claude/rules/: supported by design, discovered and processed normally
  • Invalid YAML frontmatter: report parse error, score frontmatter as 0/1
  • Empty file: flag as broken, skip interactive step, ask if it should be deleted
  • Dead pattern (0 matches): flag, suggest fix based on rule content
  • Pattern matching >30% of files: flag as too broad, suggest narrowing
  • User says "unsure" about usefulness: note it in the report, do not edit, add a comment "Review in next audit"
  • Rules not loading as expected: advise the user to add the InstructionsLoaded hook, which logs exactly which rule files load and when

Câu hỏi thường gặp

Kỹ năng AI Eval Rules làm được gì?

Audit .claude/rules/ files for structural correctness, glob validity, and real-world usefulness. Resolves each paths: pattern against actual project files, then asks the user whether each rule is still relevant and useful. Can update rules in-place based on answers. Use when setting up rules for the first time, debugging rules that fire too often or never, or doing a periodic rules hygiene pass.

Vì sao nên dùng Eval Rules trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Eval Rules là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Eval Rules trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/FlorianBruniaux/claude-code-ultimate-guide/tree/main/examples/skills/eval-rules. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Eval Rules?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Eval Rules với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Eval Rules với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Eval Rules có miễn phí không?

Có. Kỹ năng này được FlorianBruniaux phát hành trên GitHub theo giấy phép CC-BY-SA-4.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇