betting-brain-v3 / rules
Cursor rule8 starsChanged 14 months agoMITView on GitHub
Coverage threshold configuration patterns
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,531 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository27 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/99-floor.mdcCursor rule
- .cursor/rules/ai-friendly-testing.mdcCursor rule
- .cursor/rules/analytics-stub-api.mdcCursor rule
- .cursor/rules/analytics-testing.mdcCursor rule
- .cursor/rules/api-patterns.mdcCursor rule
- .cursor/rules/browser-extension.mdcCursor rule
- .cursor/rules/bun-runtime.mdcCursor rule
- .cursor/rules/cache-optimization.mdcCursor rule
- .cursor/rules/ci-integration.mdcCursor rule
- .cursor/rules/ci-patterns.mdcCursor rule
- .cursor/rules/cloudflare-infrastructure.mdcCursor rule
- .cursor/rules/cloudflare-workers.mdcCursor rule
- .cursor/rules/code-searchability.mdcCursor rule
- .cursor/rules/database-patterns.mdcCursor rule
- .cursor/rules/documentation.mdcCursor rule
- .cursor/rules/endpoint-routing.mdcCursor rule
- .cursor/rules/file-naming.mdcCursor rule
- .cursor/rules/mcp-integration.mdcCursor rule
- .cursor/rules/process-management.mdcCursor rule
- .cursor/rules/production-security.mdcCursor rule
- .cursor/rules/quality-standards.mdcCursor rule
- .cursor/rules/root-organization.mdcCursor rule
- .cursor/rules/security-patterns.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/testing-patterns.mdcCursor rule
- .cursor/rules/test-setup-patterns.mdcCursor rule
The file
We split this coverage-thresholds.mdc into the rules it gives an agent
12 rules. About 0 are common, 10 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 57
Purpose: Ensure high-quality, well-tested production code
- Distinctive: line 58
Scope: All business logic, API endpoints, core functionality
- Distinctive: line 63
Scope: Test helpers, stubs, analytics-specific utilities
- Distinctive: line 64
Enforcement: No coverage requirement, focus on functionality
- Distinctive: line 80
Keep main threshold at 80% for production quality
- Distinctive: line 81
Use analytics config only for analytics tests
- Distinctive: line 82
Document threshold rationale in commit messages
- Distinctive: line 83
Test both thresholds in CI
- Distinctive: line 87
Use analytics config for production code
- Very specific: line 94
Solution: Use --config bunfig.analytics.toml flag
- Distinctive: line 97
Solution: Check if using analytics config by mistake
- Very specific: line 100
Solution: Ensure [test] section in config file
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
version: "1.1.0"
globs: "bunfig.toml,bunfig.*.toml,package.json"
description: "Coverage threshold configuration patterns"
lastUpdated: "2025-10-08"
dependencies: ["quality-standards", "testing-patterns"]
---
# Coverage Threshold Rules
## Dual Threshold System
This codebase uses **dual coverage thresholds** to balance:
- Strict production standards
- Flexible analytics testing
### Main Suite: 80% Coverage (Strict)
```toml
# bunfig.toml
coverage = false # coverage off by default
coverageThreshold = 0.8 # 80% for production code
```
### Analytics Suite: 0% Coverage (Flexible)
```toml
# bunfig.analytics.toml
coverage = true
coverageThreshold = 0 # No threshold for analytics tests
```
## Package.json Scripts
### Main Suite Commands
```json
{
"test": "bun test --randomize",
"test:coverage": "bun test --coverage --randomize"
}
```
### Analytics Suite Commands
```json
{
"analytics:test": "bun test tests/unit/analytics-testing-example.test.ts --randomize",
"analytics:test:coverage": "bun test --coverage --randomize tests/unit/analytics-testing-example.test.ts --config bunfig.analytics.toml",
"analytics:ci": "CI=true bun run analytics:test:coverage"
}
```
## Why Dual Thresholds?
### Production Code (80% threshold)
- **Purpose**: Ensure high-quality, well-tested production code
- **Scope**: All business logic, API endpoints, core functionality
- **Enforcement**: CI fails if coverage < 80%
### Analytics Code (0% threshold)
- **Purpose**: Allow rapid iteration on analytics utilities
- **Scope**: Test helpers, stubs, analytics-specific utilities
- **Enforcement**: No coverage requirement, focus on functionality
## Configuration Hierarchy
```
bunfig.toml (root)
↓ (always takes precedence for critical settings)
--config flag
↓ (limited override capability)
Environment variables
↓ (minimal support)
```
## Best Practices
### ✅ Do These
- Keep main threshold at 80% for production quality
- Use analytics config only for analytics tests
- Document threshold rationale in commit messages
- Test both thresholds in CI
### ❌ Don't Do These
- Lower main threshold below 80%
- Use analytics config for production code
- Mix threshold configurations
- Ignore coverage failures in main suite
## Troubleshooting
### Issue: Analytics tests failing with 80% threshold
**Solution**: Use `--config bunfig.analytics.toml` flag
### Issue: Main tests passing with low coverage
**Solution**: Check if using analytics config by mistake
### Issue: Config file not working
**Solution**: Ensure `[test]` section in config file
## Related Rules
- [Analytics Testing](mdc:.cursor/rules/analytics-testing.mdc) - Core analytics testing patterns
- [CI Integration](mdc:.cursor/rules/ci-integration.mdc) - CI/CD automation with dual thresholds
- [Test Setup Patterns](mdc:.cursor/rules/test-setup-patterns.mdc) - Test configuration patterns
## Related Files
- [bunfig.toml](mdc:bunfig.toml) - Main configuration
- [bunfig.analytics.toml](mdc:bunfig.analytics.toml) - Analytics configuration
- [package.json](mdc:package.json) - Script definitions
---
**Status:** Production Ready ✅
**Last Updated:** 2025-10-07
**Enforcement:** CI/CD Required
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

