squad-conventions

GitHub

定义Squad CLI工具的核心开发规范,涵盖零依赖约束、内置测试框架使用、错误处理模式及跨平台文件操作标准。

.github/skills/squad-conventions/SKILL.md microsoft/Generative-AI-for-beginners-dotnet

Trigger Scenarios

询问Squad项目编码规范 需要遵循Squad代码风格进行开发 了解Squad项目的测试和错误处理约定

Install

npx skills add microsoft/Generative-AI-for-beginners-dotnet --skill squad-conventions -g -y
More Options

Non-standard path

npx skills add https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/.github/skills/squad-conventions -g -y

Use without installing

npx skills use microsoft/Generative-AI-for-beginners-dotnet@squad-conventions

指定 Agent (Claude Code)

npx skills add microsoft/Generative-AI-for-beginners-dotnet --skill squad-conventions -a claude-code -g -y

安装 repo 全部 skill

npx skills add microsoft/Generative-AI-for-beginners-dotnet --all -g -y

预览 repo 内 skill

npx skills add microsoft/Generative-AI-for-beginners-dotnet --list

SKILL.md

Frontmatter
{
    "name": "squad-conventions",
    "domain": "project-conventions",
    "source": "manual",
    "confidence": "high",
    "description": "Core conventions and patterns used in the Squad codebase"
}

Context

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.

Patterns

Zero Dependencies

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.

Node.js Built-in Test Runner

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/.

Error Handling — fatal() Pattern

All 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.

ANSI Color Constants

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.

File Structure

  • .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 writes

Windows Compatibility

Always 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.

Init Idempotency

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.

Copy Pattern

copyRecursive(src, target) handles both files and directories. It creates parent directories with { recursive: true } and uses fs.copyFileSync for files.

Examples

// 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}`);
}

Anti-Patterns

  • Adding npm dependencies — Squad is zero-dep. Use Node.js built-ins only.
  • Hardcoded path separators — Never use / or \ directly. Always path.join().
  • Overwriting user state on init — Init skips existing files. Only upgrade overwrites Squad-owned files.
  • Raw stack traces — All errors go through fatal(). Users see clean messages, not stack traces.
  • Inline ANSI codes — Use the color constants (GREEN, RED, DIM, BOLD, RESET).

Version History

  • bd4e082 Current 2026-08-20 14:05

Same Skill Collection

.github/skills/agent-collaboration/SKILL.md
.github/skills/coordinator-init-mode/SKILL.md
.github/skills/coordinator-response-mode/SKILL.md
.github/skills/coordinator-source-of-truth/SKILL.md
.github/skills/cross-squad-communication/SKILL.md
.github/skills/cross-squad/SKILL.md
.github/skills/error-recovery/SKILL.md
.github/skills/git-workflow/SKILL.md
.github/skills/iterative-retrieval/SKILL.md
.github/skills/reflect/SKILL.md
.github/skills/reviewer-protocol/SKILL.md
.github/skills/secret-handling/SKILL.md
.github/skills/session-recovery/SKILL.md
.github/skills/squad-help/SKILL.md
.github/skills/squad-version-check/SKILL.md
.github/skills/squad/SKILL.md
.github/skills/tiered-memory/SKILL.md
.squad/templates/skills/agent-collaboration/SKILL.md
.squad/templates/skills/agent-conduct/SKILL.md
.squad/templates/skills/architectural-proposals/SKILL.md
.squad/templates/skills/ci-validation-gates/SKILL.md
.squad/templates/skills/client-compatibility/SKILL.md
.squad/templates/skills/coordinator-init-mode/SKILL.md
.squad/templates/skills/coordinator-response-mode/SKILL.md
.squad/templates/skills/coordinator-source-of-truth/SKILL.md
.squad/templates/skills/cross-machine-coordination/SKILL.md
.squad/templates/skills/cross-squad-communication/SKILL.md
.squad/templates/skills/cross-squad/SKILL.md
.squad/templates/skills/distributed-mesh/SKILL.md
.squad/templates/skills/docs-standards/SKILL.md
.squad/templates/skills/e2e-template-testing/SKILL.md
.squad/templates/skills/economy-mode/SKILL.md
.squad/templates/skills/error-recovery/SKILL.md
.squad/templates/skills/external-comms/SKILL.md
.squad/templates/skills/fact-checking/SKILL.md
.squad/templates/skills/gh-auth-isolation/SKILL.md
.squad/templates/skills/git-workflow/SKILL.md
.squad/templates/skills/github-multi-account/SKILL.md
.squad/templates/skills/history-hygiene/SKILL.md
.squad/templates/skills/humanizer/SKILL.md
.squad/templates/skills/init-mode/SKILL.md
.squad/templates/skills/iterative-retrieval/SKILL.md
.squad/templates/skills/model-selection/SKILL.md
.squad/templates/skills/nap/SKILL.md
.squad/templates/skills/notification-routing/SKILL.md
.squad/templates/skills/personal-squad/SKILL.md
.squad/templates/skills/pr-review-response/SKILL.md
.squad/templates/skills/pr-screenshots/SKILL.md
.squad/templates/skills/ralph-two-pass-scan/SKILL.md

Metadata

Files
0
Version
bd4e082
Hash
7e1a53f1
Indexed
2026-08-20 14:05

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 16:31
浙ICP备14020137号-1 $방문자$