From test-engineering
Detect and enforce correct test file locations per project and language conventions. Use when determining where to place generated test files based on project structure, build system configuration, and language-specific conventions.
npx claudepluginhub issacchaos/local-marketplace --plugin test-engineeringThis skill uses the workspace's default tool permissions.
**Version**: 1.0.0
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Version: 1.0.0 Category: Infrastructure Languages: All supported languages Purpose: Detect and enforce correct test file locations per project and language conventions
The Test Location Detection Skill ensures that generated tests are placed in the correct, runnable location according to project structure and language conventions. This prevents tests from being placed in temporary directories (.claude-tests/, .claude/) where they won't be discovered by test runners.
Key Principle: Tests MUST be placed where the project's test runner expects to find them, following established conventions.
Find project root markers:
pyproject.toml, setup.py, setup.cfg, pytest.ini, requirements.txtpackage.jsonpom.xml, build.gradle, build.gradle.kts*.csproj, *.slngo.modCargo.tomlGemfileCMakeLists.txt, MakefileUse git root as fallback:
.git directory locationValidate project root:
Check framework-specific configuration files for test path settings:
# pytest.ini
[pytest]
testpaths = tests
# pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests", "integration"]
// package.json or jest.config.js
{
"jest": {
"testMatch": ["**/__tests__/**/*.js", "**/?(*.)+(spec|test).js"]
}
}
<!-- pom.xml -->
<build>
<testSourceDirectory>src/test/java</testSourceDirectory>
</build>
// build.gradle
sourceSets {
test {
java.srcDirs = ['src/test/java']
}
}
ProjectName.Tests/{ProjectName}.Tests or {ProjectName}.UnitTestscalculator.go → calculator_test.go*_test.gotests/ directory for integration tests#[cfg(test)] modules# .rspec or spec/spec_helper.rb
RSpec.configure do |config|
config.pattern = 'spec/**/*_spec.rb'
end
Scan project for existing test directories:
Look for common test directories:
tests/, test/, spec/, __tests__/src/test/java/, ProjectName.Tests/Analyze existing test files:
test_*.py, *_test.go, *.spec.ts)Infer pattern from existing tests:
If no configuration or existing tests found, use language defaults:
Default: tests/ directory at project root, mirroring source structure
project/
├── src/
│ └── calculator.py
└── tests/
└── test_calculator.py
Alternative: Tests alongside source (less common)
project/
└── src/
├── calculator.py
└── test_calculator.py
Naming: test_*.py or *_test.py
Default: __tests__/ or tests/ directory
project/
├── src/
│ └── calculator.ts
└── __tests__/
└── calculator.test.ts
Alternative: Tests alongside source
project/
└── src/
├── calculator.ts
└── calculator.test.ts
Naming: *.test.ts, *.spec.ts, or __tests__/*.ts
Default: Separate test source directory
project/
├── src/
│ └── main/
│ └── java/
│ └── com/example/Calculator.java
└── src/
└── test/
└── java/
└── com/example/CalculatorTest.java
Naming: *Test.java or Test*.java
Default: Same as Maven
project/
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/example/Calculator.java
│ └── test/
│ └── java/
│ └── com/example/CalculatorTest.java
Naming: *Test.java or Test*.java
Default: Separate test project
solution/
├── Calculator/
│ └── Calculator.cs
└── Calculator.Tests/
└── CalculatorTests.cs
Naming: *Tests.cs or *Test.cs
Default: Tests alongside source with _test suffix
project/
└── calculator/
├── calculator.go
└── calculator_test.go
Naming: *_test.go
Default: tests/ directory at project root
project/
├── src/
│ └── calculator.cpp
└── tests/
└── test_calculator.cpp
Alternative: Tests integrated in CMake structure
project/
├── src/
│ └── calculator.cpp
└── test/
└── calculator_test.cpp
Naming: test_*.cpp, *_test.cpp, or framework-specific
Default: tests/ directory for integration tests
project/
├── src/
│ └── lib.rs
└── tests/
└── integration_test.rs
Unit tests: Within source files in #[cfg(test)] modules
Naming: Any name for integration tests, *_test.rs common
Default: spec/ directory for RSpec
project/
├── lib/
│ └── calculator.rb
└── spec/
└── calculator_spec.rb
Naming: *_spec.rb
Given source file path, determine test file path:
Algorithm:
1. Get project root
2. Get test directory from config or convention
3. Get source file relative path from source root
4. Apply naming convention
5. Construct full test path
Example (Python):
Project root: /home/user/myproject/
Source file: /home/user/myproject/src/utils/math.py
Test directory: tests/ (from pytest.ini)
Relative path: utils/math.py (relative to src/)
Test filename: test_math.py (convention)
Final path: /home/user/myproject/tests/utils/test_math.py
Path Construction Template:
{project_root}/{test_directory}/{relative_directory}/{test_filename}
Before creating test file, validate:
tests/, spec/, src/test/java/).claude-tests/ - Temporary directory, not discoverable.claude/ - Configuration directory, not for tests.git/ - Version control directory/tmp/, C:\Temp\)If invalid location detected: Stop and raise error with recommendation.
Error: Cannot determine project root
Recommendation: Ensure source file is within a recognized project structure
Warning: No test directory found in configuration
Action: Use language default convention (e.g., tests/ for Python)
Error: Constructed test path is invalid: .claude-tests/test_foo.py
Recommendation: Review project structure and framework configuration
Error: Source file is outside project boundaries
Recommendation: Ensure source file is within project root
The Write Agent MUST:
.claude-tests/Workflow:
Write Agent receives: source_file = "src/calculator.py"
1. Call Test Location Detection Skill
Input: source_file, project_root, language, framework
Output: test_path = "tests/test_calculator.py"
2. Validate test_path is not in forbidden locations
If test_path contains ".claude-tests/" → ERROR
3. Create parent directories if needed
mkdir -p tests/
4. Generate test file at test_path
Write to: tests/test_calculator.py
Input:
/home/user/myproject/src/calculator.py/home/user/myproject/pythonpytestpytest.ini with testpaths = testsOutput:
/home/user/myproject/tests/test_calculator.pyInput:
/home/user/myproject/calculator/calculator.go/home/user/myproject/gogo testOutput:
/home/user/myproject/calculator/calculator_test.goInput:
/home/user/myproject/src/main/java/com/example/Calculator.java/home/user/myproject/javajunitpom.xml with standard Maven structureOutput:
/home/user/myproject/src/test/java/com/example/CalculatorTest.javaInput:
/home/user/myproject/src/calculator.py/home/user/myproject/.claude-tests/test_calculator.pyOutput:
For detailed conventions, see language-specific documentation:
Validate with sample projects:
pytest.iniExpected outcomes:
Last Updated: 2025-12-08 Status: Phase 1 - Python support implemented