# supabase-typed-mutations

The supabase-typed-mutations Claude Code rule adds Database types to Supabase insert, update, and upsert calls. It applies while an agent works with these mutations.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 1120 repo stars
- Author: rerun-build
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/supabase-typed-mutations.mdc
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/supabase-typed-mutations

## What it does

The rule requires Supabase mutation calls to use types that match their table. It uses the `Insert` and `Update` types under `Database['public']['Tables']`.

Import `Database` from `@/app/api/database.types`. For a `projects` update, the rule points to `Database['public']['Tables']['projects']['Update']`; inserts use the matching `Insert` type. The referenced types file must exist at that import path.

## Requirements
- Works with: Supabase

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/supabase-typed-mutations.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/supabase-typed-mutations.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/supabase-typed-mutations.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/supabase-typed-mutations.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/supabase-typed-mutations.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/supabase-typed-mutations.mdc

## When to use it
- type Supabase inserts for a table
- use the matching type for table updates
- add table types to `upsert` calls

## Example prompts
- Add the `Database` type to the Supabase `insert` call for `projects`.
- Check that the `projects` update uses its `Update` type from `Database`.
- Type this Supabase `upsert` call using the table’s `Database` type.

## Similar
- [supabase-migration-assistant](https://affpapa.org/en/nevibecode/commands/supabase-migration-assistant.md) — command · 982 installs
- [supabase-type-generator](https://affpapa.org/en/nevibecode/commands/supabase-type-generator.md) — command · 948 installs
- [supabase-audit-tables-list](https://affpapa.org/en/nevibecode/skills/supabase-audit-tables-list.md) — skill · 524 installs
- [supabase-agent-skills](https://affpapa.org/en/nevibecode/skills/supabase-agent-skills.md) — skill · 252 installs
- [supabase-admin](https://affpapa.org/en/nevibecode/skills/supabase-admin.md) — skill · 200 installs
- [supabase](https://affpapa.org/en/nevibecode/skills/membrane-supabase.md) — skill · 159 installs

From the same set: [rerun-build/rerun](https://affpapa.org/en/nevibecode/by/rerun-build/rerun.md) — 25 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
