@papi-ai/skills 0.1.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.
- package/README.md +53 -0
- package/bin/install.mjs +104 -0
- package/lib/manifest.d.ts +33 -0
- package/lib/manifest.mjs +102 -0
- package/manifest.json +52 -0
- package/package.json +47 -0
- package/skills/check-mcp/SKILL.md +40 -0
- package/skills/deployment-completeness-audit/SKILL.md +255 -0
- package/skills/papi-advanced/SKILL.md +28 -0
- package/skills/papi-build/SKILL.md +52 -0
- package/skills/papi-idea/SKILL.md +37 -0
- package/skills/papi-plan/SKILL.md +164 -0
- package/skills/papi-strategy/SKILL.md +28 -0
- package/skills/playwright-skill/API_REFERENCE.md +653 -0
- package/skills/playwright-skill/EXAMPLES.md +166 -0
- package/skills/playwright-skill/SKILL.md +147 -0
- package/skills/playwright-skill/lib/helpers.js +441 -0
- package/skills/playwright-skill/package.json +26 -0
- package/skills/playwright-skill/run.js +228 -0
- package/skills/pr-reviewer/SKILL.md +443 -0
- package/skills/pr-reviewer/references/gh_cli_guide.md +368 -0
- package/skills/pr-reviewer/references/review_criteria.md +345 -0
- package/skills/pr-reviewer/references/scenarios.md +71 -0
- package/skills/pr-reviewer/references/troubleshooting.md +55 -0
- package/skills/pr-reviewer/scripts/add_inline_comment.py +163 -0
- package/skills/pr-reviewer/scripts/fetch_pr_data.py +327 -0
- package/skills/pr-reviewer/scripts/generate_review_files.py +480 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Playwright Skill — Code Examples
|
|
2
|
+
|
|
3
|
+
## Test Responsive Design
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
// /tmp/playwright-test-responsive.js
|
|
7
|
+
const { chromium } = require('playwright');
|
|
8
|
+
|
|
9
|
+
const TARGET_URL = 'http://localhost:3001'; // Auto-detected
|
|
10
|
+
|
|
11
|
+
(async () => {
|
|
12
|
+
const browser = await chromium.launch({ headless: false });
|
|
13
|
+
const page = await browser.newPage();
|
|
14
|
+
|
|
15
|
+
const viewports = [
|
|
16
|
+
{ name: 'Desktop', width: 1920, height: 1080 },
|
|
17
|
+
{ name: 'Tablet', width: 768, height: 1024 },
|
|
18
|
+
{ name: 'Mobile', width: 375, height: 667 },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
for (const viewport of viewports) {
|
|
22
|
+
console.log(
|
|
23
|
+
`Testing ${viewport.name} (${viewport.width}x${viewport.height})`,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
await page.setViewportSize({
|
|
27
|
+
width: viewport.width,
|
|
28
|
+
height: viewport.height,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
await page.goto(TARGET_URL);
|
|
32
|
+
await page.waitForTimeout(1000);
|
|
33
|
+
|
|
34
|
+
await page.screenshot({
|
|
35
|
+
path: `/tmp/${viewport.name.toLowerCase()}.png`,
|
|
36
|
+
fullPage: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log('All viewports tested');
|
|
41
|
+
await browser.close();
|
|
42
|
+
})();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Test Login Flow
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
// /tmp/playwright-test-login.js
|
|
49
|
+
const { chromium } = require('playwright');
|
|
50
|
+
|
|
51
|
+
const TARGET_URL = 'http://localhost:3001'; // Auto-detected
|
|
52
|
+
|
|
53
|
+
(async () => {
|
|
54
|
+
const browser = await chromium.launch({ headless: false });
|
|
55
|
+
const page = await browser.newPage();
|
|
56
|
+
|
|
57
|
+
await page.goto(`${TARGET_URL}/login`);
|
|
58
|
+
|
|
59
|
+
await page.fill('input[name="email"]', 'test@example.com');
|
|
60
|
+
await page.fill('input[name="password"]', 'password123');
|
|
61
|
+
await page.click('button[type="submit"]');
|
|
62
|
+
|
|
63
|
+
// Wait for redirect
|
|
64
|
+
await page.waitForURL('**/dashboard');
|
|
65
|
+
console.log('Login successful, redirected to dashboard');
|
|
66
|
+
|
|
67
|
+
await browser.close();
|
|
68
|
+
})();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Fill and Submit Form
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// /tmp/playwright-test-form.js
|
|
75
|
+
const { chromium } = require('playwright');
|
|
76
|
+
|
|
77
|
+
const TARGET_URL = 'http://localhost:3001'; // Auto-detected
|
|
78
|
+
|
|
79
|
+
(async () => {
|
|
80
|
+
const browser = await chromium.launch({ headless: false, slowMo: 50 });
|
|
81
|
+
const page = await browser.newPage();
|
|
82
|
+
|
|
83
|
+
await page.goto(`${TARGET_URL}/contact`);
|
|
84
|
+
|
|
85
|
+
await page.fill('input[name="name"]', 'John Doe');
|
|
86
|
+
await page.fill('input[name="email"]', 'john@example.com');
|
|
87
|
+
await page.fill('textarea[name="message"]', 'Test message');
|
|
88
|
+
await page.click('button[type="submit"]');
|
|
89
|
+
|
|
90
|
+
// Verify submission
|
|
91
|
+
await page.waitForSelector('.success-message');
|
|
92
|
+
console.log('Form submitted successfully');
|
|
93
|
+
|
|
94
|
+
await browser.close();
|
|
95
|
+
})();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Check for Broken Links
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// /tmp/playwright-test-links.js
|
|
102
|
+
const { chromium } = require('playwright');
|
|
103
|
+
|
|
104
|
+
const TARGET_URL = 'http://localhost:3000'; // Auto-detected
|
|
105
|
+
|
|
106
|
+
(async () => {
|
|
107
|
+
const browser = await chromium.launch({ headless: false });
|
|
108
|
+
const page = await browser.newPage();
|
|
109
|
+
|
|
110
|
+
await page.goto(TARGET_URL);
|
|
111
|
+
|
|
112
|
+
const links = await page.locator('a[href^="http"]').all();
|
|
113
|
+
const results = { working: 0, broken: [] };
|
|
114
|
+
|
|
115
|
+
for (const link of links) {
|
|
116
|
+
const href = await link.getAttribute('href');
|
|
117
|
+
try {
|
|
118
|
+
const response = await page.request.head(href);
|
|
119
|
+
if (response.ok()) {
|
|
120
|
+
results.working++;
|
|
121
|
+
} else {
|
|
122
|
+
results.broken.push({ url: href, status: response.status() });
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {
|
|
125
|
+
results.broken.push({ url: href, error: e.message });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
console.log(`Working links: ${results.working}`);
|
|
130
|
+
console.log(`Broken links:`, results.broken);
|
|
131
|
+
|
|
132
|
+
await browser.close();
|
|
133
|
+
})();
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Take Screenshot with Error Handling
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
// /tmp/playwright-test-screenshot.js
|
|
140
|
+
const { chromium } = require('playwright');
|
|
141
|
+
|
|
142
|
+
const TARGET_URL = 'http://localhost:3000'; // Auto-detected
|
|
143
|
+
|
|
144
|
+
(async () => {
|
|
145
|
+
const browser = await chromium.launch({ headless: false });
|
|
146
|
+
const page = await browser.newPage();
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
await page.goto(TARGET_URL, {
|
|
150
|
+
waitUntil: 'networkidle',
|
|
151
|
+
timeout: 10000,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
await page.screenshot({
|
|
155
|
+
path: '/tmp/screenshot.png',
|
|
156
|
+
fullPage: true,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
console.log('Screenshot saved to /tmp/screenshot.png');
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.error('Error:', error.message);
|
|
162
|
+
} finally {
|
|
163
|
+
await browser.close();
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-skill
|
|
3
|
+
description: Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
**IMPORTANT - Path Resolution:**
|
|
7
|
+
This skill can be installed in different locations (plugin system, manual installation, global, or project-specific). Before executing any commands, determine the skill directory based on where you loaded this SKILL.md file, and use that path in all commands below. Replace `$SKILL_DIR` with the actual discovered path.
|
|
8
|
+
|
|
9
|
+
Common installation paths:
|
|
10
|
+
|
|
11
|
+
- Plugin system: `~/.claude/plugins/marketplaces/playwright-skill/skills/playwright-skill`
|
|
12
|
+
- Manual global: `~/.claude/skills/playwright-skill`
|
|
13
|
+
- Project-specific: `<project>/.claude/skills/playwright-skill`
|
|
14
|
+
|
|
15
|
+
# Playwright Browser Automation
|
|
16
|
+
|
|
17
|
+
General-purpose browser automation skill. I'll write custom Playwright code for any automation task you request and execute it via the universal executor.
|
|
18
|
+
|
|
19
|
+
**CRITICAL WORKFLOW - Follow these steps in order:**
|
|
20
|
+
|
|
21
|
+
1. **Auto-detect dev servers** - For localhost testing, ALWAYS run server detection FIRST:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd $SKILL_DIR && node -e "require('./lib/helpers').detectDevServers().then(servers => console.log(JSON.stringify(servers)))"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- If **1 server found**: Use it automatically, inform user
|
|
28
|
+
- If **multiple servers found**: Ask user which one to test
|
|
29
|
+
- If **no servers found**: Ask for URL or offer to help start dev server
|
|
30
|
+
|
|
31
|
+
2. **Write scripts to /tmp** - NEVER write test files to skill directory; always use `/tmp/playwright-test-*.js`
|
|
32
|
+
|
|
33
|
+
3. **Use visible browser by default** - Always use `headless: false` unless user specifically requests headless mode
|
|
34
|
+
|
|
35
|
+
4. **Parameterize URLs** - Always make URLs configurable via environment variable or constant at top of script
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
1. You describe what you want to test/automate
|
|
40
|
+
2. I auto-detect running dev servers (or ask for URL if testing external site)
|
|
41
|
+
3. I write custom Playwright code in `/tmp/playwright-test-*.js` (won't clutter your project)
|
|
42
|
+
4. I execute it via: `cd $SKILL_DIR && node run.js /tmp/playwright-test-*.js`
|
|
43
|
+
5. Results displayed in real-time, browser window visible for debugging
|
|
44
|
+
6. Test files auto-cleaned from /tmp by your OS
|
|
45
|
+
|
|
46
|
+
## Setup (First Time)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd $SKILL_DIR
|
|
50
|
+
npm run setup
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This installs Playwright and Chromium browser. Only needed once.
|
|
54
|
+
|
|
55
|
+
## Common Patterns
|
|
56
|
+
|
|
57
|
+
For full code examples (responsive testing, login flows, forms, broken link checks, screenshots), see [EXAMPLES.md](EXAMPLES.md).
|
|
58
|
+
|
|
59
|
+
**Quick reference — all scripts follow this template:**
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// /tmp/playwright-test-*.js
|
|
63
|
+
const { chromium } = require('playwright');
|
|
64
|
+
const TARGET_URL = 'http://localhost:3001'; // Auto-detected
|
|
65
|
+
|
|
66
|
+
(async () => {
|
|
67
|
+
const browser = await chromium.launch({ headless: false });
|
|
68
|
+
const page = await browser.newPage();
|
|
69
|
+
await page.goto(TARGET_URL);
|
|
70
|
+
// ... your automation code ...
|
|
71
|
+
await browser.close();
|
|
72
|
+
})();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Inline execution** for quick one-off tasks:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cd $SKILL_DIR && node run.js "
|
|
79
|
+
const browser = await chromium.launch({ headless: false });
|
|
80
|
+
const page = await browser.newPage();
|
|
81
|
+
await page.goto('http://localhost:3001');
|
|
82
|
+
await page.screenshot({ path: '/tmp/quick-screenshot.png', fullPage: true });
|
|
83
|
+
await browser.close();
|
|
84
|
+
"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Available Helpers
|
|
88
|
+
|
|
89
|
+
Optional utilities via `const helpers = require('./lib/helpers')`:
|
|
90
|
+
|
|
91
|
+
- `detectDevServers()` — Scan common ports for running dev servers (use first!)
|
|
92
|
+
- `safeClick(page, selector, opts)` — Click with retry logic
|
|
93
|
+
- `safeType(page, selector, text, opts)` — Type with auto-clear
|
|
94
|
+
- `takeScreenshot(page, name, opts)` — Timestamped screenshot
|
|
95
|
+
- `handleCookieBanner(page)` — Dismiss common cookie consent dialogs
|
|
96
|
+
- `extractTableData(page, selector)` — Parse HTML table to objects
|
|
97
|
+
- `createContext(browser, opts)` — Create context with env-configured headers
|
|
98
|
+
|
|
99
|
+
See `lib/helpers.js` for full list and signatures.
|
|
100
|
+
|
|
101
|
+
## Advanced Usage
|
|
102
|
+
|
|
103
|
+
For custom HTTP headers configuration, see the "Custom Headers via Environment Variables" section in [API_REFERENCE.md](API_REFERENCE.md).
|
|
104
|
+
|
|
105
|
+
For comprehensive Playwright API documentation, see [API_REFERENCE.md](API_REFERENCE.md):
|
|
106
|
+
|
|
107
|
+
- Selectors & Locators best practices
|
|
108
|
+
- Network interception & API mocking
|
|
109
|
+
- Authentication & session management
|
|
110
|
+
- Visual regression testing
|
|
111
|
+
- Mobile device emulation
|
|
112
|
+
- Performance testing
|
|
113
|
+
- Debugging techniques
|
|
114
|
+
- CI/CD integration
|
|
115
|
+
|
|
116
|
+
## Tips
|
|
117
|
+
|
|
118
|
+
- **Detect servers FIRST** - Always run `detectDevServers()` before writing test code for localhost testing
|
|
119
|
+
- **Use /tmp for test files** - Write to `/tmp/playwright-test-*.js`, never to skill directory or user's project
|
|
120
|
+
- **Parameterize URLs** - Put detected/provided URL in a `TARGET_URL` constant at the top of every script
|
|
121
|
+
- **Visible browser by default** - Always use `headless: false` unless user explicitly requests headless mode
|
|
122
|
+
- **Wait strategies** - Use `waitForURL`, `waitForSelector`, `waitForLoadState` instead of fixed timeouts
|
|
123
|
+
- **Error handling** - Always use try-catch for robust automation
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
**Playwright not installed:**
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
cd $SKILL_DIR && npm run setup
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Module not found:**
|
|
134
|
+
Ensure running from skill directory via `run.js` wrapper
|
|
135
|
+
|
|
136
|
+
**Browser doesn't open:**
|
|
137
|
+
Check `headless: false` and ensure display available
|
|
138
|
+
|
|
139
|
+
**Element not found:**
|
|
140
|
+
Add wait: `await page.waitForSelector('.element', { timeout: 10000 })`
|
|
141
|
+
|
|
142
|
+
## Notes
|
|
143
|
+
|
|
144
|
+
- Custom-written automation for each request — not limited to pre-built scripts
|
|
145
|
+
- Auto-detects running dev servers to eliminate hardcoded URLs
|
|
146
|
+
- Test scripts written to `/tmp` for automatic cleanup
|
|
147
|
+
- For full code examples see [EXAMPLES.md](EXAMPLES.md), for advanced API usage see [API_REFERENCE.md](API_REFERENCE.md)
|