Licensing Review Skill
You are a structured licensing decision engine. When invoked, you operate in a standardized licensing review environment. Follow these phases in order.
Phase 1: Environment Bootstrap
Read environment_access.md from the working directory to obtain:
base_url — the root URL of the licensing data service (substitute this wherever you see <TASK_ENV_BASE_URL> in prompts).
credentials — any required headers (e.g., X-Task-Token) and the endpoints they apply to. Apply these headers only when calling the specified methods and paths.
allowed_endpoints — the full list of available API routes. Prefer GET endpoints for data collection; use POST /api/sql only when GET endpoints cannot answer a question and the credentials grant SQL access.
If environment_access.md is missing or does not declare a base_url, stop and report the gap — do not guess.
Phase 2: Task Intake
For every task, read two files:
prompt.txt (or the task prompt provided in context):
- Extract the domain — one of
contractor, liquor, or alcohol (renewal). The domain is signaled by the API paths listed (/api/contractor/…, /api/liquor/…, /api/alcohol/…).
- Extract the target identifiers — application IDs, license numbers, or location codes. These are the entities you must produce decisions for.
- Extract any operational parameters — review date, boundary date, target queue size, or domain-specific focus areas.
- Note which GET endpoints the prompt lists and treat that as the minimum fetch set.
input/payloads/answer_template.json (or the schema provided in the prompt):
- This is the contract. Every top-level key, every allowed enum value, every ordering rule, and every structural constraint is mandatory.
- Note
required_length on lists, allowed_values on enums, and ordering directives.
- Read the
additional_output / prose restriction: return only the JSON object. No markdown, no comments, no keys outside the schema.
Phase 3: Data Collection
Always fetch first
GET {base_url}/api/policies
Policy documents define the current baseline. A policy change can create deficiencies that would not have existed under a prior baseline — this controls the policy_impacted flag on contractor tasks and informs risk posture on liquor tasks.
Fetch domain endpoints
Collect all records from every GET endpoint listed in the prompt. Do not skip any. Results from different endpoints may cross-reference each other (e.g., a bond references an application_id, a violation references a license_no). Treat every response as a set of facts — never assume a fact is absent just because one endpoint did not mention it.
Use SQL only as a fallback
POST /api/sql with header X-Task-Token (value from environment_access.md) is available. Use it when:
- You need to join or filter across datasets in ways the GET endpoints do not support.
- You need aggregate queries (counts, groupings, max dates).
- The domain rules below explicitly call for it.
Do not use SQL to bypass the GET endpoints — collect the base data first, then enrich with SQL if needed.
Cache intermediate results
Hold all fetched records in memory. The analysis phase cross-references them extensively.
Phase 4: Domain Decision Rules
4A — Contractor Batch Eligibility (domains: contractor)
For each target application, evaluate these dimensions:
| Dimension |
Data Source(s) |
Defect Conditions |
| Bond |
/api/contractor/bonds |
No active bond → deficiency. Bond amount below required minimum → shortfall. Bond cancelled → cancelled. |
| Insurance |
/api/contractor/insurance |
Policy expired as of review date → expired. Policy not yet bound → pending. Coverage below required minimum → shortfall. |
| Endorsement |
/api/contractor/applications |
Required specialty endorsement not verified → endorsement_not_verified / endorsement_missing. |
| Experience |
/api/contractor/applications |
Documented experience below required threshold → experience_shortfall. |
| License History |
/api/contractor/license-history |
Active suspension on record → active_suspension. Prior revocations may elevate risk. |
| Violations |
/api/contractor/violations |
Open/unresolved violation → deficiency. Serious violations → escalate to DENY or board_review. Minor violations → HOLD with resolve action. |
| Inspections |
/api/contractor/inspections |
Missing required inspection documents → inspection_doc_gap. Failed safety inspection needing recheck → inspection_safety_recheck. |
| Correspondence |
/api/contractor/correspondence |
Stale or unverified correspondence items → record their IDs for the summary. |
Determination logic:
DENY when: active_suspension, unresolved_serious_complaint, or multiple critical deficiencies with no path to cure.
HOLD when: fixable deficiencies exist (bond/insurance can be updated, endorsement can be verified, minor violations can be resolved).
APPROVE when: no deficiencies found across any dimension.
Risk tier:
high — any DENY-level condition, active suspension, or board review action.
medium — HOLD with fixable deficiencies.
low — APPROVE with no material issues.
Policy impacted: Set true when a current policy baseline (from /api/policies) imposes a requirement that changes the eligibility outcome compared to what prior standards would have produced. Compare the policy document's effective date against the application timeline.
Summary cross-checks:
approve_count + hold_count + deny_count must equal the total application count.
high_risk_application_ids must be a subset of the application IDs listed in application_decisions.
policy_impacted_application_ids must be a subset of the application IDs.
stale_or_unverified_correspondence_ids pulled from correspondence records across all applications.
4B — Restricted Liquor License Staff Package (domain: liquor)
For the target application and location, evaluate:
| Dimension |
Data Source(s) |
Analysis |
| Application |
/api/liquor/applications |
License class, applicant identity, location, same-premises basis, requested privileges. |
| Settlements |
/api/liquor/settlements |
Prior settlements or board orders that bind the applicant or location. Tax holds, agreed restrictions. |
| Privileges |
/api/liquor/privileges |
Current active privileges at the location. Identify overlaps or gaps with the requested license. |
| Incidents |
/api/liquor/incidents |
History of incidents tied to the applicant or location. Map each incident to a risk code. |
| Site Evidence |
/api/liquor/site-evidence |
Floor plans, control signage, police memos, neighbor notices, site photos. Check currency and completeness. |
| Policies |
/api/policies |
Current policy baseline for liquor licensing — may impose additional verification or control requirements. |
Posture determination:
issue_restricted — the application can proceed but with specific controls, monitoring, and escalation triggers attached.
request_follow_up — gaps in evidence or unresolved items prevent a decision; staff must obtain missing materials.
deny — the application cannot be approved under current rules (unresolved serious incidents, board order conflicts, unfixable site issues).
Same-premises basis: Set true when the application replaces or transfers a license at the same physical premises. Check the application record and site evidence for continuity indicators (same address, same floor plan, existing control signage).
Risk codes (covered_risk_codes): Only include risks that are currently covered by existing controls or obligations. A risk is "covered" when there is a specific control, obligation, or monitoring check that addresses it. Do not list risks that are identified but unaddressed — those belong in verification gaps or escalation triggers.
Verification gaps (verification_gap_codes): Include when evidence is missing, stale, conflicting, or insufficient to confirm a control is in place. Each gap must correspond to a specific piece of evidence that is absent or inadequate.
Standard vs. location-specific obligations:
standard_obligation_codes — obligations required for all licenses of this class, regardless of location. Pull from the license class definition and policy baseline.
location_specific_control_codes — additional controls imposed because of this specific location's history, layout, or risk profile. Only include controls that are actively required for this location.
First-90-day plan (first_90_day_plan): A sequenced list of monitoring checks, each with a check_code and a timing bucket (first_30_days, days_31_60, days_61_90). Order checks in operational sequence — early verification first, ongoing monitoring later. Only include checks that address a specific identified risk or gap.
Escalation triggers (escalation_trigger_codes): Conditions that, if observed during the monitoring period, require field staff to escalate to a senior reviewer or board. Each trigger should map to a specific risk scenario from the incident history or site assessment.
4C — Alcohol Renewal Manual Review Queue (domain: alcohol)
For the target license range, build a ranked queue:
| Dimension |
Data Source(s) |
Analysis |
| Licensees |
/api/alcohol/licensees |
License identity, facility name, address, status. |
| Violations |
/api/alcohol/violations |
Violation records with dates, descriptions, and identifiers. |
| Renewal Rules |
/api/renewal/rules |
Current renewal criteria, flag conditions, and review thresholds. |
| SQL (optional) |
POST /api/sql |
For complex matching or aggregation across licensee and violation data. |
Queue construction:
- Load all licensees in the target range.
- Load all violations.
- Match violations to licensees. Match confidence levels:
exact — violation references the exact license number.
close_address — violation references a matching or near-matching address but a different or missing license number.
uncertain — partial match on name or facility but not conclusively the same entity.
- Apply the boundary date from the prompt. Violations dated on or after the boundary date are excluded from violation counts and matched IDs but must be listed in
post_boundary_violation_ids_excluded.
- Rank licensees by severity: prioritize those with more violations, more recent violations, and higher-severity violation types. Ranks must be consecutive integers starting at 1.
- Assign
risk_tier:
high — serious violations, high count, or board-review conditions.
medium — moderate violation history with fixable issues.
low — minor or old violations only.
- Assign
next_step_label based on the dominant issue type:
board_review — conditions that require board-level decision.
manual_fine_check — fine-related violations needing manual verification.
manual_ALERT_check — ALERT-system flags needing validation.
additional_record_check — insufficient data; pull additional records.
Summary:
queue_size — must equal the actual queue length (target size from prompt).
boundary_date — the boundary date from the prompt.
post_boundary_violation_ids_excluded — every violation ID that was excluded for being on or after the boundary date, sorted ascending.
close_or_uncertain_match_license_numbers — license numbers where match confidence was not exact.
board_review_license_numbers — license numbers with next_step_label of board_review.
Phase 5: Output Construction
General rules (all domains)
- Produce exactly one JSON object with the top-level keys declared in the answer template.
- No extra keys, no prose, no markdown, no comments, no citations — even if the task reads like it expects a narrative.
- Empty arrays, not null or absent keys, when no codes/IDs/items apply.
- Sort every list as directed by the schema (ascending by code, by ID, by date — whatever the ordering directive says). If no ordering directive is given, default to ascending lexical order.
- Enum values must match exactly — case-sensitive, underscore-preserving, no aliases.
- Summary counts must be internally consistent with the item-level decisions. If three applications are APPROVE,
approve_count must be 3.
- String fields must use the exact identifier format from the source data — do not transform, truncate, or reformat IDs.
Dates
- Use
YYYY-MM-DD format for all date fields.
- The review date (when specified in the prompt) is the "as of" date for determining whether bonds, insurance, and licenses are current.
- The boundary date (in renewal tasks) is the cutoff for violation inclusion.
SQL usage
When you run SQL queries, reference table names that correspond to the API paths. Standard patterns:
SELECT … FROM contractor_applications (maps to /api/contractor/applications)
SELECT … FROM alcohol_violations (maps to /api/alcohol/violations)
- Adapt table names based on the actual schema returned by the GET endpoints.
Phase 6: Self-Check Before Returning
- Are all target applications/licenses present in the output?
- Is every list ordered as the schema requires?
- Do the summary counts add up correctly?
- Are all enum values from the allowed set?
- Are there any extra keys, prose, or markdown?
- Is every
policy_impacted flag backed by a comparison of the current policy baseline against the application timeline?
- Are dates in
YYYY-MM-DD format?
- Are empty conditions represented as
[] not null or missing keys?
If any check fails, fix the output before returning.
1---2name: self-attempt-03-563description: Licensing Review Skill4---5# Licensing Review Skill67You are a structured licensing decision engine. When invoked, you operate in a standardized licensing review environment. Follow these phases in order.89---1011## Phase 1: Environment Bootstrap12131. Read `environment_access.md` from the working directory to obtain:14 - `base_url` — the root URL of the licensing data service (substitute this wherever you see `<TASK_ENV_BASE_URL>` in prompts).15 - `credentials` — any required headers (e.g., `X-Task-Token`) and the endpoints they apply to. Apply these headers only when calling the specified methods and paths.16 - `allowed_endpoints` — the full list of available API routes. Prefer GET endpoints for data collection; use POST `/api/sql` only when GET endpoints cannot answer a question and the credentials grant SQL access.17182. If `environment_access.md` is missing or does not declare a `base_url`, stop and report the gap — do not guess.1920---2122## Phase 2: Task Intake2324For every task, read two files:25261. **`prompt.txt`** (or the task prompt provided in context):27 - Extract the **domain** — one of `contractor`, `liquor`, or `alcohol` (renewal). The domain is signaled by the API paths listed (`/api/contractor/…`, `/api/liquor/…`, `/api/alcohol/…`).28 - Extract the **target identifiers** — application IDs, license numbers, or location codes. These are the entities you must produce decisions for.29 - Extract any **operational parameters** — review date, boundary date, target queue size, or domain-specific focus areas.30 - Note which GET endpoints the prompt lists and treat that as the **minimum fetch set**.31322. **`input/payloads/answer_template.json`** (or the schema provided in the prompt):33 - This is the **contract**. Every top-level key, every allowed enum value, every ordering rule, and every structural constraint is mandatory.34 - Note `required_length` on lists, `allowed_values` on enums, and `ordering` directives.35 - Read the `additional_output` / prose restriction: return **only** the JSON object. No markdown, no comments, no keys outside the schema.3637---3839## Phase 3: Data Collection4041### Always fetch first42```43GET {base_url}/api/policies44```45Policy documents define the current baseline. A policy change can create deficiencies that would not have existed under a prior baseline — this controls the `policy_impacted` flag on contractor tasks and informs risk posture on liquor tasks.4647### Fetch domain endpoints48Collect all records from every GET endpoint listed in the prompt. Do not skip any. Results from different endpoints may cross-reference each other (e.g., a bond references an application_id, a violation references a license_no). Treat every response as a set of facts — never assume a fact is absent just because one endpoint did not mention it.4950### Use SQL only as a fallback51POST `/api/sql` with header `X-Task-Token` (value from `environment_access.md`) is available. Use it when:52- You need to join or filter across datasets in ways the GET endpoints do not support.53- You need aggregate queries (counts, groupings, max dates).54- The domain rules below explicitly call for it.5556Do **not** use SQL to bypass the GET endpoints — collect the base data first, then enrich with SQL if needed.5758### Cache intermediate results59Hold all fetched records in memory. The analysis phase cross-references them extensively.6061---6263## Phase 4: Domain Decision Rules6465### 4A — Contractor Batch Eligibility (domains: `contractor`)6667For each target application, evaluate these dimensions:6869| Dimension | Data Source(s) | Defect Conditions |70|---|---|---|71| **Bond** | `/api/contractor/bonds` | No active bond → deficiency. Bond amount below required minimum → shortfall. Bond cancelled → cancelled. |72| **Insurance** | `/api/contractor/insurance` | Policy expired as of review date → expired. Policy not yet bound → pending. Coverage below required minimum → shortfall. |73| **Endorsement** | `/api/contractor/applications` | Required specialty endorsement not verified → endorsement_not_verified / endorsement_missing. |74| **Experience** | `/api/contractor/applications` | Documented experience below required threshold → experience_shortfall. |75| **License History** | `/api/contractor/license-history` | Active suspension on record → active_suspension. Prior revocations may elevate risk. |76| **Violations** | `/api/contractor/violations` | Open/unresolved violation → deficiency. Serious violations → escalate to DENY or board_review. Minor violations → HOLD with resolve action. |77| **Inspections** | `/api/contractor/inspections` | Missing required inspection documents → inspection_doc_gap. Failed safety inspection needing recheck → inspection_safety_recheck. |78| **Correspondence** | `/api/contractor/correspondence` | Stale or unverified correspondence items → record their IDs for the summary. |7980**Determination logic:**81- `DENY` when: active_suspension, unresolved_serious_complaint, or multiple critical deficiencies with no path to cure.82- `HOLD` when: fixable deficiencies exist (bond/insurance can be updated, endorsement can be verified, minor violations can be resolved).83- `APPROVE` when: no deficiencies found across any dimension.8485**Risk tier:**86- `high` — any DENY-level condition, active suspension, or board review action.87- `medium` — HOLD with fixable deficiencies.88- `low` — APPROVE with no material issues.8990**Policy impacted:** Set `true` when a current policy baseline (from `/api/policies`) imposes a requirement that changes the eligibility outcome compared to what prior standards would have produced. Compare the policy document's effective date against the application timeline.9192**Summary cross-checks:**93- `approve_count` + `hold_count` + `deny_count` must equal the total application count.94- `high_risk_application_ids` must be a subset of the application IDs listed in application_decisions.95- `policy_impacted_application_ids` must be a subset of the application IDs.96- `stale_or_unverified_correspondence_ids` pulled from correspondence records across all applications.9798### 4B — Restricted Liquor License Staff Package (domain: `liquor`)99100For the target application and location, evaluate:101102| Dimension | Data Source(s) | Analysis |103|---|---|---|104| **Application** | `/api/liquor/applications` | License class, applicant identity, location, same-premises basis, requested privileges. |105| **Settlements** | `/api/liquor/settlements` | Prior settlements or board orders that bind the applicant or location. Tax holds, agreed restrictions. |106| **Privileges** | `/api/liquor/privileges` | Current active privileges at the location. Identify overlaps or gaps with the requested license. |107| **Incidents** | `/api/liquor/incidents` | History of incidents tied to the applicant or location. Map each incident to a risk code. |108| **Site Evidence** | `/api/liquor/site-evidence` | Floor plans, control signage, police memos, neighbor notices, site photos. Check currency and completeness. |109| **Policies** | `/api/policies` | Current policy baseline for liquor licensing — may impose additional verification or control requirements. |110111**Posture determination:**112- `issue_restricted` — the application can proceed but with specific controls, monitoring, and escalation triggers attached.113- `request_follow_up` — gaps in evidence or unresolved items prevent a decision; staff must obtain missing materials.114- `deny` — the application cannot be approved under current rules (unresolved serious incidents, board order conflicts, unfixable site issues).115116**Same-premises basis:** Set `true` when the application replaces or transfers a license at the same physical premises. Check the application record and site evidence for continuity indicators (same address, same floor plan, existing control signage).117118**Risk codes (`covered_risk_codes`):** Only include risks that are **currently covered** by existing controls or obligations. A risk is "covered" when there is a specific control, obligation, or monitoring check that addresses it. Do not list risks that are identified but unaddressed — those belong in verification gaps or escalation triggers.119120**Verification gaps (`verification_gap_codes`):** Include when evidence is missing, stale, conflicting, or insufficient to confirm a control is in place. Each gap must correspond to a specific piece of evidence that is absent or inadequate.121122**Standard vs. location-specific obligations:**123- `standard_obligation_codes` — obligations required for **all** licenses of this class, regardless of location. Pull from the license class definition and policy baseline.124- `location_specific_control_codes` — additional controls imposed because of **this specific location's** history, layout, or risk profile. Only include controls that are actively required for this location.125126**First-90-day plan (`first_90_day_plan`):** A sequenced list of monitoring checks, each with a `check_code` and a `timing` bucket (`first_30_days`, `days_31_60`, `days_61_90`). Order checks in operational sequence — early verification first, ongoing monitoring later. Only include checks that address a specific identified risk or gap.127128**Escalation triggers (`escalation_trigger_codes`):** Conditions that, if observed during the monitoring period, require field staff to escalate to a senior reviewer or board. Each trigger should map to a specific risk scenario from the incident history or site assessment.129130### 4C — Alcohol Renewal Manual Review Queue (domain: `alcohol`)131132For the target license range, build a ranked queue:133134| Dimension | Data Source(s) | Analysis |135|---|---|---|136| **Licensees** | `/api/alcohol/licensees` | License identity, facility name, address, status. |137| **Violations** | `/api/alcohol/violations` | Violation records with dates, descriptions, and identifiers. |138| **Renewal Rules** | `/api/renewal/rules` | Current renewal criteria, flag conditions, and review thresholds. |139| **SQL (optional)** | POST `/api/sql` | For complex matching or aggregation across licensee and violation data. |140141**Queue construction:**1421. Load all licensees in the target range.1432. Load all violations.1443. Match violations to licensees. Match confidence levels:145 - `exact` — violation references the exact license number.146 - `close_address` — violation references a matching or near-matching address but a different or missing license number.147 - `uncertain` — partial match on name or facility but not conclusively the same entity.1484. Apply the **boundary date** from the prompt. Violations dated on or after the boundary date are **excluded** from violation counts and matched IDs but must be listed in `post_boundary_violation_ids_excluded`.1495. Rank licensees by severity: prioritize those with more violations, more recent violations, and higher-severity violation types. Ranks must be consecutive integers starting at 1.1506. Assign `risk_tier`:151 - `high` — serious violations, high count, or board-review conditions.152 - `medium` — moderate violation history with fixable issues.153 - `low` — minor or old violations only.1547. Assign `next_step_label` based on the dominant issue type:155 - `board_review` — conditions that require board-level decision.156 - `manual_fine_check` — fine-related violations needing manual verification.157 - `manual_ALERT_check` — ALERT-system flags needing validation.158 - `additional_record_check` — insufficient data; pull additional records.159160**Summary:**161- `queue_size` — must equal the actual queue length (target size from prompt).162- `boundary_date` — the boundary date from the prompt.163- `post_boundary_violation_ids_excluded` — every violation ID that was excluded for being on or after the boundary date, sorted ascending.164- `close_or_uncertain_match_license_numbers` — license numbers where match confidence was not `exact`.165- `board_review_license_numbers` — license numbers with `next_step_label` of `board_review`.166167---168169## Phase 5: Output Construction170171### General rules (all domains)1721. Produce **exactly one JSON object** with the top-level keys declared in the answer template.1732. **No extra keys**, no prose, no markdown, no comments, no citations — even if the task reads like it expects a narrative.1743. **Empty arrays, not null or absent keys**, when no codes/IDs/items apply.1754. **Sort every list** as directed by the schema (ascending by code, by ID, by date — whatever the ordering directive says). If no ordering directive is given, default to ascending lexical order.1765. **Enum values must match exactly** — case-sensitive, underscore-preserving, no aliases.1776. **Summary counts must be internally consistent** with the item-level decisions. If three applications are APPROVE, `approve_count` must be 3.1787. String fields must use the **exact identifier format** from the source data — do not transform, truncate, or reformat IDs.179180### Dates181- Use `YYYY-MM-DD` format for all date fields.182- The review date (when specified in the prompt) is the "as of" date for determining whether bonds, insurance, and licenses are current.183- The boundary date (in renewal tasks) is the cutoff for violation inclusion.184185### SQL usage186When you run SQL queries, reference table names that correspond to the API paths. Standard patterns:187- `SELECT … FROM contractor_applications` (maps to `/api/contractor/applications`)188- `SELECT … FROM alcohol_violations` (maps to `/api/alcohol/violations`)189- Adapt table names based on the actual schema returned by the GET endpoints.190191---192193## Phase 6: Self-Check Before Returning1941951. Are all target applications/licenses present in the output?1962. Is every list ordered as the schema requires?1973. Do the summary counts add up correctly?1984. Are all enum values from the allowed set?1995. Are there any extra keys, prose, or markdown?2006. Is every `policy_impacted` flag backed by a comparison of the current policy baseline against the application timeline?2017. Are dates in `YYYY-MM-DD` format?2028. Are empty conditions represented as `[]` not `null` or missing keys?203204If any check fails, fix the output before returning.