testing-guide
БесплатноЗапускает вложенные скриптыНе проверенGenAI-first testing with structural assertions, congruence validation, and tier-based test structure. Use when writing tests, setting up test infrastructure…
Об этом скилле
Testing Guide
What to test, how to test it, and what NOT to test — for a plugin made of prompt files, Python glue, and configuration.
Philosophy: GenAI-First Testing
Traditional unit tests work for deterministic logic. But most bugs in this project are drift — docs diverge from code, agents contradict commands, component counts go stale. GenAI congruence tests catch these. Unit tests don't.
Decision rule: Can you write assert x == y and it won't break next week? → Unit test. Otherwise → GenAI test or structural test.
Three Test Patterns
1. Judge Pattern (single artifact evaluation)
An LLM evaluates one artifact against criteria. Use for: doc completeness, security posture, architectural intent.
pytestmark = [pytest.mark.genai]
def test_agents_documented_in_claude_md(self, genai):
agents_on_disk = list_agents()
claude_md = Path("CLAUDE.md").read_text()
result = genai.judge(
question="Does CLAUDE.md document all active agents?",
context=f"Agents on disk: {agents_on_disk}\nCLAUDE.md:\n{claude_md[:3000]}",
criteria="All active agents should be referenced. Score by coverage %."
)
assert result["score"] >= 5, f"Gap: {result['reasoning']}"
2. Congruence Pattern (two-source cross-reference)
The most valuable pattern. An LLM checks two files that should agree. Use for: command↔agent alignment, FORBIDDEN lists, config↔reality.
def test_implement_and_implementer_share_forbidden_list(self, genai):
implement = Path("commands/implement.md").read_text()
implementer = Path("agents/implementer.md").read_text()
result = genai.judge(
question="Do these files have matching FORBIDDEN behavior lists?",
context=f"implement.md:\n{implement[:5000]}\nimplementer.md:\n{implementer[:5000]}",
criteria="Both should define same enforcement gates. Score 10=identical, 0=contradictory."
)
assert result["score"] >= 5
Analytic Rubric Pattern (decomposed per-criterion evaluation)
More reliable than holistic scoring. Each criterion is evaluated independently with a binary MET/UNMET judgment. Use for: security posture, enforcement quality, multi-faceted assessments.
def test_security_posture_analytic(self, genai):
result = genai.judge_analytic(
question="Evaluate the security posture of this codebase",
context=f"Hook samples:\n{hook_content[:5000]}",
criteria=[
{"name": "No hardcoded secrets", "description": "No real API keys or tokens in source", "max_points": 1},
{"name": "Named exit codes", "description": "Hooks use named constants, not bare numbers", "max_points": 1},
{"name": "Path validation", "description": "File operations validate paths", "max_points": 1},
],
)
assert result["total_score"] >= 2, f"{result['total_score']}/{result['max_score']}: {result['reasoning']}"
Return value: {"criteria_results": [...], "total_score": N, "max_score": N, "pass": bool, "band": str, "reasoning": str}
When to use: Multi-faceted evaluations where you need to know which specific criteria passed or failed. Each criterion gets its own LLM call for independent judgment.
Consistency Check Pattern (multi-round agreement)
For high-stakes judgments where a single LLM evaluation might be unreliable. Runs multiple rounds and checks for agreement. Uses median score as the final result.
def test_pipeline_completeness_consistent(self, genai):
result = genai.judge_consistent(
question="Does implement.md define a complete SDLC pipeline?",
context=f"implement.md:\n{content[:6000]}",
criteria="Pipeline should have research, plan, test, implement, review, security, docs steps.",
rounds=3,
)
assert result["final_score"] >= 7, f"median={result['final_score']}, agreement={result['agreement']}"
Return value: {"rounds": [...], "agreement": bool, "scores": [...], "final_score": median, "pass": bool, "band": str, "reasoning": str}
When to use: Critical assessments where false positives/negatives are costly. Agreement=False signals the evaluation needs human review.
Temperature Guidance
All ask() calls default to temperature=0 for deterministic, reproducible judging. Override only when you need creative/diverse outputs:
# Default: temperature=0 (deterministic judging)
response = genai.ask("Evaluate this code", temperature=0)
# Override for creative tasks like edge case generation
response = genai.ask("Generate unusual test inputs", temperature=0.7)
3. Cross-Validation Pattern (two sources that must match)
No LLM needed. When two configs/files must stay in sync, read both and compare directly. Catches the #1 recurring bug class: adding something to one place but not the other.
def test_policy_and_hook_in_sync(self):
"""Policy always_allowed and hook NATIVE_TOOLS must be identical."""
poli
Установить testing-guide в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashВложенные файлы
FAQ
Что делает скилл testing-guide?
GenAI-first testing with structural assertions, congruence validation, and tier-based test structure. Use when writing tests, setting up test infrastructure, or validating coverage. TRIGGER when: test, pytest, coverage, TDD, test patterns, congruence, validation. DO NOT TRIGGER when: production code implementation, documentation, config-only changes.
Как установить скилл testing-guide?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing-guide запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic