TDD Implementation (Test-Driven Development)

VerifiedSafe

Walks through the TDD cycle (Red-Green-Refactor) to implement a feature. Writes a failing test, then minimal code to pass it, and refactors. Helps ensure correctness through test-driven development with Vitest and Svelte.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#tdd#svelte#vitest#testing#workflow

Recommended for

Automated summary

Implements features following the TDD cycle (red-green-refactor) with Svelte and Vitest.

Strengths

  • Ensures full test coverage from the start
  • Clear, structured development workflow
  • Reduces regressions through automated tests
  • Encourages minimal code and regular refactoring

Limitations

  • Requires strict discipline to stick to the cycle
  • May slow down initial development for trivial tasks
  • Not suitable for exploration or rapid prototyping
When to use it

Use this skill when implementing well-defined features in a Svelte project that require high reliability.

When not to use it

Avoid this skill during rapid prototyping phases or when requirements are still vague and change frequently.

Security analysis

Safe
Quality score85/100

The skill instructs standard TDD workflow: writing tests, running pnpm test, and editing code. No destructive or exfiltrating actions are involved. Bash is used only to run the project's test suite, which is a legitimate development task.

No concerns found

How this analysis is made

Examples

Implement a user login form
Implement a user login form with email and password fields, validation, and submit handler. Use TDD cycle with Svelte 5 and Vitest.
Add a counter component
Add a counter component that increments and decrements using Svelte 5 runes. Write tests first, then implement, then refactor.

description: TDD(テスト駆動開発)サイクルで機能を実装する allowed-tools: Bash, Read, Write, Edit, Grep, Glob argument-hint: <対象コンポーネントまたは機能の説明>

TDD 実装スキル

ワークフロー

Step 1: 対象把握

  • $ARGUMENTS から実装対象を把握する
  • 関連する既存コード・テストを確認する
  • テストファイルの配置先を決定する(co-located .test.ts)

Step 2: RED - 失敗するテストを書く

  1. テストファイルを作成する(存在しない場合)
  2. テスト対象の振る舞いをテストとして記述する
    • テスト説明は 日本語
    • describe / it を使用
  3. pnpm test を実行し、テストが 失敗する ことを確認する
import { render, screen } from '@testing-library/svelte';
import { describe, expect, it } from 'vitest';
import MyComponent from './MyComponent.svelte';

describe('MyComponent', () => {
  it('期待する振る舞いの説明', () => {
    render(MyComponent, { props: { /* ... */ } });
    // Assert
  });
});

Step 3: GREEN - テストを通す最小限のコードを書く

  1. テストを通すための 最小限 の実装を行う
  2. コンポーネントは Svelte v5 Runes API で実装する
  3. pnpm test を実行し、テストが 成功する ことを確認する

Step 4: REFACTOR - コードを整理する

  1. 重複の除去、命名の改善
  2. コンポーネント分割、Store の抽出
  3. pnpm test を実行し、テストが 引き続き成功する ことを確認する

繰り返し

Step 2〜4 を対象機能が完成するまで繰り返す。各サイクルで必ず pnpm test を実行する。

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/tdd-implementation-test-driven-development-mm8o526p/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/tdd-implementation-test-driven-development-mm8o526p' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/tdd-implementation-test-driven-development-mm8o526p/download' --output '.skill-downloads/tdd-implementation-test-driven-development-mm8o526p/SKILL.md.part' && mv '.skill-downloads/tdd-implementation-test-driven-development-mm8o526p/SKILL.md.part' '.skill-downloads/tdd-implementation-test-driven-development-mm8o526p/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read, Write, Edit, Grep, Glob

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/tdd-implementation-test-driven-development-mm8o526p/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills