pattern-mining

A method for testing whether repeated code really follows a reusable pattern. It compares independently written examples and then tests the proposed rule on a separate example it did not use to form the rule.

In plain words
What is it for?
Use it to examine recurring implementation shapes, identify true invariants and variation points, and decide whether a shared abstraction is justified.
Why use it?
It helps avoid creating abstractions—shared designs or helpers—from copied code or superficial similarities. Weak evidence stays a hypothesis instead of becoming part of the system's architecture.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/boshu2/agentops/pattern-mining
Any agent
npx skills add boshu2/agentops --skill pattern-mining
Clone the repo
git clone --depth 1 https://github.com/boshu2/agentops

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,476 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00045 $0.01476
Opus 5 $0.00023 $0.00738
Sonnet 5 $0.00009 $0.00295
Haiku 4.5 $0.00005 $0.00148

Measured 2d ago against content hash 8444d7f8f9aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pattern-mining 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.

images/gemini/skills/pattern-mining/SKILL.md · 157 lines

How it starts

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

Pattern Mining

Decide whether repeated code demonstrates a reusable rule or only a plausible hypothesis. Similar names and syntax are not enough; the abstraction must survive examples it was not designed around.

Constraints

  • To prevent lineage copies from faking recurrence, use independently implemented exemplars with repository anchors.
  • Because the candidate must generalize, form it without seeing the holdout and back-apply every holdout-driven refinement.
  • To keep weak evidence from becoming architecture, route hypotheses to no-action; only a fully proven promotion may reach operationalize.

Workflow

  1. State the candidate pattern and collect independently implemented exemplars with repository anchors. Use research when coverage is unclear.
  2. From the exemplars, separate required invariants, legitimate variation points, and incidental similarity.
  3. Require at least three distinct exemplars before promotion is possible. Form the candidate abstraction without using the holdout.
  4. Test it against every exemplar, then a separate holdout. Back-apply the refined abstraction to the original exemplars so the holdout fix cannot silently break them.
  5. Emit outcome: promote only when the exemplar floor, holdout, and back-application all pass. Route that evidence to operationalize, which decides whether the eventual shape is a skill, gate, library, template, or no action.
  6. Otherwise emit outcome: hypothesis with route: no-action. Keep the evidence bounded and name what additional observation would retest it.

Diff/align across exemplars

Invariants are extracted mechanically, not remembered. Lay the exemplars side by side, align them structurally (same role, same position in the flow — not same variable names), and diff: what survives every alignment is a candidate invariant; what varies by site is a variation point; what varies with no functional consequence is incidental. Work pairwise before generalizing — an "invariant" derived by skimming all exemplars at once is usually the first exemplar's shape with the others squinted into agreement. Stop condition: every line of the candidate abstraction is traceable to a surviving alignment across all exemplars, or it is deleted. The named failure mode is eyeball convergence — declaring similarity from memory of the files rather than from an explicit alignment, which smuggles one lineage's incidentals into the rule.

Read the full file on GitHub · 157 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 · 157 lines · 45 tokens per session scan A 8444d7f8f9aa

Subscribe to this mod's changes

pattern-mining is a skill published in the GitHub repository boshu2/agentops (431 stars, last pushed 4d ago), licensed Apache-2.0. It adds 45 tokens to every session and 1,476 once invoked, about $0.0002 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-08-30.

Related

Other skills, from other repositories

brainstorm

Explore vague or ambitious ideas into a right-sized requirements-only plan. Use when the user wants to brainstorm, think through scope, decide what to build, or needs collaborative product framing before planning, not for a decisive verdict on whether to adopt or switch to a specific external technology, library, or…

OutlineDriven/odin-claude-plugin · 85 tokens

doc-review

Use when the user asks to review or critique a prose planning document — a plan, spec, PRD, requirements doc, or design doc.

OutlineDriven/odin-claude-plugin · 32 tokens

audit-project

Run an iterative multi-agent code audit until critical and high findings are resolved. Use when the user says "audit my code", "find all the bugs", "deep code audit", "iterative review", or "review until clean".

OutlineDriven/odin-claude-plugin · 50 tokens

autolearn

Compound a solved problem into a durable in-repo learning doc. Use when a verified non-trivial fix lands, the user says "compound this", "document this fix", or "remember this". This is the automatic-capture entry point; for an explicitly requested one-off write-up, use compound.

OutlineDriven/odin-claude-plugin · 65 tokens

doubt-driven

Doubt-driven adversarial review. Use when correctness matters more than speed, the code is unfamiliar, stakes are high, a claim can't be checked by the type system or compiler, or verifying now is cheaper than debugging later.

OutlineDriven/odin-claude-plugin · 49 tokens

drift-detect

Use when the user says "plan drift", asks whether the roadmap, plans, or docs still match the code, or is deciding what to rebuild when restarting a stalled project. For doc-vs-code drift inside a specific diff, use sync-docs.

OutlineDriven/odin-claude-plugin · 56 tokens