Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问clear审计通过

tdd时差

Agent Skill

tdd 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

574

周安装

23

GitHub Stars

5

下载量

186
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:tdd(时差)
来源仓库:https://github.com/lucastamoios/celeiro
仓库路径:skills/tdd
安装命令:
npx skills add https://github.com/lucastamoios/celeiro --skill tdd
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/lucastamoios/celeiro --skill tdd

简介

TDD 分 3 步:

  • 🔴红色 - 编写失败的测试(描述你想要什么)
  • 🟢 绿色 - 使测试通过(实现最少的代码)
  • 🔵 REFACTOR - 改进代码(保持测试通过)
  • 永远记住:
  • 明确识别被测实体
  • 在实施之前编写测试
  • 测试主要情况(不是所有可能性)
  • 使用清晰的命名约定
  • 不确定时询问
  • 黄金法则:如果您正在编写实现代码而没有失败的测试,请停止并首先编写测试。
  • 参考文件
  • 示例:参见示例/feature-implementation.md
  • 和示例/对话-examples.md
  • 模板:参见 templates/test-struct.md
  • 用于测试模式和模拟
  • 命名:参见 data/naming-conventions.md
  • 命名指南
  • 覆盖范围:参见 data/coverage-guidelines.md
  • 为了测试什么
  • 每周安装量
  • 23
  • 存储库
  • 卢卡斯塔莫奥斯/塞莱罗
  • GitHub 之星
  • 5
  • 第一次看到
  • 2026 年 1 月 24 日
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克通行证

SKILL.md

TDD (Test-Driven Development) Skill

Guide Claude to follow strict Test-Driven Development practices when implementing new features or fixing bugs. Ensures tests are written BEFORE implementation code.

When to Use

  • Implementing new features
  • Adding new methods to existing services/repositories
  • Fixing bugs (write failing test first)
  • Refactoring existing code

Core TDD Cycle

RED → GREEN → REFACTOR
 ↓      ↓         ↓
Fail   Pass    Improve

1. RED - Write Failing Test

  • Write test that describes desired behavior
  • Test MUST fail (compilation error or assertion failure)
  • Verify test fails for the right reason

2. GREEN - Make Test Pass

  • Write minimal code to make test pass
  • Don't worry about perfect code yet
  • Just make it work

3. REFACTOR - Improve Code

  • Clean up implementation
  • Remove duplication
  • Improve naming
  • Tests still pass

Critical Rules

Rule 1: ALWAYS Identify Entity Under Test

Before writing any test, Claude MUST:

  1. Ask the user if entity under test is ambiguous
  2. State explicitly which entity is being tested
  3. Use correct naming in test file and test functions

See examples/dialogue-examples.md for examples of clear vs ambiguous entity identification.

Rule 2: Test File Location

Place test files next to the code being tested:

internal/service/
├── transaction_service.go
└── transaction_service_test.go  ← Test file here

pkg/ofx/
├── parser.go
└── parser_test.go  ← Test file here

Rule 3: Test Naming Convention

Pattern: Test<EntityName>_<MethodName>_<Scenario>

See data/naming-conventions.md for detailed naming guidelines and examples.

// ✅ GOOD - Clear entity, method, and scenario
func TestTransactionService_ImportFromOFX_WithDuplicateFITID(t *testing.T)
func TestOFXParser_Parse_WithInvalidXML(t *testing.T)
func TestBudgetRepository_Create_WithNullAmount(t *testing.T)

// ❌ BAD - Missing entity or scenario
func TestImport(t *testing.T)
func TestValidData(t *testing.T)

Rule 4: Test Main Cases (Not Everything)

Focus on:

  • Happy path (1 test)
  • Common errors (2-3 tests)
  • Edge cases (1-2 tests)
  • Business rules (as many as needed)

Don't test:

  • Language features (e.g., "does append work?")
  • Third-party library internals
  • Trivial getters/setters
  • Every possible combination

See data/coverage-guidelines.md for what to test and what to skip.

Test Structure (AAA Pattern)

Use templates from templates/test-structure.md:

func TestTransactionService_ImportFromOFX_Success(t *testing.T) {
    // ARRANGE - Setup test data and dependencies
    mockRepo := &mockTransactionRepository{}
    parser := ofx.NewParser()
    service := NewTransactionService(mockRepo, parser)

    ofxData := []byte(`<OFX>...</OFX>`)
    accountID := uuid.New()

    // ACT - Execute the method being tested
    result, err := service.ImportFromOFX(context.Background(), ofxData, accountID)

    // ASSERT - Verify expectations
    require.NoError(t, err)
    assert.Equal(t, 5, result.Inserted)
    assert.Equal(t, 0, result.Skipped)
}

TDD Workflow Examples

See examples/feature-implementation.md for complete examples:

Example 1: New Feature

  1. RED - Write failing test for BudgetService.CalculateEffectiveAmount()
  2. GREEN - Implement minimal code to pass
  3. REFACTOR - Add more test cases and improve

Example 2: Bug Fix

  1. RED - Reproduce bug with failing test
  2. GREEN - Fix the bug to make test pass
  3. REFACTOR - Verify no other bugs introduced

Example 3: Multiple Scenarios

Test 4 main cases for each method:

  • Happy path
  • Error handling
  • Boundary conditions
  • Business rules

Test Coverage Guidelines

From data/coverage-guidelines.md:

What to Test ✅

  • Repository: CRUD, constraints, complex queries
  • Service: Business logic, validation, error handling
  • Handler: Request/response, status codes, auth

What NOT to Test ❌

  • Language features
  • Framework internals
  • Database engine behavior
  • Third-party libraries
  • Trivial code

Mocking Guidelines

When to Mock

  • External dependencies (HTTP clients, databases)
  • Other services in service layer
  • Slow operations
  • Non-deterministic behavior (time, random)

How to Mock

See templates/test-structure.md for mock templates:

// Define interface in domain
type TransactionRepository interface {
    BulkInsert(ctx context.Context, txs []*Transaction) error
}

// Create mock in test file
type mockTransactionRepository struct {
    mock.Mock
}

func (m *mockTransactionRepository) BulkInsert(ctx context.Context, txs []*Transaction) error {
    args := m.Called(ctx, txs)
    return args.Error(0)
}

Claude's TDD Checklist

Before writing implementation code, Claude MUST:

  • Identify entity under test explicitly
  • Create/open correct test file (*_test.go)
  • Write test with clear AAA structure
  • Run test and verify it FAILS
  • State why test fails (compilation or assertion)
  • Ask user if entity or scenario is ambiguous

After test fails, Claude can:

  • Implement minimal code to pass test
  • Run test and verify it PASSES
  • Refactor if needed
  • Add more test cases for edge cases

Common Mistakes to Avoid

❌ Writing Implementation First

WRONG: "I'll implement ImportFromOFX, then test it"
RIGHT: "I'll write a test for ImportFromOFX first, then implement"

❌ Testing Multiple Things in One Test

One scenario per test function.

❌ Unclear Entity Under Test

Always specify which entity (Service, Repository, Handler) is being tested.

❌ Testing Implementation Details

Test public behavior, not internal variables or private methods.

TDD Dialog Examples

See examples/dialogue-examples.md for:

  • How to handle clear entity requests
  • How to ask for clarification when ambiguous
  • How to propose multiple test scenarios
  • How to stop before writing implementation without tests

Summary

TDD in 3 Steps:

  1. 🔴 RED - Write failing test (describe what you want)
  2. 🟢 GREEN - Make test pass (implement minimal code)
  3. 🔵 REFACTOR - Improve code (keep tests passing)

Always remember:

  • Identify entity under test explicitly
  • Write test BEFORE implementation
  • Test main cases (not every possibility)
  • Use clear naming conventions
  • Ask when unsure

Golden Rule: If you're writing implementation code without a failing test, STOP and write the test first.

Reference Files

  • Examples: See examples/feature-implementation.md and examples/dialogue-examples.md
  • Templates: See templates/test-structure.md for test patterns and mocks
  • Naming: See data/naming-conventions.md for naming guidelines
  • Coverage: See data/coverage-guidelines.md for what to test

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.02%
按下载量换算58

trae

22.94%
按下载量换算43

Antigravity

18.9%
按下载量换算35

Codex

12.41%
按下载量换算23

windsurf

8.36%
按下载量换算16

Gemini CLI

3.97%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills