| name | policy-qa-generator |
| description | Generates Cedar governance policies through a short Q&A interview, then emits the exact artifacts needed for policast-cel (Cedar source, manifest update command, and binding/tag changes). Use when the user asks for a policy wizard, policy questionnaire, “ask me questions and generate policy”, or needs help drafting row filters/column masks/deny overrides from requirements. |
policy-qa-generator
Turn policy intent into production-ready governance edits by asking a
small set of targeted questions first, then generating concrete outputs.
When to use
Activate for prompts like:
- “Create a policy generator”
- “Ask me questions and build the policy”
- “I need a row filter / mask policy but don’t know Cedar syntax”
- “Generate Cedar policy for this table/access rule”
Use this skill for authoring. Use tag-columns when the user is
only classifying table/column tags.
Workflow
Copy this checklist and track progress:
Policy-QA progress:
- [ ] Step 1: Choose storage mode + scope
- [ ] Step 2: Collect policy intent with 8 focused questions
- [ ] Step 3: Emit Cedar draft (and template vs concrete choice)
- [ ] Step 4: Emit governance-store change (bindings / tags)
- [ ] Step 5: Emit verification commands + expected behavior
Step 1 — choose storage mode + scope
Ask once:
Mode: flat-file (examples/uc/store) or UC/Delta (governance.policast.*)?
Scope: one table only, or tag-scoped template for multiple tables/columns?
If unclear, default to:
- mode = flat-file
- scope = one table
Step 2 — ask the 8 policy questions
Ask in this order, one compact question each:
- Target — full table name (
catalog.schema.table)?
- Policy type —
row_filter | column_mask | deny_override?
- Principal selector — role/group/principal wildcard?
- Predicate — plain-English condition on
principal.* and resource.*?
- Effect — permit/forbid behavior and exceptions?
- Template? — concrete target or tag-scoped (
@target_tag / @applies_to_tag)?
- Policy id + precedence — stable ID and binding order?
- Audit metadata — author identity for
set_by / created_by fields?
If the user gives partial answers, proceed with explicit assumptions.
Step 3 — emit Cedar draft
Always emit one Cedar block and state whether it is:
- concrete (
@target_table, optional @column) or
- template (
@target_tag or @applies_to_tag)
Rules:
- Use existing annotation style from
examples/policies/*.cedar.
- Keep generated IDs deterministic and reviewable.
- Prefer tag-scoped templates when the user wants repeatability across
many columns/tables.
Step 4 — emit governance-store changes
Emit the smallest complete change set for chosen mode.
Flat-file mode
Provide:
- Cedar file patch (or append snippet target path).
scripts/compile-policies.sh command.
examples/uc/store/bindings.json edit.
examples/uc/store/tags.json edit if template scope requires tags.
UC/Delta mode
Provide:
- Cedar snippet (source-of-truth for review).
- SQL
MERGE for governance.policast.bindings.
- SQL
MERGE for governance.policast.tags when tag-scoped.
- Note that manifest must be republished (compile + publish path).
Never emit many one-row INSERTs when one MERGE is enough.
Step 5 — verification plan
Always end with:
- One command/query to validate policy materialization.
- One resolve call scenario per relevant role.
- Expected result summary in plain language.
For sidecar flows, include a /policies/resolve check and expected
bindings_applied / expanded_from behavior for templates.
Output contract
Return results in this order:
- Assumptions (if any)
- Generated Cedar policy
- Governance-store updates (flat-file diff or SQL MERGE)
- Verification commands
- Next action (compile/publish/run demo)
Guardrails
- Do not invent table/column names; ask when missing.
- Do not generate policies without principal selector context unless the
user explicitly wants wildcard.
- Do not skip manifest compile/publish reminders.
- Do not mutate unrelated demo seed files unless the user asks.