用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/lukemcqueen/hermes-cortex --skill hermetic-python-testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Cross-server agent health monitoring using binary status vectors — deploy health endpoints on each agent, poll from orchestrator, alert on state transitions.
Wire a self-hosted Langfuse instance to Hermes Agent — generate API keys, configure env vars, enable the bundled plugin, install SDK, and verify traces flow.
Use before enforcement code changes or shared-repo commits.
正在显示 SKILL.md
| name | hermetic-python-testing |
| description | Write Python modules with hermetic unit-test seams. |
| version | 1.0.0 |
| category | software-development |
| author | Hermes Cortex |
| license | MIT |
| platforms | ["linux","macos"] |
| metadata | {"hermes":{"tags":["testing","python","isolation","hermetic","unit-test","seams"],"related_skills":["test-driven-development","codebase-design","survey-before-action"]}} |
Write Python modules so their unit tests never touch real state, real
credentials, or real network — and prove it. Born from telegram_notify S2
(2026-08-08): tests silently wrote to ~/.hermes-cortex/state/ and read the
real ~/.hermes/.env until the module was restructured.
# ❌ BAD — frozen at import; tests setting the env var after import hit REAL paths
STATE_FILE = Path(os.environ.get("MY_STATE_DIR", Path.home() / ".x")) / "state.json"
# ✅ GOOD — resolved per call; tests point it at tmp_path via monkeypatch.setenv
def _state_file() -> Path:
return Path(os.environ.get("MY_STATE_DIR", Path.home() / ".x")) / "state.json"
Import-time constants freeze the path for the whole process. Tests that set
env vars AFTER import (the standard monkeypatch.setenv pattern) silently
read/write the real location. Symptom to watch for: a module's real log file
or state JSON appears in ~/.hermes-cortex/state/ after a test run.
def _now() -> float: return time.time()
def _sleep(s: float) -> None: time.sleep(s)
def _send_once(token, chat_id, text): ... # the network boundary
Tests patch these module attributes:
with patch.object(tn, "_now", side_effect=fake_now), \
patch.object(tn, "_send_once", side_effect=fake_send):
...
This tests coalescing windows, retry budgets, and backoff with a fake clock and zero network.
Every test that exercises the module gets its own tmp state dir and a fake env file:
def _setup(tmp_path, monkeypatch, chat="111222333", quiet="", mute=""):
state_dir = tmp_path / "state"; state_dir.mkdir(exist_ok=True)
env_file = tmp_path / "env"
env_file.write_text(f"TELEGRAM_BOT_TOKEN=123456:TESTTOKEN\nTELEGRAM_HOME_CHANNEL={chat}\n")
monkeypatch.setenv("MY_STATE_DIR", str(state_dir))
monkeypatch.setenv("MY_ENV_FILE", str(env_file))
return state_dir, env_file
After the suite is green, confirm no real resources were touched:
/home/<user>/ paths) — placeholder values onlypytest tests/test_<module>_unit.py -q → all passgrep -nE "<real-chat-id>|<real-host>|/home/<user>/" tests/ → no hits111222333)
looks like an arbitrary integer and sails through the secret-leak detector;
the scanner only flags /home/<user>/ paths and emails. Use placeholders
(111222333) and grep for the real id before committing.if __name__ == "__main__" self-test should also go
through the same seams, or it will hit real resources when run manually.