一键导入
playwright-bdd-analyzer
BDD test quality analyzer - detects flaky patterns, coverage gaps, and maintainability issues in Playwright-BDD/Cucumber tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
BDD test quality analyzer - detects flaky patterns, coverage gaps, and maintainability issues in Playwright-BDD/Cucumber tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Trợ lý Project Manager toàn diện, tích hợp Jira & Confluence qua Atlassian MCP. Gồm 3 nhóm chức năng: [Lập kế hoạch & Tài liệu] Sprint Planning (capacity, Sprint Goal) — Roadmap (quý/năm, milestone) — PRD (goals, scope, requirements) — User Story (chuẩn INVEST, tạo Jira issue) — Meeting Notes (action items, push Jira task) — Risk Register (nhận diện, đánh giá, ứng phó) — Resource Planning (phân bổ, over-allocation) — Cost Management (ngân sách, CPI/SPI) — Timeline (milestone, critical path). [Giám sát & Cảnh báo] Sprint Health Check (6 chỉ số 🟢🟡🔴) — Daily Health Check (báo cáo standup tự động) — Cảnh báo quá hạn (theo mức nghiêm trọng) — Cảnh báo thiếu thông tin (completeness score). [Agile / Scrum / XP] Scrum Ceremonies (Planning, Daily, Review, Retro 4 formats, Grooming) — Estimation (Planning Poker, T-Shirt, MoSCoW, WSJF) — XP (TDD, Pair Programming, Simple Design) — Kanban (WIP, cycle time, bottleneck) — Anti-pattern detection — Tạo slide từ Confluence thành file .pptx.
Angular 17+ development guide covering Standalone Components, Signals-based state, NgRx, RxJS patterns, and integration with .NET/C# backends. Use when user asks to "create Angular component", "implement signal store", "setup NgRx", "write Angular service", "call .NET API from Angular", "handle HTTP in Angular", "fix RxJS subscription leak", "create Angular feature module", "implement lazy routing", "setup interceptor", or needs Angular architecture advice. Always use this skill for any Angular coding task, even if the user doesn't say "Angular" explicitly but the context is clearly frontend + .NET backend integration.
Generate Playwright E2E test step definitions from Cucumber feature files. Use when user provides a .feature file and wants to implement step definitions, create Page Object classes, or generate test code. Triggers include requests to implement steps, generate E2E tests from Gherkin scenarios, create POM classes for pages, or convert feature files to Playwright tests. Supports interactive selector discovery via Playwright MCP tools or manual user input.
Angular TDD workflow with codebase exploration and Figma design integration. Guides the Explore-Plan-Test-Implement-Refactor-Review cycle for Angular applications. Use when implementing Angular features test-first, "TDD", "Red-Green-Refactor", developing UI components from Figma designs, or when user says "write tests first". Do NOT use for Angular architecture setup (use angular-hexagonal), BDD/Gherkin scenarios (use bdd-practices), or E2E tests (use playwright-* skills).
Systematic code review for quality, correctness, and maintainability. Use when reviewing pull requests, code changes, diffs, or when asked to review/critique code. Also use when user says review this, check my code, any issues with this, PR review, code review, or provides code and asks for feedback. Covers functionality, architecture, performance, security, testing, and documentation with structured feedback using priority prefixes BLOCKING, SUGGESTION, QUESTION, NIT. Do NOT use when user wants to write new code from scratch or needs help debugging runtime errors.
Conventional Commits 1.0.0 format for consistent, parseable git commit messages. Use when committing changes, writing commit messages, or when the user mentions commit, save, git commit, or wants to persist work. Covers type selection, scope rules, description format, breaking changes, and multi-line commit workflow.
| name | playwright-bdd-analyzer |
| description | BDD test quality analyzer - detects flaky patterns, coverage gaps, and maintainability issues in Playwright-BDD/Cucumber tests |
Analyze and improve Playwright-BDD/Cucumber test quality, coverage, and maintainability.
.feature files for quality issues| Metric | Target | Priority |
|---|---|---|
| Step Reuse Rate | ≥60% | Medium |
| Declarative Scenario Rate | ≥80% | Medium |
| Scenario Independence | 100% | High |
| Happy Path Coverage | 100% | Critical |
| Error Path Coverage | 100% | Critical |
| Boundary Value Coverage | ≥80% | Medium |
| Security Test Coverage | 100% | Critical |
| Tag Coverage | ≥90% | Low |
| Flaky Test Rate | 0% | High |
# ❌ IMPERATIVE (avoid) - UI details exposed
When user enters "test@example.com" in email field
And user enters "password123" in password field
And user clicks login button
# ✅ DECLARATIVE (preferred) - business intent clear
When user logs in with valid credentials
// ❌ Fixed timeout - flaky
await page.waitForTimeout(2000);
// ✅ Explicit wait - stable
await page.waitForSelector('[data-testid="result"]');
// ❌ Text selector - brittle
await page.click('button:has-text("Submit")');
// ✅ Test ID selector - stable
await page.click('[data-testid="submit-button"]');
For each feature, verify:
waitForTimeout() usageRule: Scenarios describe WHAT happens, not HOW.
Detection: Steps containing UI keywords:
click, enter, input, select, field, button, dropdownFix: Move UI details to step definitions, expose business intent.
# Before
When user clicks "Add to Cart" button
And user enters "2" in quantity field
# After
When user adds 2 items to cart
Rule: Each scenario must run alone without depending on others.
Detection:
Fix: Use Given to establish preconditions explicitly.
# Before - depends on previous scenario
Scenario: Login with created user
When user "test@example.com" logs in
# After - independent
Scenario: Login with existing user
Given user "test@example.com" exists
When user "test@example.com" logs in
Rule: Common preconditions shared by 3+ scenarios should use Background.
Detection: Same Given step repeated in multiple scenarios.
# Before - repetition
Scenario: Create booking
Given admin is logged in
When admin creates booking
Scenario: Update booking
Given admin is logged in
When admin updates booking
# After - DRY
Background:
Given admin is logged in
Scenario: Create booking
When admin creates booking
Scenario: Update booking
When admin updates booking
Rule: Similar scenarios differing only in data should use Scenario Outline.
Detection: 3+ scenarios with identical structure, different values.
# Before - duplication
Scenario: Invalid email shows error
When user enters "invalid" in email
Then error "Invalid email format" is shown
Scenario: Invalid phone shows error
When user enters "abc" in phone
Then error "Invalid phone format" is shown
# After - parameterized
Scenario Outline: Invalid input shows validation error
When user enters "<value>" in <field>
Then error "<message>" is shown
Examples:
| field | value | message |
| email | invalid | Invalid email format |
| phone | abc | Invalid phone format |
Patterns to flag:
| Pattern | Risk | Fix |
|---|---|---|
waitForTimeout(N) | High | Use waitForSelector or waitForLoadState |
page.click('text=...') | Medium | Use data-testid attribute |
page.locator('.class') | Medium | Use data-testid for test elements |
| Nested waits | High | Single explicit wait condition |
Math.random() in tests | High | Use deterministic test data |
Required tests for user input:
@security
Scenario: XSS attack is prevented
When user enters "<script>alert('xss')</script>" in name field
And user submits form
Then script is not executed
And sanitized text is stored
@security
Scenario: Unauthenticated user cannot access admin
Given user is not logged in
When user navigates to "/admin/dashboard"
Then user is redirected to "/login"
@security
Scenario: User cannot access other tenant data
Given user belongs to Tenant A
And booking exists in Tenant B
When user views booking list
Then Tenant B booking is not visible
# BDD Quality Report
Generated: 2026-01-06 10:00:00
## Summary
| Metric | Value | Target | Status |
|--------|-------|--------|--------|
| Total Features | 12 | - | - |
| Total Scenarios | 87 | - | - |
| Step Reuse Rate | 68% | 60% | ✅ |
| Declarative Rate | 75% | 80% | ⚠️ |
| Tag Coverage | 95% | 90% | ✅ |
| Flaky Patterns | 3 | 0 | ⚠️ |
## Quality Score: 78/100
### Strengths ✅
1. High step reuse rate (68%)
2. Good tag coverage (95%)
3. Background used appropriately
### Issues ⚠️
1. Imperative scenarios (25%)
- 📁 features/admin/dashboard.feature (5/7 scenarios)
- Fix: Move UI details to step definitions
2. Missing boundary tests
- 📁 features/booking/create.feature
- Fix: Add cases for count=0, count=11
3. Flaky patterns detected
- 📁 src/tests/e2e/booking.spec.ts:42
- Fix: Replace waitForTimeout with waitForSelector
## Priority: High 🔴
1. **Fix flaky tests** (15 min)
- File: src/tests/e2e/booking.spec.ts
- Issue: waitForTimeout(2000)
- Fix: await page.waitForSelector('[data-testid="success"]')
2. **Add security tests** (30 min)
- Feature: booking/create
- Missing: XSS prevention test
## Priority: Medium 🟡
3. **Add boundary tests** (30 min)
- Feature: booking/create
- Missing: count=0, count=11 cases
4. **Refactor to declarative** (2 hours)
- 22 imperative scenarios
- Biggest impact: features/admin/*.feature
## Priority: Low 🟢
5. **Consolidate duplicate steps** (20 min)
- 3 duplicate step definitions found
Analyzes all .feature files and generates quality report.
npx ts-node scripts/analyze-features.ts [features-dir]
Output: bdd-quality-report.md
Checks step definition usage and detects duplicates.
npx ts-node scripts/check-step-coverage.ts [features-dir] [steps-dir]
Scans test files for patterns that cause flaky tests.
npx ts-node scripts/detect-flaky-patterns.ts [tests-dir]
Full analysis:
Analyze the Playwright-BDD test quality for this project
Review specific feature:
Review features/booking/create-reservation.feature for quality issues
Find coverage gaps:
Identify test coverage gaps and suggest improvements
Fix flaky tests:
Find and fix flaky test patterns in the E2E tests