nextbase-database-testing
Skill827 starsChanged 2 months agoMITView on GitHub
Use for NextBase pgTap tests, database_test.sql, RLS behavior tests, constraint assertions, plan counts, transaction cleanup, or running the local Supabase database test suite.
In this repository23 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- nextbase-architectureSkill
- nextbase-auth-ssrSkill
- nextbase-cache-componentsSkill
- nextbase-safe-actions-dataSkill
- nextbase-testingSkill
- nextbase-ui-patternsSkill
- next-cache-components-optimizerSkill
- safe-action-advancedSkill
- safe-action-clientSkill
- safe-action-hooksSkill
- safe-action-middlewareSkill
- safe-action-testingSkill
- shadcnSkill
- supabase-postgres-best-practicesSkill
- supabase-schema-migrationsSkill
- supabaseSkill
- turborepoSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- web-design-guidelinesSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Add assertions to the canonical file unless the test runner and repository intentionally adopt multiple files.
- Very specific: line 15
Update plan(N) every time assertions are added or removed.
- Very specific: line 16
Use built-in pgTap assertions and ordinary SQL.
- Distinctive: line 17
Keep fixtures inside the transaction and use deterministic UUIDs or returned IDs.
- Distinctive: line 30
Start local Supabase from the repository workflow.
- Distinctive: line 32
Add the smallest failing pgTap assertion.
- Distinctive: line 33
Keep the plan count exact and the transaction rollback intact.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
NextBase Database Testing
Load supabase, supabase-postgres-best-practices, and supabase-schema-migrations for database work.
The canonical suite is apps/database/supabase/tests/database_test.sql. It is one pgTap script wrapped in BEGIN and ROLLBACK, currently using an explicit plan(42) and SELECT * FROM finish().
Match the Existing Shape
- Add assertions to the canonical file unless the test runner and repository intentionally adopt multiple files.
- Update
plan(N)every time assertions are added or removed. Count pgTap assertions, not SQL statements or comments. - Use built-in pgTap assertions and ordinary SQL. This repository does not provide a custom
testshelper schema. - Keep fixtures inside the transaction and use deterministic UUIDs or returned IDs. Never rely on persistent local data.
What to Assert
- Structural tests: columns, types, nullability, primary/foreign keys, indexes, functions, triggers, and policy definitions.
- Behavioral tests: what
anon,authenticated, an owner, and a different user can actually select, insert, update, or delete. - RLS ownership tests must cover both the allowed owner path and the denied cross-user path.
- Constraint tests should assert the expected SQLSTATE or unchanged state, not a brittle full server error string.
Set the local role and JWT claims only for the assertion that requires them, then restore or replace them before the next persona. Remember that denied INSERT operations may raise while denied UPDATE or DELETE operations may affect zero rows; assert the actual PostgreSQL behavior and final state.
Workflow
- Start local Supabase from the repository workflow.
- Apply or regenerate the declarative schema change.
- Add the smallest failing pgTap assertion.
- Keep the plan count exact and the transaction rollback intact.
- Run:
pnpm --dir apps/database test-dbA passing structural policy-name check is not proof that RLS behavior is correct; include behavioral assertions for authorization 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.

