Catalog Listing Legal Compliance Auditing Script
Generate an automated Python auditing script to parse product listings for regulatory compliance and banned marketing claims.
Deploy this template when retail compliance teams need an automated text-analysis script to flag illegal claims and missing disclosures across catalog listings. It outputs a production-ready Python validation script with customizable regex rules and logging.
Role: Lead E-Commerce Compliance Engineer & Retail Data Architect
Context
- Raw listing dataset structure: {{catalog_data_schema}}
- Governing trade jurisdiction: {{jurisdiction_regulations}}
- Prohibited phrase and keyword registry: {{prohibited_claim_lexicon}}
- Mandatory legal disclaimer guidelines: {{mandatory_disclosure_rules}}
- Risk tolerance configuration: {{audit_severity_thresholds}}
- Target output directory and file format: {{output_report_path}}
Task
Develop an executable, modular Python script that ingests product listing copy according to {{catalog_data_schema}}, performs automated compliance parsing against {{jurisdiction_regulations}}, and exports a prioritized audit report.
Method
- Import required standard libraries (
re,json,csv,logging,argparse,pathlib) avoiding heavy external dependencies. - Define structured data models for Catalog Listing input and Policy Violation output objects.
- Implement compiled regular expression pattern matchers from {{prohibited_claim_lexicon}} targeting medical claims, exaggerated guarantees, and misleading marketing terminology.
- Construct validation algorithms verifying the presence and placement of {{mandatory_disclosure_rules}} in product descriptions.
- Assign severity classifications (Critical, Warning, Info) based on {{audit_severity_thresholds}}.
- Generate an automated batch evaluation loop with error handling for malformed or missing listing fields.
- Compile findings into a structured summary report exported directly to {{output_report_path}}.
Constraints
- MUST produce fully executable Python 3.10+ code without pseudo-code or missing function blocks.
- MUST NOT use undocumented third-party libraries; rely exclusively on the Python standard library or standard data tools (
pandas/pydantic). - Code MUST include comprehensive docstrings and type annotations on all methods.
- Error handling must gracefully handle empty fields without crashing the pipeline.
Output format
- Script Overview & Dependency Manifest
- Executable Python Script (
compliance_auditor.py) - Sample CLI Execution Command with dummy arguments
- Sample JSON Output Payload showing violation detection
Self-review
- Confirm every term from {{prohibited_claim_lexicon}} is handled via regex or deterministic token matching.
- Ensure disclosure checks accurately reflect {{mandatory_disclosure_rules}}.
- Verify syntax validity, variable typing, and file I/O operations.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.