@wipal/agent-team 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.claude/rules/common/general-rules.md +141 -0
  2. package/.claude/rules/lessons/lessons.md +91 -0
  3. package/.claude/rules/role-rules/dev-fe-rules.md +146 -0
  4. package/.claude/rules/role-rules/sa-rules.md +226 -0
  5. package/.claude/skills/SKILL-INDEX.md +299 -0
  6. package/.claude/skills/community/security-validator/SKILL.md +392 -0
  7. package/.claude/skills/core/agent-creation/SKILL.md +338 -0
  8. package/.claude/skills/core/code-review/SKILL.md +154 -0
  9. package/.claude/skills/core/git-automation/SKILL.md +93 -0
  10. package/.claude/skills/core/retrospect-work/SKILL.md +172 -0
  11. package/.claude/skills/domain/architecture/adr-writing/SKILL.md +254 -0
  12. package/.claude/skills/domain/architecture/adr-writing/references/adr-best-practices.md +257 -0
  13. package/.claude/skills/domain/architecture/adr-writing/references/adr-examples.md +246 -0
  14. package/.claude/skills/domain/architecture/adr-writing/references/adr-template.md +160 -0
  15. package/.claude/skills/domain/architecture/architecture-patterns/SKILL.md +316 -0
  16. package/.claude/skills/domain/architecture/architecture-patterns/references/event-driven.md +393 -0
  17. package/.claude/skills/domain/architecture/architecture-patterns/references/microservices.md +315 -0
  18. package/.claude/skills/domain/architecture/architecture-patterns/references/monolith.md +321 -0
  19. package/.claude/skills/domain/architecture/architecture-patterns/references/serverless.md +457 -0
  20. package/.claude/skills/domain/architecture/performance-engineering/SKILL.md +227 -0
  21. package/.claude/skills/domain/architecture/performance-engineering/references/benchmarking.md +336 -0
  22. package/.claude/skills/domain/architecture/performance-engineering/references/caching-strategies.md +284 -0
  23. package/.claude/skills/domain/architecture/performance-engineering/references/optimization.md +298 -0
  24. package/.claude/skills/domain/architecture/security-architecture/SKILL.md +206 -0
  25. package/.claude/skills/domain/architecture/security-architecture/references/auth-patterns.md +209 -0
  26. package/.claude/skills/domain/architecture/security-architecture/references/compliance.md +246 -0
  27. package/.claude/skills/domain/architecture/security-architecture/references/threat-modeling.md +219 -0
  28. package/.claude/skills/domain/architecture/system-design/SKILL.md +227 -0
  29. package/.claude/skills/domain/architecture/system-design/references/distributed-systems.md +231 -0
  30. package/.claude/skills/domain/architecture/system-design/references/resilience.md +344 -0
  31. package/.claude/skills/domain/architecture/system-design/references/scalability.md +303 -0
  32. package/.claude/skills/domain/architecture/tech-selection/SKILL.md +192 -0
  33. package/.claude/skills/domain/architecture/tech-selection/references/build-vs-buy.md +258 -0
  34. package/.claude/skills/domain/architecture/tech-selection/references/evaluation-framework.md +203 -0
  35. package/.claude/skills/domain/architecture/tech-selection/references/tech-radar.md +257 -0
  36. package/.claude/skills/domain/backend/api-design/SKILL.md +121 -0
  37. package/.claude/skills/domain/backend/database-design/SKILL.md +156 -0
  38. package/.claude/skills/domain/backend/performance-be/SKILL.md +210 -0
  39. package/.claude/skills/domain/backend/security/SKILL.md +138 -0
  40. package/.claude/skills/domain/backend/testing-be/SKILL.md +203 -0
  41. package/.claude/skills/domain/devops/ci-cd/SKILL.md +188 -0
  42. package/.claude/skills/domain/devops/containerization/SKILL.md +177 -0
  43. package/.claude/skills/domain/devops/deployment/SKILL.md +198 -0
  44. package/.claude/skills/domain/devops/infrastructure-as-code/SKILL.md +178 -0
  45. package/.claude/skills/domain/devops/monitoring/SKILL.md +163 -0
  46. package/.claude/skills/domain/frontend/accessibility/SKILL.md +179 -0
  47. package/.claude/skills/domain/frontend/frontend-design/SKILL.md +138 -0
  48. package/.claude/skills/domain/frontend/performance-fe/SKILL.md +195 -0
  49. package/.claude/skills/domain/frontend/state-management/SKILL.md +190 -0
  50. package/.claude/skills/domain/frontend/testing-fe/SKILL.md +193 -0
  51. package/.claude/skills/domain/product/requirements-gathering/SKILL.md +136 -0
  52. package/.claude/skills/domain/product/roadmap-planning/SKILL.md +169 -0
  53. package/.claude/skills/domain/product/sprint-planning/SKILL.md +151 -0
  54. package/.claude/skills/domain/product/stakeholder-communication/SKILL.md +162 -0
  55. package/.claude/skills/domain/product/user-stories/SKILL.md +141 -0
  56. package/.claude/skills/domain/quality/bug-reporting/SKILL.md +150 -0
  57. package/.claude/skills/domain/quality/regression-testing/SKILL.md +178 -0
  58. package/.claude/skills/domain/quality/test-automation/SKILL.md +185 -0
  59. package/.claude/skills/domain/quality/test-planning/SKILL.md +177 -0
  60. package/.claude/skills/leadership/code-review-advanced/SKILL.md +167 -0
  61. package/.claude/skills/leadership/mentoring/SKILL.md +151 -0
  62. package/.claude/skills/leadership/technical-debt/SKILL.md +166 -0
  63. package/.claude/skills/leadership/technical-decision/SKILL.md +160 -0
  64. package/.claude/skills/security-reports/.gitkeep +0 -0
  65. package/.claude/skills/skills-registry.yaml +441 -0
  66. package/README.md +232 -0
  67. package/bin/agent-team.js +107 -0
  68. package/package.json +51 -0
  69. package/src/commands/add.js +227 -0
  70. package/src/commands/init.js +136 -0
  71. package/src/commands/list.js +66 -0
  72. package/src/commands/remove.js +71 -0
  73. package/src/commands/switch.js +53 -0
  74. package/src/index.js +11 -0
  75. package/src/interactive/prompts.js +153 -0
  76. package/src/server/api/agents.js +150 -0
  77. package/src/server/api/roles.js +97 -0
  78. package/src/server/api/skills.js +79 -0
  79. package/src/server/index.js +78 -0
  80. package/src/ui/agents.html +174 -0
  81. package/src/ui/css/styles.css +470 -0
  82. package/src/ui/index.html +107 -0
  83. package/src/ui/roles.html +371 -0
  84. package/src/ui/skills.html +332 -0
  85. package/src/utils/file-utils.js +193 -0
  86. package/src/utils/skill-resolver.js +594 -0
  87. package/src/utils/skill-scanner.js +154 -0
  88. package/templates/CLAUDE.md.tmpl +42 -0
  89. package/templates/knowledge.md.tmpl +31 -0
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: user-stories
3
+ description: |
4
+ User story writing and refinement following agile best practices. Use when:
5
+ writing user stories, breaking down features, defining acceptance criteria,
6
+ or when user mentions "user story", "story", "acceptance criteria", "INVEST".
7
+ version: 1.0.0
8
+ category: product
9
+ tags:
10
+ - user-stories
11
+ - agile
12
+ - acceptance-criteria
13
+ - backlog
14
+ depends_on:
15
+ - requirements-gathering
16
+ recommends: []
17
+ used_by:
18
+ - sprint-planning
19
+ ---
20
+
21
+ # Skill: User Stories
22
+
23
+ ## Core Principle
24
+ **User stories describe value, not tasks.** Focus on who needs what and why, not how.
25
+
26
+ ## User Story Format
27
+
28
+ ```
29
+ As a [type of user],
30
+ I want [goal/desire],
31
+ So that [benefit/value].
32
+ ```
33
+
34
+ ## INVEST Criteria
35
+
36
+ | Letter | Meaning | Check |
37
+ |--------|---------|-------|
38
+ | **I** | Independent | Can be developed alone |
39
+ | **N** | Negotiable | Details can be discussed |
40
+ | **V** | Valuable | Provides user value |
41
+ | **E** | Estimable | Team can estimate effort |
42
+ | **S** | Small | Fits in one sprint |
43
+ | **T** | Testable | Has clear acceptance criteria |
44
+
45
+ ## Hard Rules
46
+
47
+ 1. **NEVER write tasks as stories** - Stories deliver value
48
+ 2. **NEVER skip acceptance criteria** - How do we know it's done?
49
+ 3. **ALWAYS include the "why"** - So that...
50
+ 4. **ALWAYS keep stories small** - Split large stories
51
+
52
+ ## Good vs Bad Stories
53
+
54
+ ```markdown
55
+ ❌ Bad: As a user, I want a login page
56
+ ✅ Good: As a returning user, I want to log in quickly so I can access my account
57
+
58
+ ❌ Bad: Implement password reset
59
+ ✅ Good: As a forgetful user, I want to reset my password so I can regain access to my account
60
+
61
+ ❌ Bad: As an admin, I want to manage users
62
+ ✅ Good: As an admin, I want to deactivate user accounts so I can revoke access for terminated employees
63
+ ```
64
+
65
+ ## Acceptance Criteria
66
+
67
+ ```markdown
68
+ ## Story: User can reset password
69
+
70
+ ### Acceptance Criteria
71
+ - [ ] Given I'm on the login page, when I click "Forgot password", then I see the reset form
72
+ - [ ] Given I enter a valid email, when I submit, then I receive a reset link within 5 minutes
73
+ - [ ] Given I click the reset link, when I enter a new password, then my password is updated
74
+ - [ ] Given I use an expired link, when I try to reset, then I see an error message
75
+ - [ ] Given I enter an unregistered email, when I submit, then I see a generic success message (security)
76
+ ```
77
+
78
+ ## Story Breakdown
79
+
80
+ ```
81
+ Large Story:
82
+ "As a user, I want to manage my profile"
83
+
84
+ Break down into:
85
+ 1. "As a user, I want to view my profile information"
86
+ 2. "As a user, I want to update my name and email"
87
+ 3. "As a user, I want to change my password"
88
+ 4. "As a user, I want to upload a profile picture"
89
+ 5. "As a user, I want to delete my account"
90
+ ```
91
+
92
+ ## Story Template
93
+
94
+ ```markdown
95
+ # [Story ID] [Title]
96
+
97
+ ## User Story
98
+ As a [role],
99
+ I want [feature],
100
+ So that [benefit].
101
+
102
+ ## Acceptance Criteria
103
+ - [ ] Criterion 1
104
+ - [ ] Criterion 2
105
+ - [ ] Criterion 3
106
+
107
+ ## Technical Notes
108
+ - API endpoint: POST /api/users/reset-password
109
+ - Email template: password-reset.html
110
+
111
+ ## Dependencies
112
+ - Email service must be configured
113
+
114
+ ## Estimate
115
+ Story Points: 5
116
+
117
+ ## Definition of Done
118
+ - [ ] Code complete
119
+ - [ ] Unit tests passing
120
+ - [ ] Code review approved
121
+ - [ ] QA tested
122
+ - [ ] Documentation updated
123
+ ```
124
+
125
+ ## Common Mistakes
126
+
127
+ | ❌ Mistake | ✅ Fix |
128
+ |------------|--------|
129
+ | Missing "so that" | Add the why |
130
+ | Too technical | Focus on user value |
131
+ | Too large | Break into smaller stories |
132
+ | Vague acceptance criteria | Use Given/When/Then |
133
+ | No estimate | Add story points |
134
+
135
+ ## Checklist
136
+
137
+ - [ ] Follows INVEST criteria
138
+ - [ ] Has clear acceptance criteria
139
+ - [ ] Includes user benefit
140
+ - [ ] Estimated by team
141
+ - [ ] Dependencies identified
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: bug-reporting
3
+ description: |
4
+ Bug report templates and best practices for effective issue tracking. Use when:
5
+ reporting bugs, creating issue tickets, documenting defects, or when user
6
+ mentions "bug", "issue", "defect", "bug report", "ticket".
7
+ version: 1.0.0
8
+ category: quality
9
+ tags:
10
+ - bug
11
+ - issue
12
+ - defect
13
+ - ticket
14
+ depends_on: []
15
+ recommends: []
16
+ used_by: []
17
+ ---
18
+
19
+ # Skill: Bug Reporting
20
+
21
+ ## Core Principle
22
+ **A bug report should enable reproduction.** If developers can't reproduce it, they can't fix it.
23
+
24
+ ## Severity Levels
25
+
26
+ | Level | Definition | Example |
27
+ |-------|------------|---------|
28
+ | **Critical** | System down, data loss | Database corruption |
29
+ | **High** | Major feature broken | Can't complete checkout |
30
+ | **Medium** | Feature partially broken | Filter not working |
31
+ | **Low** | Minor issue, workaround exists | Typo, UI glitch |
32
+
33
+ ## Hard Rules
34
+
35
+ 1. **NEVER report without reproduction steps** - One step, one action
36
+ 2. **NEVER assume developer context** - Include all details
37
+ 3. **ALWAYS include expected vs actual** - Clear comparison
38
+ 4. **ALWAYS search for duplicates first** - Don't create duplicates
39
+
40
+ ## Bug Report Template
41
+
42
+ ```markdown
43
+ # 🐛 [Short Description]
44
+
45
+ ## Summary
46
+ [One sentence describing the bug]
47
+
48
+ ## Severity
49
+ - [ ] Critical
50
+ - [ ] High
51
+ - [x] Medium
52
+ - [ ] Low
53
+
54
+ ## Environment
55
+ - **OS:** macOS 14.0
56
+ - **Browser:** Chrome 120
57
+ - **Version:** v2.1.0
58
+ - **Device:** Desktop
59
+
60
+ ## Steps to Reproduce
61
+ 1. Log in as standard user
62
+ 2. Navigate to Settings > Profile
63
+ 3. Click "Change Password"
64
+ 4. Enter current password
65
+ 5. Enter new password (8 characters)
66
+ 6. Click "Save"
67
+
68
+ ## Expected Behavior
69
+ Password should be updated successfully with confirmation message.
70
+
71
+ ## Actual Behavior
72
+ Error message appears: "Invalid current password" even though password is correct.
73
+
74
+ ## Evidence
75
+
76
+ ### Screenshot
77
+ [Attach screenshot]
78
+
79
+ ### Logs
80
+ ```
81
+ [2024-01-15 10:30:45] ERROR: Password validation failed
82
+ [2024-01-15 10:30:45] Stack trace: ...
83
+ ```
84
+
85
+ ### Network Request
86
+ ```
87
+ POST /api/user/password
88
+ Request: { "currentPassword": "***", "newPassword": "***" }
89
+ Response: { "error": "Invalid current password" }
90
+ ```
91
+
92
+ ## Impact
93
+ - Users cannot change passwords
94
+ - Affects ~15% of users based on support tickets
95
+ - Workaround: Reset password via email
96
+
97
+ ## Additional Context
98
+ - First reported: 2024-01-15
99
+ - Related tickets: #123, #456
100
+ - Only affects users with special characters in password
101
+
102
+ ## Possible Root Cause
103
+ Password encoding issue - special characters not properly escaped
104
+ ```
105
+
106
+ ## Quick Bug Report
107
+
108
+ ```markdown
109
+ **What:** [Bug description in one line]
110
+ **Where:** [Page/URL/Feature]
111
+ **When:** [What action triggers it]
112
+ **Severity:** [Critical/High/Medium/Low]
113
+
114
+ **Steps:**
115
+ 1. [First step]
116
+ 2. [Second step]
117
+ 3. [Third step]
118
+
119
+ **Expected:** [What should happen]
120
+ **Actual:** [What actually happened]
121
+ ```
122
+
123
+ ## Common Mistakes
124
+
125
+ | ❌ Mistake | ✅ Fix |
126
+ |------------|--------|
127
+ | Vague description | Specific, detailed |
128
+ | No reproduction steps | Number each step |
129
+ | Missing environment | OS, browser, version |
130
+ | No evidence | Screenshots, logs |
131
+ | Duplicate tickets | Search first |
132
+
133
+ ## Bug Lifecycle
134
+
135
+ ```
136
+ New → Triaged → In Progress → Fixed → Verified → Closed
137
+
138
+ Won't Fix
139
+
140
+ Cannot Reproduce
141
+ ```
142
+
143
+ ## Checklist
144
+
145
+ - [ ] Searched for duplicates
146
+ - [ ] Reproduction steps included
147
+ - [ ] Expected vs actual stated
148
+ - [ ] Evidence attached
149
+ - [ ] Environment specified
150
+ - [ ] Severity assigned
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: regression-testing
3
+ description: |
4
+ Regression test strategies and execution. Use when: running regression tests,
5
+ ensuring existing functionality works, or when user mentions "regression",
6
+ "regression test", "smoke test", "sanity test".
7
+ version: 1.0.0
8
+ category: quality
9
+ tags:
10
+ - regression
11
+ - smoke-test
12
+ - sanity-test
13
+ - qa
14
+ depends_on:
15
+ - test-automation
16
+ recommends: []
17
+ used_by: []
18
+ ---
19
+
20
+ # Skill: Regression Testing
21
+
22
+ ## Core Principle
23
+ **Protect what works.** New features shouldn't break existing functionality.
24
+
25
+ ## Test Types
26
+
27
+ | Type | Scope | When | Duration |
28
+ |------|-------|------|----------|
29
+ | **Smoke** | Critical paths | Every build | 5-15 min |
30
+ | **Sanity** | Specific feature | After fix | 15-30 min |
31
+ | **Regression** | Full suite | Before release | 1-4 hours |
32
+
33
+ ## Hard Rules
34
+
35
+ 1. **NEVER skip smoke tests** - They catch major issues early
36
+ 2. **NEVER release without regression** - Protect existing users
37
+ 3. **ALWAYS run automated tests first** - Fast feedback
38
+ 4. **ALWAYS investigate failures** - Flaky tests hide real bugs
39
+
40
+ ## Smoke Test Suite
41
+
42
+ ```markdown
43
+ # Smoke Test Checklist
44
+
45
+ ## Critical Paths (Must Pass)
46
+ - [ ] User can log in
47
+ - [ ] User can view dashboard
48
+ - [ ] User can create new item
49
+ - [ ] User can edit item
50
+ - [ ] User can delete item
51
+ - [ ] User can log out
52
+
53
+ ## API Health
54
+ - [ ] GET /health returns 200
55
+ - [ ] Database connection works
56
+ - [ ] Cache connection works
57
+ - [ ] External APIs reachable
58
+
59
+ ## Performance
60
+ - [ ] Page load < 3 seconds
61
+ - [ ] API response < 500ms
62
+ ```
63
+
64
+ ## Automated Smoke Test
65
+
66
+ ```typescript
67
+ // tests/smoke.spec.ts
68
+ import { test, expect } from '@playwright/test';
69
+
70
+ test.describe('Smoke Tests', () => {
71
+ test('health check', async ({ request }) => {
72
+ const response = await request.get('/health');
73
+ expect(response.ok()).toBeTruthy();
74
+ });
75
+
76
+ test('user can login', async ({ page }) => {
77
+ await page.goto('/login');
78
+ await page.fill('[name="email"]', process.env.TEST_USER_EMAIL!);
79
+ await page.fill('[name="password"]', process.env.TEST_USER_PASSWORD!);
80
+ await page.click('button[type="submit"]');
81
+
82
+ await expect(page).toHaveURL('/dashboard');
83
+ });
84
+
85
+ test('dashboard loads', async ({ page }) => {
86
+ await page.goto('/dashboard');
87
+ await expect(page.locator('h1')).toContainText('Dashboard');
88
+ });
89
+ });
90
+ ```
91
+
92
+ ## Regression Test Matrix
93
+
94
+ ```markdown
95
+ | Area | Smoke | Sanity | Full Regression |
96
+ |------|-------|--------|-----------------|
97
+ | Authentication | ✅ | ✅ | ✅ |
98
+ | User Management | ✅ | - | ✅ |
99
+ | Orders | - | ✅ | ✅ |
100
+ | Payments | - | - | ✅ |
101
+ | Reports | - | - | ✅ |
102
+ | Settings | - | - | ✅ |
103
+ ```
104
+
105
+ ## Regression Checklist
106
+
107
+ ```markdown
108
+ # Pre-Release Regression
109
+
110
+ ## Automation Status
111
+ - [ ] All smoke tests passing
112
+ - [ ] Feature tests passing
113
+ - [ ] No flaky test failures
114
+ - [ ] Coverage report generated
115
+
116
+ ## Manual Testing
117
+ - [ ] Critical paths verified
118
+ - [ ] New features tested
119
+ - [ ] Edge cases checked
120
+ - [ ] Cross-browser tested
121
+ - [ ] Mobile tested
122
+
123
+ ## Performance
124
+ - [ ] Load tests passed
125
+ - [ ] No memory leaks
126
+ - [ ] Response times acceptable
127
+
128
+ ## Compatibility
129
+ - [ ] Chrome latest
130
+ - [ ] Firefox latest
131
+ - [ ] Safari latest
132
+ - [ ] Mobile Safari
133
+ - [ ] Mobile Chrome
134
+ ```
135
+
136
+ ## Common Mistakes
137
+
138
+ | ❌ Mistake | ✅ Fix |
139
+ |------------|--------|
140
+ | Running all tests always | Risk-based selection |
141
+ | Ignoring flaky tests | Fix or quarantine |
142
+ | No test prioritization | Run critical first |
143
+ | Manual-only regression | Automate what makes sense |
144
+
145
+ ## CI Integration
146
+
147
+ ```yaml
148
+ # .github/workflows/regression.yml
149
+ name: Regression Tests
150
+
151
+ on:
152
+ push:
153
+ branches: [main]
154
+ schedule:
155
+ - cron: '0 2 * * *' # Nightly
156
+
157
+ jobs:
158
+ smoke:
159
+ runs-on: ubuntu-latest
160
+ steps:
161
+ - uses: actions/checkout@v4
162
+ - run: npx playwright test --grep "@smoke"
163
+
164
+ regression:
165
+ needs: smoke
166
+ runs-on: ubuntu-latest
167
+ steps:
168
+ - uses: actions/checkout@v4
169
+ - run: npx playwright test
170
+ ```
171
+
172
+ ## Checklist
173
+
174
+ - [ ] Smoke suite defined
175
+ - [ ] Automation running in CI
176
+ - [ ] Test matrix created
177
+ - [ ] Failure process defined
178
+ - [ ] Regular suite maintenance
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: test-automation
3
+ description: |
4
+ Test automation frameworks and strategies. Use when: setting up automation,
5
+ writing automated tests, choosing frameworks, or when user mentions "automation",
6
+ "automated tests", "Playwright", "Cypress", "Selenium".
7
+ version: 1.0.0
8
+ category: quality
9
+ tags:
10
+ - automation
11
+ - playwright
12
+ - cypress
13
+ - e2e
14
+ depends_on:
15
+ - test-planning
16
+ recommends: []
17
+ used_by:
18
+ - regression-testing
19
+ ---
20
+
21
+ # Skill: Test Automation
22
+
23
+ ## Core Principle
24
+ **Automate what matters.** Tests should be fast, reliable, and maintainable.
25
+
26
+ ## What to Automate
27
+
28
+ | Automate | Don't Automate |
29
+ |----------|----------------|
30
+ | Regression tests | One-time tests |
31
+ | Repetitive tasks | Exploratory testing |
32
+ | Critical paths | UI polish testing |
33
+ | Data-driven tests | Subjective testing |
34
+
35
+ ## Hard Rules
36
+
37
+ 1. **NEVER automate flaky tests** - Fix the root cause first
38
+ 2. **NEVER use fixed delays** - Wait for conditions
39
+ 3. **ALWAYS use Page Object Model** - Maintainable tests
40
+ 4. **ALWAYS run in CI** - Automation without CI is manual
41
+
42
+ ## Framework Comparison
43
+
44
+ | Feature | Playwright | Cypress | Selenium |
45
+ |---------|------------|---------|----------|
46
+ | Speed | Fast | Fast | Slow |
47
+ | Reliability | High | High | Medium |
48
+ | Multi-browser | Yes | Limited | Yes |
49
+ | Parallel | Built-in | Paid | Yes |
50
+ | Learning curve | Medium | Easy | Hard |
51
+
52
+ ## Playwright Setup
53
+
54
+ ```typescript
55
+ // playwright.config.ts
56
+ import { defineConfig } from '@playwright/test';
57
+
58
+ export default defineConfig({
59
+ testDir: './tests',
60
+ fullyParallel: true,
61
+ retries: process.env.CI ? 2 : 0,
62
+ workers: process.env.CI ? 1 : undefined,
63
+ reporter: 'html',
64
+ use: {
65
+ baseURL: 'http://localhost:3000',
66
+ trace: 'on-first-retry',
67
+ screenshot: 'only-on-failure',
68
+ },
69
+ projects: [
70
+ { name: 'chromium', use: { browserName: 'chromium' } },
71
+ { name: 'firefox', use: { browserName: 'firefox' } },
72
+ { name: 'webkit', use: { browserName: 'webkit' } },
73
+ ],
74
+ });
75
+ ```
76
+
77
+ ## Page Object Model
78
+
79
+ ```typescript
80
+ // pages/LoginPage.ts
81
+ import { Page, Locator } from '@playwright/test';
82
+
83
+ export class LoginPage {
84
+ readonly page: Page;
85
+ readonly emailInput: Locator;
86
+ readonly passwordInput: Locator;
87
+ readonly loginButton: Locator;
88
+
89
+ constructor(page: Page) {
90
+ this.page = page;
91
+ this.emailInput = page.locator('[name="email"]');
92
+ this.passwordInput = page.locator('[name="password"]');
93
+ this.loginButton = page.locator('button[type="submit"]');
94
+ }
95
+
96
+ async goto() {
97
+ await this.page.goto('/login');
98
+ }
99
+
100
+ async login(email: string, password: string) {
101
+ await this.emailInput.fill(email);
102
+ await this.passwordInput.fill(password);
103
+ await this.loginButton.click();
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Test Example
109
+
110
+ ```typescript
111
+ // tests/login.spec.ts
112
+ import { test, expect } from '@playwright/test';
113
+ import { LoginPage } from '../pages/LoginPage';
114
+
115
+ test.describe('Login', () => {
116
+ let loginPage: LoginPage;
117
+
118
+ test.beforeEach(async ({ page }) => {
119
+ loginPage = new LoginPage(page);
120
+ await loginPage.goto();
121
+ });
122
+
123
+ test('should login successfully', async ({ page }) => {
124
+ await loginPage.login('test@example.com', 'password123');
125
+
126
+ // Wait for navigation
127
+ await expect(page).toHaveURL('/dashboard');
128
+
129
+ // Verify user is logged in
130
+ await expect(page.locator('[data-testid="user-name"]')).toBeVisible();
131
+ });
132
+
133
+ test('should show error for invalid credentials', async ({ page }) => {
134
+ await loginPage.login('test@example.com', 'wrongpassword');
135
+
136
+ // Verify error message
137
+ await expect(page.locator('.error-message')).toContainText('Invalid credentials');
138
+ });
139
+ });
140
+ ```
141
+
142
+ ## Best Practices
143
+
144
+ ### Wait Strategies
145
+ ```typescript
146
+ // ❌ Bad: Fixed wait
147
+ await page.waitForTimeout(1000);
148
+
149
+ // ✅ Good: Wait for condition
150
+ await page.waitForSelector('.loaded');
151
+ await expect(page.locator('.status')).toBeVisible();
152
+ await page.waitForResponse('**/api/data');
153
+ ```
154
+
155
+ ### Test Data
156
+ ```typescript
157
+ // Use test fixtures for data
158
+ test('should create order', async ({ page, request }) => {
159
+ // Setup: Create test user via API
160
+ const user = await request.post('/api/test/users', {
161
+ data: { email: 'test@example.com' }
162
+ });
163
+
164
+ // Test...
165
+ });
166
+ ```
167
+
168
+ ## Common Mistakes
169
+
170
+ | ❌ Mistake | ✅ Fix |
171
+ |------------|--------|
172
+ | Fixed waits | Wait for conditions |
173
+ | No Page Objects | Use POM pattern |
174
+ | Flaky tests | Fix or delete |
175
+ | No parallelization | Configure workers |
176
+ | Not in CI | Add to pipeline |
177
+
178
+ ## Checklist
179
+
180
+ - [ ] Framework selected
181
+ - [ ] Page Objects implemented
182
+ - [ ] Tests run in CI
183
+ - [ ] Parallel execution configured
184
+ - [ ] Proper wait strategies
185
+ - [ ] Test data management