assert

Installation
SKILL.md

assert - Robust Test Assertions

The assert module is a powerful tool for verifying that test results meet expectations. It is widely used in automated testing and CI/CD pipelines to ensure code correctness.

When to Activate

  • When writing shell scripts that need to verify command success or failure.
  • When performing regression tests on file systems (checks for non-empty, existence, etc.).
  • When validating variable states or detecting global variable leaks.
  • When checking stdout/stderr against expected patterns or content.

Core Principles & Rules

  • Exit Code Focus: Commands return 0 on success and non-zero on failure to break script execution if combined with set -e.
  • Negation Support: Use ! for negative command checks or ^ for negative type/file checks.
  • Bulk Verification: Many subcommands support checking multiple values or files in one go.

Additional Scenarios

  • Variable Snapshots: Use var save and var cmp to detect unintended global variable modifications in functions.
  • Output Matching: Use stdout with heredocs to verify complex multi-line command outputs.
Related skills

More from x-cmd/skill

Installs
3
Repository
x-cmd/skill
GitHub Stars
20
First Seen
Apr 10, 2026