Help us improve
Share bugs, ideas, or general feedback.
From cms-cultivator
Generates test scaffolding for untested PHP and JavaScript code. Supports unit, integration, e2e, and data tests with framework-specific guidance (PHPUnit, Jest, Cypress).
npx claudepluginhub kanopi/claude-toolbox --plugin cms-cultivatorHow this skill is triggered — by the user, by Claude, or both
Slash command
/cms-cultivator:test-scaffoldingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automatically generate test scaffolding for untested code.
Writes TDD tests supporting Jest, Cypress, Detox, PHPUnit, PyTest, and Go testing. Adds unit, integration, E2E tests to improve coverage on existing code.
Generates test suites with unit, integration, and e2e tests, proper mocking strategies, and edge case coverage. Works with any language/framework.
Generates tests for TypeScript, React, Vue, Python, Go, Rust, PHP via framework detection (Jest/Vitest/Pytest/Go test/Cargo test) and expert agent routing. Auto-creates verification tasks.
Share bugs, ideas, or general feedback.
Automatically generate test scaffolding for untested code.
Good tests are an investment, not a cost.
/test-generate command): Full project test coverage with test plansThis skill provides rapid test scaffolding. For complete coverage, use comprehensive test generation + manual refinement.
Activate this skill when the user:
Before generating test scaffolding, determine:
PHP (Drupal/WordPress):
JavaScript:
Unit tests (highest priority):
Don't test (waste of time):
Mock/stub:
Don't mock:
Critical code (90%+ coverage target):
Standard code (70-80% coverage target):
Low priority (minimal coverage ok):
AAA pattern (standard):
Test name convention:
test_methodName_scenario_expectedBehavior()test_calculateTotal_withDiscount_returnsReducedPrice()User requests tests for code
↓
Analyze code type (function/class/endpoint/UI)
↓
Determine test type (unit/integration/e2e)
↓
Identify framework (PHPUnit/Jest/Cypress)
↓
Determine what to test (happy/edge/error)
↓
Identify dependencies to mock
↓
Generate test scaffolding with descriptive names
↓
Include AAA structure comments
Identify:
Unit Tests - For isolated logic:
Integration Tests - For component interaction:
E2E Tests - For user workflows:
Complete test templates are available for reference:
Use these templates as starting points, adapting for the specific code being tested.
Generate basic test structure first:
For each public method:
Identify what needs mocking:
Check:
When user shows a class with 2-3 methods:
Example Response:
"I'll generate PHPUnit tests for your UserManager class.
I see 3 public methods:
- getUser() - retrieves user data
- createUser() - creates new user
- deleteUser() - removes user
I'll create:
- Unit tests for getUser() (no database needed)
- Integration tests for createUser() and deleteUser() (require database)
[Generates test file with 6-8 test methods covering happy paths,
error cases, and edge cases]
This gives you ~80% coverage to start."
When user shows WordPress function using WP APIs:
Example Response:
"For WordPress functions using WP_Query, you'll want an integration test.
I'll generate a WP_UnitTestCase test that:
1. Creates test posts using the factory
2. Calls your function
3. Verifies the query results
4. Cleans up automatically in tearDown()
[Generates test code]
The test uses wp_insert_post() to create test data."
When user shows Drupal service with dependencies:
Example Response:
"I'll generate unit tests for your DataProcessor service.
I see it depends on:
- EntityTypeManagerInterface
- LoggerInterface
I'll:
1. Create mocks for these dependencies
2. Test each public method in isolation
3. Verify interactions with dependencies
4. Add @covers annotations for coverage tracking
[Generates test file with mocked dependencies]
This keeps tests fast by avoiding database calls."
When user shows JS function or React component:
This skill complements the /test-generate slash command:
This Skill: Automatically triggered during conversation
/test-generate Command: Explicit batch generation
testCreateUserWithValidData() not testCreateUser())Example 1: Simple class
User: "I wrote this UserManager class, need tests"
[Shows class with 3 methods]
Skill: "I'll generate PHPUnit tests for your UserManager class.
I see 3 public methods: createUser(), getUser(), deleteUser().
I'll create tests for the happy path and error cases for each.
[Generates test file]
This gives you 80% coverage to start. You may want to add edge case
tests for boundary conditions."
Example 2: WordPress function
User: "How do I test this WordPress function?"
[Shows custom function that uses WP_Query]
Skill: "For WordPress functions using WP_Query, you'll want an
integration test. I'll generate a WP_UnitTestCase test that:
1. Creates test posts using the factory
2. Calls your function
3. Verifies the query results
[Generates test code]
The test uses wp_insert_post() to create test data, then cleans up
automatically in tearDown()."
Example 3: React component
User: "Need tests for this React component"
[Shows UserProfile component]
Skill: "I'll create React Testing Library tests for your UserProfile component.
I see it:
- Displays user data from props
- Has edit button that calls onEdit callback
- Shows loading state
I'll generate tests for:
1. Rendering with user data
2. Clicking edit button
3. Loading state display
[Generates test file using React Testing Library]
These tests verify the component behavior from a user perspective."
Don't. Test public interface instead. If private method needs testing, consider extracting to separate class.
// Avoid static methods when possible
// If you must, test directly
$result = MyClass::staticMethod($input);
$this->assertEquals($expected, $result);
// Use transactions for rollback
protected function setUp(): void {
parent::setUp();
$this->database->beginTransaction();
}
protected function tearDown(): void {
$this->database->rollbackTransaction();
parent::tearDown();
}
it('fetches user data', async () => {
const user = await fetchUser(123);
expect(user.name).toBe('John Doe');
});
// Or with promises
it('fetches user data', () => {
return fetchUser(123).then(user => {
expect(user.name).toBe('John Doe');
});
});
Drupal\Tests\mymodule\Unittest_method_name()$this->assertIsArray()