一键导入
test-pattern-analysis
Analyze existing tests to identify patterns, fixtures, and conventions before writing new tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze existing tests to identify patterns, fixtures, and conventions before writing new tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
DEPRECATED - Use domain-specific skills instead. Routes to bazinga-db-core, bazinga-db-workflow, bazinga-db-agents, or bazinga-db-context.
Task groups and development planning. Use when managing task groups, development plans, or success criteria.
Agent logs, reasoning, and token tracking. Use when logging interactions, saving reasoning, tracking tokens, or managing events.
Validates BAZINGA completion claims with independent verification. Spawned ONLY when PM sends BAZINGA. Acts as final quality gate - verifies test failures, coverage, evidence, and criteria independently. Returns ACCEPT or REJECT verdict.
Build complete agent prompts deterministically via Python script. Use BEFORE spawning any BAZINGA agent (Developer, QA, Tech Lead, PM, etc.).
Context packages and learning patterns. Use when managing context packages, error patterns, or strategies.
| name | test-pattern-analysis |
| description | Analyze existing tests to identify patterns, fixtures, and conventions before writing new tests |
| version | 1.0.0 |
| allowed-tools | ["Bash","Read"] |
You are the test-pattern-analysis skill. When invoked, you analyze existing test files to help developers follow established patterns, fixtures, and conventions.
Invoke this skill when:
Do NOT invoke when:
When invoked:
Use the Bash tool to run the pre-built analysis script:
python3 .claude/skills/test-pattern-analysis/analyze_tests.py
This script will:
bazinga/artifacts/{SESSION_ID}/skills/test_patterns.jsonUse the Read tool to read:
bazinga/artifacts/{SESSION_ID}/skills/test_patterns.json
Extract key information:
framework - Detected test frameworkcommon_fixtures - Reusable test fixturestest_patterns - Structure patterns (AAA, Given-When-Then)similar_tests - Related existing testssuggested_tests - Recommended test casescoverage_target - Project coverage standardutilities - Test helper functionsReturn a concise summary to the calling agent:
Test Pattern Analysis:
- Framework: {framework}
- Pattern: {AAA|Given-When-Then}
- Naming convention: {pattern}
- Common fixtures: {fixture1}, {fixture2}
- Coverage target: {percentage}%
Suggested test cases:
1. {test case 1}
2. {test case 2}
3. {test case 3}
Similar tests to reference:
- {file1}: {test_name}
- {file2}: {test_name}
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/test_patterns.json
Scenario: Writing Tests for Password Reset
Input: Developer needs to write tests for new password reset feature
Expected output:
Test Pattern Analysis:
- Framework: pytest
- Pattern: AAA (Arrange-Act-Assert)
- Naming convention: test_<function>_<scenario>_<expected>
- Common fixtures: test_client, test_db, test_user
- Coverage target: 80%
Suggested test cases:
1. test_password_reset_valid_email_sends_token
2. test_password_reset_invalid_email_returns_error
3. test_password_reset_expired_token_returns_error
4. test_password_reset_rate_limiting_prevents_abuse
Similar tests to reference:
- tests/test_auth.py: test_login_valid_credentials_returns_token
- tests/test_email.py: test_send_email_valid_address_succeeds
Reusable fixtures:
- test_client (conftest.py): Flask test client
- test_user (conftest.py): Create test user in database
- mock_email_service (conftest.py): Mock email sending
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/test_patterns.json
Scenario: No Tests Found
Input: Developer trying to analyze patterns in project with no tests
Expected output:
Test Pattern Analysis:
- Framework: detected (pytest)
- Pattern: N/A
No existing tests found. Cannot extract patterns.
Recommendations:
1. Start with standard pytest conventions
2. Use AAA (Arrange-Act-Assert) pattern
3. Name tests: test_<function>_<scenario>_<expected>
4. Target 80% code coverage
5. Create conftest.py for shared fixtures
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/test_patterns.json
If no test files found:
If no fixtures found:
If framework detection fails:
If no similar tests found: