mayurpise/draft/learn
Claude Code and agent skill by mayurpise/draft
- community
Checking that the SKILL.md file is still in the repository.
Scan codebase to discover coding patterns and update draft/guardrails.md. Learns conventions (skip in future) and anti-patterns (always flag). Supports migration from workflow.md and pattern promotion.
Install
npx vskill@latest install mayurpise/draft/learnSKILL.md
The same SKILL.md was published earlier as mayurpise/draft/learn.
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:
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:
- 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 overfind). - Prioritize hotspots via
"$DRAFT_TOOLS/hotspot-rank.sh" --repo .— patterns in high-fanIn files are more impactful when learned. - For TS/Python/Go/C/C++, use
*-index.jsonlto 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)
Evidence over assumptions. Quantity over anecdote.
Arguments
- No arguments — full codebase pattern scan
promote— review high-confidence learned patterns and offer promotion to Hard Guardrails or Accepted Patternsmigrate— migrate## Guardrailsfromworkflow.mdtoguardrails.md(for existing projects)<path>— scan specific directory or file pattern
Step 0: Verify Draft Context
If draft/ does not exist: STOP — "No Draft context found. Run /draft:init first."
Step 1: Load Existing Guardrails
1.1: Check for guardrails.md
If it exists, read it and internalize:
- Current Hard Guardrails (checked items)
- Current Learned Conventions (existing entries)
- Current Learned Anti-Patterns (existing entries)
Then verify core guardrails integrity (backfill if missing):
Check if draft/guardrails.md contains the C++/Systems Hard Guardrails from core/guardrails.md. Detection: look for the marker heading ### C++/Systems — Object Lifecycle & Memory Safety.
- If missing AND project contains C++ code: The file predates
core/guardrails.md. Backfill by inserting the full C++/Systems Hard Guardrails sections fromcore/templates/guardrails.md(G1.x–G7.x, all pre-checked[x]) into the## Hard Guardrailssection, after any existing general guardrails. Preserve all existing entries. Announce: "Backfilled C++/Systems Hard Guardrails (G1.x–G7.x) from core/guardrails.md into draft/guardrails.md." - If missing AND project has no C++ code: Skip — these guardrails only apply to C++ projects.
- If present: No action — core guardrails already integrated.
1.2: Check for Legacy Guardrails (migration path)
If draft/guardrails.md does NOT exist:
- Check
draft/workflow.mdfor## Guardrailssection - If found, announce: "Found guardrails in workflow.md. Creating guardrails.md and migrating."
- Create
draft/guardrails.mdusing template fromcore/templates/guardrails.md - Copy checked guardrail items from
workflow.md ## Guardrailsinto the Hard Guardrails section - Add a comment in
workflow.mdwhere## Guardrailswas:
```markdown ## Guardrails
> Migrated — Guardrails have moved to draft/guardrails.md. See that file for hard guardrails, learned conventions, and learned anti-patterns. ```
If migrate argument was given, stop here after migration. Otherwise, continue to pattern scanning.
1.3: Load Supporting Context
Read and follow core/shared/draft-context-loading.md for full Draft context. Key files:
draft/.ai-context.md— Module boundaries, invariants, concurrency modeldraft/tech-stack.md— Frameworks, accepted patterns (do not learn patterns that duplicate these)draft/product.md— Product requirements
Step 2: Codebase Pattern Scan
2.1: Discover Source Files
If scope argument provided, filter to that path.
2.2: Analyze Pattern Dimensions
Scan the codebase across these dimensions, looking for recurring patterns (3+ occurrences):
Error Handling Conventions
- How errors are caught, logged, and propagated
- Custom error classes or error codes
- Try/catch patterns, error boundaries
- Retry and fallback strategies
Naming Conventions
- Variable, function, class naming styles beyond language defaults
- File naming patterns (kebab-case, PascalCase, etc.)
- Module/directory organization conventions
Architecture Patterns
- Import/dependency patterns (barrel exports, lazy loading)
- State management approaches
- API call patterns (centralized client, interceptors)
- Component composition patterns
Concurrency Patterns
- Async/await usage conventions
- Locking and synchronization approaches
- Queue and worker patterns
- Cancellation and timeout handling
Data Flow Patterns
- Validation placement (boundary vs deep)
- Serialization/deserialization conventions
- Caching strategies
- Data transformation pipelines
Testing Conventions
- Test file placement and naming
- Test structure (arrange/act/assert, given/when/then)
- Mock/stub conventions
- Fixture and factory patterns
Configuration Patterns
- Environment variable access patterns
- Feature flag patterns
- Config file conventions
2.3: Temporal Pattern Analysis
Detect patterns that are being phased out by the team:
- Identify declining patterns — For each candidate pattern, use
git blameto check the age of files containing it:
- Old files (last modified >1 year ago): high occurrence of the pattern
- New files (last modified <6 months ago): low or zero occurrence of the pattern
- If occurrence ratio old:new is >3:1, flag as a declining pattern
- Mark declining patterns — When writing to guardrails.md, add
declining: trueto the entry metadata:
```markdown
- Declining: yes — found in 8 old files (avg age 18mo), 1 new file (avg age 2mo). Being replaced by [newer pattern].
```
- Do NOT propagate declining patterns — Quality commands should not flag absence of a declining pattern as inconsistency
- Example: Old error handling style
try/catch with manual loggingfound in files last modified >1 year ago, newer files use structured error middleware — the old style is declining, not a convention to enforce
Reference: Google large-scale changes (Rosie) — systematic detection of patterns being migrated away from.
2.4: Cross-Service Pattern Comparison (Monorepo)
When in a monorepo (detected by draft/service-index.md existing OR multiple draft/ directories OR presence of packages/, services/, apps/ directories):
- Scan across services — Run pattern analysis in each service/package independently
- Compare patterns for the same concern — For each pattern dimension (error handling, naming, etc.):
- Does Service A use a different approach than Service B for the same concern?
- Example: Service A uses
Result<T, E>for error handling, Service B uses exceptions
- Flag inconsistencies — Report cross-service divergences:
``text Cross-service inconsistency: Error Handling services/auth/ → uses custom Result type (5 files) services/billing/ → uses thrown exceptions (8 files) Suggestion: standardize on one approach ``
- Respect intentional differences — Do NOT flag inconsistencies when:
- Services use different languages or frameworks
- The pattern difference is documented in
tech-stack.mdor.ai-context.md - The services have fundamentally different runtime requirements
Reference: Google monorepo practices — consistent patterns across services reduce cognitive overhead and enable large-scale tooling.
2.5: Cross-Reference Existing Knowledge
For each candidate pattern:
- Check `tech-stack.md ## Accepted Patterns` — if already documented there, skip (no duplication)
- Check existing `guardrails.md` entries — if already learned, update evidence count and date
- Check `.ai-context.md` — if described as architecture, skip (it's documented)
- Verify consistency — sample 3+ instances and confirm they follow the same approach
2.6: Git History Signal Mining
Mine git commit history for pattern signals that code scanning misses. Run only if the project is a git repository.
Scan the output for recurring message patterns (3+ occurrences of the same type):
| Commit pattern | Signal | |
|---|---|---|
fix: don't X / fix: never X | Team keeps violating X → anti-pattern candidate | |
refactor: replace X with Y | X is declining, Y is the replacement → mark X as declining: true | |
chore: enforce X / chore: add X check | X is being formalized → convention candidate | |
revert: followed by same topic 3+ times | That topic is consistently problematic → anti-pattern candidate |
Rules:
- Do NOT add git-only signals as standalone entries. Use them only to adjust confidence of patterns already found in Step 2.2.
- If a pattern appears in both commit history AND code (3+ occurrences): increase confidence by one level.
- If a pattern appears only in commit history but not in current code: note as
historically_recurring: true— do not add as active anti-pattern.
Recency weighting — for each candidate pattern from Step 2.2, check when the files containing it were last modified:
- Modified within 90 days AND pattern persists → add
recently_active: trueto the entry - Not modified in 12+ months → add
stale: true— lower enforcement priority
2.7: Graph-Aware Severity Enrichment
If draft/graph/schema.yaml exists (engine live), derive objective severity for all anti-pattern candidates based on the fanIn of files where the pattern was found via "$DRAFT_TOOLS/hotspot-rank.sh" --repo ..
For each anti-pattern candidate from Step 2.2:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/learn/SKILL.md
Popularity
- Repository stars
- 40
- Repository forks
- 6
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Sep 2026, 2 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mayurpise/draft/learn)