ai-ml-development-standards

ai-ml-development-standards is a cursor rule for Cursor from beettlle/pi-spine. It costs 0 tokens per session (2,263 once invoked), scanned A, original, MIT.

A set of development rules for machine-learning software using tools such as PyTorch and TensorFlow. It covers tensor checks, GPU use, model management, experiment tracking, and reproducible results.

In plain words
What is it for?
Use it when building or reviewing AI and machine-learning code, especially tensor operations, GPU workloads, training experiments, model handling, and repeatable research.
Why use it?
It helps catch incorrect tensor dimensions, wasted GPU work, hard-to-repeat experiments, and weak tracking of model changes. Reproducibility means being able to run an experiment again and obtain comparable results.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when building or reviewing AI and machine-learning code, especially tensor operations, GPU workloads, training experiments, model handling, and repeatable research.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/beettlle/pi-spine/ai-ml-development-standards
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/beettlle/pi-spine

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 ai-ml-development-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/beettlle/pi-spine/ai-ml-development-standards.svg)](https://agentmods.dev/rules/beettlle/pi-spine/ai-ml-development-standards)
Your own site
<a href="https://agentmods.dev/rules/beettlle/pi-spine/ai-ml-development-standards"><img src="https://agentmods.dev/badge/rules/beettlle/pi-spine/ai-ml-development-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,263 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 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.1 $0.00000 $0.02263
Opus 5 $0.00000 $0.01131
Sonnet 5 $0.00000 $0.00453
Haiku 4.5 $0.00000 $0.00226

Measured 7d ago against content hash 07a4528eaa2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

ai-ml-development-standards 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 7d 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.

.cursor/rules/ai-ml-development-standards.mdc · 203 lines

How it starts

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

Persona: AI Research Engineer

  • Role: ML systems architect specializing in GPU optimization and reproducible research. Philosophy: "Reproducibility first, performance second, complexity never."
  • Traits: Reproducibility-obsessed (seed everything), GPU-aware (memory-efficient), Experiment-tracking (log everything), Safety-first (verify all operations)

AI/ML Development Standards

This file contains AI/ML-specific development standards for PyTorch, TensorFlow, GPU optimization, model management, and reproducibility.

For universal anti-patterns: See general-llm-anti-patterns.mdc For Python standards: See python-3-development-standards.mdc


Category 1: Tensor Safety Anti-Patterns

1.1 Missing Shape Assertions (CRIT)

CRITICAL: Always assert tensor shapes before operations.

❌ Bad: result = model(input) (no shape verification) ✅ Good: assert input.shape == (batch, seq, dim); result = model(input) ⚠️ Why: Silent shape mismatches cause runtime errors, wastes GPU time, difficult debugging 🔧 Fix: Assert tensor shapes, use .shape checks before operations, validate dimensions 📍 See: python-3-development-standards.mdc section 2.9

Detect: Tensor operations without shape checks, no assertions before model calls, missing dimension validation


1.2 Device Agnosticism Failures (CRIT)

CRITICAL: Always use .to(device) explicitly, never assume device placement.

❌ Bad: tensor.cuda() (hardcoded CUDA), tensor.to("cuda:0") (hardcoded device) ✅ Good: device = torch.device("cuda" if torch.cuda.is_available() else "cpu"); tensor.to(device) ⚠️ Why: Breaks on CPU-only machines, fails on multi-GPU setups, not portable 🔧 Fix: Use device-agnostic code, check availability before device assignment, detect GPU at runtime 📍 See: general-llm-anti-patterns.mdc section 3.6 (Magic Number/String)

Detect: Hardcoded .cuda() calls, no device checks, device strings in code, CPU-only code assuming GPU


1.3 Mixed-Precision Training Errors (CRIT)

Read the full file on GitHub · 203 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. 7d ago First seen · 203 lines · 0 tokens per session scan A 07a4528eaa2a

Subscribe to this mod's changes

ai-ml-development-standards is a cursor rule published in the GitHub repository beettlle/pi-spine (3 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,263 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-31.