Debugging
AuraScore 85/100

Time-Tracking and Billing Pipeline Anomaly Diagnostic Script

Generate a diagnostic script to isolate currency rounding and rate mismatches in professional services billing sync pipelines.

Use this template when timecard entries across multi-currency client engagements fail to reconcile accurately between timesheet platforms and ERP ledgers.

Template

Role: Senior Revenue Systems Architect specializing in ERP integrations for professional services firms.

Context

  • Target enterprise ERP: {{client_erp_system}}
  • Raw anomaly log dump: {{discrepancy_sample_log}}
  • Contractual rate calculation rules: {{billing_rate_rules}}
  • Financial ledger rounding precision: {{target_currency_precision}}
  • Ledger database schema definition: {{database_schema}}
  • Critical alert threshold percentage: {{failure_threshold_pct}}

Task

Author a standalone Python diagnostic and remediation script that ingests the discrepancy log, parses billing events against the schema, validates precision rounding edge cases, and outputs structured repair patches alongside a diagnostic summary report.

Method

  1. Ingest {{discrepancy_sample_log}} and map unparsed event payloads against {{database_schema}}.
  2. Reconstruct billing calculation trees evaluating rate multipliers from {{billing_rate_rules}}.
  3. Identify floating-point arithmetic drift and multi-currency rounding errors against {{target_currency_precision}}.
  4. Correlate missing invoice line items and orphaned timecard IDs between {{client_erp_system}} and local staging records.
  5. Flag batches exceeding the error tolerance defined by {{failure_threshold_pct}} for quarantine.
  6. Generate idempotent SQL/API mutation payloads to patch corrupt ledger entries.
  7. Implement a dry-run execution harness with rollback mechanisms to safely test fixes.

Constraints

  • MUST implement strict decimal arithmetic using Python's decimal module; standard floats MUST NOT be used.
  • MUST NOT perform live database writes without an explicit --commit flag.
  • The script MUST log execution telemetry in JSON-L format to standard error.
  • Output code must be self-contained with zero third-party dependencies outside standard library and pytest.

Output format

  1. Executive RCA Summary (Markdown block, max 200 words)
  2. Diagnostic Python Script (Complete code block with docstrings and argparse CLI)
  3. Unit Test Suite (Pytest block with at least 3 edge cases)

Self-review

  • Ensure all variables ({{client_erp_system}}, {{discrepancy_sample_log}}, {{billing_rate_rules}}, {{target_currency_precision}}, {{database_schema}}, {{failure_threshold_pct}}) are explicitly handled.
  • Confirm idempotent dry-run behavior is enforced by default.
  • Verify decimal precision handles sub-cent rounding differentials accurately.
AuraScore breakdown
85/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency7/10 · Adequate

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-debugging
professional-services
erp-sync
fintech
python