main-rule

Coding rules for Python 3.12 projects that use FastAPI, a Python web framework, plus Pydantic, SQLAlchemy, uv, and Loguru. They set expectations for naming, formatting, documentation, errors, type hints, and small changes.

In plain words
What is it for?
Writing and reviewing Python web APIs, database code, configuration, logging, and tests while following PEP 8, the common Python style guide.
Why use it?
They give the coding assistant consistent project standards, reducing unclear code, unnecessary complexity, and unintended edits to other files.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/mtwn105/decipher-research-agent/main-rule
Clone the repo
git clone --depth 1 https://github.com/mtwn105/decipher-research-agent

Made for: Cursor.

Per session 336 This file is loaded in full into every session.
When invoked 336 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00336 $0.00336
Opus 5 $0.00168 $0.00168
Sonnet 5 $0.00067 $0.00067
Haiku 4.5 $0.00034 $0.00034

Measured 3d ago against content hash ded3188a36c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

main-rule 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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

backend/.cursor/rules/main-rule.mdc · 34 lines

What it actually says

You are an expert in Python, FastAPI, and scalable API development.

Here are some best practices and rules you must follow:

  • Python Version: Python 3.12

  • Frameworks and Tools:

    • pydantic
    • fastapi
    • sqlalchemy
    • uv for dependency management
    • loguru for logging

Coding Standards

  1. Use Meaningful Names: Choose descriptive variable, function, and class names.
  2. Follow PEP 8: Adhere to the Python Enhancement Proposal 8 style guide for formatting.
  3. Use Docstrings: Document functions and classes with docstrings to explain their purpose.
  4. Keep It Simple: Write simple and clear code; avoid unnecessary complexity.
  5. Use List Comprehensions: Prefer list comprehensions for creating lists over traditional loops when appropriate.
  6. Handle Exceptions: Use try-except blocks to handle exceptions gracefully.
  7. Use Type Hints: Utilize type hints for better code clarity and type checking.
  8. Avoid Global Variables: Limit the use of global variables to reduce side effects.
  9. Write Minimal Code: Only write the minimum code necessary to achieve the goal. Avoid overengineering.
  10. Don't Modify Other Files Without Permission: Do not make changes in files you weren’t explicitly asked to edit.

Important: Do not write any code until you're at least 95% confident in the requirement. Ask for clarification if needed.

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. 3d ago First seen · 34 lines · 336 tokens per session scan A ded3188a36c4

Subscribe to this mod's changes

main-rule is a cursor rule published in the GitHub repository mtwn105/decipher-research-agent (152 stars, last pushed 1y ago), licensed MIT. It adds 336 tokens to every session, about $0.0017 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-30.