一键导入
access-policy-designer
Designs and implements row-level security (RLS), column-level masking, and role-based access control policies (RBAC/ABAC).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Designs and implements row-level security (RLS), column-level masking, and role-based access control policies (RBAC/ABAC).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create, optimize, critique, and programmatically structure prompts for AI systems. Use this skill whenever the user is designing or improving a static prompt, system prompt, coding prompt, agent prompt, workflow prompt, MCP-oriented prompt package, or an algorithmic prompt optimization pipeline. Also use it when the user asks to turn vague AI behavior into a precise instruction set, tool policy, agent spec, evaluation metric, or prompt architecture.
Enforce and manage DESIGN.md specifications, extract design systems from URLs, and combine design reasoning with token roles to prevent drift.
Assumption-first architecture review skill to stress-test project plans and expose hidden risks.
Forces the agent to act with a Claude-like product mindset, prioritizing user journey, UX states, and visual quality before coding.
Compiles and extracts session knowledge into a living, interconnected LLM-Wiki. Instead of writing isolated logs, it identifies key entities, updates cross-referenced topic files in docs/knowledgelib/, and maintains an index and chronological log. Use this to ensure persistent, compounding project knowledge.
Overrides the agent's behavior to enter an interactive, consulting mode. Instead of guessing or immediately executing a task, the agent will analyze the request and ask guiding, targeted questions to clarify intent, constraints, and requirements first.
| name | access-policy-designer |
| description | Designs and implements row-level security (RLS), column-level masking, and role-based access control policies (RBAC/ABAC). |
This skill enforces Zero Trust at the database layer. Instead of relying purely on the application backend to filter WHERE tenant_id = ?, it pushes security down to the database engine to prevent data leaks.
Core assumption: Application code has bugs. Database security policies (RLS/Views) are the final, unbreakable safety net against SQL Injection or logic flaws.
Convert business rules into technical access models.
Business Rule: "Doctors can only see their own patients' records."
Translation: We need Row-Level Security (RLS) on the patients table where primary_doctor_id = current_user_id().
SELECT, INSERT, UPDATE, and DELETE.SELECT on specific columns.Customer Support role can see the users table but cannot SELECT ssn or salary.Generate platform-specific DDL for security policies.
Required Outputs (Must write BOTH to docs/database-report/):
docs/database-report/access-policy-report.md)### 🔒 Security Design: Patient Records
**Business Rule:** Doctors only access their assigned patients.
**SQL Implementation (PostgreSQL RLS):**
```sql
-- 1. Enable RLS on the table
ALTER TABLE patients ENABLE ROW LEVEL SECURITY;
-- 2. Create the SELECT policy
CREATE POLICY doctor_select_own_patients
ON patients FOR SELECT
TO qualified_doctors
USING (primary_doctor_id = current_setting('app.current_user_id')::uuid);
-- 3. Create the UPDATE policy (Must belong to them and remain assigned to them)
CREATE POLICY doctor_update_own_patients
ON patients FOR UPDATE
TO qualified_doctors
USING (primary_doctor_id = current_setting('app.current_user_id')::uuid)
WITH CHECK (primary_doctor_id = current_setting('app.current_user_id')::uuid);
app.current_user_id setting securely injected by the backend connection?
2. **Machine-Readable JSON (`docs/database-report/access-policy-output.json`)**
```json
{
"skill": "access-policy-designer",
"target_table": "patients",
"dialect": "PostgreSQL",
"policies": [
{"name": "doctor_select_own_patients", "action": "SELECT", "role": "qualified_doctors"},
{"name": "doctor_update_own_patients", "action": "UPDATE", "role": "qualified_doctors"}
],
"rls_enabled": true
}
users queries the users table to check a role, it will infinite-loop. Restrict policy lookups or use a separate user_roles mapping table.USING (EXISTS (SELECT 1 FROM ...))) execute on every row read. Warn the user if a policy will cause a sequential scan.BypassRLS roles (like system migrations or background workers).