Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code. Use when users request test generation, unit tests with mocks, or testing code that has external dependencies like database calls, API requests, file I/O, or network operations. Automatically identifies dependencies to mock and creates executable, maintainable test code.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill mocking-test-generator
Generate unit tests with proper mocking of external dependencies for Python and Java code.
Read the target code to identify:
Ask clarifying questions if:
Python: Use unittest.mock with pytest or unittest
@patch decorator for external callsMock() objects for complex dependenciespytest.fixture for reusable mocksJava: Use Mockito with JUnit 5
@Mock annotation for dependencies@ExtendWith(MockitoExtension.class) to test classwhen().thenReturn() for stubbingIdentify what to mock:
Always mock:
Never mock (unless explicitly requested):
For common patterns, reference:
Generate test code that:
Test structure:
# Python example
from unittest.mock import patch, Mock
import pytest
@patch('module.external_dependency')
def test_function_name(mock_dependency):
# Arrange: Setup mock behavior
mock_dependency.return_value = expected_value
# Act: Execute function under test
result = function_under_test(input_data)
# Assert: Verify results
assert result == expected_output
mock_dependency.assert_called_once_with(expected_args)
// Java example
@ExtendWith(MockitoExtension.class)
class ServiceTest {
@Mock
private ExternalDependency dependency;
@Test
void testMethodName() {
// Arrange: Setup mock behavior
when(dependency.method()).thenReturn(expectedValue);
// Act: Execute method under test
Service service = new Service(dependency);
String result = service.methodUnderTest();
// Assert: Verify results
assertEquals(expectedOutput, result);
verify(dependency).method();
}
}
Include:
Include comments that explain:
Keep comments concise and focused on non-obvious aspects.
Provide:
Do not:
User request: "Generate unit tests for this Python function that calls an external API"
Response:
@patch decoratorPython (pytest):
@pytest.fixture for reusable mock setups@patch as decorator or context managermock_open for file operations@patch.dict for environment variablesPython (unittest):
unittest.TestCase base class@patch decorator or patch() context managersetUp() and tearDown() methodsself.assert* methodsJava (Mockito + JUnit 5):
@ExtendWith(MockitoExtension.class) on test class@Mock for dependencies@BeforeEach for setup, @AfterEach for teardownArgumentCaptor to verify complex argumentsMockedStatic for static method mocking (Mockito 3.4+)Reference files contain detailed examples for:
Python (references/python_patterns.md):
Java (references/java_patterns.md):
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Use when implementing any feature or bugfix, before writing implementation code
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use for submitting experiments via API, tracking experiment status, downloading results, optimizing protein sequences for better expression using computational tools (NetSolP, SoluProt, SolubleMPNN, ESM), or managing protein design workflows with wet-lab validation.
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.
Take arabelatso/mocking-test-generator from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.