skills/access-policy-designer/SKILL.md
Designs and implements row-level security (RLS), column-level masking, and role-based access control policies (RBAC/ABAC).
npx skillsauth add fatih-developer/fth-skills access-policy-designerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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).tools
Create, optimize, critique, and structure prompts for AI systems. Use this skill whenever the user is designing or improving a prompt, system prompt, coding prompt, image prompt, evaluation rubric, agent prompt, workflow prompt, or MCP-oriented prompt package. Also use it when the user asks to turn vague AI behavior into a precise instruction set, tool policy, agent spec, or prompt architecture.
testing
Assumption-first architecture review skill to stress-test project plans and expose hidden risks.
testing
Enforce and manage DESIGN.md specifications, extract design systems from URLs, and combine design reasoning with token roles to prevent drift.
testing
Forces the agent to act with a Claude-like product mindset, prioritizing user journey, UX states, and visual quality before coding.