Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/analytics-testingWrote 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.
[](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/analytics-testing)<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/analytics-testing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/analytics-testing.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01310 | $0.01310 |
| Opus 5 | $0.00655 | $0.00655 |
| Sonnet 5 | $0.00262 | $0.00262 |
| Haiku 4.5 | $0.00131 | $0.00131 |
Grade A, and why
analytics-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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Analytics Testing Rules
Core Principles
Analytics Engine calls are first-class citizens in tests
- No network dependencies
- No flakes
- No waiting
Required Patterns
1. Use AnalyticsEngineStub for All Analytics Testing
// ✅ CORRECT: Use the global stub
import { createMockEnv } from '../utils/test-helpers';
const { env: mockEnv, analytics } = createMockEnv();
// Make analytics calls
await mockEnv.ANALYTICS_ENGINE.writeDataPoint({
blobs: ['event_type', 'data'],
doubles: [value1, value2],
tags: { source: 'test' }
});
// Assert with analytics.getCalls()
expect(analytics.callCount()).toBe(1);
expect(analytics.getCalls()[0].blobs).toEqual(['event_type', 'data']);
2. Never Use toHaveBeenCalledWith for Analytics
// ❌ WRONG: Generic mock assertions
expect(mockAnalytics.writeDataPoint).toHaveBeenCalledWith({
blobs: ['event_type', 'data']
});
// ✅ CORRECT: First-class analytics assertions
expect(analytics.wasCalledWith({
blobs: ['event_type', 'data']
})).toBe(true);
3. Use Helper Functions for Common Assertions
import {
expectAnalyticsCall,
expectAnalyticsCallCount,
expectAnalyticsDoubles
} from '../utils/test-helpers';
// Clean, readable assertions
expectAnalyticsCall(analytics, {
blobs: ['event_type', 'data'],
doubles: [1.5, 1000]
});
expectAnalyticsCallCount(analytics, 1);
expectAnalyticsDoubles(analytics, [1.5, 1000], 0.001);
4. Test Name Detection for Auto-Flush
// ✅ CORRECT: Set test name for auto-flush
test('should track analytics calls with stub', async () => {
setCurrentTestName('should track analytics calls with stub');
// Test implementation
});
File Organization
Analytics Test Files
- Location:
tests/unit/analytics-*.test.ts - Pattern:
analytics-[feature].test.ts - Example:
analytics-tracking.test.ts
Test Utilities
tests/utils/analytics-engine-stub.ts- Core stub implementationtests/utils/test-helpers.ts- Helper functions and assertionstests/setup/test-setup.ts- Global test configuration
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.
- 6d ago First seen · 193 lines · 1,310 tokens per session scan A 7c32f176a7e5
analytics-testing is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It adds 1,310 tokens to every session, about $0.0066 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.
Other cursor rules, from other repositories
workflow-deployment
Workflow testing and deployment process guide.
writing-tests
How to write tests in the monorepo.
manual-review.data-readiness
Manual Review data-readiness 規約——propose 階段準備驗收資料的 hard rule、[review:ui] 純功能驗證 step actionability、@no-manual-review-check marker schema、截圖檔名配對;寫 proposal.md / tasks.md 時 path-scoped 載入.
manual-review.evidence
Manual Review evidence 規約——寫 / 審 tasks.md 的 ## 人工檢查 區塊時 path-scoped 載入.
manual-review
人工檢查(Manual Review)主檔——核心 invariant、Item Kind Marker、annotation schema、Parent State Derivation、Post-Edit Gate;有 active spectra change(動 openspec/changes/)時載入.
testing-anti-patterns
Testing anti-patterns to avoid — mock 濫用、test-only production methods、不完整 mock、E2E fixture 寫死絕對日期、測試碼品質低於生產碼、測試結構契約.