.agents/skills/testing-patterns/SKILL.md
Testing patterns and principles. Unit, integration, mocking strategies.
npx skillsauth add edpachecojr/sentinel testing-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Principles for reliable test suites.
/\ E2E (Few)
/ \ Critical flows
/----\
/ \ Integration (Some)
/--------\ API, DB queries
/ \
/------------\ Unit (Many)
Functions, classes
| Step | Purpose | |------|---------| | Arrange | Set up test data | | Act | Execute code under test | | Assert | Verify outcome |
| Type | Best For | Speed | |------|----------|-------| | Unit | Pure functions, logic | Fast (<50ms) | | Integration | API, DB, services | Medium | | E2E | Critical user flows | Slow |
| Principle | Meaning | |-----------|---------| | Fast | < 100ms each | | Isolated | No external deps | | Repeatable | Same result always | | Self-checking | No manual verification | | Timely | Written with code |
| Test | Don't Test | |------|------------| | Business logic | Framework code | | Edge cases | Third-party libs | | Error handling | Simple getters |
| Area | Focus | |------|-------| | API endpoints | Request/response | | Database | Queries, transactions | | External services | Contracts |
| Phase | Action | |-------|--------| | Before All | Connect resources | | Before Each | Reset state | | After Each | Clean up | | After All | Disconnect |
| Mock | Don't Mock | |------|------------| | External APIs | The code under test | | Database (unit) | Simple dependencies | | Time/random | Pure functions | | Network | In-memory stores |
| Type | Use | |------|-----| | Stub | Return fixed values | | Spy | Track calls | | Mock | Set expectations | | Fake | Simplified implementation |
| Pattern | Example | |---------|---------| | Should behavior | "should return error when..." | | When condition | "when user not found..." | | Given-when-then | "given X, when Y, then Z" |
| Level | Use | |-------|-----| | describe | Group related tests | | it/test | Individual case | | beforeEach | Common setup |
| Approach | Use | |----------|-----| | Factories | Generate test data | | Fixtures | Predefined datasets | | Builders | Fluent object creation |
| Practice | Why | |----------|-----| | One assert per test | Clear failure reason | | Independent tests | No order dependency | | Fast tests | Run frequently | | Descriptive names | Self-documenting | | Clean up | Avoid side effects |
| ❌ Don't | ✅ Do | |----------|-------| | Test implementation | Test behavior | | Duplicate test code | Use factories | | Complex test setup | Simplify or split | | Ignore flaky tests | Fix root cause | | Skip cleanup | Reset state |
Remember: Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
tools
UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.
tools
Configure TOTP authenticator apps, send OTP codes via email/SMS, manage backup codes, handle trusted devices, and implement 2FA sign-in flows using Better Auth's twoFactor plugin. Use when users need MFA, multi-factor authentication, authenticator setup, or login security with Better Auth.
development
Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.