Skip to content

Commit 2f7fe20

Browse files
authored
claude: expand claude md instructions for testing (#15440)
Expanded some instrucitons in claude.md to cover some annoying patterns claude falls into
1 parent 6139508 commit 2f7fe20

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ Payload is a monorepo structured around Next.js, containing the core CMS platfor
6262
- Use JSDoc for complex functions; add tags only when justified beyond type signature
6363
- Use `import type` for types, regular `import` for values, separate statements even from same module
6464
- Prefix booleans with `is`/`has`/`can`/`should` (e.g., `isValid`, `hasData`) for clarity
65+
- Prefer self describing function and variable names over generic names with comments to explain their purpose
6566
- Commenting Guidelines
67+
6668
- Execution flow: Skip comments when code is self-documenting. Keep for complex logic, non-obvious "why", multi-line context, or if following a documented, multi-step flow.
6769
- Top of file/module: Use sparingly; only for non-obvious purpose/context or an overview of complex logic.
6870
- Type definitions: Property/interface documentation is always acceptable.
71+
6972
- Logger Usage (`payload.logger.error`)
7073
- Valid: `payload.logger.error('message')` or `payload.logger.error({ msg: '...', err: error })`
7174
- Invalid: `payload.logger.error('message', err)` - don't pass error as second argument
@@ -146,6 +149,8 @@ Screenshots are saved to `.playwright-mcp/` and displayed inline.
146149
- If you create a database record in a test, you MUST delete it before the test completes
147150
- For multiple tests with similar cleanup needs, use `afterEach` to centralize cleanup logic
148151
- Track created resources (IDs, files, etc.) in a shared array within the `describe` block
152+
- Do not use conditionals in tests where it can be avoided such as `if else`
153+
- Do not use `try {} finally {}` in e2e tests; prefer Playwright cleanup hooks (`afterEach`, `afterAll`)
149154

150155
**Example pattern:**
151156

0 commit comments

Comments
 (0)