squad-conventions

Enforce Squad CLI coding conventions including fatal() error handling and path.join().

Updated Nov 27, 2024
One-click install
npx skills add https://github.com/Izak90/Izak90.github.io --skill squad-conventions-izak90
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: squad-conventions
Source: https://github.com/Izak90/Izak90.github.io/tree/main/isaac_treinos_ar_livre/.copilot/skills/squad-conventions
Command: npx skills add https://github.com/Izak90/Izak90.github.io --skill squad-conventions-izak90

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Establishes and enforces standardized conventions across the Squad codebase to reduce drift and improve maintainability.

Core Features & Use Cases

  • Zero Dependencies: Squad uses only Node.js built-ins; no runtime dependencies to avoid bloat.
  • Node.js Built-in Test Runner: Tests use node:test and node:assert/strict; run with npm test; tests live in test/.
  • Error Handling — fatal() Pattern: All user-facing errors funnel through fatal(msg) for clean messages.
  • ANSI Color Constants: UI colors are defined as constants (GREEN, RED, DIM, BOLD, RESET) and reused.
  • File Structure & Windows Compatibility: Conventions around .squad/, .squad/templates/, templates/, and safe path handling with path.join().
  • Init Idempotency & Copy Pattern: Init skips existing user state; copy patterns use copyRecursive with recursive directory creation.
  • Prevention of Overwriting User State: Upgrades overwrite Squad-owned files only.

Quick Start

Align new Squad work to zero-dependency patterns, safe path handling via path.join, and the fatal() error-handling conventions.

Frequently Asked Questions about squad-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle user-facing errors in Node.js CLI tools?

User-facing errors in Node.js CLI tools should be handled using a fatal(msg) pattern. This funnels all errors through a single function to ensure clean, consistent messages instead of raw stack traces.

What's the best way to ensure cross-platform file paths in Node.js scripts?

To ensure cross-platform compatibility in Node.js scripts, use path.join() for all path construction. This prevents Windows path issues and aligns with standard file structure conventions for template directories.

Do I need external dependencies for Node.js CLI testing?

No external dependencies are needed for Node.js CLI testing. You can use the Node.js built-in test runner with node:test and node:assert/strict, running tests via npm test from the test/ directory.

How do I standardize ANSI colors in a CLI application?

To standardize ANSI colors in a CLI application, define UI colors as constants like GREEN, RED, DIM, BOLD, and RESET. Reusing these constants ensures consistent terminal output across all scripts.

How do I prevent overwriting user state during CLI tool upgrades?

To prevent overwriting user state during CLI tool upgrades, implement init idempotency by skipping existing user files. Upgrades should only overwrite tool-owned files while preserving user configurations.

Why does my Node.js CLI script break on Windows?

Node.js CLI scripts often break on Windows due to hardcoded path separators. Using path.join() for safe path handling and following cross-platform compatibility conventions resolves these file structure issues.