tdd-mastery-sh-9zy6bi

Tddmastery dedicated skill: a dedicated skill to help AI Agents efficiently complete tasks related to Tddmastery.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "tdd-mastery-sh-9zy6bi" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9137c711414e950f73dcbc005bfbd85f50c0abeabd5527b52d3532d1055b37d0. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/tdd-mastery-sh-9zy6bi before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Tddmastery dedicated skill: a dedicated skill to help AI Agents efficiently complete tasks related to Tddmastery.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
1. **Red** - Write a failing test that defines the desired behavior 2. **Green** - Write the minimum code to make the test pass 3. **Refactor** - Clean up while keeping tests green
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Tddmastery
slug: tdd-mastery
version: 1.0.0
displayName: Tddmastery
description: >
  Tddmastery专用技能,帮助AI Agent高效完成相关任务。
  Tddmastery专用技能,帮助AI Agent高效完成相关任务。
summary: "Tddmastery专用技能,帮助AI Agent高效完成相关任务。"
license: MIT
category: 开发者工具
framework:
  - Claude Code
  - Codex
  - Hermes Agent
  - OpenClaw
  - QClaw
  - WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"

TDD Mastery

Core Cycle: Red-Green-Refactor

  1. Red - Write a failing test that defines the desired behavior
  2. Green - Write the minimum code to make the test pass
  3. Refactor - Clean up while keeping tests green

Never write production code without a failing test first. Each cycle should take 2-10 minutes.

Test Structure

Use the Arrange-Act-Assert pattern consistently:

Arrange: Set up test data and dependencies
Act:     Execute the behavior under test
Assert:  Verify the expected outcome

Name tests as test_<unit>_<scenario>_<expected_result> or it("should <behavior> when <condition>").

Jest / Vitest Patterns

describe("OrderService", () => {
  it("should apply discount when order exceeds threshold", () => {
    const order = createOrder({ items: [{ price: 150, qty: 1 }] });
    const result = applyDiscount(order, { threshold: 100, percent: 10 });
    expect(result.total).toBe(135);
  });

  it("should throw when applying discount to empty order", () => {
    const order = createOrder({ items: [] });
    expect(() => applyDiscount(order, defaultDiscount)).toThrow(EmptyOrderError);
  });
});

Use vi.fn() / jest.fn() for mocks. Prefer dependency injection over module mocking. Use beforeEach for shared setup, never share mutable state between tests.

pytest Patterns

@pytest.fixture
def db_session():
    session = create_test_session()
    yield session
    session.rollback()

def test_create_user_stores_hashed_password(db_session):
    user = UserService(db_session).create(email="a@b.com", password="secret")
    assert user.password_hash != "secret"
    assert verify_password("secret", user.password_hash)

@pytest.mark.parametrize("input,expected", [
    ("", False),
    ("short", False),
    ("ValidPass1!", True),
])
def test_password_validation(input, expected):
    assert validate_password(input) == expected

Use pytest.raises for exceptions. Use conftest.py for shared fixtures. Mark slow tests with @pytest.mark.slow.

Go Testing Patterns

func TestParseConfig(t *testing.T) {
    tests := []struct {
        name    string
        input   string
        want    Config
        wantErr bool
    }{
        {"valid yaml", "port: 8080", Config{Port: 8080}, false},
        {"empty input", "", Config{}, true},
        {"invalid port", "port: -1", Config{}, true},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got, err := ParseConfig([]byte(tt.input))
            if (err != nil) != tt.wantErr {
                t.Errorf("ParseConfig() error = %v, wantErr %v", err, tt.wantErr)
                return
            }
            if !tt.wantErr && got != tt.want {
                t.Errorf("ParseConfig() = %v, want %v", got, tt.want)
            }
        })
    }
}

Use table-driven tests by default. Use t.Helper() in test utility functions. Use testify/assert only if the team already uses it.

Test Levels

Level Scope Speed Dependencies
Unit Single function/class <100ms None (mock all)
Integration Module boundaries <5s Real DB, real FS
E2E Full user flow <30s Full stack

Ratio target: 70% unit, 20% integration, 10% e2e.

Coverage Rules

  • Enforce 80% line coverage minimum in CI
  • Track branch coverage, not just line coverage
  • Exclude generated code, type definitions, and config files
  • Never write tests just to hit coverage numbers; test behavior
# Jest/Vitest
vitest run --coverage --coverage.thresholds.lines=80 --coverage.thresholds.branches=75

# pytest
pytest --cov=src --cov-fail-under=80 --cov-branch

# Go
go test -coverprofile=cover.out -coverpkg=./... ./...
go tool cover -func=cover.out

Mocking Guidelines

  • Mock at boundaries: HTTP clients, databases, file systems, clocks
  • Never mock the unit under test
  • Prefer fakes (in-memory implementations) over mocks for repositories
  • Assert on behavior, not on mock call counts
  • Use t.Cleanup / afterEach to reset shared mocks

Anti-Patterns to Avoid

  • Testing implementation details instead of behavior
  • Tests that pass when code is deleted (tautological tests)
  • Shared mutable state between test cases
  • Ignoring flaky tests instead of fixing them
  • Testing private methods directly
  • Giant test setup that obscures intent

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供全面且结构化的 TDD 实践指南,涵盖核心循环、多语言测试模式及最佳实践
  • 面向开发者群体,具有明确的实用价值,能显著提升代码质量与测试效率
Trigger Precision30/100

Areas to improve

  • description 内容模糊 Reported severity: Minor

    description 字段重复且未清晰说明具体触发场景或用户意图

    Recommendation: 建议补充具体触发场景,如'当用户需要进行测试驱动开发、编写单元测试或提升测试覆盖率时'

Structure and Standards75/100

Areas to improve

  • 缺少 When to Use 与端到端示例 Reported severity: Minor

    文档结构清晰但缺少明确的'When to Use'章节与端到端用户交互示例

    Recommendation: 建议添加'When to Use'章节说明适用场景,并提供端到端示例展示如何应用 TDD 流程

Highlights

  • frontmatter 完整,包含必要元数据
  • 内容分章节组织良好,含代码示例与表格,逻辑清晰
Execution Reliability90/100

Highlights

  • 内容基于通用最佳实践,参数与示例正确
  • 覆盖主要异常场景,无反模式提醒,可靠性高
Evidence Verifiability (mean of the first four)70/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.