@mclawnet/agent 0.5.8 → 0.6.1

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 (78) hide show
  1. package/cli.js +168 -61
  2. package/dist/__tests__/cli.test.d.ts +2 -0
  3. package/dist/__tests__/cli.test.d.ts.map +1 -0
  4. package/dist/__tests__/service-config.test.d.ts +2 -0
  5. package/dist/__tests__/service-config.test.d.ts.map +1 -0
  6. package/dist/__tests__/service-linux.test.d.ts +2 -0
  7. package/dist/__tests__/service-linux.test.d.ts.map +1 -0
  8. package/dist/__tests__/service-macos.test.d.ts +2 -0
  9. package/dist/__tests__/service-macos.test.d.ts.map +1 -0
  10. package/dist/__tests__/service-windows.test.d.ts +2 -0
  11. package/dist/__tests__/service-windows.test.d.ts.map +1 -0
  12. package/dist/backend-adapter.d.ts +2 -0
  13. package/dist/backend-adapter.d.ts.map +1 -1
  14. package/dist/{chunk-KHPEQTWF.js → chunk-KITKMSBE.js} +166 -90
  15. package/dist/chunk-KITKMSBE.js.map +1 -0
  16. package/dist/chunk-W3LSW4XY.js +95 -0
  17. package/dist/chunk-W3LSW4XY.js.map +1 -0
  18. package/dist/hub-connection.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/linux-5KQ4SCAA.js +175 -0
  21. package/dist/linux-5KQ4SCAA.js.map +1 -0
  22. package/dist/macos-FGY546NC.js +173 -0
  23. package/dist/macos-FGY546NC.js.map +1 -0
  24. package/dist/service/config.d.ts +19 -0
  25. package/dist/service/config.d.ts.map +1 -0
  26. package/dist/service/index.d.ts +6 -0
  27. package/dist/service/index.d.ts.map +1 -0
  28. package/dist/service/index.js +46 -0
  29. package/dist/service/index.js.map +1 -0
  30. package/dist/service/linux.d.ts +18 -0
  31. package/dist/service/linux.d.ts.map +1 -0
  32. package/dist/service/macos.d.ts +18 -0
  33. package/dist/service/macos.d.ts.map +1 -0
  34. package/dist/service/types.d.ts +19 -0
  35. package/dist/service/types.d.ts.map +1 -0
  36. package/dist/service/windows.d.ts +18 -0
  37. package/dist/service/windows.d.ts.map +1 -0
  38. package/dist/session-manager.d.ts +4 -7
  39. package/dist/session-manager.d.ts.map +1 -1
  40. package/dist/skill-loader.d.ts +8 -0
  41. package/dist/skill-loader.d.ts.map +1 -0
  42. package/dist/start.d.ts.map +1 -1
  43. package/dist/start.js +1 -1
  44. package/dist/windows-PIJ4CMWX.js +164 -0
  45. package/dist/windows-PIJ4CMWX.js.map +1 -0
  46. package/package.json +18 -16
  47. package/skills/academic-search/SKILL.md +147 -0
  48. package/skills/architecture/SKILL.md +294 -0
  49. package/skills/changelog-generator/SKILL.md +112 -0
  50. package/skills/chart-visualization/SKILL.md +183 -0
  51. package/skills/code-review/SKILL.md +304 -0
  52. package/skills/codebase-health/SKILL.md +281 -0
  53. package/skills/consulting-analysis/SKILL.md +584 -0
  54. package/skills/content-research-writer/SKILL.md +546 -0
  55. package/skills/data-analysis/SKILL.md +194 -0
  56. package/skills/deep-research/SKILL.md +198 -0
  57. package/skills/docx/SKILL.md +211 -0
  58. package/skills/github-deep-research/SKILL.md +207 -0
  59. package/skills/image-generation/SKILL.md +209 -0
  60. package/skills/lead-research-assistant/SKILL.md +207 -0
  61. package/skills/mcp-builder/SKILL.md +304 -0
  62. package/skills/meeting-insights-analyzer/SKILL.md +335 -0
  63. package/skills/pair-programming/SKILL.md +196 -0
  64. package/skills/pdf/SKILL.md +309 -0
  65. package/skills/performance-analysis/SKILL.md +261 -0
  66. package/skills/podcast-generation/SKILL.md +224 -0
  67. package/skills/pptx/SKILL.md +497 -0
  68. package/skills/project-learnings/SKILL.md +280 -0
  69. package/skills/security-audit/SKILL.md +211 -0
  70. package/skills/skill-creator/SKILL.md +200 -0
  71. package/skills/technical-writing/SKILL.md +286 -0
  72. package/skills/testing/SKILL.md +363 -0
  73. package/skills/video-generation/SKILL.md +247 -0
  74. package/skills/web-design-guidelines/SKILL.md +203 -0
  75. package/skills/webapp-testing/SKILL.md +162 -0
  76. package/skills/workflow-automation/SKILL.md +299 -0
  77. package/skills/xlsx/SKILL.md +305 -0
  78. package/dist/chunk-KHPEQTWF.js.map +0 -1
@@ -0,0 +1,247 @@
1
+ ---
2
+ name: video-generation
3
+ description: Create structured video scripts, storyboards, and production plans for video content. Use when planning video productions, writing video scripts, creating storyboards, or structuring educational and marketing video content.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Video Generation
8
+
9
+ Create structured video scripts with storyboards, shot lists, timing, and production notes for video content creation.
10
+
11
+ ## Overview
12
+
13
+ This skill helps create complete video production plans — from concept through script to storyboard. It covers explainer videos, tutorials, marketing content, presentations, and narrative shorts with proper visual storytelling, pacing, and audience engagement techniques.
14
+
15
+ ## When to Use
16
+
17
+ - Planning video content (explainers, tutorials, demos, marketing)
18
+ - Writing video scripts with visual and audio directions
19
+ - Creating storyboards for pre-production
20
+ - Structuring educational video series
21
+ - Designing video presentations with narration
22
+
23
+ ## When NOT to Use
24
+
25
+ - **Audio-only content** — use the `podcast-generation` skill
26
+ - **Written articles or blog posts** — use the `content-research-writer` skill
27
+ - **Live streaming** — different workflow, real-time, less structured
28
+ - **Video editing instructions** — this skill plans content, not post-production
29
+
30
+ ## Video Types
31
+
32
+ ### Explainer Video (60-120 seconds)
33
+ Explain a concept, product, or process clearly and concisely.
34
+ - Hook: 5-10 seconds (the problem)
35
+ - Solution: 15-20 seconds (what it does)
36
+ - How it works: 30-60 seconds (key features/steps)
37
+ - CTA: 10-15 seconds (what to do next)
38
+
39
+ ### Tutorial / How-To (5-15 minutes)
40
+ Step-by-step instruction for completing a task.
41
+ - Intro: What we'll build/learn (30 seconds)
42
+ - Prerequisites: What you need (30 seconds)
43
+ - Steps: One section per step, show-then-explain
44
+ - Recap: Summary of what was accomplished
45
+ - Next steps: What to explore next
46
+
47
+ ### Product Demo (2-5 minutes)
48
+ Showcase a product's features and value.
49
+ - Problem statement: The pain point (15 seconds)
50
+ - Solution reveal: First look at the product (15 seconds)
51
+ - Feature walkthrough: 3-5 key features (2-3 minutes)
52
+ - Social proof: Testimonials or metrics (30 seconds)
53
+ - CTA: How to get started (15 seconds)
54
+
55
+ ### Presentation / Talk (10-30 minutes)
56
+ Structured presentation with slides and narration.
57
+ - Opening hook: Provocative question or statistic
58
+ - Agenda: What you'll cover
59
+ - Main sections: 3-5 key points with supporting visuals
60
+ - Summary: Key takeaways
61
+ - Q&A or CTA
62
+
63
+ ## Script Creation Process
64
+
65
+ ### Step 1: Define the Video
66
+
67
+ 1. **Goal**: What should the viewer do/know after watching?
68
+ 2. **Audience**: Who is watching? What do they already know?
69
+ 3. **Format**: Explainer / Tutorial / Demo / Presentation
70
+ 4. **Duration**: Target length
71
+ 5. **Platform**: YouTube / Social / Internal / Presentation
72
+ 6. **Tone**: Professional / Casual / Fun / Serious
73
+
74
+ ### Step 2: Write the Script
75
+
76
+ Use a two-column format for video scripts:
77
+
78
+ ```
79
+ TIME | VISUAL | AUDIO (Narration/VO)
80
+ --------|-------------------------------|---------------------------
81
+ 0:00 | Logo animation | [MUSIC: Upbeat intro]
82
+ 0:05 | Problem scenario: | "Have you ever spent hours
83
+ | Person frustrated at desk | trying to..."
84
+ 0:15 | Product UI appears | "Meet [Product]. It
85
+ | with smooth transition | solves this by..."
86
+ 0:30 | Screen recording: | "Here's how it works.
87
+ | Feature 1 demo | First, you..."
88
+ 1:00 | Screen recording: | "Next, simply click..."
89
+ | Feature 2 demo |
90
+ 1:30 | Results/metrics | "The result? Users save
91
+ | animated infographic | an average of..."
92
+ 1:45 | CTA screen with URL | "Get started free at..."
93
+ 2:00 | End card with logo | [MUSIC: Outro]
94
+ ```
95
+
96
+ ### Step 3: Storyboard
97
+
98
+ For each scene, sketch or describe:
99
+
100
+ ```
101
+ SCENE 1: Opening Hook
102
+ ┌─────────────────────────┐
103
+ │ │
104
+ │ [Person looking │
105
+ │ frustrated at │
106
+ │ cluttered desk] │
107
+ │ │
108
+ │ LOWER THIRD: │
109
+ │ "Sound familiar?" │
110
+ │ │
111
+ └─────────────────────────┘
112
+ Camera: Medium shot, eye level
113
+ Movement: Slow zoom in
114
+ Duration: 5 seconds
115
+ Transition: Cut to Scene 2
116
+ ```
117
+
118
+ ### Step 4: Shot List
119
+
120
+ ```markdown
121
+ | # | Scene | Shot Type | Camera | Movement | Duration | Notes |
122
+ |---|-------|-----------|--------|----------|----------|-------|
123
+ | 1 | Intro | Medium | Eye level | Zoom in | 5s | Talent at desk |
124
+ | 2 | Problem | Close-up | Slightly high | Static | 3s | Screen showing errors |
125
+ | 3 | Solution | Wide | Eye level | Pan right | 5s | Product reveal |
126
+ | 4 | Demo 1 | Screen cap | — | — | 15s | Feature walkthrough |
127
+ | 5 | Demo 2 | Screen cap | — | — | 15s | Second feature |
128
+ | 6 | Results | Medium | Eye level | Static | 10s | Metrics on screen |
129
+ | 7 | CTA | Medium | Eye level | Static | 10s | URL and QR code |
130
+ ```
131
+
132
+ ## Visual Storytelling Principles
133
+
134
+ ### Show, Don't Tell
135
+
136
+ - Bad: Narrator says "Our product is fast" over a static logo
137
+ - Good: Screen recording showing a task completing in 2 seconds with a timer visible
138
+
139
+ ### Pacing
140
+
141
+ **Rule of 8 seconds**: Change something visually every 8 seconds maximum to maintain attention.
142
+
143
+ Changes can be:
144
+ - Cut to a new scene
145
+ - Animation or transition
146
+ - Text appearing on screen
147
+ - Camera movement
148
+ - New visual element
149
+
150
+ ### Visual Hierarchy
151
+
152
+ **What the viewer sees first (in order):**
153
+ 1. Motion (anything moving grabs attention)
154
+ 2. Faces (we're hardwired to look at faces)
155
+ 3. Text (especially if it appears/animates)
156
+ 4. Color contrast (bright against dark)
157
+ 5. Size (larger elements dominate)
158
+
159
+ ### Text on Screen
160
+
161
+ - **Maximum 7 words** per text overlay
162
+ - **Minimum 2 seconds** display time per text element
163
+ - **High contrast**: White text on dark overlay, or dark text on light
164
+ - **Consistent placement**: Pick a position and stick with it
165
+ - **Font size**: Large enough to read on mobile (the smallest common screen)
166
+
167
+ ## Script Template
168
+
169
+ ```markdown
170
+ # [Video Title]
171
+
172
+ ## Metadata
173
+ - **Type**: [Explainer / Tutorial / Demo / Presentation]
174
+ - **Duration**: [Target length]
175
+ - **Audience**: [Who is this for]
176
+ - **Goal**: [What should viewer do/know after]
177
+ - **Platform**: [YouTube / Social / Internal]
178
+ - **Tone**: [Professional / Casual / Fun]
179
+
180
+ ## Script
181
+
182
+ ### Scene 1: Hook [0:00 — 0:10]
183
+ **Visual**: [Description of what's on screen]
184
+ **Audio**: "[Narration text]"
185
+ **Text on screen**: [Any overlay text]
186
+ **Music/SFX**: [Audio cues]
187
+
188
+ ### Scene 2: Problem [0:10 — 0:25]
189
+ **Visual**: [Description]
190
+ **Audio**: "[Narration]"
191
+
192
+ ### Scene 3: Solution [0:25 — 0:45]
193
+ **Visual**: [Description]
194
+ **Audio**: "[Narration]"
195
+
196
+ [Continue for all scenes...]
197
+
198
+ ### Final Scene: CTA [X:XX — X:XX]
199
+ **Visual**: [End card with logo, URL]
200
+ **Audio**: "[Call to action narration]"
201
+
202
+ ---
203
+
204
+ ## Production Notes
205
+ - [Equipment needed]
206
+ - [Locations]
207
+ - [Graphics/animations to create]
208
+ - [Stock footage needed]
209
+ - [Music tracks]
210
+
211
+ ## Post-Production
212
+ - [ ] Rough cut assembled
213
+ - [ ] Color correction
214
+ - [ ] Graphics and text overlays added
215
+ - [ ] Music and SFX mixed
216
+ - [ ] Captions/subtitles added
217
+ - [ ] Final review
218
+ - [ ] Export for target platform(s)
219
+ ```
220
+
221
+ ## Platform-Specific Guidelines
222
+
223
+ | Platform | Aspect Ratio | Max Duration | Key Consideration |
224
+ |---|---|---|---|
225
+ | YouTube | 16:9 | No limit | SEO title, thumbnail, first 30s crucial |
226
+ | TikTok / Reels | 9:16 | 3 min | Hook in first 1-2 seconds, vertical |
227
+ | LinkedIn | 16:9 or 1:1 | 10 min | Professional tone, captions essential |
228
+ | Twitter/X | 16:9 | 2:20 | Short, punchy, works without sound |
229
+ | Presentation | 16:9 | Varies | Clean slides, readable at distance |
230
+
231
+ ## Common Pitfalls
232
+
233
+ ### No Hook
234
+ **Problem**: Video starts with logo animation and slow intro — viewer clicks away.
235
+ **Fix**: Start with the most compelling content. Logo can come after the hook.
236
+
237
+ ### Wall of Text
238
+ **Problem**: Slides packed with paragraphs that the narrator reads verbatim.
239
+ **Fix**: One idea per visual. Use images and short phrases, not paragraphs.
240
+
241
+ ### Monotone Pacing
242
+ **Problem**: Same visual style and energy level throughout.
243
+ **Fix**: Vary shot types, pacing, and energy. Mix screen recordings with face-to-camera.
244
+
245
+ ### Missing Captions
246
+ **Problem**: No subtitles — excludes deaf viewers and those watching without sound (85% of social media video).
247
+ **Fix**: Always add captions. Most platforms support SRT upload or auto-generation.
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: web-design-guidelines
3
+ description: Audit web UI code for accessibility, responsiveness, performance, and UX best practices. Use when reviewing frontend code, checking accessibility compliance, auditing design patterns, or improving web interface quality.
4
+ ---
5
+
6
+ # Web Design Guidelines
7
+
8
+ Audit web UI code against industry-standard accessibility, responsiveness, performance, and UX best practices — producing actionable findings with file and line references.
9
+
10
+ ## When to Use
11
+
12
+ - Reviewing UI code for accessibility compliance (WCAG 2.1)
13
+ - Auditing responsive design across breakpoints
14
+ - Checking web performance patterns (Core Web Vitals)
15
+ - Evaluating UX patterns and interaction design
16
+ - Validating semantic HTML and ARIA usage
17
+ - Reviewing CSS architecture and specificity
18
+
19
+ ## When NOT to Use
20
+
21
+ - **Visual design review** — this skill audits code, not mockups or screenshots
22
+ - **Backend API review** — use the `code-review` or `security-audit` skill
23
+ - **Mobile native apps** — different platform guidelines apply
24
+ - **Content writing or copy review** — use `technical-writing` skill
25
+
26
+ ## Review Process
27
+
28
+ ### Step 1: Identify Files to Audit
29
+
30
+ Read the specified files (or ask the user which files to review). Focus on:
31
+ - HTML templates and JSX/TSX components
32
+ - CSS/SCSS/Tailwind stylesheets
33
+ - JavaScript/TypeScript interaction code
34
+ - Framework config (Next.js, Vite, etc.)
35
+
36
+ ### Step 2: Run Checklist Audits
37
+
38
+ Apply each category below. For every finding, output:
39
+ ```
40
+ file:line — [category] description (severity: critical|important|suggestion)
41
+ ```
42
+
43
+ ### Step 3: Summarize
44
+
45
+ Group findings by severity. Provide a score per category (pass / needs work / fail).
46
+
47
+ ## Audit Categories
48
+
49
+ ### 1. Accessibility (WCAG 2.1 AA)
50
+
51
+ **Images and media:**
52
+ - Every `<img>` must have a meaningful `alt` attribute (not "image", not empty for informational images)
53
+ - Decorative images: use `alt=""` or CSS background
54
+ - `<video>` and `<audio>` must have captions or transcripts
55
+
56
+ **Keyboard navigation:**
57
+ - All interactive elements must be reachable via Tab
58
+ - Focus order must follow visual order
59
+ - Custom components need proper `tabindex`, `role`, and key handlers
60
+ - Focus must be visible (no `outline: none` without replacement)
61
+
62
+ **Color and contrast:**
63
+ - Text contrast ratio: minimum 4.5:1 (normal text), 3:1 (large text)
64
+ - Information must not rely on color alone (add icons, patterns, or text)
65
+
66
+ **Forms:**
67
+ - Every input must have an associated `<label>` (or `aria-label`)
68
+ - Error messages must be programmatically associated with the field
69
+ - Required fields must be marked with `aria-required="true"`
70
+
71
+ **ARIA:**
72
+ - Use semantic HTML first (`<nav>`, `<main>`, `<aside>`) before ARIA roles
73
+ - Don't add `role` to elements that already have implicit roles
74
+ - Live regions (`aria-live`) for dynamic content updates
75
+
76
+ ### 2. Responsive Design
77
+
78
+ **Breakpoints:**
79
+ - Mobile-first approach (min-width media queries)
80
+ - Test at common breakpoints: 320px, 768px, 1024px, 1440px
81
+ - No horizontal scrollbar at any viewport width
82
+
83
+ **Layout:**
84
+ - Use relative units (rem, em, %, vw/vh) over fixed px for layout
85
+ - Flexible containers: prefer `max-width` over fixed `width`
86
+ - Grid and flexbox over float-based layouts
87
+
88
+ **Touch targets:**
89
+ - Minimum 44×44px touch target size (WCAG 2.5.5)
90
+ - Adequate spacing between interactive elements on mobile
91
+
92
+ **Typography:**
93
+ - Base font size: minimum 16px (prevents iOS zoom on focus)
94
+ - Line length: 45-75 characters for readability
95
+ - Use `clamp()` for fluid typography
96
+
97
+ **Images:**
98
+ - Use `srcset` and `sizes` for responsive images
99
+ - Serve WebP/AVIF with fallbacks
100
+ - Lazy-load below-fold images (`loading="lazy"`)
101
+
102
+ ### 3. Performance
103
+
104
+ **Loading:**
105
+ - Critical CSS inlined or loaded with high priority
106
+ - Non-critical JS deferred or loaded async
107
+ - Fonts: use `font-display: swap` to prevent invisible text
108
+
109
+ **Rendering:**
110
+ - Avoid layout shifts: set explicit `width` and `height` on images
111
+ - Minimize DOM depth and node count
112
+ - Use CSS `contain` for isolated components
113
+
114
+ **Bundle size:**
115
+ - Check for unused imports and dead code
116
+ - Prefer tree-shakeable ES modules
117
+ - Lazy-load routes and heavy components
118
+
119
+ **Core Web Vitals targets:**
120
+ | Metric | Good | Needs Improvement |
121
+ |--------|------|-------------------|
122
+ | LCP (Largest Contentful Paint) | ≤ 2.5s | ≤ 4.0s |
123
+ | INP (Interaction to Next Paint) | ≤ 200ms | ≤ 500ms |
124
+ | CLS (Cumulative Layout Shift) | ≤ 0.1 | ≤ 0.25 |
125
+
126
+ ### 4. Semantic HTML
127
+
128
+ - Use `<header>`, `<nav>`, `<main>`, `<section>`, `<article>`, `<aside>`, `<footer>` appropriately
129
+ - Heading hierarchy: one `<h1>` per page, no skipping levels
130
+ - Lists use `<ul>`/`<ol>`, not styled `<div>`s
131
+ - Tables use `<table>` with `<thead>`, `<th scope>` — not div grids
132
+ - Links (`<a>`) for navigation, buttons (`<button>`) for actions
133
+
134
+ ### 5. CSS Quality
135
+
136
+ **Architecture:**
137
+ - Consistent naming convention (BEM, utility-first, or CSS modules)
138
+ - No `!important` except for utility overrides
139
+ - Specificity: keep selectors shallow (≤ 3 levels)
140
+
141
+ **Common issues:**
142
+ - No orphaned or unused styles
143
+ - Avoid `z-index` wars (use a scale: 10, 20, 30...)
144
+ - Use CSS custom properties for theme values (colors, spacing, fonts)
145
+ - Prefer logical properties (`margin-inline`) for internationalization
146
+
147
+ ### 6. UX Patterns
148
+
149
+ **Feedback:**
150
+ - Loading states for async operations (skeleton screens or spinners)
151
+ - Error states with clear recovery actions
152
+ - Success confirmations for form submissions
153
+
154
+ **Navigation:**
155
+ - Current page/section clearly indicated
156
+ - Breadcrumbs for deep hierarchies
157
+ - Back navigation works as expected
158
+
159
+ **Forms:**
160
+ - Inline validation on blur (not just on submit)
161
+ - Preserve user input on validation failure
162
+ - Autocomplete attributes for common fields (`name`, `email`, `tel`)
163
+
164
+ ## Output Format
165
+
166
+ ```markdown
167
+ ## Audit Results: [file or component name]
168
+
169
+ ### Summary
170
+ | Category | Score | Findings |
171
+ |----------|-------|----------|
172
+ | Accessibility | needs work | 3 critical, 2 important |
173
+ | Responsive | pass | 1 suggestion |
174
+ | Performance | needs work | 1 critical |
175
+ | Semantic HTML | pass | 0 |
176
+ | CSS Quality | pass | 1 suggestion |
177
+ | UX Patterns | needs work | 2 important |
178
+
179
+ ### Critical
180
+ - `src/Login.tsx:42` — [accessibility] Input missing associated label
181
+ - `src/App.css:18` — [performance] Large unoptimized background image (2.3MB)
182
+
183
+ ### Important
184
+ - `src/Nav.tsx:15` — [accessibility] Focus indicator removed with no replacement
185
+ - `src/Card.tsx:8` — [ux] No loading state for async data fetch
186
+
187
+ ### Suggestions
188
+ - `src/Layout.tsx:30` — [responsive] Consider clamp() for fluid font sizing
189
+ ```
190
+
191
+ ## Common Anti-Patterns
192
+
193
+ ### Div Soup
194
+ **Problem:** Everything is a `<div>` with click handlers — no semantic meaning.
195
+ **Fix:** Use `<button>`, `<a>`, `<nav>`, `<main>`. Reserve `<div>` for layout wrappers.
196
+
197
+ ### Accessibility Afterthought
198
+ **Problem:** ARIA added after the fact without testing with screen readers.
199
+ **Fix:** Use semantic HTML first. Test with VoiceOver/NVDA during development.
200
+
201
+ ### Desktop-First Responsive
202
+ **Problem:** Designed for 1440px, then patched for mobile.
203
+ **Fix:** Start with mobile layout, progressively enhance for larger screens.
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: webapp-testing
3
+ description: Test and interact with local web applications using Playwright. Use when verifying frontend functionality, debugging UI behavior, capturing browser screenshots, or automating browser-based testing workflows.
4
+ ---
5
+
6
+ # Web Application Testing
7
+
8
+ Test local web applications by writing Playwright scripts. This skill covers browser automation, UI testing, visual regression, and interactive debugging for any web-based application.
9
+
10
+ ## When to Use
11
+
12
+ - Verifying frontend functionality works as expected
13
+ - Debugging UI behavior and visual rendering issues
14
+ - Capturing browser screenshots for documentation or comparison
15
+ - Automating repetitive browser testing workflows
16
+ - End-to-end testing of web applications
17
+ - Checking responsive design across viewport sizes
18
+
19
+ ## When NOT to Use
20
+
21
+ - **Unit testing logic** — use the `testing` skill for non-browser tests
22
+ - **API testing** — use direct HTTP calls or test frameworks
23
+ - **Performance benchmarking** — use browser DevTools or Lighthouse directly
24
+ - **Static code analysis** — use the `code-review` skill
25
+
26
+ ## Decision Tree: Choosing Your Approach
27
+
28
+ ```
29
+ User task → Is it static HTML?
30
+ ├─ Yes → Read HTML file directly to identify selectors
31
+ │ ├─ Success → Write Playwright script using selectors
32
+ │ └─ Fails/Incomplete → Treat as dynamic (below)
33
+
34
+ └─ No (dynamic webapp) → Is the server already running?
35
+ ├─ No → Start the server first (npm run dev, etc.)
36
+ │ Then write Playwright script
37
+
38
+ └─ Yes → Reconnaissance-then-action:
39
+ 1. Navigate and wait for networkidle
40
+ 2. Take screenshot or inspect DOM
41
+ 3. Identify selectors from rendered state
42
+ 4. Execute actions with discovered selectors
43
+ ```
44
+
45
+ ## Writing Playwright Scripts
46
+
47
+ ### Basic Pattern
48
+
49
+ ```python
50
+ from playwright.sync_api import sync_playwright
51
+
52
+ with sync_playwright() as p:
53
+ browser = p.chromium.launch(headless=True)
54
+ page = browser.new_page()
55
+ page.goto('http://localhost:5173')
56
+ page.wait_for_load_state('networkidle') # CRITICAL: Wait for JS to execute
57
+ # ... your automation logic
58
+ browser.close()
59
+ ```
60
+
61
+ ### Starting the Server
62
+
63
+ If the dev server is not running, start it first:
64
+
65
+ ```bash
66
+ # Start in background, wait for ready, then run tests
67
+ npm run dev &
68
+ sleep 5 # or use wait-on to detect port availability
69
+ python test_script.py
70
+ ```
71
+
72
+ For more reliable server management, use a process manager or run in a separate terminal.
73
+
74
+ ## Reconnaissance-Then-Action Pattern
75
+
76
+ The most reliable approach for dynamic web apps:
77
+
78
+ ### Step 1: Inspect Rendered DOM
79
+
80
+ ```python
81
+ page.goto('http://localhost:5173')
82
+ page.wait_for_load_state('networkidle')
83
+ page.screenshot(path='/tmp/inspect.png', full_page=True)
84
+ content = page.content()
85
+ buttons = page.locator('button').all()
86
+ ```
87
+
88
+ ### Step 2: Identify Selectors
89
+
90
+ From the inspection results, determine the best selectors for your target elements. Prefer role-based and text-based selectors over CSS selectors for resilience.
91
+
92
+ ### Step 3: Execute Actions
93
+
94
+ ```python
95
+ page.locator('text=Submit').click()
96
+ page.locator('[data-testid="email-input"]').fill('test@example.com')
97
+ page.wait_for_selector('.success-message')
98
+ ```
99
+
100
+ ## Common Patterns
101
+
102
+ ### Form Testing
103
+
104
+ ```python
105
+ page.fill('#username', 'testuser')
106
+ page.fill('#password', 'testpass')
107
+ page.click('button[type="submit"]')
108
+ page.wait_for_url('**/dashboard')
109
+ assert 'Welcome' in page.content()
110
+ ```
111
+
112
+ ### Visual Regression
113
+
114
+ ```python
115
+ page.set_viewport_size({'width': 1280, 'height': 720})
116
+ page.screenshot(path='screenshots/desktop.png')
117
+
118
+ page.set_viewport_size({'width': 375, 'height': 667})
119
+ page.screenshot(path='screenshots/mobile.png')
120
+ ```
121
+
122
+ ### Console Log Capture
123
+
124
+ ```python
125
+ logs = []
126
+ page.on('console', lambda msg: logs.append(f'{msg.type}: {msg.text}'))
127
+ page.goto('http://localhost:5173')
128
+ page.wait_for_load_state('networkidle')
129
+ for log in logs:
130
+ print(log)
131
+ ```
132
+
133
+ ### Element Discovery
134
+
135
+ ```python
136
+ # Find all interactive elements
137
+ buttons = page.locator('button').all()
138
+ links = page.locator('a').all()
139
+ inputs = page.locator('input').all()
140
+
141
+ for btn in buttons:
142
+ print(f'Button: {btn.text_content()} — visible: {btn.is_visible()}')
143
+ ```
144
+
145
+ ## Common Pitfalls
146
+
147
+ - **Not waiting for networkidle**: Dynamic apps need JS to execute before DOM is ready. Always call `page.wait_for_load_state('networkidle')` before inspecting.
148
+ - **Brittle selectors**: Prefer `text=`, `role=`, `data-testid=` over nth-child or deep CSS paths.
149
+ - **Not closing the browser**: Always call `browser.close()` to free resources.
150
+ - **Headless vs headed**: Use `headless=True` for CI/automation, `headless=False` for local debugging.
151
+ - **Timeout errors**: Increase timeouts for slow pages: `page.wait_for_selector('.element', timeout=10000)`.
152
+
153
+ ## Best Practices
154
+
155
+ - Use `sync_playwright()` for synchronous scripts (simpler and sufficient for most testing)
156
+ - Always close the browser when done
157
+ - Use descriptive selectors: `text=`, `role=`, CSS selectors, or IDs
158
+ - Add appropriate waits: `page.wait_for_selector()` or `page.wait_for_timeout()`
159
+ - Take screenshots at key steps for debugging
160
+ - Capture console logs to detect JavaScript errors
161
+ - Test multiple viewport sizes for responsive design
162
+ - Use `page.evaluate()` for complex DOM inspection