本文へ移動
cccskills
無料GitHub で公開

unit-test-loop

This skill should be used when the user asks to "improve test coverage", "add unit tests", "TDD", "test this module", "write tests for", "increase coverage", "/ut command", or discusses unit testing strategies. Covers the unit test loop workflow, React Testing Library best practices, query priorities, and coverage improvement strategies.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Unit Test Loop - Coverage Improvement

Current branch: !git branch --show-current 2>/dev/null || echo "not in git repo"

The unit test loop uses a 2-phase workflow with Dex task tracking for persistent, cross-session test coverage improvement.

The 2-Phase Approach

PhaseNamePurpose
1Coverage AnalysisIdentify gaps, prioritize files
2Dex HandoffCreate epic + tasks from analysis

After Phase 2, use /complete <task-id> for each test task.

Starting the Loop

/ut "Improve coverage for auth module"            # Basic
/ut "Add tests" --target 80%                      # With target

Phase 1: Coverage Analysis

  1. Run coverage command to see current state
  2. Identify files with low coverage
  3. Prioritize 3-7 test tasks for user-facing behavior

Output: <phase_complete phase="1"/>

Phase 2: Dex Handoff

Create Dex epic with target, then tasks for each gap:

# Create epic
dex create "Unit Test Coverage" --description "Target: 80% coverage"

# For each gap
dex create "Test: login validation" --parent <epic-id> --description "
File: src/auth/login.ts
Current: 45%

Test should verify:
- [ ] Valid credentials succeed
- [ ] Invalid credentials show error
"

Output: <phase_complete phase="2"/> or <promise>UT SETUP COMPLETE</promise>

Working on Tasks

Use Dex + /complete workflow:

dex list --pending      # See what's ready
dex start <id>          # Start working
/complete <id>          # Run reviewers and complete

React Testing Library Patterns

"The more your tests resemble the way your software is used, the more confidence they can give you."

Query Priority (Use in Order)

PriorityQueryUse Case
1getByRoleDefault choice, use name option
2getByLabelTextForm fields with labels
3getByPlaceholderTextOnly if no label available
4getByTextNon-interactive elements
5getByTestIdLast resort only

Query Types

TypeWhen to Use
getBy/getAllByElement exists (throws if not found)
queryBy/queryAllByOnly for asserting absence
findBy/findAllByAsync elements (returns Promise)

Best Practices

// Use screen
screen.getByRole('button', { name: /submit/i })

// Use userEvent.setup()
const user = userEvent.setup()
await user.click(button)

// Use jest-dom matchers
expect(button).toBeDisabled()  // Not: expect(button.disabled).toBe(true)

// Avoid act() - RTL handles it
await screen.findByText('Loaded')  // Not: act(() => ...)

Quality Standards

  • ONE test per task - Focused, reviewable commits
  • User-facing behavior only - Test what users depend on
  • Quality over quantity - One great test beats ten shallow ones
  • No coverage gaming - Use /* v8 ignore */ for untestable code

Command Reference

/ut "prompt"                  # Start analysis
/ut "prompt" --target 80%     # With target
/cancel-ut                    # Cancel loop
/complete <task-id>           # Complete task with reviewers

Related

  • /complete - Run reviewers and mark Dex task complete
  • dex list - View pending tasks
  • dex-workflow skill - Full Dex usage patterns

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

This skill should be used when the user asks about "parallel agents", "background tasks", "run_in_background", "non-blocking agents", "check agent progress", "TaskOutput", "retrieve agent results", or discusses running multiple agents concurrently. Covers patterns for launching agents in background, monitoring progress, and retrieving results.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

Creates and manages Biome GritQL custom lint rules to enforce coding patterns. Use when creating linter rules, enforcing code conventions, preventing anti-patterns, or when the user mentions Biome, GritQL, custom lint rules, or AST-based linting.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

Transform brain dumps into polished blog posts in Nick Nisi's voice. Use when the user wants to write a blog post with scattered ideas, talking points, and conclusions that need organization into a cohesive narrative with Nick's conversational, authentic, and thoughtful tone.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

This skill should be used when implementing features from a PRD spec, tracking implementation progress, or resuming work across sessions. Covers Dex task management for PRD story execution, daily workflows, and skill auto-loading.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

This skill should be used when the user asks for "browser tests", "playwright tests", "end-to-end testing", "test user flows", "E2E coverage", "integration tests for UI", "page object pattern", "/e2e command", or discusses automated browser testing. Covers the E2E test loop workflow, Playwright patterns, page objects, and selector strategies.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

gwt

無料

Manage git worktrees using a centralized worktrees folder. Use for parallel development, PR reviews, or isolated work.

日本語の概要は準備中です。原文の説明を表示しています。

SomtoUgeh/somto-dev-toolkit22026年8月26日 更新

SomtoUgeh のスキルをすべて見る

このスキルの問題を報告する