Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(cli): support "install --skills=agents" (#39842)

Dmitry Gozmanb4c002785138
diff --git a/packages/playwright-core/src/tools/cli-client/program.ts b/packages/playwright-core/src/tools/cli-client/program.ts
index 00518aa099..de3095bcb7 100644
--- a/packages/playwright-core/src/tools/cli-client/program.ts
+++ b/packages/playwright-core/src/tools/cli-client/program.ts
@@ -209,9 +209,10 @@ async function install(args: MinimistArgs) {
await fs.promises.mkdir(playwrightDir, { recursive: true });
console.log(`✅ Workspace initialized at \`${cwd}\`.`);
- if (args.skills) {
+ if (args.skills !== undefined) {
+ const target = args.skills === 'agents' ? 'agents' : 'claude';
const skillSourceDir = path.join(__dirname, 'skill');
- const skillDestDir = path.join(cwd, '.claude', 'skills', 'playwright-cli');
+ const skillDestDir = path.join(cwd, `.${target}`, 'skills', 'playwright-cli');
if (!fs.existsSync(skillSourceDir)) {
console.error('❌ Skills source directory not found:', skillSourceDir);
diff --git a/packages/playwright-core/src/tools/cli-daemon/commands.ts b/packages/playwright-core/src/tools/cli-daemon/commands.ts
index ab018b86cb..e82d673d9d 100644
--- a/packages/playwright-core/src/tools/cli-daemon/commands.ts
+++ b/packages/playwright-core/src/tools/cli-daemon/commands.ts
@@ -904,7 +904,7 @@ const install = declareCommand({
category: 'install',
args: z.object({}),
options: z.object({
- skills: z.boolean().optional().describe('Install skills for Claude / GitHub Copilot'),
+ skills: z.string().optional().describe('Install skills to ".claude" (default) or ".agents" dir'),
}),
toolName: '',
toolParams: () => ({}),
diff --git a/tests/mcp/cli-misc.spec.ts b/tests/mcp/cli-misc.spec.ts
index 96d43dbf78..6eab31052a 100644
--- a/tests/mcp/cli-misc.spec.ts
+++ b/tests/mcp/cli-misc.spec.ts
@@ -52,6 +52,14 @@ test('install workspace w/skills', async ({ cli }, testInfo) => {
expect(references.length).toBeGreaterThan(0);
});
+test('install workspace w/--skills=agents', async ({ cli }, testInfo) => {
+ const { output } = await cli('install', '--skills=agents');
+ expect(output).toContain(`Skills installed to \`.agents${path.sep}skills${path.sep}playwright-cli\`.`);
+
+ const skillFile = testInfo.outputPath('.agents', 'skills', 'playwright-cli', 'SKILL.md');
+ expect(fs.existsSync(skillFile)).toBe(true);
+});
+
test('install handles browser detection', async ({ cli }) => {
const { output } = await cli('install');
// Verify that one of the browser detection outcomes occurred