test-driven-workflow

test-driven-workflow is a cursor rule for Cursor from microsoft/data-formulator. It costs 496 tokens per session, scanned A, original, MIT.

A test-driven development workflow requires tests to guide new features and bug fixes. Test-driven development means writing or updating a test for the expected behaviour before completing the code.

In plain words
What is it for?
Use it when adding features, fixing bugs, or refactoring code. It requires running the relevant backend or frontend tests and keeping unrelated tests unchanged.
Why use it?
It reduces the risk of shipping code that breaks existing behaviour and prevents hiding failures by deleting, skipping, or weakening tests.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding features, fixing bugs, or refactoring code. It requires running the relevant backend or frontend tests and keeping unrelated tests unchanged.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/microsoft/data-formulator/test-driven-workflow
About the project

Data Formulator is an interactive workspace where AI agents connect to data sources, answer questions, and create visualizations. It is used to explore and analyze data while branching into related questions without losing the context of each investigative path.

microsoft/data-formulator · 17,610 stars · on GitHub · data-formulator.ai

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/microsoft/data-formulator

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-driven-workflow

README.md
[![agentmods](https://agentmods.dev/badge/rules/microsoft/data-formulator/test-driven-workflow/github.svg)](https://agentmods.dev/rules/microsoft/data-formulator/test-driven-workflow)
Your own site
<a href="https://agentmods.dev/rules/microsoft/data-formulator/test-driven-workflow"><img src="https://agentmods.dev/badge/rules/microsoft/data-formulator/test-driven-workflow/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-driven-workflow

Your own site · 80×15
<a href="https://agentmods.dev/rules/microsoft/data-formulator/test-driven-workflow"><img src="https://agentmods.dev/badge/rules/microsoft/data-formulator/test-driven-workflow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 496 This file is loaded in full into every session.
When invoked 496 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00496 $0.00496
Opus 5.5 $0.00198 $0.00198
Sonnet 5.5 $0.00099 $0.00099
Haiku 4.5 $0.00050 $0.00050

Measured 1mo ago against content hash 2029dda8d557, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-driven-workflow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/test-driven-workflow.mdc · 45 lines

What it actually says

Test-Driven Workflow

1. 测试优先:新功能 / Bug 修复必须有测试

开发新功能或修复 Bug 时,必须同步编写测试,不能只提交业务代码:

  • 新功能 → 先写测试(或至少同步写),描述期望行为,再实现代码使测试通过
  • Bug 修复 → 先写复现测试,确认测试失败,再修复代码使测试通过
  • 重构 → 确保重构前已有测试覆盖,重构后测试仍然全部通过

完成实现后,主动运行相关测试验证:

  • 后端:python -m pytest tests/backend/ -q
  • 前端:yarn test

2. 测试保护:不要轻易修改测试代码

测试失败时,禁止直接修改测试代码来让测试通过。必须执行以下流程:

  1. 复现并定位:运行失败的测试,确认失败现象
  2. 诊断分类:
    • A:测试本身有问题(断言错误、setup 不正确)
    • B:业务实现有 Bug
    • C:需求/规格变更导致测试过时
  3. 给出方案:至少提供两个可选方案(改测试 / 改实现 / 补规格),说明各自影响和风险
  4. 等待确认:由用户决定采用哪个方案,再执行修改

绝对禁止:

  • 测试一红就直接改测试代码
  • 删除或跳过(@pytest.mark.skip)失败的测试来"解决"问题
  • 修改测试的断言值来匹配错误的实现

3. 精准修改:不动无关测试

与 Karpathy 编码准则的"精准修改"一致:

  • 不"顺手改进"与当前任务无关的测试代码
  • 不重构正在通过的测试
  • 不改变已有测试的断言逻辑,除非被明确要求
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 45 lines · 496 tokens per session scan A 2029dda8d557

Subscribe to this mod's changes

test-driven-workflow is a cursor rule published in the GitHub repository microsoft/data-formulator (17,610 stars, last pushed today), licensed MIT. It adds 496 tokens to every session, about $0.0020 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.