skills-catalog/ln-637-test-structure-auditor/SKILL.md
Checks test file organization, directory layout, test-to-source mapping, domain grouping, co-location. Use when auditing test structure.
npx skillsauth add levnikolaevich/claude-code-skills ln-637-test-structure-auditorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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}.
Type: L3 Worker
Specialized worker auditing test file organization and directory structure for maintainability as the test suite grows.
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
Receives contextStore with: tech_stack, testFilesMetadata (ALL types -- both automated and manual), codebase_root, output_dir, domain_mode, all_domains.
Note: Unlike other workers that receive type-filtered metadata, this worker receives ALL test files because directory structure analysis requires the full picture of where both automated and manual tests are placed.
MANDATORY READ: Load shared/references/two_layer_detection.md for detection methodology.
src/, app/, lib/) to build source domain/module treeshared/templates/audit_worker_report_template.md, write to {output_dir}/ln-637--global.md in single Write callWhat: Detect which test organization pattern the project uses and check for unintentional mixing
Detection:
src/users/users.test.ts)tests/users/users.test.ts mirrors src/users/)tests/ or __tests__/)tests/manual/ (informational, not flagged)Layer 2:
tests/automated/integration/). Check if deviation correlates with test typeSeverity: MEDIUM if hybrid without clear type-based rule (>30% of same-type tests deviate from dominant pattern)
Recommendation: Standardize test placement -- choose one pattern per test type and document in testing guidelines
Effort: L
What: Detect orphaned test files (source file deleted but test remains) and mismatched paths
Detection:
users.test.ts -> users.ts or users/index.tstest_payments.py -> payments.pyLayer 2:
test_utils.ts, test_helpers.py)Severity: MEDIUM for orphaned tests (dead code), LOW for path mismatches
Recommendation: Delete orphaned tests or update to match current source structure
Effort: S
What: Detect test directories with excessive file count that would benefit from subdirectory grouping
Detection:
node_modules, dist, build)test_auth_*.py -> auth/ subdirectory)Layer 2:
tests/manual/ (manual test structure has separate conventions)Severity: MEDIUM (>20 files), LOW (15-20 files)
Recommendation: Group tests into subdirectories by domain/feature. Suggest specific grouping based on file name analysis:
# Before (flat):
tests/test_auth_login.py, tests/test_auth_tokens.py, tests/test_users_crud.py, ...
# After (grouped):
tests/auth/test_login.py, tests/auth/test_tokens.py, tests/users/test_crud.py, ...
Effort: M
What: Check whether test directory grouping mirrors source domain structure
Detection:
all_domains or scanned src/) with test directory namestests/{domain}/ directory existssrc/{domain}/Layer 2:
domain_mode="global" or <2 source domains)Severity: MEDIUM for domains with >5 source files but no test group, LOW otherwise
Recommendation: Create test directory/group for domain to maintain structural alignment
Effort: M
What: Detect which co-location pattern the project uses and flag inconsistencies
Detection:
Layer 2:
Severity: MEDIUM if >20% of same-type tests deviate from dominant placement pattern
Recommendation: Consolidate test placement -- move deviating tests to follow the project's dominant pattern
Effort: M-L
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/references/audit_scoring.md.
Severity mapping:
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/templates/audit_worker_report_template.md.
Write JSON summary per shared/references/audit_summary_contract.md. In managed mode the caller passes both runId and summaryArtifactPath; in standalone mode the worker generates its own run-scoped artifact path per shared contract.
Write report to {output_dir}/ln-637--global.md with category: "Test Structure" and checks: layout_pattern, test_source_mapping, flat_dir_growth, domain_grouping, colocation_consistency.
Return summary per shared/references/audit_summary_contract.md.
When summaryArtifactPath is absent, write the standalone runtime summary under .hex-skills/runtime-artifacts/runs/{run_id}/evaluation-worker/{worker}--{identifier}.json and optionally echo the same summary in structured output.
Report written: .hex-skills/runtime-artifacts/runs/{run_id}/audit-report/ln-637--global.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
.test. vs .spec.) is out of scope -- do not duplicateMANDATORY READ: Load shared/references/audit_worker_core_contract.md.
{output_dir}/ln-637--global.md (atomic single Write call)Version: 1.0.0 Last Updated: 2026-03-15
testing
Audits architecture config boundaries: typed settings, scattered env reads, config leakage, and layer ownership. Use for config architecture.
tools
Finds architecture-level modernization opportunities: obsolete custom mechanisms, overbuilt extension points, and simplifiable architecture. Use when auditing architecture evolution.
development
Builds dependency topology, detects cycles, validates import rules, and calculates coupling metrics. Use when auditing architecture topology.
testing
Checks layer, resource ownership, and orchestration boundaries. Use when auditing architecture boundary enforcement.