safety

safety is a cursor rule for Cursor from Pranav-Karra-3301/tuck. It costs 0 tokens per session (415 once invoked), scanned A, original, MIT.

A set of safety rules for coding agents, covering file changes, backups, secrets, and input validation. Zod is a TypeScript library used here to check that external data has the expected shape.

In plain words
What is it for?
Use it when an agent deletes or overwrites files, changes configuration, handles API keys or passwords, or processes data from outside the program.
Why use it?
It reduces the risk of losing user files, exposing credentials, or accepting malformed input. Destructive actions require confirmation, and modified files must be backed up first.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { ConfigSchema } from '../schemas/config.schema.js';.

Good fit Use it when an agent deletes or overwrites files, changes configuration, handles API keys or passwords, or processes data from outside the program.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Pranav-Karra-3301/tuck
agentmods
npx agentmods add rules/pranav-karra-3301/tuck/safety

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 safety

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/pranav-karra-3301/tuck/safety"><img src="https://agentmods.dev/badge/rules/pranav-karra-3301/tuck/safety.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 415 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.00415
Opus 5.5 $0.00000 $0.00166
Sonnet 5.5 $0.00000 $0.00083
Haiku 4.5 $0.00000 $0.00042

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

Security

Grade A, and why

safety 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 3mo 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/safety.mdc · 88 lines

What it actually says

Safety Rules

Core Safety Principles

  1. Never lose user data - This is the most important rule
  2. Confirm destructive actions - Always ask before deleting/overwriting
  3. Create backups - Before any file modification
  4. Validate all input - Use Zod schemas

Destructive Operations

ALWAYS confirm before:

  • Deleting files
  • Overwriting files
  • Removing tracked files
  • Resetting configuration
// Required pattern
const confirmed = await prompts.confirm(
  'This will delete all backups. Continue?',
  false  // Default to safe option
);

if (!confirmed) {
  prompts.cancel('Operation cancelled');
  return;
}

Backup Requirements

Before modifying any user file:

  1. Create a backup copy
  2. Store backup location
  3. Provide restore path in error messages
// Create backup before modification
const backupPath = await createBackup(originalPath);

try {
  await modifyFile(originalPath);
} catch (error) {
  throw new Error(`Failed. Restore from: ${backupPath}`);
}

Secrets and Credentials

NEVER:

  • Store API keys in tracked files
  • Track SSH private keys
  • Include passwords in config
  • Log sensitive data

Input Validation

Use Zod for ALL external data:

  • Config file contents
  • Manifest file contents
  • User-provided paths
  • Environment variables
import { ConfigSchema } from '../schemas/config.schema.js';

const data = JSON.parse(fileContent);
const config = ConfigSchema.parse(data); // Throws if invalid

Path Handling

ALWAYS use path utilities:

  • expandPath() - Expand ~ to full path
  • collapsePath() - Collapse home to ~
  • pathExists() - Check existence safely

NEVER:

  • Assume path format
  • Use raw ~ in fs operations
  • Hardcode paths
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. 3mo ago First seen · 88 lines · 0 tokens per session scan A 8aa85fca330e

Subscribe to this mod's changes

safety is a cursor rule published in the GitHub repository Pranav-Karra-3301/tuck (15 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 415 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.

Related

safety compared with cursor rules from other repositories

safety next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
safetyPranav-Karra-3301/tuckCursor rule154mo agoMITA0Cursor
registries-and-authvltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor
spec-parsingvltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor
install-build-phasesvltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor
idealvltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor
security-archivevltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor
vlxvltpkg/vltpkgCursor rule5783d agoBSD-2-Clause-PatentA0Cursor