database-change
Skill0 starsChanged 3 days agoMITView on GitHub
Add or change a Supabase/Postgres table, column, constraint or RLS policy for this project, and wire it through types, server functions, query options and the admin UI. Use for any schema or data-access change.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- TiagoGranelli/slopprooftheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- TiagoGranelli/slopproof★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- add-page-sectionSkill
- portfolio-security-checkSkill
- verify-changesSkill
- add-page-sectionSkill
- database-changeSkill
- portfolio-security-checkSkill
- verify-changesSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Any other agent: write the migration SQL and the app code, but do not try to connect to the database or invent a connection string.
- Very specific: line 31
Create drizzle/migrations/NNNN_<short_description>.sql, where NNNN is the next number.
- Very specific: line 60
Every table gets RLS, REVOKE ALL … FROM PUBLIC, anon, authenticated followed by explicit grants, and the "Admins manage" policy.
- Very specific: line 62
Add "Public read" only for data the public site shows.
- Very specific: line 67
Never grant anon anything beyond SELECT.
- Very specific: line 75
Add or extend the app-level interface in src/data/types.ts.
- Very specific: line 80
Use publicClient() and select an explicit column list.
- Very specific: line 85
If the admin table needs raw rows, use a sub-key such as ["things", "rows"] so that invalidating ["things"] refreshes both.
- Very specific: line 95
Run the portfolio-security-check skill on the migration, then verify-changes.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database change
The database is Supabase, managed through Lovable Cloud. Schema history is the
numbered SQL files in drizzle/migrations/. Applied migrations are never edited.
Who applies migrations
- Inside Lovable: Lovable Cloud writes and applies the migration and
regenerates
src/integrations/supabase/types.tsanddrizzle/migrations/meta/*. - Any other agent: write the migration SQL and the app code, but do not try to connect to the database or invent a connection string. In your report, say that the owner must apply the migration in Lovable, or in the Supabase SQL editor for a fork, before the code works.
- Don't add entries to
drizzle/migrations/meta/_journal.jsonyourself. A migration that is listed in the journal but was not applied by Lovable's migrator breaks it: with0008_chat_rate_limitLovable had to comment the file out and re-apply the same SQL as0009. Add only the.sqlfile and ask the owner to have Lovable apply it ("Apply the database migration drizzle/migrations/NNNN_….sql"). Lovable then registers it, sometimes as a new file with the same SQL (e.g.0010_apply_courses.sql). In that case, delete your unregistered original so a fresh replay does not create the table twice, and number your next migration after Lovable's.
1. Write the migration
Create drizzle/migrations/NNNN_<short_description>.sql, where NNNN is the next
number. Template for a new public-read, admin-write table:
CREATE TABLE public.talks (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
title text NOT NULL,
url text CHECK (url IS NULL OR url ~* '^https://'),
sort_order int NOT NULL DEFAULT 0,
created_at timestamptz NOT NULL DEFAULT now()
);
-- Supabase's default privileges grant ALL (including TRUNCATE, which ignores
-- RLS) on new tables to anon and authenticated. Revoke first, then grant.
REVOKE ALL ON public.talks FROM PUBLIC, anon, authenticated;
GRANT SELECT ON public.talks TO anon;
GRANT SELECT, INSERT, UPDATE, DELETE ON public.talks TO authenticated;
GRANT ALL ON public.talks TO service_role;
ALTER TABLE public.talks ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Public read" ON public.talks
FOR SELECT TO anon, authenticated USING (true);
CREATE POLICY "Admins manage" ON public.talks
FOR ALL TO authenticated
USING (public.has_role(auth.uid(), 'admin'))
WITH CHECK (public.has_role(auth.uid(), 'admin'));Rules:
- Every table gets RLS,
REVOKE ALL … FROM PUBLIC, anon, authenticatedfollowed by explicit grants, and the"Admins manage"policy. Add"Public read"only for data the public site shows. - New columns on existing tables need a
DEFAULTor must be nullable, so existing rows still work. - URL columns get an
https://CHECK constraint, likeprojectsin0005_security_hardening.sql. - Never grant
anonanything beyondSELECT. Never weakenhas_rolegrants.
2. Types
src/integrations/supabase/types.tsis generated. Outside Lovable, leave it alone and say in your report that it must be regenerated. If the type check fails because the table is missing, note this instead of hand-editing the generated file.- Add or extend the app-level interface in
src/data/types.ts.
3. Server function and query
In src/data/portfolio.functions.ts, copy fetchSkills:
- Use
publicClient()and select an explicit column list. .order("sort_order").- On error,
throw new Error("Could not load <thing>"). Never pass the raw error on.
In src/data/index.ts, add export const thingsQuery = queryOptions({ queryKey: ["things"], queryFn: ... }).
If the admin table needs raw rows, use a sub-key such as ["things", "rows"] so
that invalidating ["things"] refreshes both.
4. Admin UI (if editable)
Extend the Table union in src/components/admin/useAdminCrud.ts, then build
src/routes/admin.<things>.tsx by following admin.skills.tsx.
5. Verify
Run the portfolio-security-check skill on the migration, then verify-changes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

