DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to have an AI assistant write tests that follow team rules with Agentic Playwright

Use the bundled rules and write-time hook so Claude Code or Cursor produces tests in the project's required style.

Short answer: Scaffold the project with npm create agentic-playwright . -- --demo, or use the Dev Container; then open the project in Claude Code or Cursor so the rule files for that tool load automatically; ask the assistant for a test covering one feature of your application and let it follow the Constitution and skills. All steps.

Who it is forA developer or QA lead who wants AI assistant output to match team conventions without re-explaining them in every prompt.

The problemAI assistants tend to write tests with XPath, hard waits, any types, and inconsistent structure unless they are told the rules each time.

The outcomeA new test file using page objects, Given/When/Then steps, and web-first assertions, with the forbidden patterns blocked by the hook.

What you need first

  • Node.js v22.x or later
  • npm v10.x or later
  • An empty directory or empty git repo for the test project
  • A web application URL to test, or the --demo option to try the bundled demo app

Steps

  1. Scaffold the project with npm create agentic-playwright . -- --demo, or use the Dev Container.
  2. Open the project in Claude Code or Cursor so the rule files for that tool load automatically.
  3. Ask the assistant for a test covering one feature of your application and let it follow the Constitution and skills.
  4. Check that the output has no waitForTimeout, XPath, or any type, and that the hook blocks those patterns if the assistant tries to write them.
  5. Run npm test to confirm the new test passes.

Prompt for your agent

In the agentic-playwright repo, write a Playwright test for <feature-under-test> using the Constitution and skills under .claude/. Expected output: a spec with page objects, Given/When/Then steps, web-first assertions, and one tag. Verify the file has no waitForTimeout, XPath, or any type, and that `npm test` passes.

Caveat. The README says the hook covers only mechanically detectable patterns, so you still need to review AI-written tests for correctness.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for idavidov13/agentic-playwright and "Have an AI assistant write tests that follow team rules"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer