vitest-testing
**AI-friendly comprehensive testing guidance for Vitest with practical patterns and behavior-driven development.**
What this skill does
# Vitest Testing Skill - Master Reference
**AI-friendly comprehensive testing guidance for Vitest with practical patterns and behavior-driven development.**
> **For humans:** Start with [README.md](README.md) for full navigation
> **For AI agents:** This file provides quick access to all skill resources
---
## ๐ฏ Quick Access for Agents
### Decision Support
- **What type of test should I write?** โ [index.md](index.md)
- **How do I structure this test?** โ [principles/aaa-pattern.md](principles/aaa-pattern.md)
- **Is this code testable?** โ [refactoring/testability-patterns.md](refactoring/testability-patterns.md)
### Most Referenced Patterns
- **[F.I.R.S.T Principles](principles/first-principles.md)** - Fast, Isolated, Repeatable, Self-Checking, Timely
- **[AAA Pattern](principles/aaa-pattern.md)** - Arrange-Act-Assert structure
- **[Black Box Testing](strategies/black-box-testing.md)** - Test behavior through public APIs
- **[Test Doubles](patterns/test-doubles.md)** - Mocks, stubs, spies, fakes
---
## ๐ Skill Organization
### Core Principles `/principles/`
Foundation concepts that guide all testing decisions:
| File | Purpose | When to Use |
|------|---------|-------------|
| [first-principles.md](principles/first-principles.md) | F.I.R.S.T quality attributes | Every test |
| [aaa-pattern.md](principles/aaa-pattern.md) | Arrange-Act-Assert structure | Structuring tests |
| [bdd-integration.md](principles/bdd-integration.md) | Given/When/Then with AAA | Business-focused tests |
### Testing Strategies `/strategies/`
Approaches for different testing scenarios:
| File | Purpose | When to Use |
|------|---------|-------------|
| [black-box-testing.md](strategies/black-box-testing.md) | Testing via public APIs | Default approach (99% of tests) |
| [implementation-details.md](strategies/implementation-details.md) | When to test internals | Rare exceptions only |
### Practical Patterns `/patterns/`
Ready-to-use patterns for common scenarios:
| File | Purpose | When to Use |
|------|---------|-------------|
| [test-doubles.md](patterns/test-doubles.md) | Mocks, stubs, spies, fakes | Isolating dependencies |
| [async-testing.md](patterns/async-testing.md) | Testing promises, async/await | Async operations |
| [error-testing.md](patterns/error-testing.md) | Testing exceptions, edge cases | Error scenarios |
| [component-testing.md](patterns/component-testing.md) | React/Vue component patterns | UI components |
| [api-testing.md](patterns/api-testing.md) | HTTP clients, REST APIs | API integration |
| [performance-testing.md](patterns/performance-testing.md) | Benchmarks, load testing | Performance-critical code |
| [test-data.md](patterns/test-data.md) | Factories, builders, fixtures | Test data management |
### Refactoring for Testability `/refactoring/`
Transform untestable code into testable code:
| File | Purpose | When to Use |
|------|---------|-------------|
| [testability-patterns.md](refactoring/testability-patterns.md) | Extract pure functions, DI, etc. | Code hard to test |
### Quick Reference `/quick-reference/`
Fast lookups and decision aids:
| File | Purpose | When to Use |
|------|---------|-------------|
| [cheatsheet.md](quick-reference/cheatsheet.md) | Syntax, matchers, mocking | Quick syntax lookup |
| [jest-to-vitest.md](quick-reference/jest-to-vitest.md) | Migration from Jest | Migrating projects |
---
## ๐ค Agent Integration Points
### For typescript-coder Agent
**When writing tests:**
```typescript
// 1. Check decision tree
const testType = checkDecisionTree(codeType)
// Reference: /skills/vitest-testing/index.md
// 2. Apply F.I.R.S.T principles
ensureTestsAreFast() // < 100ms
ensureTestsAreIsolated() // No shared state
// Reference: /skills/vitest-testing/principles/first-principles.md
// 3. Use AAA structure
// Arrange โ Act โ Assert
// Reference: /skills/vitest-testing/principles/aaa-pattern.md
// 4. Follow black box strategy
testThroughPublicAPI() // Not private methods
// Reference: /skills/vitest-testing/strategies/black-box-testing.md
```
**When refactoring:**
```typescript
// Check if code is testable
if (isHardToTest(code)) {
// Apply testability patterns
applyPattern(testabilityPatterns)
// Reference: /skills/vitest-testing/refactoring/testability-patterns.md
}
```
### For Code Review Agents
**Check these aspects:**
- [ ] Tests follow F.I.R.S.T principles
- [ ] Tests use AAA structure
- [ ] Tests use black box approach (public APIs only)
- [ ] Proper mocking of external dependencies
- [ ] Error scenarios covered
- [ ] Async operations handled correctly
---
## ๐ฏ Common Workflows
### Workflow 1: Writing Tests for New Feature
```
1. Consult decision tree โ /skills/vitest-testing/index.md
2. Determine test type โ Unit/Integration/Component
3. Apply F.I.R.S.T principles โ /skills/vitest-testing/principles/first-principles.md
4. Structure with AAA โ /skills/vitest-testing/principles/aaa-pattern.md
5. Use relevant pattern โ /skills/vitest-testing/patterns/
6. Reference examples โ /skills/vitest-testing/examples/ (when created)
```
### Workflow 2: Refactoring for Testability
```
1. Identify pain points โ What makes this hard to test?
2. Select pattern โ /skills/vitest-testing/refactoring/testability-patterns.md
3. Apply pattern โ Extract pure functions, inject dependencies, etc.
4. Write tests โ Black box tests for refactored code
5. Verify โ All tests pass, code is easier to test
```
### Workflow 3: Testing Async Code
```
1. Check async patterns โ /skills/vitest-testing/patterns/async-testing.md
2. Mock external APIs โ /skills/vitest-testing/patterns/test-doubles.md
3. Control timing โ Use vi.useFakeTimers()
4. Test states โ Loading, success, error
5. Verify cleanup โ Resources released
```
---
## ๐ Philosophy
This skill follows these core beliefs:
### 1. Behavior over Implementation
Tests should verify WHAT the code does, not HOW it does it. Focus on observable outcomes and public contracts. Implementation details should be testable indirectly through public APIs.
### 2. Example-Driven Learning
Every principle includes practical examples. Before/after refactoring shows impact. Complete examples provide working templates.
### 3. Testability by Design
Code that's hard to test is poorly designed. Refactoring patterns transform untestable code. Testability improvements enhance overall code quality.
### 4. F.I.R.S.T Quality
Fast, Isolated, Repeatable, Self-Checking, Timely tests create a valuable safety net that developers trust and maintain.
---
## ๐ Skill Map
```
vitest-testing/
โโโ SKILL.md โ You are here (AI agent entry point)
โโโ README.md โ Human navigation hub
โโโ index.md โ Decision tree
โโโ principles/ โ Testing fundamentals
โ โโโ first-principles.md โ F.I.R.S.T (most important)
โ โโโ aaa-pattern.md โ Test structure
โ โโโ bdd-integration.md โ Given/When/Then
โโโ strategies/ โ Testing approaches
โ โโโ black-box-testing.md โ Default strategy
โ โโโ implementation-details.md โ Rare exceptions
โโโ patterns/ โ Practical implementations
โ โโโ test-doubles.md โ Mocking (highly referenced)
โ โโโ component-testing.md โ React/UI testing
โ โโโ async-testing.md โ Promises, async/await
โ โโโ error-testing.md โ Error scenarios
โ โโโ api-testing.md โ HTTP/API testing
โ โโโ performance-testing.md โ Benchmarks, load tests
โ โโโ test-data.md โ Factories, builders
โโโ refactoring/ โ Making code testable
โ โโโ testability-patterns.md โ Extract, inject, isolate
โโโ quick-reference/ โ Fast lookups
โโโ cheatsheet.md โ Syntax reference
โโโ jest-to-vitest.md โ Migration guide
```
---
## ๐ Learning Paths
### For Beginners
1. [F.I.R.S.T Principles](principles/first-principles.md) - Understand quality attributes
2. [AAA Pattern](princiRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.