Skip to main content

squad-conventions

Core conventions and patterns used in the Squad codebase Use when this capability is needed.

설치로 이동

소스 정보

저장소
tomevault-io/tomes
최근 소스 활동
2026년 7월 23일 21:48
감지된 SKILL.md 언어
영어
스타
1
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
squad-conventions
description
Core conventions and patterns used in the Squad codebase Use when this capability is needed.
metadata
{"author":"candoumbe"}
## 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 ```javascript // 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`). --- > Source: [candoumbe/DataFilters](https://github.com/candoumbe/DataFilters) — distributed by [TomeVault](https://tomevault.io). <!-- tomevault:4.0:skill_md:2026-07-19 -->
GitHub에서 보기