skills/test-scaffolding/SKILL.md
Automatically generate test scaffolding when user writes new code without tests or mentions needing tests. Supports unit, integration, e2e, and data tests for PHP and JavaScript. Invoke when user mentions "tests", "testing", "coverage", "write tests", or shows new untested code.
npx skillsauth add kanopi/cms-cultivator test-scaffoldingInstall 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.
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()tools
Strategist-focused site audit for discovery and pre-discovery. Given a site URL and optional qualitative research data, navigates the site via CoWork, audits against all 21 UX Laws from lawsofux.com, reviews content hierarchy, synthesises qualitative data, runs Lighthouse, and produces two deliverables — a Project Knowledge Summary (Markdown for Claude Desktop Projects) and a polished, iterable HTML Artifact for client sharing. Use when a strategist, UX lead, or PM asks for a discovery audit, UX laws audit, content hierarchy review, pre-discovery site review, "audit this site for strategy", "strategist audit", "UX audit", or pastes a site URL with discovery context. Not for developer audits — use accessibility-audit, performance-audit, or live-site-audit for those.
development
Provide story point estimation guidance with hour calculations for software development tasks. Uses Fibonacci sequence (1, 2, 3, 5, 8, 13, 21, 34+) and converts story points to hours. Includes platform-specific adjustments and velocity calculations.
tools
Perform a full QA review of a Teamwork task by reading the task and all its comments for context, extracting the multi-dev URL, generating dynamic validation steps tailored to the task type, and using CoWork browser automation to execute those steps on the multi-dev environment. Produces a structured validation report with pass/fail per step, screenshots, internal notes, and a client-facing summary — all shown in chat. Use this skill whenever the user asks to QA, test, validate, or review a Teamwork task or multi-dev environment — even if they just say "can you QA this?" or paste a Teamwork link. Also triggers for phrases like "run QA on", "check the multi-dev", "validate this task", "test the dev link", or "review the ticket". Works across Drupal/CMS updates, WordPress/plugin updates, bug fixes, new feature development, and general web development tasks.
tools
Generate a client-facing project heartbeat / status update message for a Kanopi project, ready to be posted as a Teamwork message. Use this skill whenever the user asks to write, draft, generate, or send a project update, heartbeat, status update, or progress report to a client. Also triggers when the user says things like "time for a project update", "draft the heartbeat", "write up the update for [project]", or "it's been two weeks, let's send an update". Always use this skill — even if the user doesn't say "heartbeat" — whenever the intent is to summarise recent project activity for a client audience.