一键导入
squad-conventions
Core conventions and patterns used in the Squad codebase
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Core conventions and patterns used in the Squad codebase
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
{what this skill teaches agents}
{what this skill teaches agents}
**WORKFLOW SKILL** — Iteratively improve skill frontmatter compliance using the Ralph loop pattern. WHEN: "run sensei", "sensei help", "improve skill", "fix frontmatter", "skill compliance", "frontmatter audit", "score skill", "check skill tokens". INVOKES: token counting tools, test runners, git commands. FOR SINGLE OPERATIONS: use token CLI directly for counts/checks.
**WORKFLOW SKILL** — Research, outline, and scaffold a Slidev presentation. Phase 1 researches the topic and generates a detailed OUTLINE.md via runSubagent research and user guidance. Phase 2 generates slides.md, style.css, and images/ from the approved outline. WHEN: "create presentation", "new presentation", "scaffold presentation", "new Slidev deck", "new talk", "create slides", "start a presentation", "presentation about". INVOKES: runSubagent (web search, Microsoft Learn, WorkIQ), vscode_askQuestions, file-system tools. FOR SINGLE OPERATIONS: copy template folder manually.
**WORKFLOW SKILL** — Query WorkIQ for recent activity signals, identify patterns in conversations and meetings, cross-reference with latest tech announcements, and propose aligned demos as GitHub issues. WHEN: "intelligence scan", "what demos to build", "scan recent activity", "WorkIQ scan", "demo proposals from conversations", "identify demo opportunities", "what should I demo next". INVOKES: WorkIQ MCP, web search, GitHub issue tools. FOR SINGLE OPERATIONS: Query WorkIQ MCP directly.
Build an n-layer dependency graph from .NET upgrade assessment data and generate a phased modernization plan. Parses assessment.json from the .NET upgrade tools, extracts project dependency hierarchy via breadth-first layering, splits thick layers to cap projects per sub-layer, and produces a phased upgrade plan with Mermaid diagrams. Each phase targets PR-reviewable scope. SDK-style conversion is Phase 0, then layer-by-layer bottom-up modernization. WHEN: "plan appmod phases", "generate upgrade layers", "dependency layer plan", "phased migration plan", "break down dotnet upgrade", "layer extraction", "modernization phases", "upgrade dependency graph", "PR-sized migration plan", "appmod phasing strategy".
| name | squad-conventions |
| description | Core conventions and patterns used in the Squad codebase |
| domain | project-conventions |
| confidence | high |
| source | manual |
These conventions apply to all work on the Squad CLI tool (create-squad). Squad is a zero-dependency Node.js package that adds AI agent teams to any project. Understanding these patterns is essential before modifying any Squad source code.
Squad has zero runtime dependencies. Everything uses Node.js built-ins (fs, path, os, child_process). Do not add packages to dependencies in package.json. This is a hard constraint, not a preference.
Tests use node:test and node:assert/strict — no test frameworks. Run with npm test. Test files live in test/. The test command is node --test test/.
fatal() PatternAll user-facing errors use the fatal(msg) function which prints a red ✗ prefix and exits with code 1. Never throw unhandled exceptions or print raw stack traces. The global uncaughtException handler calls fatal() as a safety net.
Colors are defined as constants at the top of index.js: GREEN, RED, DIM, BOLD, RESET. Use these constants — do not inline ANSI escape codes.
.squad/ — Team state (user-owned, never overwritten by upgrades).squad/templates/ — Template files copied from templates/ (Squad-owned, overwritten on upgrade).github/agents/squad.agent.md — Coordinator prompt (Squad-owned, overwritten on upgrade)templates/ — Source templates shipped with the npm package.squad/skills/ — Team skills in SKILL.md format (user-owned).squad/decisions/inbox/ — Drop-box for parallel decision writesAlways use path.join() for file paths — never hardcode / or \ separators. Squad must work on Windows, macOS, and Linux. All tests must pass on all platforms.
The init flow uses a skip-if-exists pattern: if a file or directory already exists, skip it and report "already exists." Never overwrite user state during init. The upgrade flow overwrites only Squad-owned files.
copyRecursive(src, target) handles both files and directories. It creates parent directories with { recursive: true } and uses fs.copyFileSync for files.
// Error handling
function fatal(msg) {
console.error(`${RED}✗${RESET} ${msg}`);
process.exit(1);
}
// File path construction (Windows-safe)
const agentDest = path.join(dest, '.github', 'agents', 'squad.agent.md');
// Skip-if-exists pattern
if (!fs.existsSync(ceremoniesDest)) {
fs.copyFileSync(ceremoniesSrc, ceremoniesDest);
console.log(`${GREEN}✓${RESET} .squad/ceremonies.md`);
} else {
console.log(`${DIM}ceremonies.md already exists — skipping${RESET}`);
}
/ or \ directly. Always path.join().fatal(). Users see clean messages, not stack traces.GREEN, RED, DIM, BOLD, RESET).