Discover Test Patterns
Automatically discover and document test patterns used in the project for reference during planning and implementation.
What to Discover
Test File Organization
- Location patterns (e.g.,
*_test.go, *.test.ts, test_*.py)
- Directory structure (e.g.,
tests/, __tests__/, alongside source)
- Framework being used
Common Patterns
Find and document:
- How tests are structured (describe/it, test functions, etc.)
- Assertion style (testify, chai, pytest, etc.)
- Mocking approach (mockery, jest.mock, unittest.mock, etc.)
- Setup/teardown patterns
- Table-driven test examples
Framework Detection
Identify testing frameworks:
- Go: testing, testify, ginkgo
- TypeScript/JavaScript: Jest, Mocha, Vitest
- Python: pytest, unittest
- Rust: built-in test framework
Discovery Process
- Find test files: Use glob patterns to locate tests
- Read examples: Read 2-3 representative test files
- Extract patterns: Identify common structures and styles
- Document: Use template to create reference doc
Output Format
Write to: thoughts/notes/testing.md
Use the template from templates/testing-reference.md and populate with discovered patterns.
Example Output Structure
---
last_updated: 2025-12-23T10:00:00Z
last_updated_by: Claude
project: my-project
---
# Test Patterns Reference
Last discovered: 2025-12-23
## Go Test Patterns
### File Organization
- **Location**: `*_test.go` files alongside source
- **Framework**: testify/require
- **Example**: `internal/auth/handler_test.go`
### Common Pattern: Table-Driven Tests
**Found in**: `internal/auth/handler_test.go:45-78`
```go
func TestAuthHandler(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
// test cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.expected, result)
})
}
}
Assertion Style
- Use
require for assertions that should stop test
- Use
assert for non-critical checks
Mocking Approach
- Mockery-generated mocks in
mocks/ directory
- Interface-based mocking pattern
## When to Use
Automatically invoked by the `plan` command if `thoughts/notes/testing.md` doesn't exist.
---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/eveld) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->
1---2name: discover-test-patterns3description: Use during planning to discover and document test patterns and conventions for writing consistent tests. Use when this capability is needed.4---56# Discover Test Patterns78Automatically discover and document test patterns used in the project for reference during planning and implementation.910## What to Discover1112### Test File Organization13- Location patterns (e.g., `*_test.go`, `*.test.ts`, `test_*.py`)14- Directory structure (e.g., `tests/`, `__tests__/`, alongside source)15- Framework being used1617### Common Patterns18Find and document:19- How tests are structured (describe/it, test functions, etc.)20- Assertion style (testify, chai, pytest, etc.)21- Mocking approach (mockery, jest.mock, unittest.mock, etc.)22- Setup/teardown patterns23- Table-driven test examples2425### Framework Detection26Identify testing frameworks:27- **Go**: testing, testify, ginkgo28- **TypeScript/JavaScript**: Jest, Mocha, Vitest29- **Python**: pytest, unittest30- **Rust**: built-in test framework3132## Discovery Process33341. **Find test files**: Use glob patterns to locate tests352. **Read examples**: Read 2-3 representative test files363. **Extract patterns**: Identify common structures and styles374. **Document**: Use template to create reference doc3839## Output Format4041Write to: `thoughts/notes/testing.md`4243Use the template from `templates/testing-reference.md` and populate with discovered patterns.4445## Example Output Structure4647```markdown48---49last_updated: 2025-12-23T10:00:00Z50last_updated_by: Claude51project: my-project52---5354# Test Patterns Reference5556Last discovered: 2025-12-235758## Go Test Patterns5960### File Organization61- **Location**: `*_test.go` files alongside source62- **Framework**: testify/require63- **Example**: `internal/auth/handler_test.go`6465### Common Pattern: Table-Driven Tests66**Found in**: `internal/auth/handler_test.go:45-78`6768```go69func TestAuthHandler(t *testing.T) {70 tests := []struct {71 name string72 input string73 expected string74 }{75 // test cases76 }77 for _, tt := range tests {78 t.Run(tt.name, func(t *testing.T) {79 require.Equal(t, tt.expected, result)80 })81 }82}83```8485### Assertion Style86- Use `require` for assertions that should stop test87- Use `assert` for non-critical checks8889### Mocking Approach90- Mockery-generated mocks in `mocks/` directory91- Interface-based mocking pattern92```9394## When to Use9596Automatically invoked by the `plan` command if `thoughts/notes/testing.md` doesn't exist.9798---99> Converted and distributed by [TomeVault](https://tomevault.io/claim/eveld) — claim your Tome and manage your conversions.100<!-- tomevault:4.0:skill_md:2026-04-13 -->