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.
git clone --depth 1 https://github.com/holasoymalva/AI-Unit-Test-BuilderWrote 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/holasoymalva/ai-unit-test-builder/generate-unit-test)<a href="https://agentmods.dev/rules/holasoymalva/ai-unit-test-builder/generate-unit-test"><img src="https://agentmods.dev/badge/rules/holasoymalva/ai-unit-test-builder/generate-unit-test/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.
<a href="https://agentmods.dev/rules/holasoymalva/ai-unit-test-builder/generate-unit-test"><img src="https://agentmods.dev/badge/rules/holasoymalva/ai-unit-test-builder/generate-unit-test.svg" alt="Reviewed on agentmods" width="80" 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.00008 | $0.01539 |
| Opus 5.5 | $0.00003 | $0.00616 |
| Sonnet 5.5 | $0.00002 | $0.00308 |
| Haiku 4.5 | $0.00001 | $0.00154 |
Grade A, and why
generate-unit-test 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.
How it starts
The opening of the file, as written. The whole thing — 275 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rule: Unit Test Generation
Goal
To guide an AI assistant in generating comprehensive unit tests based on a previously created function analysis document. The tests should cover all scenarios identified in the analysis and follow testing best practices.
Prerequisites
- A function analysis document (created by
extract-functions.mdc) - Source code file to be tested
- Knowledge of the testing framework being used (Jest, Vitest, etc.)
Process
- Load Analysis Document: Read and understand the function analysis document
- Identify Testing Framework: Determine the testing framework and setup requirements
- Generate Test Structure: Create the basic test file structure with imports and setup
- Generate Function Tests: Create comprehensive tests for each function based on the analysis
- Add Mock Implementations: Generate necessary mocks and test utilities
- Save Test File: Save as
[source-filename].test.[extension]alongside the source file
Test Generation Guidelines
Test File Structure
// Imports and setup
import { function1, function2 } from './source-file';
import { jest } from '@jest/globals'; // or equivalent for your framework
// Mock setup (if needed)
jest.mock('external-dependency');
// Test setup and utilities
const mockSetup = () => { /* setup code */ };
// Test suites grouped by function
describe('FunctionName', () => {
// Tests for each function
});
For Each Function Generate:
1. Basic Test Structure
describe('[FunctionName]', () => {
// Setup
beforeEach(() => {
// Reset mocks, setup test data
});
// Test cases here
});
2. Happy Path Tests
- Test normal, expected usage
- Test with typical input values
- Verify expected return values and behavior
3. Edge Case Tests
- Boundary values (empty strings, zero, null, undefined)
- Maximum/minimum values
- Special characters or unusual but valid inputs
4. Error Handling Tests
- Invalid inputs
- Error throwing scenarios
- Error message validation
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.
- 1mo ago First seen · 275 lines · 8 tokens per session scan A 5f17b761449c
generate-unit-test is a cursor rule published in the GitHub repository holasoymalva/AI-Unit-Test-Builder (7 stars, last pushed 1y ago), licensed MIT. It adds 8 tokens to every session and 1,539 once invoked, about $0.0000 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-31.
Other cursor rules, from other repositories
jest
Jest: describe/it, matchers, mocking, async testing.
vitest
Vitest: unit testing, mocking, coverage, snapshot testing.
pytest
You are an expert in pytest testing. Follow these rules.
propose-test-cases
Propose comprehensive test cases for PR changes.
07-testing
Cursor rule "07-testing" from orbitalsonic/AndroidPilot, covering testing, architecture, prefer, unit testing and scope.
jest-unit-testing-cursorrules-prompt-file
Cursor rules for Jest development with unit testing.