tools/sage-claude-plugin/skills/pack-draft/SKILL.md
Phase 4 of pack building. Generates pack files from observations and processed sources. Handles both community pack (full structure) and project overlay (overrides.md only) paths.
npx skillsauth add xoai/sage pack-draftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate the pack files from evidence.
Core Principle: Every pattern is grounded in an observed agent failure. Every anti-pattern describes real agent behavior. Nothing is hypothetical. The observation report is your evidence — the draft is your argument.
Run the scaffolding tool:
bash .sage/tools/sage-new-pack.sh <pack-name> --layer <N>
This creates the directory structure with template files.
For each confirmed need from the observation report, write a pattern.
Format (mandatory):
# Pattern Name
**Why agents get this wrong:** [1-2 sentences explaining the root cause —
stale training data, wrong defaults, missing context]
**Do:** [2-3 sentences of specific instruction + code example if needed]
Rules:
For each confirmed failure from the observation report, write an anti-pattern.
Format (mandatory):
# Anti-Pattern: Name
**What agents do:** [1-2 sentences — exact behavior observed]
**Why it's wrong:** [1-2 sentences — consequence of the mistake]
**Do instead:** [1 sentence — the correction]
Rules:
Extract 3-7 non-negotiable principles from the patterns:
1. [Framework] components MUST [do X] because [reason].
2. [Pattern Y] MUST NOT be used because [reason].
Use MUST/MUST NOT/SHOULD/SHOULD NOT language. These are laws, not suggestions.
Fill in pack.yaml with real values: name, description, layer, dependencies,
activation conditions, framework version, last-verified date.
Transfer the test prompts from Phase 3 (pack-observe) into tests.md:
Count approximate tokens (words × 1.3) across all content files. Verify total is within budget:
If over budget, trim the lowest-priority patterns first. Better to have 5 sharp patterns than 7 diluted ones.
mkdir -p .sage/packs/<pack-name>
From the project context gathered in Phase 2, generate a single overlay file:
# Project Overlay: <pack-name>
## Extends: <community-pack-name>
## Project-Specific Conventions
### [Convention Category]
[Specific rule for this project]
### [Convention Category]
[Specific rule]
## Constraints
- [What this project cannot use and why]
- [Required patterns]
## Project API Patterns
[Any project-specific API formats, response structures, error handling]
Rules:
---
name: "@project/<pack-name>"
type: overlay
extends: "<community-pack-name>"
version: "1.0.0"
---
Community pack: Complete pack in packs/<name>/ with all required files.
Project overlay: .sage/packs/<name>/overrides.md + minimal pack.yaml.
tools
Captures agent mistakes, corrections, and discovered gotchas so they are not repeated. Use when: (1) a command or operation fails unexpectedly, (2) the user corrects the agent, (3) the agent discovers non-obvious behavior through debugging, (4) an API or tool behaves differently than expected, (5) a better approach is found for a recurring task. Also searches past learnings before starting tasks to avoid known pitfalls. Activate alongside the sage-memory skill — they share the same MCP backend but serve different purposes (sage-memory = codebase knowledge, sage-self-learning = agent mistakes and gotchas).
development
Typed knowledge graph stored in sage-memory. Use when creating or querying structured entities (Person, Project, Task, Event, Document), linking related objects, checking dependencies, planning multi-step actions as graph transformations, or when skills need to share structured state. Trigger on "remember that X is Y", "what do I know about", "link X to Y", "show dependencies", "what blocks X", entity CRUD, cross-skill data access, or any request involving structured relationships between things.
tools
Integrates sage-memory into Sage workflows. Teaches the agent when to remember (store findings during work), when to recall (search memory at session start and task start), and how to learn (structured knowledge capture via sage learn). Use when the user mentions memory, remember, recall, learn, capture knowledge, onboard to codebase, or when starting any session where sage-memory MCP tools are available.
tools
Captures agent mistakes, corrections, and discovered gotchas so they are not repeated. Use when: (1) a command or operation fails unexpectedly, (2) the user corrects the agent, (3) the agent discovers non-obvious behavior through debugging, (4) an API or tool behaves differently than expected, (5) a better approach is found for a recurring task. Also searches past learnings before starting tasks to avoid known pitfalls. Activate alongside the sage-memory skill — they share the same MCP backend but serve different purposes (sage-memory = codebase knowledge, sage-self-learning = agent mistakes and gotchas).