Create CLAUDE.md / AGENTS.md for a QA Automation Repository
Generate a CLAUDE.md or AGENTS.md file that gives an AI coding assistant accurate, opinionated context about your QA automation repository — selector strategy, assertion style, naming, and what the AI must not change.
You are a senior QA automation engineer setting up an AI coding assistant for a test automation repository. Generate a CLAUDE.md (or AGENTS.md) file that gives the AI assistant accurate, opinionated context to work effectively in this repo. Repository purpose: {{REPO_PURPOSE}} Automation framework and language: {{FRAMEWORK_STACK}} Folder structure (brief): {{FOLDER_STRUCTURE}} Selector strategy: {{SELECTOR_STRATEGY}} Assertion style and libraries: {{ASSERTION_STYLE}} Test naming conventions: {{NAMING_CONVENTIONS}} Test data approach: {{TEST_DATA_APPROACH}} Areas the AI must NOT change: {{DO_NOT_TOUCH}} Good examples of existing patterns to follow: {{GOOD_EXAMPLES}} Anti-patterns the AI should refuse to write: {{ANTI_PATTERNS}} Generate a CLAUDE.md / AGENTS.md file with the following sections: ## Overview What this repo does, what application it tests, and the primary automation framework. ## Key commands The commands needed to install dependencies, run the full suite, run a subset by tag, and lint/type-check. ## Architecture Brief description of the folder structure, what lives where, and how tests are organised. ## Selector strategy Precise rules for how to locate elements — e.g., prefer data-testid, then ARIA roles, then visible text; never use CSS class names or XPath. Include an example of correct and incorrect selector usage. ## Assertion style Which assertion library and style to use. Include a correct and an incorrect example. ## Test naming conventions Rules for naming test files, describe blocks, and individual test cases. ## Test data How test data is managed — where it lives, how it is seeded, and the hard rule that real credentials, PII, and production data must never appear in the repo. ## Do not change Explicit list of files, directories, or patterns the AI must not modify without explicit instruction. Explain why for each. ## Anti-patterns to refuse Things the AI must refuse to generate even if asked — e.g., hardcoded waits, CSS class selectors, disabling linting rules, committing secrets. ## Code review checklist A short checklist the AI should run against any test it generates before presenting it. Keep the file concise — under 400 lines. This file will be read by the AI on every interaction, so precision matters more than length.
{{REPO_PURPOSE}}requiredWhat this repository tests
e.g. End-to-end Playwright tests for the Customer Portal web app
{{FRAMEWORK_STACK}}requiredAutomation framework and language
e.g. Playwright + TypeScript
{{FOLDER_STRUCTURE}}requiredBrief overview of the repo folder layout
e.g. tests/ (specs), pages/ (page objects), fixtures/ (Playwright fixtures), data/ (test data JSON), utils/ (helpers)
{{SELECTOR_STRATEGY}}requiredRules for how to locate elements
e.g. 1. data-testid attribute; 2. ARIA role + name; 3. visible text. Never CSS classes, IDs, or XPath.
{{ASSERTION_STYLE}}requiredAssertion library and preferred style
e.g. Playwright expect(); always assert the specific value, not just that an element exists
{{NAMING_CONVENTIONS}}requiredNaming rules for test files, describe, and test names
e.g. Files: <feature>.spec.ts; describe: 'Feature — scenario'; test: 'should <expected result> when <condition>'
{{TEST_DATA_APPROACH}}requiredHow test data is created and managed
e.g. Synthetic data only; API-seeded via beforeAll; JSON fixtures in data/; no hardcoded emails or passwords
{{DO_NOT_TOUCH}}requiredFiles or directories the AI must never modify
e.g. playwright.config.ts (team-owned); .github/workflows/ (DevOps team); data/users.json (read-only seed data)
{{GOOD_EXAMPLES}}Paths to existing tests that represent good patterns
e.g. tests/auth/login.spec.ts (good POM usage); tests/checkout/payment.spec.ts (good data isolation)
{{ANTI_PATTERNS}}requiredThings the AI must refuse to generate
e.g. page.waitForTimeout(); CSS class selectors; hardcoded URLs; test data with real-looking email addresses
- Test the generated CLAUDE.md by asking Claude Code to write a new test and verifying it follows the stated conventions.
- Confirm the 'do not touch' list covers all files your team manages outside the test suite.
- Check that the selector strategy section includes both a correct and incorrect example — AI follows by example.
- Verify the anti-patterns section is specific enough to be actionable, not just 'write clean code'.
- Keep the file under 400 lines — an overly long CLAUDE.md loses effectiveness as the AI tries to process it.
AI output requires human review before use. These checks are your responsibility.
- A CLAUDE.md is only as accurate as the inputs — vague instructions produce vague guidance for the AI.
- The AI assistant will not follow the CLAUDE.md perfectly — treat it as a strong default, not a hard constraint.
- CLAUDE.md goes stale as the codebase evolves; schedule reviews when the framework or conventions change.
- Never include actual credentials, API keys, or sensitive configuration in CLAUDE.md — it is committed to source control.