first-plan-pattern-extraction

A method for finding recurring coding conventions and anti-patterns in a project. Every recorded pattern must include a concrete example showing the file and line where it was observed.

In plain words
What is it for?
Use it during discovery to inspect representative source and test files, identify repeated structures, common imports, coding recipes and warnings, and assign confidence to the findings.
Why use it?
It turns observations from the code into evidence-backed guidance for future work. This avoids presenting guesses or unsupported preferences as project rules.

Skill for Claude CodeCodex

Part of the fp plugin — 19 skills, 19 commands, 4 agents, 1 hook shipped together

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/vynazevedo/first-plan/pattern-extraction
Any agent
npx skills add vynazevedo/first-plan --skill pattern-extraction
Clone the repo
git clone --depth 1 https://github.com/vynazevedo/first-plan

Made for: Claude Code, Codex.

Or install fp, the plugin that ships this one along with the rest of its 19 skills, 19 commands, 4 agents, 1 hook.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,231 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.00056 $0.01231
Opus 5 $0.00028 $0.00616
Sonnet 5 $0.00011 $0.00246
Haiku 4.5 $0.00006 $0.00123

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

Security

Grade A, and why

first-plan-pattern-extraction 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 3d 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.

skills/pattern-extraction/SKILL.md · 111 lines

How it starts

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

Pattern Extraction

Como transformar observações do código em "padrões" registráveis em .first-plan/02-conventions/, 06-rationale/do.md, 06-rationale/dont.md.

Princípio

Sem exemplo do código, sem padrão. Toda regra extraída precisa de pelo menos 1 exemplo concreto (path:line). Sem exemplo, vira pergunta em 08-meta/questions.md ou é descartada.

Algoritmo de extração

1. Amostragem

Para cada categoria (errors, naming, testing, etc), amostre arquivos representativos:

  • Top 10 arquivos por linhas de código (não-teste)
  • Top 5 arquivos modificados nos últimos 30 dias
  • 3 arquivos de teste de cada pasta principal

Limite: máx 50 arquivos lidos por categoria. Se ficar muito ruidoso, abortar com confidence baixa.

2. Identificação de padrão candidato

Em cada arquivo amostrado, busque:

  • Repetição estrutural (5+ ocorrências da mesma forma)
  • Imports comuns (mesmo símbolo importado em N+ arquivos)
  • Receitas (e.g., "todo handler começa com func Handle...(ctx Context, req Request) (Response, error)")
  • Comentários proibitivos (// don't use X, // use Y instead)
  • Código deletado em commits recentes (sinal de anti-padrão)

3. Confidence scoring

Cada padrão candidato ganha confidence baseado em sinais convergentes:

Sinal Peso
5+ ocorrências consistentes +0.3
10+ ocorrências consistentes +0.5
Mesmo padrão em testes e código de produção +0.2
Comentário no codebase explicitamente preferindo o padrão +0.2
Documentado em README/CLAUDE.md/docs/ +0.2
Ocorre em código recente (últimos 90 dias) +0.1
Não tem variantes inconsistentes +0.2
Tem variantes inconsistentes (alguns fazem A, outros B) -0.3
Apenas 1-2 ocorrências -0.4
Apenas em código antigo (>1 ano sem update) -0.2
Conflita com outro padrão extraído -0.3

Soma final clamped em [0.0, 1.0]. Threshold default 0.7.

4. Anti-padrões (o que o projeto evita)

Detectar via:

  • Ausência consistente de algo comum em outros projetos similares (e.g., zero any em projeto TS estrito = sinal forte de "evitar any")
  • Comentários // don't, // avoid, // nao usar, // removed because
  • Commits/PRs com mensagens "remove", "deprecate", "migrate away from"
  • Padrão substituído por outro (e.g., todos os console.log foram trocados por logger.info em commits recentes)

Read the full file on GitHub · 111 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. 3d ago First seen · 111 lines · 56 tokens per session scan A 4a3aa3ed7d93

Subscribe to this mod's changes

first-plan-pattern-extraction is a skill published in the GitHub repository vynazevedo/first-plan (23 stars, last pushed 8d ago), licensed MIT. It adds 56 tokens to every session and 1,231 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-08-30.

Related

Other skills, from other repositories

RecallMax

Enhances AI memory capabilities with long-context support.

Bilal140202/the-lord-of-the-skills · 13 tokens

agent-memory

Persistent memory system for AI coding agents. Use when you need to save facts about the user, store interaction preferences, log session events, or search previously saved memories. Triggers on remembering, saving context, recalling past decisions, or when the user says "remember this". Also use proactively when the…

OctavianTocan/agent-memory · 78 tokens

snip

You are an expert at writing declarative YAML filters for snip, a CLI proxy that reduces LLM token consumption by filtering shell output.

edouard-claude/snip · 0 tokens

release-notes

Draft user-facing release notes from a git log range. Trigger when the user asks for "release notes", "changelog entry", or "what shipped this week" with a git ref range. Output is markdown sections grouped by Features / Fixes / Breaking with PR links.

jnMetaCode/ai-coding-guide · 59 tokens

arch-check

架构与实现审查 —— 基于「概念建模 → 职责划分 → 机制/策略分离 → 因果与不变量 → 属性建模 → 模块化 → SOLID → GRASP → YAGNI」的全维度审查,带置信度门控与假阳性抑制(对抗"过度工程建议"这类 AI slop)。触发于:要求 review/审查架构、检查目录结构/依赖关系/职责划分、重构前评估、技术债盘点、判断是否过度设计,或问「这个设计合理吗 / 该怎么拆 / 有没有循环依赖 / 这个改动架构上 OK 吗」。一律按最高强度审查。用法:arch-check [范围] [--fix|--plan]。范围可为目录/文件/PR;缺省审当前分支相对基线的全部变更。.

AgentsMesh/AgentsMesh · 212 tokens

Agent Context File Writer

Writes a high-quality CLAUDE.md, .cursorrules, or .windsurfrules file that gives a coding agent the right project context, conventions, and constraints to work effectively.

Notysoty/openagentskills · 45 tokens