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.
npx agentmods add rules/modelengine-group/nexent/pytest_unit_test_rulesgit clone --depth 1 https://github.com/ModelEngine-Group/nexentWhat 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 | $0.00000 | $0.00394 |
| Opus 5 | $0.00000 | $0.00197 |
| Sonnet 5 | $0.00000 | $0.00079 |
| Haiku 4.5 | $0.00000 | $0.00039 |
Grade A, and why
pytest_unit_test_rules 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 2d 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.
What it actually says
Pytest Unit Test Rules (Concise)
Framework
- Use pytest exclusively; prefer fixtures; use pytest
assertstatements.
Naming
- Files
test_*; classesTest*; functionstest_*.
Imports
- Order: standard library, third‑party, project.
- Import only the unit under test; mock collaborators using
pytest-mock.
Import and Mock Rules
- Do not directly import external interfaces/clients/services into tests to exercise collaborators.
- Patch where the dependency is imported (lookup site) using a fully‑qualified path.
- Use
side_effectto cover error paths when appropriate.
from pytest_mock import MockFixture
from backend.apps.some_app import create_resource
def test_create_resource_success(mocker: MockFixture):
mocker.patch(
"backend.services.model_provider_service.ModelProviderService.create",
return_value={"id": "res-1"},
)
assert create_resource({...})["id"] == "res-1"
Structure and Size
- Keep files under 500 lines or split by feature; include
__init__.pyin split directories; usetest_<module>_<feature>.pynames.
Coverage and Async
- Cover success/error flows and boundaries; use
@pytest.mark.parametrizefor variants. - Use
@pytest.mark.asynciofor async tests.
Isolation
- Use
autouse=Truefixtures to reset state; fully mock external I/O and APIs.
Checklist
- pytest only (no unittest)
- naming conventions followed
- collaborators mocked with pytest-mock
- import/mocking rules followed
- async tests decorated when needed
- clear, specific assertions
- adequate coverage (normal and exception paths)
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.
- 2d ago First seen · 52 lines · 0 tokens per session scan A f51c66663f80
pytest_unit_test_rules is a cursor rule published in the GitHub repository ModelEngine-Group/nexent (5,841 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 394 tokens. 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.
Other cursor rules, from other repositories
latest-ai-models
Use only the latest AI models from all providers (updated Feb 2026).
callback-system
Lifecycle callback system design for agentic loops.
react-loop
ReAct loop implementation design and pattern details.
laravel-ai-sdk-integration
How Laragentic integrates with and extends the Laravel AI SDK.
developer-experience
Developer experience principles and usage patterns for Laragentic.
package-structure
Directory structure and file organization conventions for the Laragentic package.