본문으로 건너뛰기
cccskills
무료GitHub에 공개

create-readonly-db-role

Prepare read-only PostgreSQL access for AI agents, including SQL files, protected connection settings, and checks that writes and sensitive-table reads fail. A human applies production database changes and agrees which tables agents must not access.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Set up read-only PostgreSQL access for agents. Use only when the user explicitly invokes /create-readonly-db-role.

연동 도구SupabasePostgreSQL
설치 방법 보기

이럴 때 유용합니다

  • Prepare a read-only database account for agents
  • Exclude tables containing secrets or personal data
  • Verify that writes and restricted reads are blocked
  • Document project-specific database query practices

포함된 파일(2)

  • SKILL.md5.1 KB
  • agents/openai.yaml43 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Create a Read-Only DB Role for Agents

Prepare a SELECT-only role and protected connection. The SQL, role name, grants, denylist, RLS setting, timeouts, and connection steps are examples to adapt to your system, not live production configuration.

Access model

  1. SELECT-only grants. Grant no write permissions; use a denylist to exclude secrets and PII.
  2. Current and future tables. Grant SELECT on all tables in public, including future tables through default privileges, then revoke denylisted tables. Never grant the auth schema. New sensitive tables need a manual revoke.
  3. Soft guardrails. Set default_transaction_read_only = on and a short statement_timeout suited to the workload.

RLS: tables may return no rows when the role has no applicable policy. Consider bypassrls only if it fits your security model: it skips row filtering, while grants and the denylist still apply.

Workflow

  1. Check the role: select rolname from pg_roles where rolname = 'agent_reader';. Use your chosen name; if it exists, update rather than recreate it.
  2. Agree on the denylist with the human. Identify secret or PII tables agents must never see, such as credentials, webhook payloads, and identity tables.
  3. Save SQL in the repo, e.g. docs/database/create-agent-reader-role.sql. Comment what changes, why, and how to apply, verify, and revert. Chat-only SQL is insufficient.
  4. The human applies it. Agents never run production DDL. In Supabase, paste the file into the SQL editor, then delete the query from its history because it contains the password. The human stores the password in a password manager.
  5. Wire the connection through a protected secret manager or local environment configuration; never commit it. Supabase session poolers typically use <role>.<project-ref> on port 5432. Install psql if missing (Homebrew libpq on macOS).
  6. Run every verification check below.
  7. Create a project-local usage skill covering key tables, query patterns, read-only access, and never pasting PII into commits or docs.

SQL template

-- Example only. Rename the role, timeout, and denylist for your system.

-- 1. role + soft guardrails
create role agent_reader with login password 'REPLACE_ME';
alter role agent_reader set default_transaction_read_only = on;
alter role agent_reader set statement_timeout = '10s';  -- example timeout; change as needed

-- 2. SELECT-only grants, denylist model
grant usage on schema public to agent_reader;
grant select on all tables in schema public to agent_reader;
alter default privileges for role postgres in schema public
  grant select on tables to agent_reader;   -- future tables auto-readable

-- 3. denylist: keep secrets and PII invisible (replace with your own tables)
revoke select on table public.secrets from agent_reader;
revoke select on table public.private_events from agent_reader;

-- 4. only if RLS is enabled, no policy covers this role, and bypass fits your model
alter role agent_reader bypassrls;

Revert: drop owned by agent_reader; drop role agent_reader;

Verification

All checks must pass before declaring done:

# Load the connection URL from your secret manager or local environment configuration.
psql "<readonly-connection-url>" -X -c "select current_user;"                      # -> agent_reader
psql "<readonly-connection-url>" -X -c "show statement_timeout;"                   # -> matches your chosen timeout
psql "<readonly-connection-url>" -X -c "select count(*) from public.<big_table>;"  # -> real number, NOT 0
psql "<readonly-connection-url>" -X -c "delete from public.<any_table> where false;"
# -> ERROR: read-only transaction (soft guardrail)
psql "<readonly-connection-url>" -X -c "begin; set transaction read write; delete from public.<any_table> where false; rollback;"
# -> ERROR: permission denied (the hard wall)
psql "<readonly-connection-url>" -X -c "select * from public.<denylisted> limit 1;"         # -> ERROR: permission denied
psql "<readonly-connection-url>" -X -c "select * from auth.<identity_table> limit 1;"       # -> ERROR: permission denied

Verify both protections: writes fail under the read-only guardrail, and fail with permission denied when it is off. If any check fails, correct the configuration through the human and rerun all checks.

Troubleshooting and maintenance

  • No rows across tables: check RLS policies; use bypassrls only if appropriate.
  • Write verification succeeds: stop. Have the human revoke the role's privileges and correct the setup, then rerun all checks.
  • Supabase authentication fails: check the pooler username, usually <role>.<project-ref>.
  • Legitimate query times out: add filters or limits before raising the timeout.
  • New sensitive table: add revoke select to the denylist.
  • Password rotation: have the human run alter role agent_reader with password '...' and update the stored connection secret.
  • Never allow agents to write through this role. Production writes remain human-only.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

4x4

무료

Work through sixteen open questions in four rounds to clarify major product decisions, risky changes, or large refactors. The agent adapts later questions to earlier answers, then turns your decisions into a step-by-step implementation plan.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Clarifying decisions before a major product change
  • Planning a large refactor
  • Deciding rollout order for a risky change
davidondrej/skills4.2천2026년 10월 19일 업데이트

Document approved decisions as concise ADRs, or architecture decision records. It preserves the user's meaning and conditions, removes conversational filler, follows the project's numbering, and presents the saved record for review.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Record a decision approved in conversation
  • Preserve the conditions and scope of a decision
  • Add a numbered ADR to existing records
davidondrej/skills4.2천2026년 10월 19일 업데이트

Keep a Mac awake for a chosen duration or while a specified process runs. The skill uses built-in macOS tools to manage one session, verify that sleep prevention is active, and control whether the display stays on.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Keep a Mac awake during a lengthy task
  • Prevent sleep while a specified process runs
  • Allow the display to dim while keeping the Mac awake
davidondrej/skills4.2천2026년 10월 19일 업데이트

Turn a feature or refactoring idea into a concise implementation prompt for another agent. It asks focused questions one at a time, records decisions, and includes development steps, validation, and working rules.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Clarify requirements for a new feature
  • Decide edge cases and failure behavior
  • Define the scope of a refactor
davidondrej/skills4.2천2026년 10월 19일 업데이트

bb-cli

무료

Inspect and manage BB threads, environments, projects, and plugins through its command line interface. The skill guides agents to identify the correct targets, apply changes, and verify the resulting state.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Check BB projects and environment status
  • Manage skills and plugins
  • Create or operate threads
davidondrej/skills4.2천2026년 10월 19일 업데이트

Create, install, and debug TypeScript plugins that extend bb with custom pages, sidebar panels, CLI commands, agent tools, themes, and other features. The skill also guides development reloads, log checks, and verification of installed plugins.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Add a custom page or sidebar panel to bb
  • Create a bb CLI command or agent tool
  • Investigate plugin errors through logs
davidondrej/skills4.2천2026년 10월 19일 업데이트

davidondrej의 스킬 모두 보기

이 스킬의 문제 신고