Init
A Claude Code skill for init workflows and automation
What Is Init?
Init is a specialized Claude Code skill designed to automate and streamline the process of setting up Playwright for end-to-end (E2E) testing in JavaScript and TypeScript projects. By leveraging project analysis and intelligent scaffolding, Init provides a fast, reliable way to bootstrap a production-ready Playwright environment that integrates seamlessly with popular web frameworks. Rather than manually configuring test infrastructure, developers can use Init to detect the project’s framework, generate configuration files, establish folder structures, and even create CI workflows—all through a single automated workflow.
Why Use Init?
Setting up Playwright for a new or existing project can be tedious and error-prone, especially when dealing with different frameworks or ensuring consistency across multiple repositories. Init addresses these challenges by automating repetitive setup tasks and enforcing best practices. Use cases include:
- Quickly onboarding new projects or team members onto standardized E2E testing infrastructure.
- Ensuring Playwright is correctly configured for the project’s framework (such as Next.js, React, Vue, Angular, or Svelte).
- Preventing misconfiguration or missing dependencies by automatically detecting the project’s environment.
- Saving time by generating example tests and CI workflows out-of-the-box.
- Simplifying the migration of legacy projects to modern testing practices.
By using Init, development teams can focus on writing meaningful E2E tests rather than wrestling with configuration, installation, or folder structure conventions.
How to Get Started
To use Init, invoke the skill when you want to bootstrap Playwright in your project. Typical trigger phrases include "set up playwright", "add e2e tests", "configure playwright", "testing setup", "init playwright", or "add test infrastructure".
The Init workflow consists of the following steps:
1. Project
Analysis
Init first scans your project using a dedicated subagent, which checks:
package.jsonto detect the framework (React, Next.js, Vue, Angular, Svelte).- The presence of
tsconfig.jsonto decide between TypeScript and JavaScript setup. - Whether
@playwright/testis already listed in dependencies. - Existing test directories, such as
tests/,e2e/, or__tests__/. - CI configuration files, like
.github/workflows/or.gitlab-ci.yml.
2. Playwright
Installation
If Playwright is not already installed, Init automatically runs:
npm init playwright@latest -- --quietAlternatively, for manual installation:
npm install -D @playwright/test
npx playwright install --with-deps chromium3. Configuration
Generation
Init generates a tailored playwright.config.ts based on the detected framework. For example, a Next.js-based project would receive:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html', { open: 'never' }],
['list'],
],
// Additional framework-specific settings
});4. Folder Structure and Example
Tests
Init creates or updates the test directory (e.g., e2e/), adds starter tests, and ensures the structure matches community standards.
5. CI Workflow
Integration
If a CI configuration is missing, Init generates the necessary workflow files. For GitHub Actions, this might include a .github/workflows/playwright.yml file to automate test execution.
Key Features
- Framework Detection: Automatically identifies React, Next.js, Vue, Angular, or Svelte projects and adapts configuration accordingly.
- TypeScript/JavaScript Support: Determines the language from project files and sets up the appropriate configuration.
- Automated Installation: Installs Playwright and its dependencies if not already present.
- Config Generation: Creates a comprehensive
playwright.config.tswith best-practice defaults for parallelism, retries, and reporting. - Folder Structure Enforcement: Establishes or updates the E2E test directory, adding example tests to jumpstart development.
- CI Integration: Detects or creates continuous integration workflows for Playwright, supporting GitHub Actions and other CI platforms.
- Idempotency: Safely re-runs without overwriting existing customized configuration or tests.
Best Practices
- Run Init on New Projects: Immediately set up Playwright with Init when starting a new codebase to ensure consistent test infrastructure.
- Customize Generated Files: Review and tailor the generated
playwright.config.tsand example tests to fit your specific requirements or coding standards. - Leverage CI Integration: Take advantage of the generated CI workflows to maintain test reliability across branches and pull requests.
- Maintain Test Directory Structure: Use the recommended folder (such as
e2e/) for all E2E tests to keep your project organized and maintainable. - Update Dependencies Regularly: Periodically re-run Init or update Playwright to benefit from the latest features and security patches.
Important Notes
- Init is designed to be safe and minimally invasive; it avoids overwriting existing custom configuration or tests unless explicitly directed.
- Always review generated files, especially CI workflows and configuration, before committing to version control.
- While Init streamlines Playwright setup, advanced customization may require manual intervention for complex project requirements.
- Init assumes a Node.js-based project structure. For non-standard setups, manual adjustments might be necessary.
- The skill is open-source and available for community contributions and enhancements. For more information or to report issues, refer to the Init GitHub repository.
More Skills You Might Like
Explore similar skills to enhance your workflow
Building Incident Response Playbooks
Designs and documents structured incident response playbooks that define step-by-step procedures for specific
Axiom Xcode MCP
iOS and xOS development guidance for Xcode MCP patterns and best practices
Meeting Insights Analyzer
Analyzes meeting transcripts and recordings to uncover behavioral patterns, communication insights, and actionable feedback. Identifies when you avoid
Building Identity Federation with SAML Azure AD
Establish SAML 2.0 identity federation between on-premises Active Directory and Azure AD (Microsoft Entra ID)
Analyzing Cyber Kill Chain
Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain framework to identify which phases
Backend Patterns
Implement and automate scalable backend architectural patterns for robust system development