rule

rule is a cursor rule for Cursor from noobgaminghard/cursor-rules. It costs 0 tokens per session (2,173 once invoked), scanned A, a copy of cursorrules, MIT.

A set of development rules for Python projects that train and run machine-learning models with tools such as PyTorch and scikit-learn.

In plain words
What is it for?
Use it to organize datasets, model definitions, training loops, evaluation, experiment tracking, and prediction code.
Why use it?
It provides a defined project structure and practices for validating data, testing code, tracking experiments, and making results reproducible.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Good fit Use it to organize datasets, model definitions, training loops, evaluation, experiment tracking, and prediction code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/noobgaminghard/cursor-rules/rule
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.

Clone the repo
git clone --depth 1 https://github.com/noobgaminghard/cursor-rules

Made for: Cursor.

Wrote 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.

agentmods badge for rule

README.md
[![agentmods](https://agentmods.dev/badge/rules/noobgaminghard/cursor-rules/rule/github.svg)](https://agentmods.dev/rules/noobgaminghard/cursor-rules/rule)
Your own site
<a href="https://agentmods.dev/rules/noobgaminghard/cursor-rules/rule"><img src="https://agentmods.dev/badge/rules/noobgaminghard/cursor-rules/rule/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.

agentmods 80×15 button for rule

Your own site · 80×15
<a href="https://agentmods.dev/rules/noobgaminghard/cursor-rules/rule"><img src="https://agentmods.dev/badge/rules/noobgaminghard/cursor-rules/rule.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,173 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 91% copy Near-identical to another mod 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.1 $0.00000 $0.02173
Opus 5.5 $0.00000 $0.00869
Sonnet 5.5 $0.00000 $0.00435
Haiku 4.5 $0.00000 $0.00217

Measured 1mo ago against content hash c14e0f692310, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 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.

Origin

This is a copy

91% identical to cursorrules — 6 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

rules/ai-ml-python/rule.mdc · 250 lines

How it starts

The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI/ML Python Projects — Cursor Rules

Production ML: PyTorch, data pipelines, experiment tracking, and deployment

Project Context

You are building an AI/ML project with Python. The project uses PyTorch for model training, handles data pipelines with proper validation, tracks experiments systematically, and follows production ML engineering practices. Code is type-hinted, tested, and reproducible.

Project Structure

project/
  src/
    data/
      datasets.py           # PyTorch Dataset classes
      transforms.py         # Data augmentation and preprocessing
      loaders.py            # DataLoader configurations
      validation.py         # Data quality checks
    models/
      architectures/        # Model definitions
        resnet.py
        transformer.py
      losses.py             # Custom loss functions
      metrics.py            # Evaluation metrics
    training/
      trainer.py            # Training loop
      callbacks.py          # Training callbacks (early stopping, checkpointing)
      optimizers.py         # Optimizer configurations
    inference/
      predictor.py          # Inference pipeline
      postprocess.py        # Output postprocessing
    utils/
      config.py             # Configuration management
      logging.py            # Experiment logging
      reproducibility.py    # Seed setting, deterministic mode
  configs/
    train_config.yaml       # Training hyperparameters
    model_config.yaml       # Model architecture config
  scripts/
    train.py                # Training entry point
    evaluate.py             # Evaluation script
    export.py               # Model export (ONNX, TorchScript)
  notebooks/
    exploration.ipynb       # Data exploration (not production code)
  tests/
    test_data.py
    test_models.py
    test_training.py

PyTorch Model Patterns

  • Inherit from nn.Module. Always call super().__init__().
  • Type hint all method signatures:
    class ClassificationHead(nn.Module):
        def __init__(self, in_features: int, num_classes: int, dropout: float = 0.1) -> None:
            super().__init__()
            self.dropout = nn.Dropout(dropout)
            self.fc = nn.Linear(in_features, num_classes)
    
        def forward(self, x: torch.Tensor) -> torch.Tensor:
            x = self.dropout(x)
            return self.fc(x)
    
  • Use nn.Sequential or nn.ModuleList for dynamic layer construction — never regular Python lists.
  • Register buffers for non-parameter tensors: self.register_buffer('mean', torch.zeros(3)).
  • Use @torch.no_grad() for inference methods.
  • DON'T: Use numpy operations inside forward() — they break autograd.
  • DON'T: Create tensors in forward() without sending to the correct device.

Read the full file on GitHub · 250 lines

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. 1mo ago First seen · 250 lines · 0 tokens per session scan A c14e0f692310

Subscribe to this mod's changes

rule is a cursor rule published in the GitHub repository noobgaminghard/cursor-rules (1 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,173 tokens. A static security scan graded it A with 0 findings. It is 91% identical to cursorrules, differing in 6 lines, and is treated as a copy.