Validate WCAG 2.1 Level AA compliance and accessibility best practices. Use when performing accessibility audits and WCAG certification.
中文简介正在准备中。当前显示原文说明。
Generate test scaffolding for modules with proper structure, fixtures, and mock configurations.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
This skill provides comprehensive test scaffolding and templates for quickly setting up unit and integration tests with proper structure, fixtures, and mocking configurations. It guides the creation of well-structured, maintainable tests following best practices.
On-demand via command: /generate-tests <file-path>
Example:
/generate-tests src/tools/example/core.py
Complete pytest unit test template with:
Complete integration test template with:
test_*.py or *_test.py)/generate-tests src/tools/doc_fetcher/core.py
Provides:
tests/test_doc_fetcher_core.py structure/generate-tests src/api/endpoints.py
Provides:
tests/integration/test_endpoints.py structure/generate-tests src/components/Button.tsx
Provides:
src/components/Button.test.tsx structuredef test_function_name_condition_expected():
"""Test description."""
# Arrange - Set up test data and conditions
input_data = {"key": "value"}
expected = "result"
# Act - Execute the function under test
result = function_under_test(input_data)
# Assert - Verify the outcome
assert result == expected
class TestClassName:
"""Tests for ClassName."""
@pytest.fixture
def instance(self):
"""Create test instance."""
return ClassName()
def test_method_success(self, instance):
"""Test successful method execution."""
result = instance.method()
assert result is not None
def test_method_error_handling(self, instance):
"""Test method handles errors."""
with pytest.raises(ValueError):
instance.method(invalid_input)
@pytest.mark.parametrize("input,expected", [
("test1", "result1"),
("test2", "result2"),
("test3", "result3"),
])
def test_function_with_parameters(input, expected):
"""Test function with multiple inputs."""
result = function_under_test(input)
assert result == expected
from unittest.mock import Mock, patch
@patch('module.external_service')
def test_with_mocked_service(mock_service):
"""Test with mocked external service."""
# Configure mock
mock_service.return_value = "mocked_response"
# Test function that uses service
result = function_that_calls_service()
# Verify
assert result == "expected"
mock_service.assert_called_once()
@pytest.fixture
def mock_database():
"""Mock database connection."""
db = Mock()
db.query.return_value = [{"id": 1, "name": "test"}]
return db
def test_database_query(mock_database):
"""Test database query."""
result = get_data(mock_database)
assert len(result) == 1
mock_database.query.assert_called()
def test_api_endpoint_integration(client):
"""Test API endpoint with real client."""
# Arrange
payload = {"data": "test"}
# Act
response = client.post("/api/endpoint", json=payload)
# Assert
assert response.status_code == 200
assert response.json()["status"] == "success"
def test_database_integration(db_session):
"""Test database operations."""
# Arrange
record = Model(name="test", value=123)
# Act
db_session.add(record)
db_session.commit()
# Assert
result = db_session.query(Model).filter_by(name="test").first()
assert result is not None
assert result.value == 123
# Python with pytest-cov
pytest --cov=src --cov-report=html
# JavaScript with Jest
jest --coverage
# View coverage report
open htmlcov/index.html # Python
open coverage/lcov-report/index.html # JavaScript
test_function_condition_expectedtest_process_data_invalid_input_raises_error还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Validate WCAG 2.1 Level AA compliance and accessibility best practices. Use when performing accessibility audits and WCAG certification.
中文简介正在准备中。当前显示原文说明。
Analyze feature requirements, dependencies, and security considerations. Use when starting feature implementation from GitHub issues to understand scope, technical feasibility, and risks.
中文简介正在准备中。当前显示原文说明。
Run SQL queries against psql, BigQuery, or MySQL from the terminal, including natural-language-to-SQL and schema exploration. Use when analyzing data, inspecting DB state, or debugging tables. Trigger on "query the database", "SQL", "show me data from", "explore table".
中文简介正在准备中。当前显示原文说明。
Design REST APIs or function contracts with clear request/response specifications, error handling patterns, authentication strategies, and comprehensive documentation.
中文简介正在准备中。当前显示原文说明。
Generate comprehensive API endpoint tests for REST and GraphQL APIs. Creates tests for all HTTP methods, status codes, authentication, and validation.
中文简介正在准备中。当前显示原文说明。
Design component architecture and module structure using established architectural patterns for clean, maintainable, and scalable systems.
中文简介正在准备中。当前显示原文说明。