Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计通过

tdd-workflowTDD 工作流程

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

832

周安装

35

GitHub Stars

37

下载量

291
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill tdd-workflow

简介

用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合编写单元测试、端到端测试或根据日志定位问题。
  • 使用时需确认测试框架、运行命令和夹具数据,避免误改逻辑。
  • 涉及浏览器或服务时,应区分本地模拟与生产环境。
  • 建议结合项目实际配置使用,确保测试有效性。tdd-workflow 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

TDD Workflow

Core Principle

Never write implementation code before a failing test exists for that behavior.

Execution Flow

1. Setup

LANG = /majestic:config tech_stack "unknown"
If LANG == "unknown": detect from project files (package.json → TypeScript, Gemfile → Ruby, go.mod → Go, pyproject.toml → Python)
If LANG == "unknown": AskUserQuestion("What language/framework?")

RUNNER = lookup LANG in [references/language-configs.md]
If LANG in [ruby]: delegate to `rspec-coder` or `minitest-coder` skill for runner details

INCREMENTS = decompose feature using patterns from [references/increments.md]
  - Read requirements/plan
  - Identify pattern (Data Transformation, CRUD, State Machine, Calculation, Integration)
  - Break into ordered increments: degenerate → happy path → variations → edge cases → errors

For each INCREMENT in INCREMENTS:
  TaskCreate(subject: INCREMENT.name, description: INCREMENT.test_description)

AskUserQuestion("Review increments. Adjust ordering or scope?", options: ["Looks good", "Modify"])

2. TDD Loop (per increment)

For each INCREMENT in INCREMENTS:
  TaskUpdate(INCREMENT.task_id, status: "in_progress")

  # RED
  Write failing test to real file (not code block)
  RUN = Bash(RUNNER.test_command)
  If RUN.status == PASS: STOP — investigate unexpected pass
  If RUN.status == FAIL (wrong reason): fix test, rerun
  PAUSE → show test + failure output, wait for user

  # GREEN
  Write minimal implementation code
  RUN = Bash(RUNNER.full_suite_command)
  If RUN.status == FAIL: show output, PAUSE → ask user to fix or hand off
  If RUN.status == PASS: auto-continue (no pause)

  # REFACTOR
  If improvement opportunities exist:
    Refactor implementation and/or test code
    RUN = Bash(RUNNER.full_suite_command)
    If RUN.status == FAIL: revert refactor, PAUSE → discuss
    If RUN.status == PASS: auto-continue (no pause)

  TaskUpdate(INCREMENT.task_id, status: "completed")
  Brief summary of what was implemented
  → immediately begin next increment (no pause between increments)

3. Wrap-up

RUN = Bash(RUNNER.full_suite_command)
Report: increments completed, total tests, pass/fail status
Suggest: remaining work, missed edge cases, integration tests needed

Pause/Continue Rules

SituationAction
RED: test fails (expected)Pause — show test + failure, wait for user
RED: test passes unexpectedlyStop — investigate, don't proceed
GREEN: all tests passAuto-continue to REFACTOR
GREEN: tests failPause — show output, ask user
REFACTOR: tests passAuto-continue to next increment
REFACTOR: tests failRevert + Pause — discuss approach
Between incrementsAuto-continue — no pause

Task Tracking Integration

TASK_TRACKING = /majestic:config task_tracking.enabled false
WORKFLOW_ID = "tdd-{timestamp}"

If TASK_TRACKING:
  For each TaskCreate: add metadata {workflow: WORKFLOW_ID, phase: "tdd-loop"}
  For each TaskUpdate: wrap with If TASK_TRACKING: TaskUpdate(...)
  On Wrap-up: update ledger if LEDGER_ENABLED
    LEDGER_ENABLED = /majestic:config task_tracking.ledger false
    LEDGER_PATH = /majestic:config task_tracking.ledger_path .agents/workflow-ledger.yml

Red-Green-Refactor Cycle

1. Red Phase: Write a Failing Test

  • Select one small, specific behavior from the increment
  • Write a descriptive test that expresses the expected behavior
  • Run the test to confirm it fails (red)
  • The failure should be for the right reason (not syntax error or missing dependency)

2. Green Phase: Minimal Implementation

  • Implement only the minimal code necessary to pass the failing test
  • Resist adding extra features or handling edge cases not yet covered by tests
  • Run the test to confirm it passes (green)

3. Refactor Phase: Improve Quality

  • Review both implementation and test code for improvements
  • Remove duplication, improve naming, extract methods
  • Apply language-specific idioms and patterns
  • Run tests after each refactoring step to ensure they still pass

Test Sequencing Strategy

Order tests from simple to complex:

  1. Happy path — The core behavior with valid inputs
  2. Validation tests — Required fields, format constraints
  3. Edge cases — Boundary conditions, empty values, unusual inputs
  4. Error handling — Invalid inputs, failure scenarios
  5. Integration points — Interactions with other components

Test Quality Guidelines

Each test should:

  • Cover exactly one behavior
  • Be isolated — no shared state between tests
  • Have a clear, descriptive name
  • Fail for only one reason

Avoid:

  • Testing implementation details instead of behavior
  • Writing tests after the code
  • Sharing test setup that creates hidden dependencies
  • Skipping the refactor phase

Framework-Specific Implementation

For language-specific test runner commands, see references/language-configs.md.

For Ruby projects:

  • RSpec: Apply rspec-coder skill
  • Minitest: Apply minitest-coder skill

A Rails example is available in references/rails-tdd-workflow.md.

Test Generation Patterns

When writing tests outside a TDD loop (e.g., adding coverage to existing code), follow these patterns.

Framework Detection

EvidenceFramework
spec/ + _spec.rb + .rspecRSpec
test/ + _test.rb + test_helper.rbMinitest
*.test.js + jest.config.jsJest
*.spec.ts in tests/ or e2e/Playwright
vitest.config.jsVitest

Test Plan Structure

Before writing tests, create a plan covering:

  1. Scope - What functionality will be tested
  2. Happy path scenarios - Expected successful flows
  3. Sad path scenarios - Error handling, validations, failures
  4. Edge cases - Boundary conditions, null/empty values, unusual inputs
  5. Auth checks - Authorization/authentication (if applicable)
  6. Test data requirements - Fixtures or data needed
  7. Mocking strategy - External services/dependencies to mock

Test Case Matrix

Use for complex scenarios with multiple parameters:

ObjectiveInputsExpected OutputTest Type
Validate creationvalid paramsCreated, 201Happy Path
Reject duplicateexisting dataError, 422Sad Path
Handle emptymissing fieldValidation errorEdge Case

Completion Criteria

Tests are complete when ALL of these are met:

Coverage: All public methods tested, happy/sad/edge paths covered, auth checks included.

Quality: Tests pass (verified by running), isolated (no shared state), follow AAA pattern (Arrange-Act-Assert), descriptive names.

Framework compliance: Proper matchers, appropriate mocking, follows project patterns.

Test Writing Best Practices

  • Test behavior, not implementation details
  • One assertion focus per test
  • Use descriptive test names that document expected behavior
  • Prefer explicit assertions over implicit ones
  • Use test doubles sparingly and purposefully
  • Group related tests with describe/context blocks
  • Test data should be minimal but sufficient
  • For Rails: use transactional fixtures and database cleaner
  • For Playwright: proper waiting strategies, avoid flaky selectors

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.86%
按下载量换算107

Claude

26.87%
按下载量换算78

Cursor

19.5%
按下载量换算57

Gemini CLI

8.67%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

来源信息

继续浏览同类 Skills