ai-friendly-testing

ai-friendly-testing is a cursor rule for Cursor from brendadeeznuts1111/betting-brain-v3. It costs 2,076 tokens per session, scanned A, original, MIT.

A set of rules for running Bun tests in a format that coding assistants can read easily. Bun is a JavaScript and TypeScript runtime, and the rules include commands that show failures while reducing routine output.

In plain words
What is it for?
Use it to run focused or coverage tests, enable AI-friendly output, and configure database mocks for normal queries and storage-size checks.
Why use it?
It makes test results shorter and easier to interpret during AI-assisted coding. It also documents how test scripts detect common AI environments and how database mocks should handle different queries.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions Claude Code; mentions Cursor.

Good fit Use it to run focused or coverage tests, enable AI-friendly output, and configure database mocks for normal queries and storage-size checks.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing
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/brendadeeznuts1111/betting-brain-v3

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 ai-friendly-testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing/github.svg)](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing)
Your own site
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing/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 ai-friendly-testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/ai-friendly-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,076 This file is loaded in full into every session.
When invoked 2,076 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.02076 $0.02076
Opus 5 $0.01038 $0.01038
Sonnet 5 $0.00415 $0.00415
Haiku 4.5 $0.00208 $0.00208

Measured 10d ago against content hash c8f1244f2121, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

ai-friendly-testing 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 10d 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/ai-friendly-testing.mdc · 352 lines

How it starts

The opening of the file, as written. The whole thing — 352 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI-Friendly Testing Patterns

Bun Test with AI Integration

Always use AI-friendly test output when working with AI assistants:

# Dedicated AI command (preferred)
bun run test:ai

# Environment variable approach
CLAUDECODE=1 bun test
CLAUDECODE=1 bun test tests/unit
CLAUDECODE=1 bun test --coverage

Auto-Detection

CI scripts automatically detect AI environments:

  • CLAUDECODE=1 - Claude Code
  • REPL_ID=1 - Replit AI
  • AGENT=1 - Generic AI agent

Commands that auto-enable quiet mode:

bun run ci:local    # ✅ Auto-detects AI environment
bun run ci:bun      # ✅ Auto-detects AI environment

Benefits

  • ✅ Shows only test failures (not passing tests)
  • ✅ Reduces output verbosity for AI context windows
  • ✅ Preserves failure details and summaries
  • ✅ Improves readability in AI sessions

Test Mock Patterns

For D1 database mocks, handle both regular and cost cap queries:

mockEnv = {
  ANALYTICS: {
    prepare: (query: string) => {
      // Handle cost cap queries (dbstat)
      if (query.includes('dbstat') || query.includes('SUM(pgsize)')) {
        return {
          first: async () => ({ size: 1000000, rows: 1000 }),
          bind: () => ({ first: async () => ({ size: 1000000, rows: 1000 }) }),
          run: async () => ({ success: true }),
          all: async () => []
        };
      }
      
      // Handle regular queries
      return {
        bind: (...params: any[]) => ({
          first: async () => ({ /* your data */ })
        }),
        first: async () => null,
        run: async () => ({ success: true }),
        all: async () => []
      };
    }
  }
};

Environment Variables

Set any of these to enable quiet mode:

Variable Use Case
CLAUDECODE=1 Claude Code sessions
REPL_ID=1 Replit AI environments
AGENT=1 Generic AI agent flag

Package Scripts

Available in package.json:

{
  "scripts": {
    "test:ai": "CLAUDECODE=1 bun test",
    "test": "bun test",
    "test:unit": "bun test tests/unit",
    "test:integration": "bun test tests/integration"
  }
}

Read the full file on GitHub · 352 lines

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. 10d ago First seen · 352 lines · 2,076 tokens per session scan A c8f1244f2121

Subscribe to this mod's changes

ai-friendly-testing is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It adds 2,076 tokens to every session, about $0.0104 per session on Opus 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-31.