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.
development
Branch-per-initiative git discipline for all delivery workflows. Defines branch naming by workflow, the propose-confirm creation protocol, dirty-tree and detached-HEAD handling, the always user-gated merge protocol, worktree support for parallel sessions, and abandonment cleanup. Activates only in git repositories — silently inactive everywhere else. Use when starting /build, /fix, /architect, or /build-x at Standard+ scope, when resuming an initiative, when offering a merge at a completion checkpoint, or when the user wants a second concurrent initiative.
development
Drives task-by-task execution from an approved plan with quality gates between each task. Reads the plan, finds the next incomplete task, dispatches implementation, validates, updates progress, and continues. Use after a plan is approved and the user says "go", "start building", "execute the plan", or "implement the feature".
testing
Preserves and restores context across agent sessions using plan file checkboxes as source of truth. Use when starting a new session, resuming previous work, ending a session, or when the user says "continue from last time", "what was I doing", or "save progress".
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).