rule-engine-extract

rule-engine-extract is a skill for Claude Code from sfc-gh-dflippo/snowflake-dbt-demo. It costs 55 tokens per session (1,202 once invoked), scanned A, original, Apache-2.0.

A rule-learning step that compares changed SQL files or reviews Git history to identify reusable migration fixes. Git is a system that records versions and changes to files.

In plain words
What is it for?
Use it after fixing converted SQL to capture the pattern, or to learn rules from earlier committed changes.
Why use it?
It avoids repeating the same manual SQL correction across future conversions. The result documents a before-and-after change as a rule that can be reused.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the snowflake-migration plugin — 72 skills, 7 agents shipped together

Good fit Use it after fixing converted SQL to capture the pattern, or to learn rules from earlier committed changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sfc-gh-dflippo/snowflake-dbt-demo/extract
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sfc-gh-dflippo/snowflake-dbt-demo --skill extract
Clone the repo
git clone --depth 1 https://github.com/sfc-gh-dflippo/snowflake-dbt-demo

Made for: Claude Code.

Or install snowflake-migration, the plugin that ships this one along with the rest of its 72 skills, 7 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rule-engine-extract

README.md
[![agentmods](https://agentmods.dev/badge/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract/github.svg)](https://agentmods.dev/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract)
Your own site
<a href="https://agentmods.dev/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract"><img src="https://agentmods.dev/badge/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rule-engine-extract

Your own site · 80×15
<a href="https://agentmods.dev/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract"><img src="https://agentmods.dev/badge/skills/sfc-gh-dflippo/snowflake-dbt-demo/extract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,202 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00055 $0.01202
Opus 5 $0.00028 $0.00601
Sonnet 5 $0.00011 $0.00240
Haiku 4.5 $0.00006 $0.00120

Measured 2d ago against content hash bd42e9d22a39, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rule-engine-extract scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/snowflake-migration/skills/migration/migrate-objects/rule-engine/extract/SKILL.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Extract Rules

Analyze changes to converted SQL files and extract reusable migration rules. Works in two modes:

  • Interactive fix mode — the user fixed a file; compare before/after to extract a rule
  • Git history mode — analyze committed changes retroactively

Prerequisites

  • Rule engine set up (../SKILL.md)
  • Snowflake connection active

Mode Selection

If the user says something like "I fixed X, extract a rule" or "deduce a rule from my fix" → use Interactive Fix Mode.

If the user says "analyze recent changes" or "extract rules from git history" → use Git History Mode.


Interactive Fix Mode

Step 1: Get the "After" SQL

Read the current converted file (the fixed version):

cat <project_dir>/snowflake/<type>/<schema>/<name>.sql

Or ask the user which file they fixed.

Step 2: Get the "Before" SQL

Find the changes in the file — use git diff, git log, or any other method to obtain the previous version. If no history is available, ask the user.

Step 3: Analyze the Diff

Compare before and after to identify distinct fix patterns. For each pattern:

  1. What changed — describe the transformation (before → after)
  2. Why — what Snowflake compatibility issue does this fix?
  3. Is it mechanical? — can a regex handle it, or does it need AI context?

If mechanical (direct find/replace):

  • Propose replacement_mode = 'regex'
  • Write match_pattern (detection regex)
  • Write replacement_find and replacement_replace (substitution regex)

If context-dependent:

  • Propose replacement_mode = 'ai'
  • Write match_pattern (detection regex)
  • Write ai_context describing: what to look for, how to fix it, edge cases to watch for

Always generate examples from the actual before/after.

Step 4: Check for Duplicates

Use the find_similar_rules tool with query set to a description of the pattern.

If a similar rule exists:

This pattern matches existing rule "". No new rule needed.

Read the full file on GitHub · 159 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 159 lines · 0 tokens per session scan A bd42e9d22a39

Subscribe to this mod's changes

rule-engine-extract is a skill published in the GitHub repository sfc-gh-dflippo/snowflake-dbt-demo (33 stars, last pushed 3d ago), licensed Apache-2.0. It adds 55 tokens to every session and 1,202 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-10.