Inferensys

Prompt

Pre-Execution Field Audit Prompt Template

A practical prompt playbook for using Pre-Execution Field Audit Prompt Template in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, and operational boundaries for the Pre-Execution Field Audit Prompt Template.

This prompt is designed for operations engineers and platform teams who need to enforce a data quality gate before an automated workflow proceeds. The core job-to-be-done is auditing a single record or payload against a configurable completeness specification and generating a structured, machine-readable pass/fail report with per-field status. It is ideal for preventing silent failures, partial completions, or downstream corruption caused by missing required fields in agent pipelines, ETL jobs, or API-driven automation. The user is typically an engineer who understands the data contract and needs a reliable, context-aware gate that can be wired into a pre-execution hook.

Use this prompt when you need a semantic completeness check that goes beyond simple schema validation. Unlike an API contract validator that checks for type correctness, this prompt understands context-dependent requirements and severity thresholds. For example, a customer_email field might be optional for a lead record but critical for a contract_signing event. The prompt evaluates each field against a specification that defines whether it is required, optional, or conditionally_required based on other field values, and assigns a severity (BLOCKER, WARNING, INFO) to each violation. This allows the calling application to decide whether to halt execution, log a warning, or proceed with caution.

Do not use this prompt as a replacement for static schema validation at the API boundary. It is not designed to validate JSON Schema, XML Schema, or Protobuf contracts; those checks should happen in the application layer before the payload reaches this audit. Also avoid using this prompt for real-time, latency-sensitive transactions where a 500ms-2s LLM call is unacceptable. For high-throughput streaming data, pre-filter with deterministic rules and reserve this prompt for edge cases or records that fail initial validation. In regulated domains such as finance or healthcare, always route BLOCKER-level audit failures to a human review queue and log the full audit report for compliance evidence.

Before implementing, define your completeness specification as a structured object that the prompt can consume. Each field rule should include the field name, its requirement level, any conditional dependencies, and the severity of a violation. The output is a JSON report with an overall audit_result (PASS, FAIL, WARNING) and a field_results array containing each field's status, missing value indicator, and a human-readable reason. Wire this prompt into your workflow's pre-execution hook, parse the JSON response, and use the audit_result to gate the next step. Start with a small set of critical fields and expand the specification as you observe false-positive and false-negative patterns in production.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Pre-Execution Field Audit Prompt works, where it fails, and what you must have in place before relying on it.

01

Good Fit: Structured Data Quality Gates

Use when: you have a known completeness specification (required fields, types, constraints) and need a pass/fail report before an automated workflow proceeds. Guardrail: define the specification as a machine-readable schema so the prompt and downstream code share a single source of truth.

02

Bad Fit: Subjective Completeness Judgments

Avoid when: completeness depends on unwritten business rules, tribal knowledge, or case-by-case human judgment. The prompt will miss context that isn't in the specification. Guardrail: if the spec can't be written down, route to a human review queue instead of an automated gate.

03

Required Input: A Machine-Readable Completeness Spec

What to watch: the prompt needs a structured specification of required fields, optional fields, types, and severity thresholds. Without it, the audit is guesswork. Guardrail: store the spec in a version-controlled JSON or YAML file and inject it as [COMPLETENESS_SPEC] so audits are reproducible and auditable.

04

Required Input: The Payload or Record to Audit

What to watch: the prompt must receive the full record as [INPUT_PAYLOAD]. Partial or truncated payloads produce false positives. Guardrail: validate that the payload is complete before invoking the audit prompt; if the payload itself is truncated, escalate before auditing.

05

Operational Risk: Silent False Passes

What to watch: the model may mark a field as present when it contains placeholder values, empty strings, or semantically null data. Guardrail: add explicit rules in the spec for what counts as 'present' (non-null, non-empty, matches pattern) and include negative test cases in your eval suite.

06

Operational Risk: Spec Drift Over Time

What to watch: the completeness specification changes as the data model evolves, but the prompt still references an old version. Guardrail: version the spec alongside the prompt, run regression tests on every spec change, and include the spec version in the audit report output.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that audits a record or payload against a completeness specification and generates a pass/fail report with per-field status.

The following prompt template is designed to be pasted directly into your prompt layer. It accepts a target record, a completeness specification, and optional severity thresholds. Every variable is enclosed in square brackets. Replace each placeholder with the actual data, schema, or configuration value before sending the prompt to the model. The prompt instructs the model to perform a strict field-by-field audit and return a structured report—never a conversational summary.

text
You are a pre-execution field audit system. Your only job is to compare a target record against a completeness specification and produce a structured pass/fail report.

## INPUT
Target Record:
[RECORD]

Completeness Specification:
[SPECIFICATION]

Severity Thresholds:
[SEVERITY_THRESHOLDS]

## TASK
1. Parse the completeness specification. It defines required fields, optional fields, data-type constraints, format patterns, and cross-field dependency rules.
2. For every field listed in the specification, determine whether the target record satisfies the requirement.
3. Assign each field a status: PASS, FAIL, or NOT_APPLICABLE.
4. For every FAIL status, include:
   - The field name.
   - The specific requirement that was violated.
   - The actual value found (or indicate that the field is absent).
   - A severity level: BLOCKER, WARNING, or INFO, based on the severity thresholds provided.
5. If any field has a BLOCKER severity, set the overall audit result to FAIL. Otherwise, set it to PASS_WITH_WARNINGS if any WARNING exists, or PASS if all fields pass.
6. Do not invent fields. Do not guess missing data. If the specification references a field that is absent from the record, report it as FAIL with severity BLOCKER unless the specification marks it optional.

## OUTPUT_SCHEMA
Return a single JSON object with this exact structure:
{
  "audit_result": "PASS" | "PASS_WITH_WARNINGS" | "FAIL",
  "audit_timestamp": "ISO-8601 timestamp of audit completion",
  "fields": [
    {
      "field_name": "string",
      "status": "PASS" | "FAIL" | "NOT_APPLICABLE",
      "requirement": "string describing the rule that was checked",
      "actual_value": "string or null",
      "severity": "BLOCKER" | "WARNING" | "INFO"
    }
  ],
  "blocker_count": 0,
  "warning_count": 0,
  "info_count": 0
}

## CONSTRAINTS
- Do not add commentary outside the JSON object.
- Do not omit fields that are present in the specification.
- If the target record is empty or missing, report every required field as FAIL with severity BLOCKER.
- Respect the severity thresholds. A field that violates a BLOCKER rule must never be downgraded.

To adapt this template, replace [RECORD] with the actual payload, database row, form submission, or API request body under audit. Replace [SPECIFICATION] with a structured description of required fields, types, formats, and dependency rules—this can be a JSON schema fragment, a YAML policy block, or a plain-text field list. Replace [SEVERITY_THRESHOLDS] with rules that map violation types to severity levels, such as 'missing required field → BLOCKER' or 'format mismatch → WARNING'. After substitution, validate that the output schema is still reachable by running the prompt against a known-good and known-bad record before deploying it into a production gate. If the workflow involves regulated data or irreversible actions, always route BLOCKER results to a human review queue before proceeding.

IMPLEMENTATION TABLE

Prompt Variables

Placeholders required by the Pre-Execution Field Audit Prompt Template. Replace each placeholder with concrete values before sending the prompt to the model. Validation notes describe how to verify the placeholder is correctly populated at runtime.

PlaceholderPurposeExampleValidation Notes

[RECORD_PAYLOAD]

The full data record or payload to audit for completeness

{"customer_id": "C-9921", "email": null, "plan": "enterprise"}

Must be valid JSON or structured text. Parse check before prompt assembly. Null fields allowed; the audit will flag them.

[FIELD_SPECIFICATION]

Schema defining required fields, types, nullability, and severity per field

[{"field": "email", "type": "string", "required": true, "severity": "blocking"}]

Must be valid JSON array. Each entry requires field, type, and required keys. Schema validation before prompt assembly.

[SEVERITY_THRESHOLD]

Minimum severity level that causes a FAIL verdict. Accepts 'blocking', 'warning', or 'info'

blocking

Must be one of: blocking, warning, info. Enum check. If set to 'info', only missing blocking fields trigger FAIL.

[AUDIT_CONTEXT]

Optional business context explaining why the audit is running and what downstream action depends on it

Pre-deployment customer record validation before provisioning enterprise tenant

Null allowed. If provided, keep under 500 tokens to avoid diluting the field specification. Length check recommended.

[OUTPUT_FORMAT]

Desired output structure. Typically 'json' or 'markdown-report'

json

Must be one of: json, markdown-report. Enum check. JSON output requires a downstream parser; markdown-report is human-facing.

[ALLOWED_NULL_FIELDS]

List of field names where null is acceptable even if the field is present

["middle_name", "secondary_contact"]

Must be a JSON array of strings. Null allowed. If empty, all null values in required fields trigger a gap. Array schema check.

[MAX_GAP_REPORT_LENGTH]

Maximum number of gap entries before the report is truncated with a summary count

50

Must be a positive integer. Prevents unbounded output on large payloads. Integer parse check. Default to 100 if unset.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Pre-Execution Field Audit Prompt into an application with validation, retries, and human review.

The Pre-Execution Field Audit prompt is designed to act as a synchronous gate before any downstream action. Wire it into your application as a blocking step: the system sends the payload and the completeness specification to the model, receives the pass/fail report, and only proceeds if audit_result is pass. If the result is fail, the application must halt execution and route the structured failure report to the appropriate handler—typically a human review queue, a notification system, or a retry loop that requests missing data from the user. This prompt is not a background check; it is a hard gate. The application layer must enforce the pass/fail decision; never rely on the model's output alone to block execution without a code-level guard that checks the audit_result field before calling the next step.

Validation and retry logic: Parse the model's JSON output immediately. Validate that audit_result is exactly pass or fail. If the field is missing or malformed, retry the prompt once with an explicit error message appended to the context: The previous output was missing the required 'audit_result' field. Return a valid JSON object with 'audit_result' set to 'pass' or 'fail'. If the second attempt also fails, escalate to a human operator with the raw payload and specification attached. For high-stakes workflows (financial transactions, configuration changes, data deletion), add a secondary validation step: if audit_result is pass, randomly sample 5-10% of passed audits for human spot-checking to detect false positives where the model incorrectly approved an incomplete payload. Log every audit result—pass or fail—with the full payload, specification, model version, and timestamp for audit trail purposes.

Model choice and tool use: This prompt works best with models that have strong JSON output capabilities and low latency, since it sits on the critical path of a workflow. GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro are suitable defaults. Avoid using smaller or faster models without testing them against your specific field rules and severity thresholds; false negatives (incorrectly passing incomplete payloads) are the primary risk. Do not give this prompt access to tools or function calling—it should produce a self-contained JSON report without side effects. If your completeness specification is large or dynamic, store it as a configuration object in your application and inject it into the [COMPLETENESS_SPEC] placeholder at runtime rather than hardcoding it in the system prompt. For RAG-augmented audits where field rules depend on external policy documents, retrieve the relevant policy sections first, inject them into the specification, and then run the audit prompt.

Human review integration: When the audit fails, the field_status array in the output is your primary handoff artifact. Route it to a review queue with the original payload, the failing fields highlighted, and the severity levels preserved. The reviewer should be able to override the failure (with a required justification logged for audit), request missing data from the submitter, or reject the payload permanently. Never allow the system to automatically retry the action after a human override without re-running the audit prompt against the corrected payload. For compliance-heavy environments, store the full audit report alongside the action record so that downstream reviewers can see exactly which fields were checked and what the model found.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the fields, types, and validation rules for the structured pass/fail report generated by the Pre-Execution Field Audit Prompt. Use this contract to parse and validate the model's output before acting on it.

Field or ElementType or FormatRequiredValidation Rule

audit_id

string (UUID)

Must match the [AUDIT_ID] input exactly. Fail if missing or mismatched.

audit_timestamp

string (ISO 8601)

Must be a valid ISO 8601 datetime string. Fail if unparseable.

overall_status

enum: PASS | FAIL | ERROR

Must be one of the three allowed values. FAIL if any field has status FAIL. ERROR if the audit itself could not be completed.

fields

array of objects

Must be a non-empty array. Each object must conform to the field_status schema below.

fields[].field_name

string

Must exactly match a field name from the [FIELD_SPECIFICATION] input.

fields[].status

enum: PRESENT | MISSING | INVALID | NOT_APPLICABLE

Must be one of the four allowed values. MISSING if required and absent. INVALID if present but fails a type or constraint check.

fields[].observed_value

string or null

If status is PRESENT or INVALID, provide the value found. If MISSING, must be null. Truncate to 256 characters.

fields[].failure_reason

string or null

Required if status is MISSING or INVALID. Must reference the specific rule from [FIELD_SPECIFICATION] that was violated. Null otherwise.

PRACTICAL GUARDRAILS

Common Failure Modes

The Pre-Execution Field Audit Prompt is a gate, not a generator. When it fails, it either lets bad data through or blocks good data unnecessarily. Here are the most common failure modes and how to guard against them.

01

Schema Drift Between Audit and Execution

What to watch: The field audit prompt checks against a hardcoded or stale schema that no longer matches the downstream system's actual requirements. New required fields are added to the API but not to the audit spec, allowing incomplete payloads to pass. Guardrail: Store the completeness specification as a versioned configuration artifact. The audit prompt must reference the spec by version, and any downstream schema change triggers a forced review of the audit rules.

02

False-Positive Blocking on Optional Fields

What to watch: The model treats conditionally required or optional fields as mandatory, halting valid workflows. This is common when the prompt uses absolute language like 'all fields must be present' without encoding conditional logic. Guardrail: Define field rules with explicit severity levels (REQUIRED, CONDITIONAL, OPTIONAL) and conditions. Include counterexamples in the prompt showing valid records with intentionally empty optional fields.

03

Null vs. Empty String Confusion

What to watch: The model fails to distinguish between a missing field (null/absent) and an intentionally empty value (empty string, zero, false). This causes false failures when a user legitimately provides an empty value. Guardrail: Explicitly define the difference between 'absent' and 'empty' in the prompt's field rules. Add test cases for zero-length strings, zero integers, and false booleans to your eval harness.

04

Context Window Truncation of the Audit Spec

What to watch: For large payloads with many fields, the completeness specification itself gets truncated from the context window, causing the model to hallucinate field requirements or skip checks entirely. Guardrail: If the spec exceeds ~30% of the context window, split the audit into multiple passes by field group. Log a warning when the spec-plus-payload approaches the model's context limit.

05

Hallucinated Field Names in the Report

What to watch: The model invents field names that don't exist in the original payload or spec, making the audit report unparseable by downstream automation. Guardrail: Require the output to use only field paths present in the input payload. Add a post-audit validation step that checks every field reference in the report against the input schema and rejects reports with unknown field paths.

06

Overly Permissive Pass on Malformed Data

What to watch: The model passes a record because a field 'looks close enough' to the required type—accepting a string where an integer is required, or a free-text field where an enum is expected. Guardrail: Include explicit type-checking rules in the prompt (e.g., 'reject if field type does not match exactly'). Add eval cases with type mismatches and measure strict pass/fail accuracy separately from semantic judgment.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Pre-Execution Field Audit Prompt before shipping. Each criterion targets a specific failure mode in field-level completeness checks.

CriterionPass StandardFailure SignalTest Method

Field Completeness Detection

All missing required fields from [FIELD_SPEC] are correctly identified with status 'MISSING'

A required field marked 'PRESENT' when it is absent from [PAYLOAD]

Run with a payload missing 3 known required fields; assert all 3 appear in the report with status 'MISSING'

Optional Field Handling

Optional fields absent from [PAYLOAD] are marked 'ABSENT_OK' and do not cause a FAIL verdict

An optional field triggers a FAIL verdict or is reported as 'MISSING'

Run with a payload missing only optional fields; assert overall verdict is PASS and no optional field shows 'MISSING'

Severity Threshold Logic

Overall verdict is FAIL when any field with severity 'BLOCKER' is missing; verdict is PASS when only 'WARNING' fields are missing

A payload missing only WARNING-severity fields returns FAIL, or a BLOCKER gap returns PASS

Test two payloads: one missing a BLOCKER field, one missing only WARNING fields; assert verdicts are FAIL and PASS respectively

Field Status Enum Accuracy

Every field in the report uses exactly one of: PRESENT, MISSING, ABSENT_OK, UNKNOWN

A field status appears as a free-text string or an undefined enum value

Parse the output JSON; assert all values in the field status array match the allowed enum set

Report Structure Compliance

Output matches [OUTPUT_SCHEMA] exactly: top-level verdict, per-field array with name, status, severity, message

Output is missing the verdict field, or per-field objects lack required keys

Validate output against the JSON schema; assert no schema violations on required fields or types

Message Clarity for Missing Fields

Each MISSING field includes a human-readable message stating what is missing and why it is required

A MISSING field has an empty, null, or generic message like 'missing'

Inspect the message field for each MISSING entry; assert length > 10 characters and contains the field name

Empty Payload Handling

An empty [PAYLOAD] returns FAIL with every required field listed as MISSING

An empty payload returns PASS, a null pointer error, or an empty field list

Submit an empty JSON object as [PAYLOAD]; assert verdict is FAIL and the field count matches the number of required fields in [FIELD_SPEC]

Partial Payload Handling

A payload with some but not all required fields returns FAIL and correctly distinguishes PRESENT from MISSING fields

A partially complete payload returns PASS, or PRESENT fields are mislabeled as MISSING

Submit a payload with exactly half the required fields; assert verdict is FAIL and the PRESENT/MISSING split matches the input

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with a simple field list and pass/fail logic. Use the base prompt with a hardcoded [FIELD_SPECIFICATION] as a JSON array of {"field": "...", "required": true, "type": "..."} objects. Skip severity thresholds and focus on binary completeness checks.

code
[FIELD_SPECIFICATION]: [
  {"field": "customer_email", "required": true, "type": "email"},
  {"field": "order_total", "required": true, "type": "number"}
]

Watch for

  • Missing type validation: the prompt may flag a field as present but not check if the value matches the expected type
  • Overly strict null handling: empty strings vs. null vs. missing keys can produce inconsistent results
  • No handling of nested fields or arrays in the payload
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.