← スキル一覧に戻る

writing-tests
by jasonkuhrt
Tool configurations
⭐ 1🍴 0📅 2026年1月22日
SKILL.md
name: writing-tests description: TypeScript testing conventions and TDD practices. Use when writing tests, fixing bugs, or organizing test files.
Writing Tests
File Organization
- 1:1 test file mapping:
foo.ts→foo.test.ts describeblocks for each export (unless single export)- No top-level describes repeating module name
- Avoid redundant top-level describe blocks that repeat information already in the file path
- Example: In
src/arr/traits/eq.test.ts, don't usedescribe('Arr.Eq implementation')- the file path already indicates this - Focus describe blocks on behavior groupings, not restating what's being tested
- Example: In
Test Quality
- Prefer property-based testing with fast-check
- Few high-impact tests over exhaustive coverage
- Minimalist test fixtures - absolute minimum test cases needed. Quality over quantity.
Grouping
CRITICAL: Use Test.describe() NOT comments for grouping:
// ❌ BAD - inline comments for grouping
// Long flags
test('--verbose works', ...)
test('--quiet works', ...)
// ✅ GOOD - Test.describe for grouping
Test.describe('long flags', () => {
test('--verbose works', ...)
test('--quiet works', ...)
})
TDD for Bug Fixes
CRITICAL: Before implementing ANY bug fix:
- Create a failing unit test that reproduces the problem
- Confirm it fails
- Implement the fix
- Confirm test passes
No exceptions - TDD is mandatory for bug fixes. Only skip for complex integration scenarios (e.g., massive deep state in Playwright browser tests).
Before Using Test APIs
READ THE JSDOC - Before using ANY test API, read the actual JSDoc documentation in the source code. Never guess the API signature. Find usage examples in the codebase if needed.
スコア
総合スコア
55/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です



