Inferensys

Prompt

Contact Import Pre-Flight Validation Prompt Template

A practical prompt playbook for CRM administrators and data engineers validating contact batches before system ingestion. Produces validation reports with field-level errors, format violations, duplicate warnings, and required-field completeness.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, required context, and boundaries for the Contact Import Pre-Flight Validation Prompt Template.

This prompt is designed for CRM administrators, data engineers, and integration developers who need to validate contact records before they enter a production system. It accepts a batch of contact records and a set of custom validation rules, then produces a structured validation report that flags field-level errors, format violations, duplicate warnings, and required-field completeness. Use this prompt when you need a pre-flight check that stops bad data before it reaches your CRM, CDP, or customer database. This prompt belongs in the data ingestion pipeline, not in post-ingestion cleanup. Run it before any INSERT or UPSERT operation.

The ideal scenario is a batch import workflow where contact data arrives from multiple sources—form submissions, API integrations, model-generated outputs, or file uploads—and you need a consistent, auditable gate before the data touches your system of record. The prompt expects two inputs: a JSON array of contact records and a validation rules object that defines required fields, format patterns, uniqueness constraints, and acceptable value ranges. It returns a structured report with per-record pass/fail status, field-level error details, and aggregate batch statistics. Do not use this prompt for real-time single-record validation where latency is critical; a deterministic validator in application code will be faster and cheaper. Do not use it for post-ingestion data cleansing, deduplication across existing records, or enrichment—those are separate workflows covered by sibling playbooks like Contact Record Deduplication and Golden Record Selection.

Before deploying this prompt, ensure your validation rules are explicit and testable. Ambiguous rules like 'email should look valid' will produce inconsistent results. Instead, define rules with regex patterns, allowed enum values, and explicit required-field lists. Wire the prompt into your ingestion pipeline with a hard cutoff: records that fail validation should be quarantined, not silently dropped. Log every validation report for audit trails. If your batch exceeds the model's context window, chunk it and run validation per chunk with consistent rules. For high-risk domains like healthcare or finance, add a human review step for records flagged with warnings rather than hard failures—the model may misinterpret edge-case formats that a domain expert would accept.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Contact Import Pre-Flight Validation Prompt works well, where it breaks, and the operational preconditions for safe use.

01

Good Fit: Structured Batch Ingestion

Use when: You have a batch of contact records (CSV, JSON, or structured text) that must pass field-level validation before CRM ingestion. Guardrail: The prompt expects a defined schema upfront. Provide a [VALIDATION_RULES] block with field names, required flags, and format constraints.

02

Bad Fit: Real-Time Single-Record Entry

Avoid when: Validating one contact at a time in a synchronous user-facing form. Guardrail: This prompt is designed for batch reporting. For single-record validation, use application-level form validation and reserve the prompt for offline audit or bulk cleanup.

03

Required Inputs

Risk: The prompt produces generic or incorrect reports without explicit rules. Guardrail: Always supply [CONTACT_BATCH], [VALIDATION_RULES], and [OUTPUT_SCHEMA]. Optional [DUPLICATE_DEFINITION] and [EXISTING_RECORDS] blocks improve deduplication accuracy.

04

Operational Risk: Rule Drift

Risk: Validation rules change over time (new required fields, format updates), but the prompt template isn't updated. Guardrail: Version your [VALIDATION_RULES] block alongside your CRM schema. Run regression tests with a golden batch whenever rules change.

05

Operational Risk: Large Batch Timeouts

Risk: Very large contact batches exceed context windows or cause timeouts. Guardrail: Chunk batches into sizes that fit your model's context (e.g., 50-100 records per chunk). Use a harness that merges chunk reports and tracks partial failures.

06

Operational Risk: False Duplicate Flags

Risk: Overly aggressive fuzzy matching flags legitimate distinct contacts as duplicates. Guardrail: Define [DUPLICATE_DEFINITION] with explicit match criteria (exact email, phone, or composite keys). Include a confidence threshold and route low-confidence matches to a human review queue.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template with square-bracket placeholders for validating contact import batches before CRM ingestion.

This prompt template is designed to be copied directly into your application's prompt layer. It accepts a batch of contact records, a set of custom validation rules, and an output schema, then produces a structured validation report. Every placeholder is enclosed in square brackets and must be replaced with concrete values at runtime—either hardcoded in your prompt version or injected by your application harness. Do not ship this template with unresolved placeholders.

text
You are a contact import validation engine. Your job is to inspect a batch of contact records and produce a validation report that flags every field-level error, format violation, duplicate warning, and required-field gap before the records enter a CRM.

## INPUT
[CONTACT_BATCH]

## VALIDATION RULES
Apply the following rules to every record in the batch. Rules marked REQUIRED must fail the record if violated. Rules marked WARNING should be noted but do not block ingestion.

[VALIDATION_RULES]

## OUTPUT SCHEMA
Return a single JSON object with this exact structure:
{
  "batch_summary": {
    "total_records": <integer>,
    "passed": <integer>,
    "failed": <integer>,
    "warnings_only": <integer>
  },
  "records": [
    {
      "record_index": <integer>,
      "status": "passed" | "failed" | "warning",
      "fields": {
        "<field_name>": {
          "value": <original value or null>,
          "status": "valid" | "invalid" | "missing" | "warning",
          "error": <string or null>,
          "suggested_fix": <string or null>
        }
      },
      "duplicate_of": <integer or null>,
      "duplicate_confidence": <float between 0 and 1 or null>
    }
  ]
}

## CONSTRAINTS
[CONSTRAINTS]

## EXAMPLES
[EXAMPLES]

## INSTRUCTIONS
1. Validate every record against every applicable rule.
2. For duplicate detection, compare records within the batch using the fields specified in [DUPLICATE_MATCH_FIELDS].
3. If a field is required by the rules and missing or empty, mark it as "missing" with status "invalid".
4. If a field is present but violates a format rule, mark it as "invalid" and include a specific error message.
5. If a field triggers a WARNING rule, mark it as "warning" and include the warning reason.
6. Never invent or guess field values. If a field is missing, set its value to null.
7. If [RISK_LEVEL] is "high", flag any record with more than [MAX_ALLOWED_FAILURES] failed fields for human review by setting status to "failed" and adding a top-level "requires_review": true flag.
8. Return ONLY the JSON object. No markdown, no commentary, no code fences.

To adapt this template for your pipeline, replace each placeholder with concrete values. [CONTACT_BATCH] should receive your serialized contact records—typically a JSON array of objects. [VALIDATION_RULES] must be a structured description of your field requirements, format rules, and duplicate detection logic. If your CRM expects email addresses to match RFC 5322, state that explicitly. If phone numbers must be E.164, say so. [CONSTRAINTS] should capture output limits like maximum batch size, field length caps, or disallowed characters. [EXAMPLES] should include at least one passing record, one failing record with field-level errors, and one duplicate pair. [DUPLICATE_MATCH_FIELDS] defines which fields to compare—typically email, phone, or a composite key. [RISK_LEVEL] and [MAX_ALLOWED_FAILURES] control whether the prompt escalates records for human review. Test your filled template against a golden dataset of known-good and known-bad records before deploying.

IMPLEMENTATION TABLE

Prompt Variables

Placeholders required by the Contact Import Pre-Flight Validation Prompt Template. Replace each placeholder with concrete values before sending the prompt. Validation notes describe how to check that the replacement value is safe and correct.

PlaceholderPurposeExampleValidation Notes

[CONTACT_BATCH]

The raw contact records to validate, as a JSON array of objects

Must be valid JSON. Array length must not exceed batch size limit. Each object must have at least one contact field.

[REQUIRED_FIELDS]

List of field names that must be present and non-null in every record

["email", "first_name", "last_name"]

Must be a JSON array of strings. Field names must match keys in [CONTACT_BATCH] schema. Empty array allowed if no fields are required.

[FIELD_VALIDATION_RULES]

Per-field validation rules specifying format, type, and constraints

{"email": {"type": "email", "max_length": 254}, "phone": {"type": "phone", "format": "E.164"}}

Must be a JSON object. Each key must match a field in the contact schema. Rule types must be from the supported set: email, phone, string, number, date, url, enum.

[DUPLICATE_MATCH_KEYS]

Field combinations used to detect potential duplicate records within the batch

["email", ["first_name", "last_name", "phone"]]

Must be a JSON array of strings or arrays of strings. Each entry defines a match key. Nested arrays represent composite keys. Empty array disables duplicate detection.

[CUSTOM_CONSTRAINT_EXPRESSIONS]

Additional business rules expressed as natural language constraints

["Phone number must not start with 0 after country code", "Company name must match legal entity name if provided"]

Must be a JSON array of strings. Each string must be a single, unambiguous constraint. Avoid compound constraints in one string. Empty array allowed.

[OUTPUT_SCHEMA]

Expected structure of the validation report

{"valid": "boolean", "errors": [{"record_index": "number", "field": "string", "error_type": "string", "message": "string"}], "duplicates": [["number", "number"]]}

Must be a valid JSON Schema or a plain object describing field names and types. Must include error, duplicate, and summary sections. Null not allowed.

[MAX_RECORDS_PER_BATCH]

Maximum number of records the prompt should process in one call

100

Must be a positive integer. Should not exceed the model's context window capacity for the expected record size. Test with worst-case record size before setting.

[LOCALE]

Locale for formatting validation messages, date interpretations, and number formats

"en-US"

Must be a valid BCP 47 language tag. Affects error message language and date/number parsing. Null defaults to en-US.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Contact Import Pre-Flight Validation prompt into a reliable application workflow with validation, retries, and human review gates.

The Contact Import Pre-Flight Validation prompt is designed to sit between your contact data source and your CRM ingestion endpoint. In a typical implementation, you'll receive a batch of contact records—from a CSV upload, an API payload, a model extraction pipeline, or a manual data entry form—and you need to validate them before they hit your system of record. The prompt expects a structured input containing the contact batch, your validation rules, and the expected output schema. You should wrap this prompt in an application layer that handles chunking for large batches, enforces rate limits, and manages partial failures without losing validated records.

For production wiring, implement a validation harness that does the following: (1) Split large batches into chunks of 50-100 records to stay within context windows and avoid token exhaustion. (2) Pre-process each chunk to extract the fields your validation rules reference—don't send raw, unparsed blobs. (3) Call the prompt with a structured [INPUT] object containing records, validation_rules, and [OUTPUT_SCHEMA]. (4) Parse the model's JSON response and run it through a schema validator (JSON Schema or Pydantic) before trusting the output. If the response fails schema validation, retry once with the validation error injected into [CONTEXT]. If it fails twice, route the chunk to a human review queue with the raw records and the partial validation output. (5) Log every validation run with the prompt version, model, chunk ID, timestamp, and pass/fail counts for auditability. For model choice, GPT-4o and Claude 3.5 Sonnet handle structured validation reliably; avoid smaller models for batches with complex custom rules or nested field dependencies.

The most common production failure mode is custom rule injection breaking the output schema. When users supply free-text validation rules in [CONSTRAINTS], the model may produce a valid report that doesn't match your expected JSON structure—missing fields, extra commentary, or nested objects where arrays are expected. Mitigate this by always including a strict [OUTPUT_SCHEMA] with required fields, types, and enum constraints. For high-stakes imports (financial data, healthcare contacts, compliance-sensitive records), add a human approval step before the validated batch reaches your CRM. The prompt's [RISK_LEVEL] parameter should gate this: set it to high for regulated data, which triggers a review flag in your harness. Finally, build a regression test suite with known-bad contact batches—duplicate emails, malformed phone numbers, missing required fields, encoding artifacts—and run it against every prompt version before deployment. This catches silent regressions where a prompt update fixes one validation case but breaks another.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the validation report generated by the Contact Import Pre-Flight Validation prompt. Use this contract to parse and gate the model's output before ingestion into a CRM or data pipeline.

Field or ElementType or FormatRequiredValidation Rule

validation_report

object

Top-level key must be present and parseable as a JSON object.

validation_report.batch_id

string

Must match the [BATCH_ID] provided in the prompt input. Non-matching value triggers a schema mismatch error.

validation_report.summary

object

Must contain total_records, valid_records, invalid_records, and duplicate_warnings as integers. Sum of valid + invalid must equal total_records.

validation_report.field_errors

array of objects

Each object must have record_index (integer), field_name (string), current_value (string or null), error_type (enum: format_violation, required_field_missing, type_mismatch), and suggestion (string or null). Empty array if no errors.

validation_report.duplicate_warnings

array of objects

Each object must have record_index_a, record_index_b (integers), matched_on (array of strings), and confidence (float 0.0-1.0). Empty array if no duplicates detected.

validation_report.completeness_report

object

Must map field_name (string) to an object containing present_count, missing_count, and completeness_pct (float). All fields from [REQUIRED_FIELDS] must be present as keys.

validation_report.injected_rules_report

array of objects or null

If [CUSTOM_VALIDATION_RULES] are provided, each object must contain rule_id (string), rule_description (string), failures (array of record_index integers), and passed_count (integer). Return null if no custom rules supplied.

validation_report.generated_at

string (ISO 8601)

Must be a valid ISO 8601 datetime string. Parse check required. If unparseable, reject the entire report and trigger a retry.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when validating contact batches before CRM ingestion, and how to guard against it.

01

Schema Drift Between Prompt and Validator

What to watch: The prompt defines validation rules in natural language, but the downstream validator enforces a different schema. Fields like phone_type might be expected as an enum by the system but generated as free text by the model. Guardrail: Generate the validation report against a machine-readable schema artifact (JSON Schema, Pydantic model) injected into the prompt as [VALIDATION_SCHEMA]. Never duplicate rules manually.

02

Silent Hallucination of Missing Fields

What to watch: The model confidently reports email_valid: true for a record where the email field is entirely absent. It fills in a plausible but fabricated validation result instead of flagging the missing field. Guardrail: Require the prompt to output a field_presence map before any validation logic. Add an eval that cross-references input keys against the report's presence map and fails on any fabricated field status.

03

Inconsistent Error Severity Classification

What to watch: The same duplicate email error is classified as severity: warning in one record and severity: error in another. This breaks downstream routing logic that depends on consistent severity labels. Guardrail: Inject a strict [SEVERITY_RUBRIC] with concrete, testable conditions for each level. Use few-shot examples that demonstrate edge cases, and validate output severity distribution against expected patterns.

04

Context Window Overflow on Large Batches

What to watch: Sending a batch of 500 contacts causes the model to silently drop records from the end of the input, producing a validation report that appears complete but is missing entries. Guardrail: Implement a pre-flight chunker that splits batches into fixed-size windows. Add a record count assertion: the number of records in the output report must match the input count. Fail the batch if counts diverge.

05

Custom Validation Rule Misinterpretation

What to watch: A custom rule like reject if company_domain != email_domain is applied to records where company_domain is null, causing false rejections. The model treats null as a domain mismatch instead of skipping the rule. Guardrail: Require each custom rule in [CUSTOM_RULES] to include an explicit skip_condition. Test the harness with records designed to trigger null, empty, and missing fields for every custom rule before production deployment.

06

Duplicate Detection False Positives on Common Names

What to watch: The model flags John Smith at two different companies as a duplicate because it overweights name similarity and ignores the company_name field. This creates noisy duplicate warnings that erode user trust. Guardrail: Inject a [MATCHING_RULES] configuration that defines required match fields and weighting. Include a threshold parameter and require the model to output a match_reason for every flagged duplicate so operators can audit decisions.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Contact Import Pre-Flight Validation Prompt before shipping. Each criterion targets a specific failure mode observed in production CRM ingestion pipelines. Run these checks against a golden dataset of 50-100 contact records containing known errors, edge cases, and clean records.

CriterionPass StandardFailure SignalTest Method

Field-Level Error Detection

All injected format violations (e.g., malformed email, invalid phone, missing required fields) are flagged with correct field name and error type

Missed violations or misattributed error types in more than 2% of test records

Inject 20 known format errors across a 100-record batch; assert recall >= 98% and error type accuracy >= 95%

Duplicate Warning Precision

Duplicate warnings fire only for records sharing the configured match key (e.g., email OR phone) with similarity above threshold; no false positives on distinct records

False duplicate flags on records with different match keys or similarity below threshold

Insert 10 true duplicate pairs and 10 near-duplicate distinct pairs; assert precision >= 90% and recall >= 95% on true duplicates

Required-Field Completeness Check

Every record missing a required field per [REQUIRED_FIELDS] config is flagged; no false flags on records with all required fields present

Missing-field flags on records where the field is present but empty string vs. truly absent

Test with 20 records missing various required fields and 20 complete records; assert 100% recall on missing fields and 0% false positives on complete records

Custom Validation Rule Execution

All rules injected via [CUSTOM_VALIDATION_RULES] are evaluated; rule failures appear in output with rule ID and violating field

Custom rule silently skipped or rule failure attributed to wrong field

Inject 5 custom rules with known pass/fail cases; assert 100% rule execution and correct field attribution

Output Schema Compliance

Validation report matches [OUTPUT_SCHEMA] exactly: correct field names, types, and structure; no extra or missing top-level keys

Extra fields, missing required keys, or type mismatches in the JSON output

Validate output against JSON Schema for 50 test runs; assert 100% structural compliance

Batch Boundary Integrity

Report contains exactly one entry per input record; no record duplication, omission, or index shift in the output array

Output array length differs from input array length or record indices are misaligned

Process batches of 1, 50, and 200 records; assert output length equals input length and record-level errors map to correct input index

Confidence Flagging for Ambiguous Cases

Records with ambiguous format (e.g., phone number matching multiple country patterns) receive confidence score below [CONFIDENCE_THRESHOLD] and are flagged for review

Ambiguous records assigned high confidence or not flagged for human review

Inject 10 intentionally ambiguous records; assert all receive confidence below threshold and review flag is true

Idempotency Across Retries

Identical input batch produces identical validation report on repeated runs with same [VALIDATION_RULES] config

Field-level error messages, confidence scores, or duplicate groupings change across runs without input changes

Run same 50-record batch 3 times with temperature=0; assert byte-identical output or semantically equivalent diffs only

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a smaller set of validation rules. Remove custom rule injection and focus on the core checks: required fields, email format, phone format, and duplicate detection. Run against a small CSV sample (10–50 rows) and review the report manually.

Prompt snippet

code
Validate the following contact batch for basic field-level errors.

[CONTACT_BATCH]

Check for:
- Missing required fields: first_name, last_name, email
- Invalid email format
- Invalid phone format (E.164)
- Exact duplicate rows

Return a JSON report with `errors` and `warnings` arrays.

Watch for

  • Missing schema checks on optional fields
  • Overly broad duplicate detection that flags legitimate near-duplicates
  • No confidence scoring, so all errors look equally severe
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.