storage

storage is a cursor rule for Cursor from materialize-labs/ai-optimized-starter-app. It costs 9 tokens per session (1,389 once invoked), scanned A, original, MIT.

Rules for storing files in Supabase Storage, a cloud service for uploading and serving files. They cover secure access, bucket naming, file validation, upload options, and organization.

In plain words
What is it for?
Implementing file uploads and downloads, configuring storage buckets, validating files, setting permissions, and organizing stored assets.
Why use it?
They reduce risks from hardcoded settings, unsafe file types, incorrect content types, accidental replacements, and inconsistent storage paths.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Implementing file uploads and downloads, configuring storage buckets, validating files, setting permissions, and organizing stored assets.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/materialize-labs/ai-optimized-starter-app/storage
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/materialize-labs/ai-optimized-starter-app

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 storage

README.md
[![agentmods](https://agentmods.dev/badge/rules/materialize-labs/ai-optimized-starter-app/storage/github.svg)](https://agentmods.dev/rules/materialize-labs/ai-optimized-starter-app/storage)
Your own site
<a href="https://agentmods.dev/rules/materialize-labs/ai-optimized-starter-app/storage"><img src="https://agentmods.dev/badge/rules/materialize-labs/ai-optimized-starter-app/storage/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 storage

Your own site · 80×15
<a href="https://agentmods.dev/rules/materialize-labs/ai-optimized-starter-app/storage"><img src="https://agentmods.dev/badge/rules/materialize-labs/ai-optimized-starter-app/storage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,389 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.00009 $0.01389
Opus 5.5 $0.00004 $0.00556
Sonnet 5.5 $0.00002 $0.00278
Haiku 4.5 $0.00001 $0.00139

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

Security

Grade A, and why

storage 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 2mo 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/storage.mdc · 238 lines

How it starts

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

Supabase Storage Architecture

This document outlines our approach to file storage using Supabase Storage. These guidelines ensure consistent, secure, and efficient file handling across the application.

Core Principles

  1. Security First: Enforce proper access controls and permissions
  2. Structured Organization: Maintain consistent file paths and bucket structures
  3. Performance Optimization: Implement efficient upload/download strategies
  4. Error Resilience: Handle failures gracefully at all points

Configuration Best Practices

  • Use environment variables for all bucket names
    // In .env.local
    NEXT_PUBLIC_SUPABASE_PROFILE_BUCKET="profile-images"
    
    // In code
    const profileBucket = process.env.NEXT_PUBLIC_SUPABASE_PROFILE_BUCKET
    
  • Never hardcode bucket names in application code
  • Set appropriate file size limits and validate file types
  • Use upsert: true only when intentionally replacing files
  • Always include proper content-type headers when uploading

Bucket Organization

Naming & Structure

  • Use kebab-case for bucket names: profile-images, document-files
  • Create purpose-specific buckets rather than general-purpose ones
  • Document each bucket's purpose and access pattern

Security Policies

  • Make buckets private by default
  • Implement Row Level Security (RLS) for user-specific access
  • Example RLS policy for user-owned files:
    CREATE POLICY "Users can only access their own files"
    ON storage.objects
    FOR ALL
    USING (auth.uid()::text = (storage.foldername(name))[1]);
    

Note: For production deployment, provide SQL scripts for required RLS policies to your DevOps team.

File Path Conventions

Organize files using consistent path structures:

{bucket}/{userId}/{purpose}/{filename}

Examples:

  • User avatars: profile-images/user_123/avatar/profile.jpg
  • Documents with versioning: documents/user_123/contracts/2024-02-13-contract.pdf

This structure:

  • Enables effective RLS policies
  • Simplifies permission management
  • Provides natural organization

Read the full file on GitHub · 238 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. 2mo ago First seen · 238 lines · 9 tokens per session scan A 64eaed985d53

Subscribe to this mod's changes

storage is a cursor rule published in the GitHub repository materialize-labs/ai-optimized-starter-app (16 stars, last pushed 1y ago), licensed MIT. It adds 9 tokens to every session and 1,389 once invoked, about $0.0000 per session on Opus 5.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.