ln-630-test-auditor by levnikolaevich/claude-code-skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-630-test-auditorPaths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
协调跨 8 个质量类别的全面测试套件审计,使用 7 个专业工作者。发现自动化测试 (*.test.*, *.spec.*) 和手动测试 (tests/manual/**/*.sh)。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
docs/project/test_audit.md(基于文件,不创建任务)"编写测试。不要太多。主要是集成测试。" — Kent Beck "基于风险而非覆盖率进行测试。" — ISO 29119
关键原则:
输入: 代码库根目录
操作:
**/*.test.* (Jest, Vitest)**/*.spec.* (Mocha, Jasmine)**/__tests__/**/* (Jest 约定)tests/manual/**/*.sh (手动 bash 测试脚本)type: "automated"|"manual"has_expected_dir(同级目录 expected/ 是否存在)、suite_dir、harness_sourced(是否引用了 test_harness.sh)hex-graph MCP 服务器可用:
index_project(path=codebase_root) — 构建/刷新代码图graph_indexed: true 到 contextStore(ln-634 使用 find_hotspots 进行关键路径识别)输出: testFilesMetadata — 包含基本统计信息和 type 字段的测试文件列表
目标: 一次性收集测试最佳实践上下文,与所有工作者共享
操作:
contextStore,包含:
将 output_dir 添加到 contextStore:
{
"output_dir": "docs/project/.audit/ln-630/{YYYY-MM-DD}"
}
输出: contextStore — 所有工作者共享的上下文
关键优势: 上下文一次性收集 → 传递给所有工作者 → 令牌高效
mkdir -p {output_dir} # 工作者文件在合并后清理(阶段 7)
必须阅读: 加载 shared/references/audit_coordinator_domain_mode.md。
使用共享模式检测 domain_mode 和 all_domains。此协调器保留一条本地规则:共享文件夹在覆盖率分析中保持可见,但不增加业务领域覆盖率百分比。
必须阅读: 加载 shared/references/task_delegation_pattern.md 和 shared/references/audit_worker_core_contract.md。
全局工作者扫描整个测试套件(不感知领域):
---|---|---|---
1 | ln-631-test-business-logic-auditor | 业务逻辑焦点 | 框架/库测试(Prisma, Express, bcrypt, JWT, axios, React hooks)→ 移除
2 | ln-632-test-e2e-priority-auditor | 端到端优先级 | 端到端基线(2/端点),金字塔验证,缺失的端到端测试
3 | ln-633-test-value-auditor | 基于风险的价值 | 有用性分数 = 影响 × 概率决策:≥15 保留,10-14 审查,<10 移除
5 | ln-635-test-isolation-auditor | 隔离 + 反模式 | 隔离(6 个类别),确定性,反模式(7 种类型)
6 | ln-636-manual-test-auditor | 手动测试质量 | 测试框架采用,黄金文件,快速失败,配置源,模板合规性,幂等性
7 | ln-637-test-structure-auditor | 测试结构 | 目录布局,测试到源码的映射,扁平目录增长信号,共置一致性
按类型过滤的委托: 协调器在传递给工作者之前按 type 拆分 testFilesMetadata:
testFilesMetadata.filter(f => f.type == "automated")testFilesMetadata.filter(f => f.type == "manual")testFilesMetadata(两种类型 — 结构分析需要完整视图)调用(6 个工作者并行):
// filteredByType: ln-631..635 为自动化测试,ln-636 为手动测试,ln-637 为所有测试
FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635, ln-636, ln-637]:
Agent(description: "Test audit via " + worker,
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"" + worker + "\")
CONTEXT:
" + JSON.stringify({...contextStore, testFilesMetadata: filteredByType}),
subagent_type: "general-purpose")
领域感知工作者每个领域运行一次:
---|---|---|---
4 | ln-634-test-coverage-auditor | 覆盖率缺口 | 每个领域关键路径的缺失测试(资金 20+, 安全 20+, 数据 15+, 核心流程 15+)
调用:
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
Agent(description: "Test coverage " + domain.name + " via ln-634",
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"ln-634-test-coverage-auditor\")
CONTEXT:
" + JSON.stringify(domain_context),
subagent_type: "general-purpose")
ELSE:
// 回退:为整个代码库调用一次(全局模式)
Agent(description: "Test coverage via ln-634",
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"ln-634-test-coverage-auditor\")
CONTEXT:
" + JSON.stringify(contextStore),
subagent_type: "general-purpose")
并行策略:
领域感知工作者添加可选字段:domain, scan_path
必须阅读: 加载 shared/references/audit_coordinator_aggregation.md 和 shared/references/context_validation.md。
使用共享的聚合模式进行输出目录检查、返回值解析、严重性汇总、文件读取和最终报告组装。
此协调器的本地规则:
domain_mode="domain-aware" 时按领域分组。上下文验证(后过滤):
对合并的发现应用规则 1, 5 和测试特定过滤器:
FOR EACH finding WHERE severity IN (HIGH, MEDIUM):
# Rule 1: ADR/Planned Override
IF finding matches ADR → advisory "[Planned: ADR-XXX]"
# Rule 5: Locality/Single-Consumer
IF "extract shared helper" suggestion AND consumer_count == 1 → advisory
# Test-specific: Custom wrapper detection
IF "framework test" finding (ln-631) AND test imports custom wrapper class:
→ advisory (tests custom logic, not framework)
# Test-specific: Setup/fixture code
IF "The Liar" finding (ln-635) AND file is conftest/fixture/setup:
→ advisory (setup code, no assertions expected)
# Test-specific: Parameterized test
IF "The Giant" finding (ln-635) AND test is parameterized/data-driven:
→ severity -= 1 (size from data, not complexity)
Downgraded findings → "Advisory Findings" section in report.
Recalculate scores excluding advisory findings from penalty.
豁免: 覆盖率缺口 CRITICAL 发现(ln-634),风险价值分数(ln-633)。
## 测试套件审计报告 - [DATE]
### 执行摘要
[2-3 句话:测试套件健康状况、主要问题、关键建议]
### 严重性摘要
| 严重性 | 数量 |
|----------|-------|
| 严重 | X |
| 高 | X |
| 中 | X |
| 低 | X |
| **总计** | **X** |
### 合规性分数
| 类别 | 分数 | 备注 |
|----------|-------|-------|
| 业务逻辑焦点 | X/10 | 发现 X 个框架测试 |
| 端到端关键覆盖率 | X/10 | 缺少 X 个关键路径的端到端测试 |
| 基于风险的价值 | X/10 | X 个低价值测试 |
| 覆盖率缺口 | X/10 | X 个未测试的关键路径 |
| 隔离与反模式 | X/10 | X 个隔离 + 反模式问题 |
| 手动测试质量 | X/10 | X 个手动测试质量问题 |
| 测试结构 | X/10 | X 个布局/组织问题 |
| **总体** | **X/10** | 7 个类别的平均值 |
### 领域覆盖率摘要(新增 - 如果 domain_mode="domain-aware")
| 领域 | 关键路径 | 已测试 | 覆盖率 % | 缺口 |
|--------|---------------|--------|------------|------|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| payments | 6 | 5 | 83% | 1 |
| **总计** | **26** | **19** | **73%** | **7** |
### 审计发现
| 严重性 | 位置 | 问题 | 原则 | 建议 | 工作量 |
|----------|----------|-------|-----------|----------------|--------|
| **严重** | routes/payment.ts:45 | 支付处理缺少端到端测试(优先级 25) | 端到端关键覆盖率 / 资金流 | 添加端到端测试:成功支付 + 折扣边缘情况 | M |
| **高** | auth.test.ts:45-52 | 测试 'bcrypt hashes password' 验证库行为 | 业务逻辑焦点 / 加密测试 | 删除 — bcrypt 已由维护者测试 | S |
| **高** | db.test.ts:78-85 | 测试 'Prisma findMany returns array' 验证 ORM | 业务逻辑焦点 / ORM 测试 | 删除 — Prisma 已测试 | S |
| **高** | user.test.ts:45 | 反模式 'The Liar' — 无断言 | 反模式 / The Liar | 添加特定断言或删除测试 | S |
| **中** | utils.test.ts:23-27 | 测试 'validateEmail' 有用性分数为 4 | 基于风险的价值 / 低优先级 | 删除 — 可能已被端到端注册测试覆盖 | S |
| **中** | order.test.ts:200-350 | 反模式 'The Giant' — 150 行 | 反模式 / The Giant | 拆分为专注的测试 | M |
| **低** | payment.test.ts | 反模式 'Happy Path Only' — 无错误测试 | 反模式 / Happy Path | 添加负面测试 | M |
### 按领域划分的覆盖率缺口(如果 domain_mode="domain-aware")
#### 领域:users (src/users/)
| 严重性 | 类别 | 缺失的测试 | 位置 | 优先级 | 工作量 |
|----------|----------|--------------|----------|----------|--------|
| 严重 | 资金 | 端到端:processRefund() | services/user.ts:120 | 20 | M |
| 高 | 安全 | 单元:validatePermissions() | middleware/auth.ts:45 | 18 | S |
#### 领域:orders (src/orders/)
| 严重性 | 类别 | 缺失的测试 | 位置 | 优先级 | 工作量 |
|----------|----------|--------------|----------|----------|--------|
| 严重 | 资金 | 端到端:applyDiscount() | services/order.ts:45 | 25 | M |
| 高 | 数据 | 集成:orderTransaction() | repositories/order.ts:78 | 16 | M |
每个工作者:
contextStoretestFilesMetadata(标记有 type: "automated"|"manual")令牌效率:
必须阅读: 加载 shared/references/results_log_pattern.md
向 docs/project/.audit/results_log.md 追加一行,包含:Skill=ln-630, Metric=overall_score, Scale=0-10, 来自阶段 5 聚合的分数。计算与上一个 ln-630 行的差值。如果文件缺失则创建并添加表头。滚动窗口:最多 50 条记录。
rm -rf {output_dir}
删除带日期的输出目录 (docs/project/.audit/ln-630/{YYYY-MM-DD}/)。合并的报告和结果日志已经保存了所有审计数据。
type: "manual"docs/project/test_audit.mddocs/project/.audit/results_log.md必须阅读: 加载 shared/references/meta_analysis_protocol.md
技能类型:review-coordinator(仅工作者)。在所有阶段完成后运行。使用 review-coordinator — workers only 格式输出到聊天。
shared/references/orchestrator_pattern.mdshared/references/risk_based_testing_guide.mdshared/references/task_delegation_pattern.mdshared/references/audit_coordinator_domain_mode.mdshared/references/audit_coordinator_aggregation.mdshared/references/research_tool_fallback.md工作者:
参考:
版本: 4.0.0 最后更新: 2025-12-23
每周安装
166
仓库
GitHub 星标
253
首次出现
Jan 24, 2026
安全审计
安装于
claude-code153
cursor149
codex148
opencode147
gemini-cli147
github-copilot142
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Coordinates comprehensive test suite audit across 8 quality categories using 7 specialized workers. Discovers both automated tests (*.test.*, *.spec.*) and manual tests (tests/manual/**/*.sh).
docs/project/test_audit.md (file-based, no task creation)"Write tests. Not too many. Mostly integration." — Kent Beck "Test based on risk, not coverage." — ISO 29119
Key Principles:
Inputs: Codebase root directory
Actions:
**/*.test.* (Jest, Vitest)**/*.spec.* (Mocha, Jasmine)**/__tests__/**/* (Jest convention)tests/manual/**/*.sh (manual bash test scripts)type: "automated"|"manual"has_expected_dir (sibling expected/ exists), suite_dir, harness_sourced (sources test_harness.sh)Output: testFilesMetadata — list of test files with basic stats and type field
Goal: Gather testing best practices context ONCE, share with all workers
Actions:
contextStore with:
Add output_dir to contextStore:
{
"output_dir": "docs/project/.audit/ln-630/{YYYY-MM-DD}"
}
Output: contextStore — shared context for all workers
Key Benefit: Context gathered ONCE → passed to all workers → token-efficient
mkdir -p {output_dir} # Worker files cleaned up after consolidation (Phase 7)
MANDATORY READ: Load shared/references/audit_coordinator_domain_mode.md.
Detect domain_mode and all_domains with the shared pattern. This coordinator keeps one local rule: shared folders remain visible in coverage analysis, but do not inflate business-domain coverage percentages.
MANDATORY READ: Load shared/references/task_delegation_pattern.md and shared/references/audit_worker_core_contract.md.
Global workers scan entire test suite (not domain-aware):
---|---|---|---
1 | ln-631-test-business-logic-auditor | Business Logic Focus | Framework/Library tests (Prisma, Express, bcrypt, JWT, axios, React hooks) → REMOVE
2 | ln-632-test-e2e-priority-auditor | E2E Priority | E2E baseline (2/endpoint), Pyramid validation, Missing E2E tests
3 | ln-633-test-value-auditor | Risk-Based Value | Usefulness Score = Impact × ProbabilityDecisions: ≥15 KEEP, 10-14 REVIEW, <10 REMOVE
5 | ln-635-test-isolation-auditor | Isolation + Anti-Patterns | Isolation (6 categories), Determinism, Anti-Patterns (7 types)
6 | ln-636-manual-test-auditor | Manual Test Quality | Harness adoption, golden files, fail-fast, config sourcing, template compliance, idempotency
7 | ln-637-test-structure-auditor | Test Structure | Directory layout, test-to-source mapping, flat directory growth signals, co-location consistency
Type-filtered delegation: Coordinator splits testFilesMetadata by type before passing to workers:
testFilesMetadata.filter(f => f.type == "automated") onlytestFilesMetadata.filter(f => f.type == "manual") onlytestFilesMetadata (both types — structure analysis requires full picture)Invocation (6 workers in PARALLEL):
// filteredByType: automated for ln-631..635, manual for ln-636, ALL for ln-637
FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635, ln-636, ln-637]:
Agent(description: "Test audit via " + worker,
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"" + worker + "\")
CONTEXT:
" + JSON.stringify({...contextStore, testFilesMetadata: filteredByType}),
subagent_type: "general-purpose")
Domain-aware worker runs once per domain:
---|---|---|---
4 | ln-634-test-coverage-auditor | Coverage Gaps | Missing tests for critical paths per domain (Money 20+, Security 20+, Data 15+, Core Flows 15+)
Invocation:
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
Agent(description: "Test coverage " + domain.name + " via ln-634",
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"ln-634-test-coverage-auditor\")
CONTEXT:
" + JSON.stringify(domain_context),
subagent_type: "general-purpose")
ELSE:
// Fallback: invoke once for entire codebase (global mode)
Agent(description: "Test coverage via ln-634",
prompt: "Execute audit worker.
Step 1: Invoke worker:
Skill(skill: \"ln-634-test-coverage-auditor\")
CONTEXT:
" + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Parallelism strategy:
Domain-aware workers add optional fields: domain, scan_path
MANDATORY READ: Load shared/references/audit_coordinator_aggregation.md and shared/references/context_validation.md.
Use the shared aggregation pattern for output directory checks, return-value parsing, severity rollups, file reads, and final report assembly.
Local rules for this coordinator:
domain_mode="domain-aware".Context Validation (Post-Filter):
Apply Rules 1, 5 + test-specific filters to merged findings:
FOR EACH finding WHERE severity IN (HIGH, MEDIUM):
# Rule 1: ADR/Planned Override
IF finding matches ADR → advisory "[Planned: ADR-XXX]"
# Rule 5: Locality/Single-Consumer
IF "extract shared helper" suggestion AND consumer_count == 1 → advisory
# Test-specific: Custom wrapper detection
IF "framework test" finding (ln-631) AND test imports custom wrapper class:
→ advisory (tests custom logic, not framework)
# Test-specific: Setup/fixture code
IF "The Liar" finding (ln-635) AND file is conftest/fixture/setup:
→ advisory (setup code, no assertions expected)
# Test-specific: Parameterized test
IF "The Giant" finding (ln-635) AND test is parameterized/data-driven:
→ severity -= 1 (size from data, not complexity)
Downgraded findings → "Advisory Findings" section in report.
Recalculate scores excluding advisory findings from penalty.
Exempt: Coverage gap CRITICAL findings (ln-634), risk-value scores (ln-633).
## Test Suite Audit Report - [DATE]
### Executive Summary
[2-3 sentences: test suite health, major issues, key recommendations]
### Severity Summary
| Severity | Count |
|----------|-------|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |
| **Total** | **X** |
### Compliance Score
| Category | Score | Notes |
|----------|-------|-------|
| Business Logic Focus | X/10 | X framework tests found |
| E2E Critical Coverage | X/10 | X critical paths missing E2E |
| Risk-Based Value | X/10 | X low-value tests |
| Coverage Gaps | X/10 | X critical paths untested |
| Isolation & Anti-Patterns | X/10 | X isolation + anti-pattern issues |
| Manual Test Quality | X/10 | X manual test quality issues |
| Test Structure | X/10 | X layout/organization issues |
| **Overall** | **X/10** | Average of 7 categories |
### Domain Coverage Summary (NEW - if domain_mode="domain-aware")
| Domain | Critical Paths | Tested | Coverage % | Gaps |
|--------|---------------|--------|------------|------|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| payments | 6 | 5 | 83% | 1 |
| **Total** | **26** | **19** | **73%** | **7** |
### Audit Findings
| Severity | Location | Issue | Principle | Recommendation | Effort |
|----------|----------|-------|-----------|----------------|--------|
| **CRITICAL** | routes/payment.ts:45 | Missing E2E for payment processing (Priority 25) | E2E Critical Coverage / Money Flow | Add E2E: successful payment + discount edge cases | M |
| **HIGH** | auth.test.ts:45-52 | Test 'bcrypt hashes password' validates library behavior | Business Logic Focus / Crypto Testing | Delete — bcrypt already tested by maintainers | S |
| **HIGH** | db.test.ts:78-85 | Test 'Prisma findMany returns array' validates ORM | Business Logic Focus / ORM Testing | Delete — Prisma already tested | S |
| **HIGH** | user.test.ts:45 | Anti-pattern 'The Liar' — no assertions | Anti-Patterns / The Liar | Add specific assertions or delete test | S |
| **MEDIUM** | utils.test.ts:23-27 | Test 'validateEmail' has Usefulness Score 4 | Risk-Based Value / Low Priority | Delete — likely covered by E2E registration | S |
| **MEDIUM** | order.test.ts:200-350 | Anti-pattern 'The Giant' — 150 lines | Anti-Patterns / The Giant | Split into focused tests | M |
| **LOW** | payment.test.ts | Anti-pattern 'Happy Path Only' — no error tests | Anti-Patterns / Happy Path | Add negative tests | M |
### Coverage Gaps by Domain (if domain_mode="domain-aware")
#### Domain: users (src/users/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|----------|----------|--------------|----------|----------|--------|
| CRITICAL | Money | E2E: processRefund() | services/user.ts:120 | 20 | M |
| HIGH | Security | Unit: validatePermissions() | middleware/auth.ts:45 | 18 | S |
#### Domain: orders (src/orders/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|----------|----------|--------------|----------|----------|--------|
| CRITICAL | Money | E2E: applyDiscount() | services/order.ts:45 | 25 | M |
| HIGH | Data | Integration: orderTransaction() | repositories/order.ts:78 | 16 | M |
Each worker:
contextStore with testing best practicestestFilesMetadata with test file list (tagged with type: "automated"|"manual")Token Efficiency:
MANDATORY READ: Load shared/references/results_log_pattern.md
Append one row to docs/project/.audit/results_log.md with: Skill=ln-630, Metric=overall_score, Scale=0-10, Score from Phase 5 aggregation. Calculate Delta vs previous ln-630 row. Create file with header if missing. Rolling window: max 50 entries.
rm -rf {output_dir}
Delete the dated output directory (docs/project/.audit/ln-630/{YYYY-MM-DD}/). The consolidated report and results log already preserve all audit data.
type: "manual" in testFilesMetadatadocs/project/test_audit.mddocs/project/.audit/results_log.mdMANDATORY READ: Load shared/references/meta_analysis_protocol.md
Skill type: review-coordinator (workers only). Run after all phases complete. Output to chat using the review-coordinator — workers only format.
shared/references/orchestrator_pattern.mdshared/references/risk_based_testing_guide.mdshared/references/task_delegation_pattern.mdshared/references/audit_coordinator_domain_mode.mdshared/references/audit_coordinator_aggregation.mdshared/references/research_tool_fallback.mdWorkers:
Reference:
Version: 4.0.0 Last Updated: 2025-12-23
Weekly Installs
166
Repository
GitHub Stars
253
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code153
cursor149
codex148
opencode147
gemini-cli147
github-copilot142
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
33,600 周安装
hex-graph MCP server is available:
index_project(path=codebase_root) — builds/refreshes code graphgraph_indexed: true to contextStore for workers (ln-634 uses find_hotspots for critical path identification)