create-readonly-db-role
Skill1 starsChanged 9 months agoMITView on GitHub
Prepare least-privilege PostgreSQL agent access when requested.
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/code-simplifier.mdcCursor rule
- .cursor/rules/tdd-verification.mdcCursor rule
- ckm:banner-designSkill
- ckm:brandSkill
- ckm:designSkill
- ckm:design-systemSkill
- ckm:slidesSkill
- ckm:ui-stylingSkill
- ui-ux-pro-maxSkill
- mission-control-agent-integrationSkill
- adr-verbatimSkill
- agent-watchdogSkill
- anSkill
- api-and-interface-designSkill
- architectSkill
- arenaSkill
- automate-meSkill
- babysitSkill
- before-and-afterSkill
- benchmark-checklistSkill
- blast-radiusSkill
- broSkill
- ci-cd-and-automationSkill
- code-structureSkill
- correctSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- deprecation-and-migrationSkill
- deslopSkill
- efficient-fableSkill
- efficient-frontierSkill
- efficient-orchestratorSkill
- evidence-driven-testingSkill
- factory-babysit-prSkill
- factory-collectSkill
- factory-human-digestSkill
- factory-lookbackSkill
- factory-recoverSkill
- factory-review-prsSkill
- factory-shipSkill
- factorySkill
- factory-watchdogSkill
- figure-it-outSkill
- fix-ciSkill
- fix-merge-conflictsSkill
- frontend-ui-engineeringSkill
- get-pr-commentsSkill
- greploop-appsSkill
- greploopSkill
- handoffSkill
- howSkill
- interrogateSkill
- in-your-own-wordsSkill
- ketchupSkill
- maintain-formal-verification-skillSkill
- maintain-verification-skillSkill
- make-pr-easy-to-reviewSkill
- mission-control-budget-controlSkill
- The first 60 shown.
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 17
Use when the user requests PostgreSQL access for an agent.
- Distinctive: line 30
Prefer sanitized fixtures or a separately controlled reporting database when the task does not require production data.
- Very specific: line 42
Keep the agent role non-superuser, without BYPASSRLS, role creation, database creation, replication, object ownership, or privileged …
- Very specific: line 44
Check both inherited access and roles reachable through SET ROLE.
- Distinctive: line 55
If shared grants break isolation, propose a scoped owner-reviewed correction or a separate access mechanism.
- Distinctive: line 58
Use a read-only transaction default, statement timeout, and suitable connection limits as additional guardrails.
- Distinctive: line 76
Use isolated fixtures for mutation probes.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Prepare read-only database access
Use when the user requests PostgreSQL access for an agent. Prepare a scoped access plan, reviewable SQL, and verification evidence. This skill does not grant permission to alter production roles or retrieve customer data.
Establish the access boundary
Identify the database version, environment, provider, role, required queries, and approved tables, columns, and tenant scope. Inspect existing roles, grants, ownership, memberships, row-level security policies, and object-creation defaults. If the role exists, compare its effective access with the desired access before changing it. Do not recreate it or replace its password without authorization.
Prefer sanitized fixtures or a separately controlled reporting database when the task does not require production data. Read-only access can still disclose private data and consume database resources.
Prepare the least-privilege plan
- Grant access to explicitly approved objects and columns. Grant only required schema usage and query privileges. Do not grant SELECT on all current or future tables and then rely on a sensitive-table denylist. Review new tables and columns before exposing them. Table-level SELECT includes future columns, so use reviewed column grants or explicit-column reporting views when the column boundary matters.
- Keep the agent role non-superuser, without
BYPASSRLS, role creation, database creation, replication, object ownership, or privileged memberships. Check both inherited access and roles reachable throughSET ROLE. ANOINHERITattribute alone is not proof of isolation. - Preserve row-level security. Empty results can be correct. Inspect the applicable policy and session identity, then verify known permitted and denied fixture rows. Do not bypass RLS to make a query return data. Review view ownership and security behavior too; a view is not automatically a tenant boundary.
- Inspect effective privileges from
PUBLICand memberships, including functions and procedures. Revoking a direct grant does not cancel an inherited grant. Review callableSECURITY DEFINERroutines and other write-capable paths; SELECT-only table grants do not prevent invoking them. If shared grants break isolation, propose a scoped owner-reviewed correction or a separate access mechanism. Do not revoke shared application privileges blindly. - Use a read-only transaction default, statement timeout, and suitable connection limits as additional guardrails. A client can change its transaction default; ACLs and policies must enforce the actual boundary.
Save project-specific SQL with no passwords in the established database-change location. Include the target environment, privilege diff, preconditions, application procedure, verification, and scoped rollback. Provision credentials through the approved secret mechanism; do not put them in Git, query-history examples, command arguments, or reports. Use the provider's current documented connection and TLS settings rather than guessing pooler URLs.
Apply only within explicit authority for that environment and change. Otherwise deliver the prepared SQL and checks for the authorized operator. Do not treat a request to prepare access as approval to change production.
Verify the effective role
Connect as the actual agent login, not an administrator using assumed context. Use isolated fixtures for mutation probes; a rolled-back statement may still invoke triggers or external side effects. Verify:
- The intended login, effective role, database, settings, and membership scope.
- Approved queries return the expected fixture rows and columns, including a known permitted row when one exists. A real empty result is not a failure.
- Sensitive objects, excluded columns, and other tenants' rows remain inaccessible. Distinguish permission errors from intentional RLS filtering.
- With the read-only transaction setting disabled in an isolated test, persistent writes, DDL, privilege escalation, and unapproved callable routines still fail. Check applicable INSERT, UPDATE, DELETE, TRUNCATE, sequence mutation, and function paths rather than one DELETE alone.
- New fixture objects created by each relevant migration owner remain inaccessible until explicitly approved. Check default privileges as well as existing objects.
Capture results without row contents or secrets. Report the environment tested
and any unverified paths. Do not claim the role is production-ready from static
SQL review alone. Roll back only grants and configuration introduced by this
change; avoid broad ownership cleanup such as DROP OWNED.
Authoritative references, checked against the target server version: privileges, REVOKE, row security, default privileges, and function security.
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.

