[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74HE8WY2R79WX8TF6RF989S":3,"skill-same:01M74HE8WY2R79WX8TF6RF989S":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M74HE8WY2R79WX8TF6RF989S","tdd-pro-bash32-portability",null,"macOS bash 3.2 + BSD-tool portability checklist for substrate writing in claude-tdd-pro. Reference BEFORE any new Write\u002FEdit of a .sh file. Catches the 9 recurring portability gotchas (associative arrays, wc -l padding, printf %, env-var-passing-first, set -u + empty arrays, BSD grep --, redirect order, help-to-stderr, node -e top-level return, CLAUDE_PLUGIN_ROOT vs cwd).","drumfiend21\u002Fclaude-tdd-pro","drumfiend21","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10619389?v=4","01M74HCNYY9VCB2B7FNCSPQSZN","Siddharth Joshi","01M74HCNZHQP883HA9WSN1G6TR",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftdd-pro-bash32-portability\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: tdd-pro-bash32-portability\ndescription: macOS bash 3.2 + BSD-tool portability checklist for substrate writing in claude-tdd-pro. Reference BEFORE any new Write\u002FEdit of a .sh file. Catches the 9 recurring portability gotchas (associative arrays, wc -l padding, printf %, env-var-passing-first, set -u + empty arrays, BSD grep --, redirect order, help-to-stderr, node -e top-level return, CLAUDE_PLUGIN_ROOT vs cwd).\n---\n\n# macOS Bash 3.2 + BSD-Tool Portability Checklist\n\n**Rule:** Before writing or editing any new bash substrate, walk through this list. Don't catch these failures via spec runs — they're well-known and avoidable.\n\n**Why:** Across CL-146..196 the same five portability bugs were repeatedly hit (associative arrays, `wc -l` padding, `printf %`, env-var passing, `set -u` + empty arrays). Each costs a debug-test-fix cycle of ~2 minutes. Treating this as a known-defect catalog saves ~10% per CL. Validated on CL-197: full H-8 promotion passed 10\u002F10 first-run after applying this checklist (vs. ~4 spec-fix cycles per CL without it).\n\nThe canonical source-of-truth is [docs\u002Fmemory\u002Ffeedback-bash32-portability-checklist.md](..\u002F..\u002F..\u002Fdocs\u002Fmemory\u002Ffeedback-bash32-portability-checklist.md).\n\n## The nine recurring portability bugs\n\n### 1. No associative arrays\n\nbash 3.2 (macOS default) rejects `declare -A`. Use `node -e '...'` for map\u002Fdict operations:\n\n```bash\n# WRONG — fails on macOS\ndeclare -A counts\ncounts[apple]=3\n\n# RIGHT — node handles maps\nCOUNT_JSON=$(KEY=apple VAL=3 node -e '\n  const out = { [process.env.KEY]: Number(process.env.VAL) };\n  process.stdout.write(JSON.stringify(out));\n')\n```\n\n### 2. `wc -l \u003C file` pads output with whitespace on macOS\n\n```bash\n# WRONG — actual value is \"       2\", not \"2\"\n[ \"$(wc -l \u003C file)\" = \"2\" ]\n\n# RIGHT — strip whitespace\n[ \"$(wc -l \u003C file | tr -d ' ')\" = \"2\" ]\n```\n\n**Also patch spec files** — never trust a raw `wc -l` substring comparison.\n\n### 3. `printf '...%\\n'` is malformed\n\n`%` starts a format spec; `%\\n` is invalid. To emit a literal `%`, use `%%\\n`:\n\n```bash\n# WRONG — silently produces nothing\nprintf 'similarity index 90%\\n'\n\n# RIGHT\nprintf 'similarity index 90%%\\n'\n```\n\nCaught in W-9 spec setup with `similarity index 90%\\n`.\n\n### 4. Env-var passing into subshells must come FIRST\n\n```bash\n# WRONG — sets VAR in parent shell but NOT in node child\nVAR=val RESULT=$(node -e 'console.log(process.env.VAR)')\n\n# RIGHT — env-var goes inside the subshell, before the command\nRESULT=$(VAR=val node -e 'console.log(process.env.VAR)')\n```\n\nBites every node-via-bash one-liner.\n\n### 5. `set -u` + empty array reference errors\n\n`set -uo pipefail` + `\"${ARR[@]}\"` on an empty array → unbound variable error:\n\n```bash\n# WRONG — errors when ARR is empty\nset -uo pipefail\nARR=()\nfor x in \"${ARR[@]}\"; do echo \"$x\"; done\n\n# RIGHT — guard or use the empty-safe expansion\n[[ ${#ARR[@]} -gt 0 ]] && for x in \"${ARR[@]}\"; do echo \"$x\"; done\n# OR\nfor x in \"${ARR[@]+\"${ARR[@]}\"}\"; do echo \"$x\"; done\n```\n\n### 6. BSD `grep --flag-arg` confusion\n\n`grep -E \"--json...\"` is read as a flag. Use `--` to end flag parsing:\n\n```bash\n# WRONG — BSD grep tries to parse --json as a flag\ngrep -E \"--json-input\" file\n\n# RIGHT\ngrep -E -- \"--json-input\" file\n```\n\n### 7. Redirect order matters\n\n`find ... 2>\u002Fdev\u002Fnull >&2` sends find's stdout to \u002Fdev\u002Fnull because `>&2` is evaluated when fd2 was just redirected:\n\n```bash\n# WRONG — stdout goes to \u002Fdev\u002Fnull, not to original stderr\nfind . -type f 2>\u002Fdev\u002Fnull >&2\n\n# RIGHT — stdout to original stderr, then fd2 to \u002Fdev\u002Fnull\nfind . -type f >&2 2>\u002Fdev\u002Fnull\n```\n\n### 8. `node -e` does not allow top-level `return`\n\nCode passed via `-e` runs at the top of a module, not inside a function:\n\n```bash\n# WRONG — SyntaxError: Illegal return statement\nnode -e '\n  const x = check();\n  if (!x) { return; }\n  doMore(x);\n'\n\n# RIGHT — invert the condition\nnode -e '\n  const x = check();\n  if (x) { doMore(x); }\n'\n\n# OR — wrap in an IIFE\nnode -e '(() => {\n  const x = check();\n  if (!x) return;\n  doMore(x);\n})();'\n```\n\nCost one spec-fix on S-9 conformance-report coverage matrix.\n\n### 9. `CLAUDE_PLUGIN_ROOT` may not be cwd\n\nSpec tests `mkdir -p repo` and `cd` to a tmpdir, but substrate that looks up registries or rule trees with `$PWD\u002F...` will miss them:\n\n```bash\n# WRONG — assumes cwd is plugin root\nSOURCES=\"$PWD\u002Fstandards\u002Fsources.yaml\"\n\n# RIGHT — use CLAUDE_PLUGIN_ROOT for in-repo lookups, --root \u003Cdir> for the repo-under-test\nPLUGIN_ROOT=\"${CLAUDE_PLUGIN_ROOT:-$(cd \"$(dirname \"$0\")\u002F..\u002F..\" && pwd -P)}\"\nSOURCES=\"$PLUGIN_ROOT\u002Fstandards\u002Fsources.yaml\"\n```\n\n## Bonus rule — help text must go to stderr\n\nWhen specs do `2>out.txt && grep ...`, the help output needs to be on stderr:\n\n```bash\n# WRONG — help goes to stdout, spec misses it\n-h|--help) echo \"Usage: foo --bar\"; exit 0 ;;\n\n# RIGHT — wrap in { ... } >&2 or use echo >&2\n-h|--help) echo \"Usage: foo --bar\" >&2; exit 0 ;;\n\n# OR for multi-line help\n-h|--help) { cat \u003C\u003CEOF\nUsage: foo --bar \u003Cname>\n  --bar    set the bar\nEOF\n} >&2; exit 0 ;;\n```\n\nCaught in H-6 with `\u002Fplan-first --help`; lost 4 spec-fix cycles before fixing.\n\n## When to invoke this skill\n\n- BEFORE writing or editing any `.sh` file.\n- When debugging a spec that worked locally but fails in CI\u002Fcloud (cloud is usually Linux with bash 5+ and GNU tools — `wc -l` and `printf` differ).\n- When porting a script tested on Linux to macOS.\n\n## Related skills\n\n- [`tdd-pro-cl-workflow`](..\u002Ftdd-pro-cl-workflow\u002FSKILL.md) — the broader per-CL discipline.\n- [`tdd-pro-batch-cl`](..\u002Ftdd-pro-batch-cl\u002FSKILL.md) — when to ship multiple substrate writes together.\n","# macOS Bash 3.2 + BSD-Tool Portability Checklist\n\n**Rule:** Before writing or editing any new bash substrate, walk through this list. Don't catch these failures via spec runs — they're well-known and avoidable.\n\n**Why:** Across CL-146..196 the same five portability bugs were repeatedly hit (associative arrays, `wc -l` padding, `printf %`, env-var passing, `set -u` + empty arrays). Each costs a debug-test-fix cycle of ~2 minutes. Treating this as a known-defect catalog saves ~10% per CL. Validated on CL-197: full H-8 promotion passed 10\u002F10 first-run after applying this checklist (vs. ~4 spec-fix cycles per CL without it).\n\nThe canonical source-of-truth is [docs\u002Fmemory\u002Ffeedback-bash32-portability-checklist.md](..\u002F..\u002F..\u002Fdocs\u002Fmemory\u002Ffeedback-bash32-portability-checklist.md).\n\n## The nine recurring portability bugs\n\n### 1. No associative arrays\n\nbash 3.2 (macOS default) rejects `declare -A`. Use `node -e '...'` for map\u002Fdict operations:\n\n```bash\n# WRONG — fails on macOS\ndeclare -A counts\ncounts[apple]=3\n\n# RIGHT — node handles maps\nCOUNT_JSON=$(KEY=apple VAL=3 node -e '\n  const out = { [process.env.KEY]: Number(process.env.VAL) };\n  process.stdout.write(JSON.stringify(out));\n')\n```\n\n### 2. `wc -l \u003C file` pads output with whitespace on macOS\n\n```bash\n# WRONG — actual value is \"       2\", not \"2\"\n[ \"$(wc -l \u003C file)\" = \"2\" ]\n\n# RIGHT — strip whitespace\n[ \"$(wc -l \u003C file | tr -d ' ')\" = \"2\" ]\n```\n\n**Also patch spec files** — never trust a raw `wc -l` substring comparison.\n\n### 3. `printf '...%\\n'` is malformed\n\n`%` starts a format spec; `%\\n` is invalid. To emit a literal `%`, use `%%\\n`:\n\n```bash\n# WRONG — silently produces nothing\nprintf 'similarity index 90%\\n'\n\n# RIGHT\nprintf 'similarity index 90%%\\n'\n```\n\nCaught in W-9 spec setup with `similarity index 90%\\n`.\n\n### 4. Env-var passing into subshells must come FIRST\n\n```bash\n# WRONG — sets VAR in parent shell but NOT in node child\nVAR=val RESULT=$(node -e 'console.log(process.env.VAR)')\n\n# RIGHT — env-var goes inside the subshell, before the command\nRESULT=$(VAR=val node -e 'console.log(process.env.VAR)')\n```\n\nBites every node-via-bash one-liner.\n\n### 5. `set -u` + empty array reference errors\n\n`set -uo pipefail` + `\"${ARR[@]}\"` on an empty array → unbound variable error:\n\n```bash\n# WRONG — errors when ARR is empty\nset -uo pipefail\nARR=()\nfor x in \"${ARR[@]}\"; do echo \"$x\"; done\n\n# RIGHT — guard or use the empty-safe expansion\n[[ ${#ARR[@]} -gt 0 ]] && for x in \"${ARR[@]}\"; do echo \"$x\"; done\n# OR\nfor x in \"${ARR[@]+\"${ARR[@]}\"}\"; do echo \"$x\"; done\n```\n\n### 6. BSD `grep --flag-arg` confusion\n\n`grep -E \"--json...\"` is read as a flag. Use `--` to end flag parsing:\n\n```bash\n# WRONG — BSD grep tries to parse --json as a flag\ngrep -E \"--json-input\" file\n\n# RIGHT\ngrep -E -- \"--json-input\" file\n```\n\n### 7. Redirect order matters\n\n`find ... 2>\u002Fdev\u002Fnull >&2` sends find's stdout to \u002Fdev\u002Fnull because `>&2` is evaluated when fd2 was just redirected:\n\n```bash\n# WRONG — stdout goes to \u002Fdev\u002Fnull, not to original stderr\nfind . -type f 2>\u002Fdev\u002Fnull >&2\n\n# RIGHT — stdout to original stderr, then fd2 to \u002Fdev\u002Fnull\nfind . -type f >&2 2>\u002Fdev\u002Fnull\n```\n\n### 8. `node -e` does not allow top-level `return`\n\nCode passed via `-e` runs at the top of a module, not inside a function:\n\n```bash\n# WRONG — SyntaxError: Illegal return statement\nnode -e '\n  const x = check();\n  if (!x) { return; }\n  doMore(x);\n'\n\n# RIGHT — invert the condition\nnode -e '\n  const x = check();\n  if (x) { doMore(x); }\n'\n\n# OR — wrap in an IIFE\nnode -e '(() => {\n  const x = check();\n  if (!x) return;\n  doMore(x);\n})();'\n```\n\nCost one spec-fix on S-9 conformance-report coverage matrix.\n\n### 9. `CLAUDE_PLUGIN_ROOT` may not be cwd\n\nSpec tests `mkdir -p repo` and `cd` to a tmpdir, but substrate that looks up registries or rule trees with `$PWD\u002F...` will miss them:\n\n```bash\n# WRONG — assumes cwd is plugin root\nSOURCES=\"$PWD\u002Fstandards\u002Fsources.yaml\"\n\n# RIGHT — use CLAUDE_PLUGIN_ROOT for in-repo lookups, --root \u003Cdir> for the repo-under-test\nPLUGIN_ROOT=\"${CLAUDE_PLUGIN_ROOT:-$(cd \"$(dirname \"$0\")\u002F..\u002F..\" && pwd -P)}\"\nSOURCES=\"$PLUGIN_ROOT\u002Fstandards\u002Fsources.yaml\"\n```\n\n## Bonus rule — help text must go to stderr\n\nWhen specs do `2>out.txt && grep ...`, the help output needs to be on stderr:\n\n```bash\n# WRONG — help goes to stdout, spec misses it\n-h|--help) echo \"Usage: foo --bar\"; exit 0 ;;\n\n# RIGHT — wrap in { ... } >&2 or use echo >&2\n-h|--help) echo \"Usage: foo --bar\" >&2; exit 0 ;;\n\n# OR for multi-line help\n-h|--help) { cat \u003C\u003CEOF\nUsage: foo --bar \u003Cname>\n  --bar    set the bar\nEOF\n} >&2; exit 0 ;;\n```\n\nCaught in H-6 with `\u002Fplan-first --help`; lost 4 spec-fix cycles before fixing.\n\n## When to invoke this skill\n\n- BEFORE writing or editing any `.sh` file.\n- When debugging a spec that worked locally but fails in CI\u002Fcloud (cloud is usually Linux with bash 5+ and GNU tools — `wc -l` and `printf` differ).\n- When porting a script tested on Linux to macOS.\n\n## Related skills\n\n- [`tdd-pro-cl-workflow`](..\u002Ftdd-pro-cl-workflow\u002FSKILL.md) — the broader per-CL discipline.\n- [`tdd-pro-batch-cl`](..\u002Ftdd-pro-batch-cl\u002FSKILL.md) — when to ship multiple substrate writes together.\n",{"name":5,"description":7},"main","41c38db9b8cf2d5b7743093654a12fdd9cd59c03",".claude\u002Fskills\u002Ftdd-pro-bash32-portability","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro","https:\u002F\u002Fgithub.com\u002Fdrumfiend21","http:\u002F\u002Fjungleej.wordpress.com","2026-11-09 20:29:03",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add drumfiend21\u002Fclaude-tdd-pro --skill tdd-pro-bash32-portability",{"tool":37,"command":38},"bunx","bunx skills add drumfiend21\u002Fclaude-tdd-pro --skill tdd-pro-bash32-portability",{"tool":40,"command":41},"pnpm","pnpm dlx skills add drumfiend21\u002Fclaude-tdd-pro --skill tdd-pro-bash32-portability","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftdd-pro-bash32-portability\u002FSKILL.md",true,[],[46,53,60,67,74,80],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M74HHPZCJM1SJFPMAT28GZ1S","test-first-extract","Use when the user asks to EXTRACT or RELOCATE existing code into its own file, module, or component (\"extract X\", \"split out Y\", \"pull Z into its own file\", \"decompose god-file\"). NOT for net-new features (use tdd-feature-build) or behavior changes (use fix-bug). Enforces the 9-step extraction with isolated unit tests + integration regression tests as a two-tier safety net.","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Ftest-first-extract\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M74HHK1QJ5APDRM7WWMC90X9","tdd-feature-build","Use when the user describes a NEW feature to add (\"add X to Y\", \"implement Z\", \"build a feature that…\", \"make it possible to…\"). Enforces TDD — failing test first, minimum code to pass, refactor. Refuses to ship code without a test that demonstrably catches its absence. Does NOT trigger on bug fixes (use bug-fix-discipline) or refactors (use test-first-extract). Will ask 1-3 clarifying questions before writing any code; safe to delegate from \u002Ffeature command.","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Ftdd-feature-build\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M74HHEXN1MK9SK9JDGN52YDJ","sync","Multi-machine git-backed sync of local TDD Pro state via the `tdd-pro-sync` branch. Use when operators run claude-tdd-pro on more than one machine and want their FAILURE-LOG, decisions, audit checkpoints, workflow state, operator-curated URL registries, operator\u002Fcommunity trees, and paywalled attestations to follow them between hosts.","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Fsync\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M74HHBQ8K1FNZ5AXTEGGF8RW","strict-component-tests","Use when writing or reviewing test files. Enforces strict assertions that actually catch regressions (getByRole, exact counts, jest-dom matchers) in contrast to permissive tests (queryAllByText length > 0) that pass against broken UIs. References QUALITY-BAR.md for the canonical strictness rules.","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Fstrict-component-tests\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M74HHA5W00JK570KTA68MRZD","spec","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Fspec\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M74HH5HR9S2Q6HRAW0GTXATA","spec-first","Use when the user describes a non-trivial feature or system that should be specified in writing before any code is written. Pattern from Geoffrey Huntley's \"Ralph\" loop, OpenSpec, intent-driven.dev, and Kent Beck's \"augmented coding\" framing — specs+tests are the durable artifact, code is the disposable one. Produces a Markdown spec document that the user reviews; only after approval does any code get written (typically via tdd-feature-build or \u002Ffeature).","https:\u002F\u002Fgithub.com\u002Fdrumfiend21\u002Fclaude-tdd-pro\u002Fblob\u002Fmain\u002Fskills\u002Fspec-first\u002FSKILL.md",[],[]]