From twake-guidelines
Use when writing, reviewing, or refactoring frontend tests in Twake/Cozy React projects. Enforces @testing-library/react (never Enzyme or TestCafe), data-testid attributes, queryBy + toBeInDocument()/toBe(null) patterns, colocated *.spec files (no __tests__ folders), and bans snapshot tests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/twake-guidelines:twake-frontend-testingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Apply these rules when writing or reviewing any frontend test in a Twake or Cozy React project.
Apply these rules when writing or reviewing any frontend test in a Twake or Cozy React project.
@testing-library/react.If you find legacy Enzyme or TestCafe tests while editing nearby code, leave them alone unless migration is the task at hand — migration is its own ticket.
Do not write toMatchSnapshot() / toMatchInlineSnapshot() tests. They rot silently: reviewers rubber-stamp regenerated snapshots, which defeats the point of a test.
Assert on explicit, meaningful properties instead:
// ❌ Forbidden
expect(container).toMatchSnapshot()
// ✅ Good
expect(screen.getByRole('heading')).toHaveTextContent('Welcome, Alice')
expect(screen.queryByTestId('error-banner')).toBe(null)
data-testiddata-testid attribute on any element a test needs to target, if no accessible role / label already works.getByRole / getByLabelText first (better for accessibility). Fall back to data-testid only when the semantic query is ambiguous or fragile.submit-btn, error-banner.queryBy vs getBy in assertionsUse the right helper for the right assertion:
| Intent | Helper | Matcher |
|---|---|---|
| Element must be present | getByX | — (getByX throws if absent) |
| Assert presence explicitly | queryByX | .toBeInTheDocument() |
| Assert absence | queryByX | .toBe(null) |
// ✅ Good
expect(screen.queryByTestId('submit-btn')).toBeInTheDocument()
expect(screen.queryByTestId('error-banner')).toBe(null)
// ❌ Avoid — passes even when the element doesn't render
expect(screen.getByTestId('submit-btn')).toBeDefined()
The .toBeDefined() pattern is a false positive: getByX throws on absence, so the matcher never actually runs the absent-case assertion.
Test files live next to the source file, not in a separate __tests__ folder.
components/
UserCard.jsx
UserCard.spec.jsx ✅ colocated
UserCard.styl
__tests__/ ❌ do not create
UserCard.jsx
Naming: <SourceFile>.spec.<ext> (e.g. UserCard.spec.jsx, formatAmount.spec.js).
describe per component or module; one it per behavior. Keep test names human-readable (it('shows an error when the password is too short')).npx claudepluginhub linagora/twake-guidelines --plugin twake-guidelinesProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.