Skip to content

chore: enhancements to claude code#904

Draft
carlosthe19916 wants to merge 11 commits intoguacsec:mainfrom
carlosthe19916:claude/skills
Draft

chore: enhancements to claude code#904
carlosthe19916 wants to merge 11 commits intoguacsec:mainfrom
carlosthe19916:claude/skills

Conversation

@carlosthe19916
Copy link
Collaborator

@carlosthe19916 carlosthe19916 commented Jan 31, 2026

Summary by Sourcery

Introduce a structured Claude E2E testing workflow with Playwright-specific agents, hooks, and skills, and integrate automatic execution of relevant tests on file changes.

Enhancements:

  • Revise the e2e-test command to orchestrate planning, generation, and verification phases for Playwright UI tests.
  • Add specialized agents for Playwright test planning, generation, execution, and healing to standardize E2E test authoring and maintenance.
  • Define a GitHub assistant skill and a Playwright quality-check skill to streamline repository operations and Playwright code conventions.
  • Introduce reusable scripts to start and stop a remote Playwright container and to run linting and formatting checks via npm.

Tests:

  • Add a PostToolUse hook that detects newly written or edited Playwright and API test files and automatically runs only the affected tests with targeted execution.

Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 31, 2026

Reviewer's Guide

Adds a Claude E2E testing workflow centered around Playwright, including new planner/generator/healer/executor agents, containerized Playwright remote server management hooks, an auto-execution PostToolUse hook, lint/format automation, and a refined e2e-test command plus GitHub/Playwright skills metadata.

Sequence diagram for the new Playwright E2E testing workflow

sequenceDiagram
    actor Developer
    participant Claude
    participant e2e_test_command
    participant playwright_test_planner
    participant playwright_test_generator
    participant playwright_test_executor
    participant playwright_test_healer
    participant lint_and_format_hook
    participant playwright_remote_start
    participant playwright_remote_stop
    participant PlaywrightServer

    Developer->>Claude: Request E2E Playwright tests
    Claude->>e2e_test_command: Invoke e2e-test command

    e2e_test_command->>playwright_test_planner: Plan test strategy
    playwright_test_planner-->>e2e_test_command: Test plan

    e2e_test_command->>playwright_test_generator: Generate Playwright tests
    playwright_test_generator-->>e2e_test_command: Test code

    e2e_test_command->>lint_and_format_hook: Run lint-and-format.sh
    lint_and_format_hook->>lint_and_format_hook: npm run format:fix
    lint_and_format_hook->>lint_and_format_hook: npm run check:write
    lint_and_format_hook->>lint_and_format_hook: npm run check
    lint_and_format_hook-->>e2e_test_command: Lint/format results

    e2e_test_command->>playwright_remote_start: Run playwright-remote-start.sh
    playwright_remote_start->>PlaywrightServer: Start containerized server
    PlaywrightServer-->>playwright_remote_start: Ready on port 5000
    playwright_remote_start-->>e2e_test_command: Runtime info

    e2e_test_command->>playwright_test_executor: Execute tests (PostToolUse hook)
    playwright_test_executor->>PlaywrightServer: Run Playwright tests
    PlaywrightServer-->>playwright_test_executor: Test results

    alt Tests failed
        playwright_test_executor->>playwright_test_healer: Request healing
        playwright_test_healer-->>playwright_test_executor: Updated tests/fixes
    end

    e2e_test_command->>playwright_remote_stop: Run playwright-remote-stop.sh
    playwright_remote_stop->>PlaywrightServer: Stop container
    PlaywrightServer-->>playwright_remote_stop: Stopped
    playwright_remote_stop-->>e2e_test_command: Stop confirmation

    e2e_test_command-->>Claude: Final E2E report
    Claude-->>Developer: Summarized results and next steps
Loading

File-Level Changes

Change Details Files
Redefine the e2e-test Claude command to use a multi-phase workflow with dedicated Playwright planner, generator, healer, and executor agents.
  • Rename and expand metadata for the e2e-test command, clarifying it generates Playwright E2E tests from a message argument.
  • Replace previous manual guidance with a three-phase process: gather context from app and existing tests, plan via playwright-test-planner, generate via playwright-test-generator, then verify via healer and executor agents.
  • Constrain execution to only new or edited tests and require final output to include coverage summary, per-file status, and recommendations.
.claude/commands/e2e-test.md
Introduce a PostToolUse hook that automatically runs only the touched Playwright or API E2E tests using a remote Playwright server container.
  • Add a Bash hook that parses JSON tool responses with jq to detect written/edited test files and their session IDs.
  • Match file paths against Playwright UI and API test patterns, track tested files per session to avoid re-running, and build targeted npm commands (including optional grep by new test names extracted from structured patches).
  • Start and stop a remote Playwright server container via helper scripts, run tests with timeout and proper env vars, and emit structured success JSON or blocking failure output with logs.
  • Use a per-session tracking file under /tmp to remember which files have been tested and avoid duplicates.
  • Handle both Write and Edit tool_name cases with different command construction strategies.
.claude/hooks/execute-playwright-test.sh
Add Claude agents for planning, generating, healing, and executing Playwright tests, wired to custom MCP tools and container orchestration.
  • Define playwright-test-planner agent that explores the UI via browser tools, designs comprehensive test plans, and persists them as markdown using planner_setup_page and planner_save_plan.
  • Define playwright-test-generator agent that consumes a plan, uses generator_setup_page and browser tools to execute each step, reads the generator log, and writes single-test spec files under describes matching top-level plan items.
  • Define playwright-test-healer agent that runs tests, debugs failures with test_run/test_debug and browser inspection tools, edits tests via Edit/MultiEdit/Write, and can mark flaky cases with test.fixme().
  • Define playwright-test-executor agent that validates file paths, detects test type, manages a claude-playwright-{session_id} container, builds a grep-filtered npm command, runs with timeout, parses results, and reports structured success/failure guidance and cleanup behavior.
.claude/agents/playwright-test-executor.md
.claude/agents/playwright-test-generator.md
.claude/agents/playwright-test-planner.md
.claude/agents/playwright-test-healer.md
Provide container lifecycle hooks to start and stop a shared Playwright remote server in podman or docker.
  • Add a start script that detects podman/docker, runs the official Playwright image with network host, pwuser user, and run-server on port 5000, and supports a configurable container name.
  • Add a stop script that detects podman/docker, stops a given container by name, and exposes simple CLI usage with help flags.
.claude/hooks/playwright-remote-start.sh
.claude/hooks/playwright-remote-stop.sh
Add Claude skills metadata for GitHub and Playwright code quality plus an npm-based lint/format hook.
  • Introduce a GitHub skill that wraps gh CLI usage with concise communication rules, conventional commit conventions, branch naming guidelines, and PR comment TODO checkbox format.
  • Introduce a Playwright skill that defines local Playwright testing patterns and anti-patterns (fixtures, custom expect, type-safe abstractions, and where assertions should live).
  • Add a lint-and-format hook script that runs npm format:fix, check:write, and check sequentially under strict bash options.
  • Create base Claude settings JSON file (currently empty or default-config placeholder).
.claude/skills/github/SKILL.md
.claude/skills/playwright/SKILL.md
.claude/hooks/lint-and-format.sh
.claude/settings.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.91%. Comparing base (9e82125) to head (076e89a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #904      +/-   ##
==========================================
- Coverage   64.40%   63.91%   -0.49%     
==========================================
  Files         187      187              
  Lines        3295     3295              
  Branches      746      746              
==========================================
- Hits         2122     2106      -16     
- Misses        875      891      +16     
  Partials      298      298              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant

Comments