[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73CK0MED08SQWHEJFK0HFHM":3,"skill-same:01M73CK0MED08SQWHEJFK0HFHM":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":6,"updatedAt":48,"install":49,"resources":62},"01M73CK0MED08SQWHEJFK0HFHM","test-cli-application",null,"Write integration tests for a Node.js CLI application using the built-in node:test module. Covers the exec helper pattern, output assertions, filesystem state verification, cleanup hooks, JSON output parsing, error case testing, and state restoration after destructive tests. Use when adding tests to an existing CLI, testing a new command, verifying adapter behavior across frameworks, or setting up CI for a CLI tool.","roohe\u002Fagentic-super-skills","roohe","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99054084?v=4","01M734WCDFP6RZVT5CNM00QR26","01M734WCE4BD0T4NZS5PCV9V5F",10,"MIT","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Ftest-cli-application\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: test-cli-application\nlocale: caveman-lite\nsource_locale: en\nsource_commit: 82c77053\ntranslator: \"Julius Brussee homage — caveman\"\ntranslation_date: \"2026-05-03\"\ndescription: >\n  Write integration tests for a Node.js CLI application using the built-in\n  node:test module. Covers the exec helper pattern, output assertions,\n  filesystem state verification, cleanup hooks, JSON output parsing, error\n  case testing, and state restoration after destructive tests. Use when\n  adding tests to an existing CLI, testing a new command, verifying adapter\n  behavior across frameworks, or setting up CI for a CLI tool.\nlicense: MIT\nallowed-tools: Read Write Edit Bash Grep Glob\nmetadata:\n  author: Philipp Thoss\n  version: \"1.0\"\n  domain: cli\n  complexity: intermediate\n  language: TypeScript\n  tags:\n    - cli\n    - testing\n    - nodejs\n    - node-test\n    - integration\n---\n\n# Test a CLI Application\n\nWrite integration tests for a Node.js CLI using the built-in `node:test` module with `execSync`.\n\n## When to Use\n\n- Adding tests to an existing CLI application\n- Testing a newly created command\n- Verifying adapter\u002Fplugin behavior across target frameworks\n- Setting up CI that validates CLI correctness\n- Catching regressions after refactoring CLI internals\n\n## Inputs\n\n- **Required**: Path to the CLI entry point (e.g., `cli\u002Findex.js`)\n- **Required**: Commands to test\n- **Optional**: Framework adapters to test (dry-run mode)\n- **Optional**: Cleanup requirements (files\u002Fsymlinks created by tests)\n\n## Procedure\n\n### Step 1: Set Up Test Infrastructure\n\n```javascript\nimport { describe, it, before, after } from 'node:test';\nimport assert from 'node:assert\u002Fstrict';\nimport { execSync } from 'child_process';\nimport { existsSync, rmSync } from 'fs';\nimport { resolve } from 'path';\n\nconst CLI = 'node cli\u002Findex.js';\nconst ROOT = process.cwd();\n\nfunction run(args) {\n  return execSync(`${CLI} ${args}`, {\n    cwd: ROOT,\n    encoding: 'utf8',\n    timeout: 10000,\n  });\n}\n```\n\nKey design decisions:\n- `node:test` is built-in — no test runner dependency needed\n- `execSync` runs the CLI as a subprocess — tests the actual binary, not internal functions\n- 10-second timeout prevents hanging on interactive prompts\n- `encoding: 'utf8'` gives string output for regex matching\n- All paths relative to `ROOT` for reproducibility\n\n**Got:** A test file that imports from `node:test` and has a working `run()` helper.\n\n**If fail:** If `node:test` is not available, your Node.js version is below 18. Upgrade or use a polyfill.\n\n### Step 2: Write Smoke Tests\n\nSmoke tests verify the CLI starts, parses arguments, and produces expected output shapes:\n\n```javascript\ndescribe('meta', () => {\n  it('shows version', () => {\n    const out = run('--version');\n    assert.match(out, \u002F\\d+\\.\\d+\\.\\d+\u002F);\n  });\n\n  it('shows help with all commands', () => {\n    const out = run('--help');\n    assert.match(out, \u002Finstall\u002F);\n    assert.match(out, \u002Flist\u002F);\n    assert.match(out, \u002Fdetect\u002F);\n  });\n});\n\ndescribe('registry', () => {\n  it('list shows expected counts', () => {\n    const out = run('list --domains');\n    assert.match(out, \u002F\\d+ domains\u002F);\n  });\n\n  it('search finds known items', () => {\n    const out = run('search \"docker\"');\n    assert.match(out, \u002Fresult\\(s\\) for \"docker\"\u002F);\n  });\n\n  it('search returns 0 for nonsense', () => {\n    const out = run('search \"xyzzy-nonexistent\"');\n    assert.match(out, \u002F0 result\u002F);\n  });\n});\n```\n\nSmoke test patterns:\n- `--version` and `--help` always work\n- Registry loading validates data integrity\n- Search with known and unknown terms\n\n**Got:** Smoke tests confirm the CLI is functional and data is loaded.\n\n**If fail:** If registry counts change frequently, use `\\d+` instead of hardcoded numbers.\n\n### Step 3: Write Lifecycle Tests\n\nLifecycle tests verify create → verify → delete sequences with cleanup:\n\n```javascript\ndescribe('install', () => {\n  const testPath = resolve(ROOT, '.agents\u002Fskills\u002Fcommit-changes');\n\n  after(() => {\n    \u002F\u002F Always clean up, even if tests fail\n    try { rmSync(testPath); } catch {}\n    try { rmSync(resolve(ROOT, '.agents\u002Fskills'), { recursive: true }); } catch {}\n    try { rmSync(resolve(ROOT, '.agents'), { recursive: true }); } catch {}\n  });\n\n  it('dry-run does not create files', () => {\n    const out = run('install commit-changes --dry-run');\n    assert.match(out, \u002FDRY RUN\u002F);\n    assert.ok(!existsSync(testPath));\n  });\n\n  it('installs creates the target', () => {\n    run('install commit-changes');\n    assert.ok(existsSync(testPath));\n  });\n\n  it('skips already installed', () => {\n    const out = run('install commit-changes');\n    assert.match(out, \u002Fskipped\u002F);\n  });\n\n  it('uninstall removes the target', () => {\n    run('uninstall commit-changes');\n    assert.ok(!existsSync(testPath));\n  });\n});\n```\n\nCleanup rules:\n- Use `after()` hooks, not `afterEach()` — lifecycle tests build on each other\n- Wrap cleanup in `try\u002Fcatch` — cleanup must not fail the test suite\n- Clean from leaf to root (file → parent dir → grandparent dir)\n- If the test modifies shared state (symlinks, config files), restore it\n\n**Got:** Tests run in sequence within the describe block, cleanup runs even on failure.\n\n**If fail:** If tests run in parallel (non-default in node:test), force sequential with `{ concurrency: 1 }`.\n\n### Step 4: Write Dry-Run Tests for Each Adapter\n\nTest each adapter's target path without making changes:\n\n```javascript\ndescribe('adapter: cursor (dry-run)', () => {\n  it('targets .cursor\u002Fskills\u002F path', () => {\n    const out = run('install commit-changes --framework cursor --dry-run');\n    assert.match(out, \u002F\\.cursor\\\u002Fskills\u002Fi);\n  });\n});\n\ndescribe('adapter: copilot (dry-run)', () => {\n  it('targets .github\u002F path', () => {\n    const out = run('install commit-changes --framework copilot --dry-run');\n    assert.match(out, \u002F\\.github\u002Fi);\n  });\n});\n```\n\nThis pattern scales to any number of adapters. Each test:\n- Uses `--framework` to bypass auto-detection\n- Uses `--dry-run` so no files are created\n- Asserts the target path appears in output\n\n**Got:** One describe block per adapter, each with at least a path assertion.\n\n**If fail:** If the adapter doesn't exist in the project, the test will fail with \"Unknown framework.\" This is correct — adapter tests should only exist for implemented adapters.\n\n### Step 5: Write Error Case Tests\n\n```javascript\ndescribe('errors', () => {\n  it('rejects unknown items', () => {\n    assert.throws(\n      () => run('install nonexistent-skill-xyz'),\n      \u002FNo matching items|Unknown\u002F,\n    );\n  });\n\n  it('rejects unknown framework', () => {\n    assert.throws(\n      () => run('install commit-changes --framework nonexistent'),\n      \u002FUnknown framework\u002F,\n    );\n  });\n\n  it('handles missing state gracefully', () => {\n    assert.throws(\n      () => run('scatter nonexistent-team'),\n      \u002Fnot burning|Unknown\u002F,\n    );\n  });\n});\n```\n\nError testing patterns:\n- `assert.throws` catches non-zero exit codes from `execSync`\n- Regex match on the error message (captured from stderr)\n- Test both \"item not found\" and \"invalid option\" errors\n- Verify error messages suggest corrective actions\n\n**Got:** All error paths produce non-zero exit codes and helpful messages.\n\n**If fail:** `execSync` throws on non-zero exit. The error's `stderr` or `stdout` contains the message. Check `error.stdout` if `assert.throws` regex doesn't match.\n\n### Step 6: Write JSON Output Tests\n\n```javascript\ndescribe('json output', () => {\n  it('campfire --json outputs valid JSON', () => {\n    const out = run('campfire --json');\n    const data = JSON.parse(out);\n    assert.ok(typeof data.totalTeams === 'number');\n    assert.ok(Array.isArray(data.fires));\n  });\n\n  it('gather --dry-run --json outputs structured data', () => {\n    const out = run('gather tending --dry-run --json');\n    \u002F\u002F JSON may follow a DRY RUN header — extract from first '{'\n    const jsonStart = out.indexOf('{');\n    assert.ok(jsonStart >= 0, 'Should contain JSON');\n    const data = JSON.parse(out.slice(jsonStart));\n    assert.equal(data.team, 'tending');\n  });\n});\n```\n\nJSON testing gotchas:\n- Some commands prefix JSON with human-readable text (e.g., DRY RUN header)\n- Extract JSON by finding the first `{` character\n- Validate structure (key presence, types), not exact values\n- Values like counts may change as content is added\n\n**Got:** JSON output is parseable and contains expected keys.\n\n**If fail:** If `JSON.parse` fails, the command may be mixing human text with JSON. Either fix the command to output pure JSON in `--json` mode, or extract the JSON substring.\n\n### Step 7: Handle Cleanup and State Restoration\n\n```javascript\ndescribe('stateful commands', () => {\n  const stateDir = resolve(ROOT, '.agent-almanac');\n\n  after(() => {\n    \u002F\u002F Remove state file created by tests\n    try { rmSync(stateDir, { recursive: true }); } catch {}\n  });\n\n  \u002F\u002F Tests that create\u002Fmodify state...\n});\n\n\u002F\u002F Restore symlinks that destructive tests may remove\ndescribe('destructive tests', () => {\n  after(() => {\n    \u002F\u002F Restore symlinks that scatter\u002Funinstall removed\n    const skills = ['heal', 'meditate', 'remote-viewing'];\n    for (const skill of skills) {\n      const link = resolve(ROOT, `.claude\u002Fskills\u002F${skill}`);\n      if (!existsSync(link)) {\n        try {\n          execSync(`ln -s ..\u002F..\u002Fskills\u002F${skill} ${link}`, { cwd: ROOT });\n        } catch {}\n      }\n    }\n  });\n});\n```\n\nState restoration rules:\n- State files (`.agent-almanac\u002Fstate.json`) must be cleaned after tests\n- Symlinks removed by `scatter`\u002F`uninstall` must be restored\n- Manifest files (`agent-almanac.yml`) created by `init` must be removed\n- Order: `after()` hooks run in reverse declaration order — declare restore hooks last\n\n**Got:** The test suite leaves the project in the same state it found it.\n\n**If fail:** If CI reports leftover files after test runs, add the cleanup to `after()`. Use `git status` after test runs to detect leaked state.\n\n## Validation\n\n- [ ] Test file runs with `node --test cli\u002Ftest\u002Fcli.test.js`\n- [ ] All tests pass (0 failures)\n- [ ] Smoke tests cover `--version`, `--help`, and registry loading\n- [ ] Lifecycle tests verify create → verify → delete with cleanup\n- [ ] At least one adapter dry-run test exists per implemented adapter\n- [ ] Error cases test non-zero exit codes with message matching\n- [ ] JSON output tests parse actual output (not mocked)\n- [ ] After hooks restore all state modified by tests\n\n## Pitfalls\n\n- **Hardcoded counts that break**: Registry totals change as content is added. Use `\\d+` regex or read the count dynamically instead of asserting `329 skills`.\n- **Tests that depend on execution order**: `node:test` runs suites in declaration order by default, but tests within a suite may not. Use lifecycle suites (create → verify → delete) within a single `describe` to guarantee order.\n- **Missing cleanup on test failure**: If a test fails mid-lifecycle, `after()` still runs. But if you throw in `before()`, subsequent tests and `after()` may not run. Keep `before()` minimal.\n- **Interactive prompts hanging tests**: Commands with confirmation prompts will hang `execSync`. Either pipe `echo y |` or ensure `--yes` is always passed in tests.\n- **Testing with real installs in CI**: Tests that create files in `.claude\u002Fskills\u002F` or `.agents\u002Fskills\u002F` modify the working tree. CI may fail on \"dirty working directory\" checks. Always clean up.\n\n## Related Skills\n\n- `scaffold-cli-command` — build the commands that these tests verify\n- `build-cli-plugin` — build the adapters tested in Step 4\n- `design-cli-output` — output patterns that tests assert against\n","# Test a CLI Application\n\nWrite integration tests for a Node.js CLI using the built-in `node:test` module with `execSync`.\n\n## When to Use\n\n- Adding tests to an existing CLI application\n- Testing a newly created command\n- Verifying adapter\u002Fplugin behavior across target frameworks\n- Setting up CI that validates CLI correctness\n- Catching regressions after refactoring CLI internals\n\n## Inputs\n\n- **Required**: Path to the CLI entry point (e.g., `cli\u002Findex.js`)\n- **Required**: Commands to test\n- **Optional**: Framework adapters to test (dry-run mode)\n- **Optional**: Cleanup requirements (files\u002Fsymlinks created by tests)\n\n## Procedure\n\n### Step 1: Set Up Test Infrastructure\n\n```javascript\nimport { describe, it, before, after } from 'node:test';\nimport assert from 'node:assert\u002Fstrict';\nimport { execSync } from 'child_process';\nimport { existsSync, rmSync } from 'fs';\nimport { resolve } from 'path';\n\nconst CLI = 'node cli\u002Findex.js';\nconst ROOT = process.cwd();\n\nfunction run(args) {\n  return execSync(`${CLI} ${args}`, {\n    cwd: ROOT,\n    encoding: 'utf8',\n    timeout: 10000,\n  });\n}\n```\n\nKey design decisions:\n- `node:test` is built-in — no test runner dependency needed\n- `execSync` runs the CLI as a subprocess — tests the actual binary, not internal functions\n- 10-second timeout prevents hanging on interactive prompts\n- `encoding: 'utf8'` gives string output for regex matching\n- All paths relative to `ROOT` for reproducibility\n\n**Got:** A test file that imports from `node:test` and has a working `run()` helper.\n\n**If fail:** If `node:test` is not available, your Node.js version is below 18. Upgrade or use a polyfill.\n\n### Step 2: Write Smoke Tests\n\nSmoke tests verify the CLI starts, parses arguments, and produces expected output shapes:\n\n```javascript\ndescribe('meta', () => {\n  it('shows version', () => {\n    const out = run('--version');\n    assert.match(out, \u002F\\d+\\.\\d+\\.\\d+\u002F);\n  });\n\n  it('shows help with all commands', () => {\n    const out = run('--help');\n    assert.match(out, \u002Finstall\u002F);\n    assert.match(out, \u002Flist\u002F);\n    assert.match(out, \u002Fdetect\u002F);\n  });\n});\n\ndescribe('registry', () => {\n  it('list shows expected counts', () => {\n    const out = run('list --domains');\n    assert.match(out, \u002F\\d+ domains\u002F);\n  });\n\n  it('search finds known items', () => {\n    const out = run('search \"docker\"');\n    assert.match(out, \u002Fresult\\(s\\) for \"docker\"\u002F);\n  });\n\n  it('search returns 0 for nonsense', () => {\n    const out = run('search \"xyzzy-nonexistent\"');\n    assert.match(out, \u002F0 result\u002F);\n  });\n});\n```\n\nSmoke test patterns:\n- `--version` and `--help` always work\n- Registry loading validates data integrity\n- Search with known and unknown terms\n\n**Got:** Smoke tests confirm the CLI is functional and data is loaded.\n\n**If fail:** If registry counts change frequently, use `\\d+` instead of hardcoded numbers.\n\n### Step 3: Write Lifecycle Tests\n\nLifecycle tests verify create → verify → delete sequences with cleanup:\n\n```javascript\ndescribe('install', () => {\n  const testPath = resolve(ROOT, '.agents\u002Fskills\u002Fcommit-changes');\n\n  after(() => {\n    \u002F\u002F Always clean up, even if tests fail\n    try { rmSync(testPath); } catch {}\n    try { rmSync(resolve(ROOT, '.agents\u002Fskills'), { recursive: true }); } catch {}\n    try { rmSync(resolve(ROOT, '.agents'), { recursive: true }); } catch {}\n  });\n\n  it('dry-run does not create files', () => {\n    const out = run('install commit-changes --dry-run');\n    assert.match(out, \u002FDRY RUN\u002F);\n    assert.ok(!existsSync(testPath));\n  });\n\n  it('installs creates the target', () => {\n    run('install commit-changes');\n    assert.ok(existsSync(testPath));\n  });\n\n  it('skips already installed', () => {\n    const out = run('install commit-changes');\n    assert.match(out, \u002Fskipped\u002F);\n  });\n\n  it('uninstall removes the target', () => {\n    run('uninstall commit-changes');\n    assert.ok(!existsSync(testPath));\n  });\n});\n```\n\nCleanup rules:\n- Use `after()` hooks, not `afterEach()` — lifecycle tests build on each other\n- Wrap cleanup in `try\u002Fcatch` — cleanup must not fail the test suite\n- Clean from leaf to root (file → parent dir → grandparent dir)\n- If the test modifies shared state (symlinks, config files), restore it\n\n**Got:** Tests run in sequence within the describe block, cleanup runs even on failure.\n\n**If fail:** If tests run in parallel (non-default in node:test), force sequential with `{ concurrency: 1 }`.\n\n### Step 4: Write Dry-Run Tests for Each Adapter\n\nTest each adapter's target path without making changes:\n\n```javascript\ndescribe('adapter: cursor (dry-run)', () => {\n  it('targets .cursor\u002Fskills\u002F path', () => {\n    const out = run('install commit-changes --framework cursor --dry-run');\n    assert.match(out, \u002F\\.cursor\\\u002Fskills\u002Fi);\n  });\n});\n\ndescribe('adapter: copilot (dry-run)', () => {\n  it('targets .github\u002F path', () => {\n    const out = run('install commit-changes --framework copilot --dry-run');\n    assert.match(out, \u002F\\.github\u002Fi);\n  });\n});\n```\n\nThis pattern scales to any number of adapters. Each test:\n- Uses `--framework` to bypass auto-detection\n- Uses `--dry-run` so no files are created\n- Asserts the target path appears in output\n\n**Got:** One describe block per adapter, each with at least a path assertion.\n\n**If fail:** If the adapter doesn't exist in the project, the test will fail with \"Unknown framework.\" This is correct — adapter tests should only exist for implemented adapters.\n\n### Step 5: Write Error Case Tests\n\n```javascript\ndescribe('errors', () => {\n  it('rejects unknown items', () => {\n    assert.throws(\n      () => run('install nonexistent-skill-xyz'),\n      \u002FNo matching items|Unknown\u002F,\n    );\n  });\n\n  it('rejects unknown framework', () => {\n    assert.throws(\n      () => run('install commit-changes --framework nonexistent'),\n      \u002FUnknown framework\u002F,\n    );\n  });\n\n  it('handles missing state gracefully', () => {\n    assert.throws(\n      () => run('scatter nonexistent-team'),\n      \u002Fnot burning|Unknown\u002F,\n    );\n  });\n});\n```\n\nError testing patterns:\n- `assert.throws` catches non-zero exit codes from `execSync`\n- Regex match on the error message (captured from stderr)\n- Test both \"item not found\" and \"invalid option\" errors\n- Verify error messages suggest corrective actions\n\n**Got:** All error paths produce non-zero exit codes and helpful messages.\n\n**If fail:** `execSync` throws on non-zero exit. The error's `stderr` or `stdout` contains the message. Check `error.stdout` if `assert.throws` regex doesn't match.\n\n### Step 6: Write JSON Output Tests\n\n```javascript\ndescribe('json output', () => {\n  it('campfire --json outputs valid JSON', () => {\n    const out = run('campfire --json');\n    const data = JSON.parse(out);\n    assert.ok(typeof data.totalTeams === 'number');\n    assert.ok(Array.isArray(data.fires));\n  });\n\n  it('gather --dry-run --json outputs structured data', () => {\n    const out = run('gather tending --dry-run --json');\n    \u002F\u002F JSON may follow a DRY RUN header — extract from first '{'\n    const jsonStart = out.indexOf('{');\n    assert.ok(jsonStart >= 0, 'Should contain JSON');\n    const data = JSON.parse(out.slice(jsonStart));\n    assert.equal(data.team, 'tending');\n  });\n});\n```\n\nJSON testing gotchas:\n- Some commands prefix JSON with human-readable text (e.g., DRY RUN header)\n- Extract JSON by finding the first `{` character\n- Validate structure (key presence, types), not exact values\n- Values like counts may change as content is added\n\n**Got:** JSON output is parseable and contains expected keys.\n\n**If fail:** If `JSON.parse` fails, the command may be mixing human text with JSON. Either fix the command to output pure JSON in `--json` mode, or extract the JSON substring.\n\n### Step 7: Handle Cleanup and State Restoration\n\n```javascript\ndescribe('stateful commands', () => {\n  const stateDir = resolve(ROOT, '.agent-almanac');\n\n  after(() => {\n    \u002F\u002F Remove state file created by tests\n    try { rmSync(stateDir, { recursive: true }); } catch {}\n  });\n\n  \u002F\u002F Tests that create\u002Fmodify state...\n});\n\n\u002F\u002F Restore symlinks that destructive tests may remove\ndescribe('destructive tests', () => {\n  after(() => {\n    \u002F\u002F Restore symlinks that scatter\u002Funinstall removed\n    const skills = ['heal', 'meditate', 'remote-viewing'];\n    for (const skill of skills) {\n      const link = resolve(ROOT, `.claude\u002Fskills\u002F${skill}`);\n      if (!existsSync(link)) {\n        try {\n          execSync(`ln -s ..\u002F..\u002Fskills\u002F${skill} ${link}`, { cwd: ROOT });\n        } catch {}\n      }\n    }\n  });\n});\n```\n\nState restoration rules:\n- State files (`.agent-almanac\u002Fstate.json`) must be cleaned after tests\n- Symlinks removed by `scatter`\u002F`uninstall` must be restored\n- Manifest files (`agent-almanac.yml`) created by `init` must be removed\n- Order: `after()` hooks run in reverse declaration order — declare restore hooks last\n\n**Got:** The test suite leaves the project in the same state it found it.\n\n**If fail:** If CI reports leftover files after test runs, add the cleanup to `after()`. Use `git status` after test runs to detect leaked state.\n\n## Validation\n\n- [ ] Test file runs with `node --test cli\u002Ftest\u002Fcli.test.js`\n- [ ] All tests pass (0 failures)\n- [ ] Smoke tests cover `--version`, `--help`, and registry loading\n- [ ] Lifecycle tests verify create → verify → delete with cleanup\n- [ ] At least one adapter dry-run test exists per implemented adapter\n- [ ] Error cases test non-zero exit codes with message matching\n- [ ] JSON output tests parse actual output (not mocked)\n- [ ] After hooks restore all state modified by tests\n\n## Pitfalls\n\n- **Hardcoded counts that break**: Registry totals change as content is added. Use `\\d+` regex or read the count dynamically instead of asserting `329 skills`.\n- **Tests that depend on execution order**: `node:test` runs suites in declaration order by default, but tests within a suite may not. Use lifecycle suites (create → verify → delete) within a single `describe` to guarantee order.\n- **Missing cleanup on test failure**: If a test fails mid-lifecycle, `after()` still runs. But if you throw in `before()`, subsequent tests and `after()` may not run. Keep `before()` minimal.\n- **Interactive prompts hanging tests**: Commands with confirmation prompts will hang `execSync`. Either pipe `echo y |` or ensure `--yes` is always passed in tests.\n- **Testing with real installs in CI**: Tests that create files in `.claude\u002Fskills\u002F` or `.agents\u002Fskills\u002F` modify the working tree. CI may fail on \"dirty working directory\" checks. Always clean up.\n\n## Related Skills\n\n- `scaffold-cli-command` — build the commands that these tests verify\n- `build-cli-plugin` — build the adapters tested in Step 4\n- `design-cli-output` — output patterns that tests assert against\n",{"name":5,"locale":23,"license":14,"metadata":24,"translator":35,"description":36,"allowed-tools":37,"source_commit":38,"source_locale":39,"translation_date":40},"caveman-lite",{"tags":25,"author":31,"domain":26,"version":32,"language":33,"complexity":34},[26,27,28,29,30],"cli","testing","nodejs","node-test","integration","Philipp Thoss","1.0","TypeScript","intermediate","Julius Brussee homage — caveman","Write integration tests for a Node.js CLI application using the built-in node:test module. Covers the exec helper pattern, output assertions, filesystem state verification, cleanup hooks, JSON output parsing, error case testing, and state restoration after destructive tests. Use when adding tests to an existing CLI, testing a new command, verifying adapter behavior across frameworks, or setting up CI for a CLI tool.\n","Read Write Edit Bash Grep Glob","82c77053","en","2026-05-03","master","f483e54f3ad5f202a77d45f2e57f8d970b71195f","skills_library\u002Ftest-cli-application",2,"https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills","https:\u002F\u002Fgithub.com\u002Froohe","yoou.link","2026-05-19 15:56:07",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add roohe\u002Fagentic-super-skills --skill test-cli-application",{"tool":55,"command":56},"bunx","bunx skills add roohe\u002Fagentic-super-skills --skill test-cli-application",{"tool":58,"command":59},"pnpm","pnpm dlx skills add roohe\u002Fagentic-super-skills --skill test-cli-application","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Ftest-cli-application\u002FSKILL.md",true,[],[64,71,78,85,92,99],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M73D865CZME2FCMKA4PQM348","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M73D7Z64J4ABWZJD7P44XBBF","youtube-downloader","Download and process YouTube content for research. Use when: downloading competitor videos for analysis; extracting audio for podcasts; getting transcripts for content repurposing; archiving webinars; research content curation","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyoutube-downloader\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M73D7K8778TGZV3GJFR3703D","yc-pitch-deck","Create a compelling startup pitch deck that follows the structure proven to raise billions from top investors. Master the YC and Sequoia formats that get founders funded. Use when: **Fundraising** to create investor pitch decks; **YC application** to structure your narrative; **Demo Day prep** to craft your 2-minute pitch; **Angel investors** to communicate your opportunity; **Partnership pitches** to structure compelling asks","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyc-pitch-deck\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M73D70KJSE0E8Z28YMNNRT04","x-twitter-scraper","Use when the user needs X (Twitter) data or confirmation-gated X actions through Xquik: tweet search, user lookup, follower extraction, media download, monitoring, webhooks, MCP, SDKs, posting, likes, DMs, and profile updates. Requires a Xquik API key. Never ask for X login material.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fx-twitter-scraper\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":18},"01M73D6ED01GV077R7K4NZNFZJ","write-vignette","Create R package vignettes using R Markdown or Quarto. Covers vignette setup, YAML configuration, code chunk options, building and testing, and CRAN requirements for vignettes. Use when adding a Getting Started tutorial, documenting complex workflows spanning multiple functions, creating domain-specific guides, or when CRAN submission requires user-facing documentation beyond function help pages.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-vignette\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":18},"01M73D69YJR0BK3NFHE0CYG3EF","write-validation-documentation","Write IQ\u002FOQ\u002FPQ validation documentation for computerized systems in regulated environments. Covers protocols, reports, test scripts, deviation handling, and approval workflows. Use when validating R or other software for regulated use, preparing for a regulatory audit, documenting qualification of computing environments, or creating and updating validation protocols and reports for new or re-qualified systems.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-validation-documentation\u002FSKILL.md",[],[]]