Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计未展示

tdd-workflowTDD 工作流程

Agent Skill

tdd-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

419

周安装

18

GitHub Stars

公开资料未说明

下载量

147
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add sakataka/tetris-game2 --skill "tdd-workflow"

简介

tdd-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于信息搜集、技术研究和内容筛选等需要精准匹配的场景。
  • 通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 安装前需确认权限范围和维护状态,注意可能涉及联网或文件操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

TDD Workflow for Tetris Game

Test-driven development guidance following the project's strict TDD requirements.

TDD Principles

  1. Test First: Write tests before implementation
  2. Red-Green-Refactor: Fail → Pass → Improve
  3. Co-located Tests: Test files must be next to implementation (*.test.ts)
  4. 160+ Tests: Comprehensive coverage for all game logic
  5. Property-based Testing: Use fast-check for critical game mechanics

Test Execution

# Run all tests (160+ tests)
bun test

# Run specific test file
bun test src/game/board.test.ts

# Run tests with coverage
bun test --coverage

Testing Requirements

✅ Required Practices

  • Co-located Tests: Place test files next to implementation src/game/ ├── board.ts ├── board.test.ts # ✅ Co-located ├── pieces.ts └── pieces.test.ts # ✅ Co-located
  • Result<T, E> Pattern: Game logic must return Result type type Result<T, E> = {ok: true; value: T} | {ok: false; error: E} // Good example export const rotatepiece = (piece: Piece): Result<Piece, RotationError> => {//...}
  • Block Bodies in forEach: Avoid implicit returns in test loops // ✅ Good testCases.forEach((testCase) => {expect(fn(testCase.input)).toBe(testCase.expected)}) // ❌ Bad (implicit return) testCases.forEach(testCase => expect(fn(testCase.input)).toBe(testCase.expected))
  • Property-based Testing: Use fast-check for game mechanics import fc from 'fast-check' test('piece rotation is reversible', () => {fc.assert(fc.property(fc.integer(), (rotation) => {const piece = rotatePiece(basePiece, rotation) const reversed = rotatePiece(piece, -rotation) return deepEqual(reversed, basePiece)}))})

❌ Prohibited Practices

  • ❌ Relaxing conditions to resolve test errors
  • ❌ Skipping tests or using inappropriate mocking
  • ❌ Hardcoding outputs or responses
  • ❌ Ignoring or hiding error messages
  • ❌ Temporary fixes that postpone problems

TDD Workflow Steps

1. Write Failing Test (Red)

// src/game/scoring.test.ts
test('T-Spin triple awards 1600 points', () => {
  const result = calculateScore({
    linesCleared: 3,
    isTSpin: true,
    level: 1
  })

  expect(result.ok).toBe(true)
  if (result.ok) {
    expect(result.value).toBe(1600)
  }
})

2. Implement Minimum Code (Green)

// src/game/scoring.ts
export const calculateScore = (params: ScoreParams): Result<number, ScoreError> => {
  if (params.isTSpin && params.linesCleared === 3) {
    return { ok: true, value: 1600 }
  }
  // ... rest of implementation
}

3. Refactor (Clean)

  • Improve code quality while keeping tests green
  • Add edge case tests
  • Use property-based testing for comprehensive coverage

When This Skill Activates

  • "Write a test for this function"
  • "Test this game logic"
  • "Improve test coverage"
  • "Fix failing tests"
  • "Add tests for edge cases"
  • "Use TDD to implement this"
  • "Property-based test for rotation"

Test Structure Best Practices

// src/game/board.test.ts
import { describe, test, expect } from 'bun:test'
import { createBoard, placePiece } from './board'
import fc from 'fast-check'

describe('Board Operations', () => {
  test('creates empty 20x10 board', () => {
    const board = createBoard()
    expect(board.length).toBe(20)
    expect(board[0].length).toBe(10)
  })

  test('placing piece updates board state', () => {
    const board = createBoard()
    const result = placePiece(board, piece, { x: 4, y: 0 })

    expect(result.ok).toBe(true)
    if (result.ok) {
      expect(result.value.board).not.toBe(board) // Immutability
    }
  })

  // Property-based test
  test('board operations preserve dimensions', () => {
    fc.assert(
      fc.property(fc.array(fc.array(fc.boolean())), (cells) => {
        const board = createBoardFromCells(cells)
        return board.length === 20 && board[0].length === 10
      })
    )
  })
})

Advanced Testing Patterns

See testing-patterns.md for:

  • Complex Result<T, E> pattern usage
  • Property-based testing strategies
  • Test organization best practices
  • Mocking guidelines

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Claude Code

27.36%
按下载量换算40

Antigravity

20.14%
按下载量换算30

windsurf

18.24%
按下载量换算27

trae

13.21%
按下载量换算19

OpenCode

7.41%
按下载量换算11

Codex

2.95%
按下载量换算4

安全审计

暂无安全审计结果可展示。

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills