intent-based-dedup

intent-based-dedup is a skill for Claude Code, Codex from j5ik2o/okite-ai. It costs 237 tokens per session (2,341 once invoked), scanned A, original, MIT.

A code-design guide for deciding when similar code should be combined based on its purpose, not only on matching text. It explains how to avoid misapplying DRY, the practice of not repeating code.

In plain words
What is it for?
Use it during code review, refactoring, or new development to judge whether duplicate code should become a shared function.
Why use it?
It helps prevent unrelated business rules from being tied together just because their code currently looks alike.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it during code review, refactoring, or new development to judge whether duplicate code should become a shared function.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j5ik2o/okite-ai/intent-based-dedup
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 j5ik2o/okite-ai --skill intent-based-dedup
Clone the repo
git clone --depth 1 https://github.com/j5ik2o/okite-ai

Made for: Claude Code, Codex.

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 intent-based-dedup

README.md
[![agentmods](https://agentmods.dev/badge/skills/j5ik2o/okite-ai/intent-based-dedup.svg)](https://agentmods.dev/skills/j5ik2o/okite-ai/intent-based-dedup)
Your own site
<a href="https://agentmods.dev/skills/j5ik2o/okite-ai/intent-based-dedup"><img src="https://agentmods.dev/badge/skills/j5ik2o/okite-ai/intent-based-dedup.svg" alt="Measured on agentmods" height="20"></a>
Per session 237 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,341 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.00237 $0.02341
Opus 5 $0.00118 $0.01171
Sonnet 5 $0.00047 $0.00468
Haiku 4.5 $0.00024 $0.00234

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

Security

Grade A, and why

intent-based-dedup 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 5d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/intent-based-dedup/SKILL.md · 203 lines

How it starts

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

意図ベースの共通化判定

字面が同じかどうかより、意図(目的)が同じかどうかで共通化する。

核心原則

「字面が同じなら共通化」という単純思考は危険。意図・目的の一致を最優先に判断する。

コード表現が同一でも、ビジネスロジック上の目的が異なれば共通化してはならない。 逆に、表現が異なっていても目的が同じなら統一すべきである。

判断マトリックス

字面 意図 判定 アクション
同じ 同じ 共通化 ◎ DRY原則を適用し共通関数に抽出
異なる 同じ 統一 ◎ どちらかの実装に統一
同じ 異なる 共通化 ✗ 絶対に共通化禁止(最重要)
異なる 異なる 共通化 ✗ 検討不要

判断フロー

重複コードを発見した
    ↓
2つのコードの「目的」は同じか?
    ├─ YES → 字面は同じか?
    │         ├─ YES → 共通化する(標準的DRY)
    │         └─ NO → 実装方式を統一する
    └─ NO → 字面は同じか?
              ├─ YES → ⚠ 共通化禁止(最も危険なケース)
              └─ NO → 何もしない

アンチパターン検出

以下のパターンを見つけたらDRY誤適用の兆候:

❌ 異なるドメイン概念に同じユーティリティ関数を使い回す
❌ "たまたま同じ計算式" を共通関数に抽出
❌ 共通化した関数に if (type == A) / else if (type == B) の分岐が増える
❌ 共通関数名が汎用的すぎる(calculate, process, transform等)
❌ 一方の仕様変更時に「もう一方も壊れないか」を心配する
❌ 共通関数のパラメータが増殖し続ける

4パターンの詳細

1. 字面が同じ × 意図が同じ → 共通化する

DRY原則が正しく適用されるケース。

// ❌ 同じ目的の処理が2箇所に重複
fn report_even_squares(numbers: &[i32]) -> Vec<i32> {
    numbers.iter()
        .filter(|&&x| x % 2 == 0)
        .map(|&x| x * x)
        .collect()
}

fn display_even_squares(numbers: &[i32]) -> Vec<i32> {
    numbers.iter()
        .filter(|&&x| x % 2 == 0)
        .map(|&x| x * x)
        .collect()
}

// ✅ 共通化: 同じ目的なので1つにまとめる
fn even_squares(numbers: &[i32]) -> Vec<i32> {
    numbers.iter()
        .filter(|&&x| x % 2 == 0)
        .map(|&x| x * x)
        .collect()
}

2. 字面が異なる × 意図が同じ → 統一する

同じ目的だが異なる実装スタイルで書かれているケース。

// パターンA: 関数型アプローチ
fn total_a(values: &[i32]) -> i32 {
    values.iter().fold(0, |acc, &x| acc + x)
}

// パターンB: 命令型アプローチ
fn total_b(values: &[i32]) -> i32 {
    let mut sum = 0;
    for &v in values { sum += v; }
    sum
}

// ✅ どちらか一方に統一(チーム規約に従う)
fn total(values: &[i32]) -> i32 {
    values.iter().sum()
}

3. 字面が同じ × 意図が異なる → 共通化禁止(最重要)

最も危険なケース。 形式上同じコードでも、ビジネス上の目的が異なる。

// ケース1: 攻撃力計算(地形倍率を適用)
fn adjusted_attack_points(weapon_points: &[i32]) -> Vec<i32> {
    weapon_points.iter()
        .map(|&x| x * 2)
        .filter(|&x| x % 2 == 0)
        .map(|x| x * x)
        .collect()
}

// ケース2: 武器加工費用計算
fn weighted_crafting_costs(amounts: &[i32]) -> Vec<i32> {
    amounts.iter()
        .map(|&x| x * 2)
        .filter(|&x| x % 2 == 0)
        .map(|x| x * x)
        .collect()
}

Read the full file on GitHub · 203 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. 5d ago First seen · 203 lines · 237 tokens per session scan A a00ebb166758

Subscribe to this mod's changes

intent-based-dedup is a skill published in the GitHub repository j5ik2o/okite-ai (81 stars, last pushed 4mo ago), licensed MIT. It adds 237 tokens to every session and 2,341 once invoked, about $0.0012 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-03.