[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74JGEBX591Q0NMB2KM951XM":3,"skill-same:01M74JGEBX591Q0NMB2KM951XM":61},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":46},"01M74JGEBX591Q0NMB2KM951XM","clirunner-env",null,"Use when a CLI test builds env= as a filtered-dict, passes env={}, or relies on monkeypatch.delenv. Click's CliRunner.invoke only overrides keys the dict names; pass {key: None} to delete one.","MrBinnacle\u002Fskills","MrBinnacle","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F124333270?v=4","01M74JFP3ZCYZP94CVBY1JR1E6","Matthew Gruber","01M74JFP4K4A75MGTZBC9D836G",1,"MIT","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fclirunner-env\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: clirunner-env\ndescription: \"Use when a CLI test builds env= as a filtered-dict, passes env={}, or relies on monkeypatch.delenv. Click's CliRunner.invoke only overrides keys the dict names; pass {key: None} to delete one.\"\ndisable-model-invocation: true\n---\n\n# Click CliRunner: `env=None` deletes; absence does NOT\n\n## Problem\n\nYou wrote a CLI test where the SUT (system under test) branches on whether an env var is set. The test invokes the CLI via `CliRunner.invoke(cli, args, env=clean_env_dict)`, where `clean_env_dict` omits the env var you want absent. The test passes locally. You ship it. Later it turns out the test was never exercising the \"var absent\" branch — it was running with the var present (inherited from your shell), and your assertion happened to also pass for the \"var present\" code path. In a live-API-call test, this can mean the test SILENTLY makes the network call you thought you were preventing.\n\n## Root cause\n\nClick's `CliRunner.invoke(env=...)` is an OVERRIDE dict, not a REPLACEMENT environment. It iterates the dict and applies each key:\n\n- `env[key] = \"value\"` → sets `os.environ[key] = \"value\"` for the duration of the invocation, restoring afterward\n- `env[key] = None` → calls `del os.environ[key]` for the duration of the invocation, restoring afterward\n- key absent from `env` → `os.environ[key]` is left UNTOUCHED\n\nOriginally verified against `click\u002Ftesting.py:534` on Click 8.1.x; re-checked 2026-08-23 and 2026-08-24 against the current published [testing module source](https:\u002F\u002Fgithub.com\u002Fpallets\u002Fclick\u002Fblob\u002Fstable\u002Fsrc\u002Fclick\u002Ftesting.py); re-checked 2026-10-06 against Click 8.5.x (the stable docs header and the published testing module). The durable evidence is the signature: `env: Mapping[str, str | None] | None` on `CliRunner`, `CliRunner.invoke` and `CliRunner.isolation`. A value type of `str | None` is the API stating that `None` is a meaningful value rather than an omission — that is the delete. The docs describe `env` as \"overrides\", which is the absent-keys-untouched half. Cite the signature, not a file offset or a version pin — the `8.1.x` branch no longer exists, and the signature has survived every check so far.\n\n## Trigger conditions\n\nYou wrote one of these patterns and the test silently passed:\n\n```python\n# Pattern 1: filtered dict\nclean_env = {k: v for k, v in os.environ.items() if k != \"ANTHROPIC_API_KEY\"}\nrunner.invoke(cli, args, env=clean_env)  # ANTHROPIC_API_KEY may STILL be in os.environ during invoke\n\n# Pattern 2: empty dict\nrunner.invoke(cli, args, env={})  # NOTHING is deleted; nothing is overridden; identity to no env=\n\n# Pattern 3: subset dict\nrunner.invoke(cli, args, env={\"OTHER_VAR\": \"x\"})  # Only OTHER_VAR is touched\n```\n\nSpecific symptoms:\n\n- Test passes when run alone but you can't reproduce the bug it was supposed to catch\n- `os.environ.get(\"MY_VAR\")` inside the SUT returns a non-empty string even though the test \"set\" `env` to a dict without `MY_VAR`\n- A pre-flight key check passes when you expected it to fail\n- A test that asserts \"refuse when key absent\" never actually fires its refusal path\n\n## Fix\n\nPass `{key: None}` explicitly for every env var that must be absent:\n\n```python\nrunner.invoke(cli, args, env={\n    \"ANTHROPIC_API_KEY\": None,      # delete for the duration of invoke\n    \"OPENROUTER_API_KEY\": None,     # delete for the duration of invoke\n    \"SOME_OVERRIDE\": \"value-x\",     # set for the duration of invoke\n})\n```\n\nFor pytest-based tests, prefer [`monkeypatch.delenv`](https:\u002F\u002Fdocs.pytest.org\u002Fen\u002Fstable\u002Fhow-to\u002Fmonkeypatch.html) when the code under test is not exclusively a CLI entry-point — the SUT then runs with the key genuinely absent from `os.environ`, which is the clearer semantics:\n\n```python\ndef test_resolver_no_keys(monkeypatch):\n    monkeypatch.delenv(\"ANTHROPIC_API_KEY\", raising=False)\n    monkeypatch.delenv(\"OPENROUTER_API_KEY\", raising=False)\n    # ... assertion\n```\n\nWhen you MUST use CliRunner's `env=` (the SUT is launched as a click command and you need one invocation), use the `{key: None}` form.\n\n## Verification\n\nAfter the fix, verify the test actually exercises the intended branch:\n\n1. Temporarily insert `print(f\"key={os.environ.get('MY_VAR')!r}\", file=sys.stderr)` inside the SUT and re-run. The print should show `key=None`.\n2. Run the test on a machine where the env var IS set in the shell. A correct fix passes\u002Ffails the same way as on a clean machine.\n3. If the test asserts an exception, intentionally remove the `{key: None}` and confirm the test then fails. Put it back.\n\n## Notes\n\nOpen [gotchas.md](gotchas.md) when a CLI test silently passed on a branch that never ran the absent-env path. It records the origin incident and how this card's own references rotted.\n\n- Most dangerous in tests of API-key-dependent code: the missing `{key: None}` can let a test silently make a live network call, burning real money and producing flaky results.\n- The behavior is documented — [the env parameter on CliRunner.invoke](https:\u002F\u002Fclick.palletsprojects.com\u002Fen\u002Fstable\u002Fapi\u002F#click.testing.CliRunner.invoke) — but phrased as \"added\u002Foverridden,\" not as \"absence does nothing.\" Easy to miss.\n- `subprocess.run(env=...)` works differently: there, `env=` REPLACES the entire environment. The cross-tool inconsistency is a contributor to the confusion.\n\n## Example (2026-06-09)\n\n```python\n# tests\u002Fablation\u002Ftest_cli_d3_fixes.py — BEFORE, looked correct\nclean_env = {k: v for k, v in os.environ.items() if k != \"ANTHROPIC_API_KEY\"}\nresult = runner.invoke(run_ablation, [...], env=clean_env)\nassert \"ANTHROPIC_API_KEY is not set\" in result.output\n```\n\nOn a machine where `OPENROUTER_API_KEY` was set, a model-aware resolver in the SUT rewrote the model id and proceeded to a live 12-minute Anthropic API call. The test passed because the old assertion string was still in `result.output` from a DIFFERENT code path — the branch under test was never exercised.\n\n```python\n# AFTER\nresult = runner.invoke(run_ablation, [...], env={\n    \"ANTHROPIC_API_KEY\": None,\n    \"OPENROUTER_API_KEY\": None,\n})\nassert \"ANTHROPIC_API_KEY is not set\" in result.output  # now actually fires\n```\n","# Click CliRunner: `env=None` deletes; absence does NOT\n\n## Problem\n\nYou wrote a CLI test where the SUT (system under test) branches on whether an env var is set. The test invokes the CLI via `CliRunner.invoke(cli, args, env=clean_env_dict)`, where `clean_env_dict` omits the env var you want absent. The test passes locally. You ship it. Later it turns out the test was never exercising the \"var absent\" branch — it was running with the var present (inherited from your shell), and your assertion happened to also pass for the \"var present\" code path. In a live-API-call test, this can mean the test SILENTLY makes the network call you thought you were preventing.\n\n## Root cause\n\nClick's `CliRunner.invoke(env=...)` is an OVERRIDE dict, not a REPLACEMENT environment. It iterates the dict and applies each key:\n\n- `env[key] = \"value\"` → sets `os.environ[key] = \"value\"` for the duration of the invocation, restoring afterward\n- `env[key] = None` → calls `del os.environ[key]` for the duration of the invocation, restoring afterward\n- key absent from `env` → `os.environ[key]` is left UNTOUCHED\n\nOriginally verified against `click\u002Ftesting.py:534` on Click 8.1.x; re-checked 2026-08-23 and 2026-08-24 against the current published [testing module source](https:\u002F\u002Fgithub.com\u002Fpallets\u002Fclick\u002Fblob\u002Fstable\u002Fsrc\u002Fclick\u002Ftesting.py); re-checked 2026-10-06 against Click 8.5.x (the stable docs header and the published testing module). The durable evidence is the signature: `env: Mapping[str, str | None] | None` on `CliRunner`, `CliRunner.invoke` and `CliRunner.isolation`. A value type of `str | None` is the API stating that `None` is a meaningful value rather than an omission — that is the delete. The docs describe `env` as \"overrides\", which is the absent-keys-untouched half. Cite the signature, not a file offset or a version pin — the `8.1.x` branch no longer exists, and the signature has survived every check so far.\n\n## Trigger conditions\n\nYou wrote one of these patterns and the test silently passed:\n\n```python\n# Pattern 1: filtered dict\nclean_env = {k: v for k, v in os.environ.items() if k != \"ANTHROPIC_API_KEY\"}\nrunner.invoke(cli, args, env=clean_env)  # ANTHROPIC_API_KEY may STILL be in os.environ during invoke\n\n# Pattern 2: empty dict\nrunner.invoke(cli, args, env={})  # NOTHING is deleted; nothing is overridden; identity to no env=\n\n# Pattern 3: subset dict\nrunner.invoke(cli, args, env={\"OTHER_VAR\": \"x\"})  # Only OTHER_VAR is touched\n```\n\nSpecific symptoms:\n\n- Test passes when run alone but you can't reproduce the bug it was supposed to catch\n- `os.environ.get(\"MY_VAR\")` inside the SUT returns a non-empty string even though the test \"set\" `env` to a dict without `MY_VAR`\n- A pre-flight key check passes when you expected it to fail\n- A test that asserts \"refuse when key absent\" never actually fires its refusal path\n\n## Fix\n\nPass `{key: None}` explicitly for every env var that must be absent:\n\n```python\nrunner.invoke(cli, args, env={\n    \"ANTHROPIC_API_KEY\": None,      # delete for the duration of invoke\n    \"OPENROUTER_API_KEY\": None,     # delete for the duration of invoke\n    \"SOME_OVERRIDE\": \"value-x\",     # set for the duration of invoke\n})\n```\n\nFor pytest-based tests, prefer [`monkeypatch.delenv`](https:\u002F\u002Fdocs.pytest.org\u002Fen\u002Fstable\u002Fhow-to\u002Fmonkeypatch.html) when the code under test is not exclusively a CLI entry-point — the SUT then runs with the key genuinely absent from `os.environ`, which is the clearer semantics:\n\n```python\ndef test_resolver_no_keys(monkeypatch):\n    monkeypatch.delenv(\"ANTHROPIC_API_KEY\", raising=False)\n    monkeypatch.delenv(\"OPENROUTER_API_KEY\", raising=False)\n    # ... assertion\n```\n\nWhen you MUST use CliRunner's `env=` (the SUT is launched as a click command and you need one invocation), use the `{key: None}` form.\n\n## Verification\n\nAfter the fix, verify the test actually exercises the intended branch:\n\n1. Temporarily insert `print(f\"key={os.environ.get('MY_VAR')!r}\", file=sys.stderr)` inside the SUT and re-run. The print should show `key=None`.\n2. Run the test on a machine where the env var IS set in the shell. A correct fix passes\u002Ffails the same way as on a clean machine.\n3. If the test asserts an exception, intentionally remove the `{key: None}` and confirm the test then fails. Put it back.\n\n## Notes\n\nOpen [gotchas.md](gotchas.md) when a CLI test silently passed on a branch that never ran the absent-env path. It records the origin incident and how this card's own references rotted.\n\n- Most dangerous in tests of API-key-dependent code: the missing `{key: None}` can let a test silently make a live network call, burning real money and producing flaky results.\n- The behavior is documented — [the env parameter on CliRunner.invoke](https:\u002F\u002Fclick.palletsprojects.com\u002Fen\u002Fstable\u002Fapi\u002F#click.testing.CliRunner.invoke) — but phrased as \"added\u002Foverridden,\" not as \"absence does nothing.\" Easy to miss.\n- `subprocess.run(env=...)` works differently: there, `env=` REPLACES the entire environment. The cross-tool inconsistency is a contributor to the confusion.\n\n## Example (2026-06-09)\n\n```python\n# tests\u002Fablation\u002Ftest_cli_d3_fixes.py — BEFORE, looked correct\nclean_env = {k: v for k, v in os.environ.items() if k != \"ANTHROPIC_API_KEY\"}\nresult = runner.invoke(run_ablation, [...], env=clean_env)\nassert \"ANTHROPIC_API_KEY is not set\" in result.output\n```\n\nOn a machine where `OPENROUTER_API_KEY` was set, a model-aware resolver in the SUT rewrote the model id and proceeded to a live 12-minute Anthropic API call. The test passed because the old assertion string was still in `result.output` from a DIFFERENT code path — the branch under test was never exercised.\n\n```python\n# AFTER\nresult = runner.invoke(run_ablation, [...], env={\n    \"ANTHROPIC_API_KEY\": None,\n    \"OPENROUTER_API_KEY\": None,\n})\nassert \"ANTHROPIC_API_KEY is not set\" in result.output  # now actually fires\n```\n",{"name":5,"description":7,"disable-model-invocation":24},true,"main","fb8ab02da6c849e2cdb704371f5c8c190512d15e","skills\u002Fengineering\u002Fclirunner-env","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills","https:\u002F\u002Fmrbinnacle.github.io\u002Fskills\u002F","https:\u002F\u002Fgithub.com\u002FMrBinnacle","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fmatthew-g-83390523","I make AI coding agents work in messy, real environments, and measure whether they did. Ex-Army NCO, ex-J.P. Morgan.","2026-11-15 04:37:29",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":24},[36,39,42],{"tool":37,"command":38},"npx","npx skills add MrBinnacle\u002Fskills --skill clirunner-env",{"tool":40,"command":41},"bunx","bunx skills add MrBinnacle\u002Fskills --skill clirunner-env",{"tool":43,"command":44},"pnpm","pnpm dlx skills add MrBinnacle\u002Fskills --skill clirunner-env","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fclirunner-env\u002FSKILL.md",[47,53,57],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"evals\u002Fevals.json","REFERENCE","参考文档",3067,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fclirunner-env\u002Fevals\u002Fevals.json",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"EVIDENCE.md",5395,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fclirunner-env\u002FEVIDENCE.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"gotchas.md",2352,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fclirunner-env\u002Fgotchas.md",[62,69,76,83,90,97],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M74JHKQKA5V9N4B4VDAHBGAP","subagent-handback","Use when prompting, briefing or dispatching a research subagent, or when one goes idle with no report. Name a return channel, check its tool grant, verify every claim, negatives first.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fsubagent-handback\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M74JHGXP4YFAGQCRTMFQ8Q5F","disposition-schema","Use when dispatching parallel agents to verify or adjudicate findings (adversarial verify, security disposition, council fires), or before you consolidate their outputs and risk an ID collision.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fdisposition-schema\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M74JHDMFE7VN27QTC6YRPW22","decision-rights","Use when writing a handoff, plan, ADR or subagent brief, or one says \"do not re-litigate\" or \"final\". Separates evidence access from decision rights and marks what is non-negotiable.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fdecision-rights\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M74JHARZJ246DYV6SSXFRNXT","dead-predicate","Use when a hook didn't fire, a reminder never arrived, or before claiming a rule is hook-enforced: a live router rule can match nothing (missing word, JSON escape, shadowing, stale name).","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fdead-predicate\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M74JH7P66AGN3RHKH7DVA5Y4","vacuous-check","Fail-open success checks. Use when a script says OK but nothing happened, a probe batch returns a false negative or 0 results, or `String(got) === String(want)` passes on a type mismatch.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fvacuous-check\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M74JH59H7FJZW0VR6EXMHQJ5","stale-deploy","Use when asking \"is it live\", a deploy looks stale, or a poll loop exits instantly. Verify a GitHub Pages or CDN deploy serves new content: poll a marker new to this deploy.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fstale-deploy\u002FSKILL.md",[],[]]