learn

A codebase-scanning workflow that records recurring coding patterns and known anti-patterns in project guardrails.

In plain words
What is it for?
It is for discovering project-specific conventions, recording patterns to skip in future checks, identifying patterns that should always be flagged, and migrating or promoting existing workflow rules.
Why use it?
It helps later quality checks understand which conventions to accept and which repeated mistakes to flag.

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/drafthq/draft/learn
Any agent
npx skills add drafthq/draft --skill learn
Clone the repo
git clone --depth 1 https://github.com/drafthq/draft

Made for: Claude Code, Codex.

Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,465 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.00042 $0.05465
Opus 5 $0.00021 $0.02733
Sonnet 5 $0.00008 $0.01093
Haiku 4.5 $0.00004 $0.00547

Measured yesterday against content hash a088521ca6ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

learn 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 yesterday.

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/learn/SKILL.md · 513 lines

How it starts

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

Learn — Pattern Discovery & Guardrails Update

Scan the codebase to discover recurring coding patterns and update draft/guardrails.md with learned conventions and anti-patterns. This improves future quality command accuracy by reducing false positives and catching known-bad patterns.

MANDATORY GRAPH LOOKUP (read before pattern scanning)

First resolve the bundled helpers:

# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
# is not exported into skill Bash). See core/shared/tool-resolver.md.
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}/scripts/tools"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"

When draft/graph/schema.yaml exists, this skill must follow the graph-first lookup contract in core/shared/graph-query.md §Mandatory Lookup Contract. Use the graph to:

  1. Enumerate a module's symbols/files via "$DRAFT_TOOLS/graph-callers.sh"/"$DRAFT_TOOLS/graph-impact.sh" and "$DRAFT_TOOLS/graph-arch.sh" --repo . (preferred over find).
  2. Prioritize hotspots via "$DRAFT_TOOLS/hotspot-rank.sh" --repo . — patterns in high-fanIn files are more impactful when learned.
  3. For TS/Python/Go/C/C++, use *-index.jsonl to identify class/function definitions rather than re-discovering them via regex.

Filesystem find for source discovery (Step 2.1) is permitted as a complement to the graph for languages not covered by indexes (e.g. Ruby, Java without ctags). Record the rationale in the Graph Usage Report.

Red Flags - STOP if you're

See shared red flags — applies to all code-touching skills.

Skill-specific:

  • Writing to guardrails.md without reading the codebase first
  • Learning a pattern from fewer than 3 occurrences
  • Auto-promoting patterns to Hard Guardrails (requires human approval)
  • Overwriting human-curated Hard Guardrails with learned patterns
  • Learning patterns that contradict tech-stack.md ## Accepted Patterns
  • Removing existing learned entries (only update or add)

Read the full file on GitHub · 513 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. yesterday First seen · 513 lines · 42 tokens per session scan A a088521ca6ef

Subscribe to this mod's changes

learn is a skill published in the GitHub repository drafthq/draft (40 stars, last pushed 13d ago), licensed MIT. It adds 42 tokens to every session and 5,465 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.