Inferensys

Prompt

Naming Convention and Case Format Audit Prompt

A practical prompt playbook for using the Naming Convention and Case Format Audit Prompt in production AI workflows to enforce camelCase, snake_case, and other key naming standards.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for auditing key naming conventions in structured LLM outputs.

This prompt is for engineering teams who need to enforce consistent key naming conventions—such as camelCase, snake_case, PascalCase, or kebab-case—across structured LLM outputs before those outputs reach downstream parsers, databases, or public APIs. The primary job-to-be-done is automated convention auditing: given a JSON object and a target case format, the prompt produces a field-by-field violation report with suggested corrections. The ideal user is a backend engineer, platform developer, or AI reliability lead integrating an LLM into a product where API contracts, database column mappings, or SDK type definitions depend on predictable key shapes. You should use this prompt when your system generates structured data and you cannot rely on the model alone to remember or consistently apply a naming standard across all fields, especially in long or nested outputs.

This prompt is not a schema validator, a type checker, or a completeness auditor. It does not verify that the right fields exist, that values are the correct type, or that business logic constraints are satisfied. It only audits the surface form of the keys themselves. Do not use this prompt when you need full JSON Schema compliance checking, cross-field dependency validation, or semantic correctness grading—pair it with sibling prompts like the JSON Schema Compliance Judge or Field Presence Audit for those concerns. The prompt is also not a repair tool; it identifies violations and suggests corrections but does not rewrite the payload. You will need a separate repair step or human review to apply the suggested fixes, especially when a correction could collide with another key name or a reserved word in your target system.

Before using this prompt, you must define your target convention explicitly. Ambiguous instructions like 'use standard JavaScript naming' will produce inconsistent results. Instead, specify the exact case format with clear rules: for camelCase, state that the first word is lowercase and subsequent words start uppercase with no separators; for snake_case, state that words are lowercase and separated by underscores. Provide examples of correct and incorrect keys in the [EXAMPLES] placeholder to anchor the model's behavior. The prompt works best when the input object is already valid JSON and the keys are strings. If your LLM output is still in a code block, contains trailing commas, or uses single quotes, run a syntax validation step first. Finally, recognize that this prompt is a narrow, deterministic audit tool—it should be one step in a multi-stage validation pipeline, not a standalone quality gate for production data.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and what inputs it assumes for a naming convention audit.

01

Good Fit: API Contract Enforcement

Use when: your platform ingests LLM-generated JSON and downstream parsers expect strict camelCase or snake_case keys. Guardrail: Run this audit as a pre-parse validation step in your API gateway before the payload reaches business logic.

02

Good Fit: Multi-Team Schema Governance

Use when: multiple teams contribute prompts that produce overlapping JSON schemas and you need a single source of truth for key format rules. Guardrail: Store the expected convention per schema in a registry and run the audit in CI against golden outputs.

03

Bad Fit: Free-Text or Narrative Outputs

Avoid when: the LLM output is prose, markdown, or unstructured text without a defined key-value schema. Guardrail: Use a format compliance prompt for structured outputs instead; this prompt requires a known set of keys to audit.

04

Bad Fit: Single-Key or Flat List Outputs

Avoid when: the output contains only one or two keys where convention is trivially verifiable by a regex. Guardrail: Skip the LLM audit and use a deterministic lint rule; reserve this prompt for outputs with 10+ keys where manual review is painful.

05

Required Inputs

You must provide: the raw LLM output to audit, the expected naming convention (camelCase, snake_case, PascalCase, kebab-case), and the list of keys to check. Guardrail: If keys are dynamic, supply a schema or example payload so the prompt can discover keys before auditing them.

06

Operational Risk: Silent Convention Drift

Risk: A prompt update changes output keys from snake_case to camelCase without downstream awareness, breaking deserialization. Guardrail: Pair this audit with a regression test that compares key names against a golden fixture on every prompt or model change.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt with square-bracket placeholders to audit a JSON payload for naming convention violations.

This section provides a copy-ready prompt template that you can drop into your evaluation harness to audit a JSON payload for naming convention and case format violations. The template is designed to be model-agnostic and uses square-bracket placeholders for all dynamic inputs, making it easy to parameterize in code. The prompt instructs the model to act as a strict convention auditor, checking every key against a specified case format and producing a structured violation report.

text
You are a strict naming convention auditor. Your task is to inspect the provided JSON payload and identify every key that violates the required naming convention.

[CONSTRAINTS]
- Only flag keys that do not match the [REQUIRED_CASE_FORMAT] convention.
- Ignore values; only audit the key names.
- Check all keys, including those in nested objects and arrays of objects.
- If a key is a reserved word in common programming languages (e.g., 'class', 'import', 'default'), flag it as a separate violation type.
- If the payload contains a mix of conventions (e.g., some camelCase and some snake_case keys), note this as an inconsistency violation.

[INPUT]
```json
[INPUT_JSON_PAYLOAD]

[OUTPUT_SCHEMA] You must respond with a single JSON object conforming to this schema: { "convention_audit": { "required_convention": "[REQUIRED_CASE_FORMAT]", "total_keys_checked": <integer>, "violations": [ { "key_path": "<string, e.g., 'user.address.streetName'>", "current_name": "<string>", "violation_type": "<'case_mismatch' | 'reserved_word' | 'inconsistent_convention'>", "suggested_correction": "<string or null>" } ], "summary": "<string>" } }

[EXAMPLES] Input: {"userId": 1, "user_name": "Alice"} Required Case: camelCase Output: { "convention_audit": { "required_convention": "camelCase", "total_keys_checked": 2, "violations": [ { "key_path": "user_name", "current_name": "user_name", "violation_type": "case_mismatch", "suggested_correction": "userName" } ], "summary": "1 violation found: 'user_name' should be 'userName'. Payload has inconsistent conventions (camelCase and snake_case)." } }

[RISK_LEVEL] This is a deterministic format check. If the output does not match the [OUTPUT_SCHEMA], the evaluation harness should retry once. If the retry fails, log the raw output and escalate for manual review.

To adapt this template, replace the placeholders in your application code before sending the request to the model. The [INPUT_JSON_PAYLOAD] should be the stringified JSON you want to audit. The [REQUIRED_CASE_FORMAT] should be a clear string like camelCase, snake_case, PascalCase, or kebab-case. The [OUTPUT_SCHEMA] is provided inline as a strict JSON Schema, which you can also enforce using your model's structured output or JSON mode features. The [EXAMPLES] section provides a one-shot demonstration of the desired behavior, which is critical for getting consistent violation types and suggested corrections. For production use, consider expanding the examples to include nested objects and reserved word collisions.

After integrating this prompt, your next step is to build a thin validation wrapper in your application that parses the model's response, confirms it matches the output schema, and routes violations to your logging or alerting system. Avoid the temptation to make the prompt do more than audit naming conventions; combining it with type checking or business logic validation will degrade its reliability. For high-risk pipelines where a missed violation could break downstream parsers, always pair this prompt with a deterministic post-check in code that verifies the model's violation count against a simple regex scan of the original keys.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Naming Convention and Case Format Audit Prompt. Each placeholder must be populated before the prompt can produce a reliable convention violation report.

PlaceholderPurposeExampleValidation Notes

[TARGET_PAYLOAD]

The structured output to audit for naming convention violations

{"user_id": 1, "firstName": "Jane", "last_name": "Doe"}

Must be valid parseable JSON. Empty payload returns empty violation list. Non-JSON input triggers format error before convention audit.

[CONVENTION_RULES]

The expected naming convention specification per scope or field type

{"default": "snake_case", "exceptions": {"API_RESPONSE": "camelCase"}}

Must include a default convention. Exceptions map is optional. Unrecognized convention values should cause the prompt to request clarification rather than guessing.

[SCOPE_DECLARATION]

Optional scope label to select which convention rules apply when multiple conventions coexist

"API_RESPONSE"

Must match a key in [CONVENTION_RULES].exceptions or be null. If null, the default convention applies globally. Mismatched scope triggers a scope-resolution warning.

[RESERVED_WORDS_LIST]

List of reserved words that must not appear as bare keys even if they match convention

["class", "import", "return", "type"]

Can be empty array. Reserved-word collisions should be flagged with severity 'warning' and a suggested alternative key name. Case-insensitive matching recommended.

[OUTPUT_SCHEMA]

Expected output structure for the violation report

{"violations": [{"field_path": "string", "current_case": "string", "expected_case": "string", "suggested_fix": "string", "severity": "error|warning"}]}

Must be a valid JSON Schema or example shape. Prompt uses this to format the violation report. Missing schema defaults to a standard violation array.

[CONSTRAINTS]

Additional rules such as allowed prefixes, suffixes, or acronym handling

"Acronyms longer than 2 characters preserve case: 'APIKey' is valid camelCase"

Can be null. When provided, constraints override default convention behavior for specified patterns. Ambiguous constraints should be rejected with a request for clarification.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the naming convention audit prompt into an API, validation pipeline, or CI/CD check with retry and logging.

The Naming Convention and Case Format Audit Prompt is designed to be called as a post-processing step after your primary LLM generates a structured output. It should not be the final gatekeeper on its own—treat it as a high-signal automated reviewer that flags violations for either automatic repair or human review. The prompt expects a JSON payload and a target convention (e.g., camelCase, snake_case, PascalCase), and it returns a structured violation report. Wire this into your application as a dedicated validation service that sits between the primary model response and your downstream parsers or databases.

For an API integration, wrap the prompt in a function that accepts the raw LLM output and a convention parameter. The function should: (1) attempt to parse the input as JSON and immediately return a parse error if it fails—do not send unparseable strings to the auditor; (2) call the LLM with the audit prompt, using a low temperature (0.0–0.1) and a model that reliably follows JSON output instructions; (3) validate the auditor's response against a strict schema that expects violations as an array of objects with field_path, current_case, expected_case, and suggested_fix; (4) if the auditor's output fails schema validation, retry once with an explicit error message appended to the prompt; (5) log the full audit result, including the original payload hash, convention, violation count, and auditor model version, to your observability platform. For high-throughput systems, batch multiple outputs into a single audit call by wrapping them in a records array and asking the auditor to return a per-record violation list.

In a CI/CD pipeline, integrate this prompt as a gate in your prompt regression test suite. Maintain a golden dataset of known-correct and known-violating payloads. For each test case, assert that the auditor correctly identifies zero violations for compliant payloads and catches every seeded violation in non-compliant ones. Track false-positive and false-negative rates over time, and set a threshold—if the auditor misses more than 5% of known violations, block the prompt change and investigate. For production use, pair this audit prompt with an automated repair step: when violations are detected, feed the violation report and original payload into a repair prompt that applies the suggested fixes and returns a corrected output. Always log the pre-repair and post-repair payloads for auditability. Avoid using this prompt on outputs that contain mixed conventions by design (e.g., keys from external APIs that follow different standards); instead, scope the audit to the fields your team controls and document which fields are exempt.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the naming convention violation report. Use this contract to parse, validate, and integrate the LLM output into downstream linting or CI pipelines.

Field or ElementType or FormatRequiredValidation Rule

violations

Array of objects

Must be present and parseable as a JSON array. Empty array is valid if no violations found.

violations[].field_path

String (e.g., 'user.first_name')

Must be a non-empty string representing the JSON path to the violating key. Validate with a path-existence check against the input schema.

violations[].current_case

String (e.g., 'camelCase')

Must be a non-empty string. Validate against a controlled vocabulary of known case formats: 'camelCase', 'PascalCase', 'snake_case', 'kebab-case', 'UPPER_CASE', 'unknown'.

violations[].expected_case

String (e.g., 'snake_case')

Must be a non-empty string matching the [TARGET_CONVENTION] input parameter. Validate with an exact string match against the target convention.

violations[].suggested_fix

String (e.g., 'user_first_name')

Must be a non-empty string. Validate that the suggested fix matches the expected_case format when converted, and that it is not identical to the original field name.

violations[].severity

String

Must be one of: 'error', 'warning', 'info'. Validate with an enum check. Reserved-word collisions should be severity 'error'.

summary.total_fields_audited

Integer

Must be a non-negative integer. Validate that it equals the count of unique keys recursively extracted from the [INPUT_JSON].

summary.violations_found

Integer

Must be a non-negative integer. Validate that it equals the length of the 'violations' array.

PRACTICAL GUARDRAILS

Common Failure Modes

Naming convention audits fail in predictable ways. These are the most common failure modes when using an LLM to enforce case formats, reserved words, and naming standards across structured outputs.

01

Reserved-Word Collision Blindness

What to watch: The model flags class, import, or type as violations in one language but misses them in another, or fails to recognize that a reserved word in the target language (e.g., from in Python, delete in JavaScript) will break code generation. Guardrail: Provide an explicit reserved-word list per target language in the prompt. Test with a golden set that includes the top 20 reserved words for each language you support.

02

Mixed-Convention Drift Within a Single Output

What to watch: The model correctly identifies that most keys are camelCase but misses a single snake_case key inserted mid-payload, or worse, normalizes the entire output to one convention and silently breaks API contracts that intentionally mix conventions (e.g., camelCase for user fields, snake_case for metadata). Guardrail: Add a per-field convention expectation map to the prompt. Validate output with a script that checks each field against its expected convention, not a global heuristic.

03

Acronym and Abbreviation Inconsistency

What to watch: The model treats userId, UserID, and user_id as equivalent, or normalizes APIKey to apikey (losing readability) or api_key (breaking camelCase). Acronym handling is a top source of false positives and false negatives. Guardrail: Define an acronym policy in the prompt (e.g., "acronyms longer than 2 characters preserve original casing: APIKey stays APIKey"). Include acronym-heavy test cases like HTTPSConnection, XMLParser, and dBLevel.

04

False-Positive Flagging of Intentional Exceptions

What to watch: The model flags fields that intentionally break convention—such as third-party API response keys, database column names, or legacy fields under a migration freeze—as violations. This erodes trust in the audit and creates noise. Guardrail: Support an allowlist of fields that are exempt from convention checks. Include the allowlist directly in the prompt or as a structured input alongside the payload to audit.

05

Case-Only Difference Collapse

What to watch: The model treats fieldname and fieldName as the same key when checking for duplicates or convention adherence, missing that case-sensitive systems (JSON, JavaScript, Python dicts) treat them as distinct. This can cause silent data loss when one key overwrites another. Guardrail: Add an explicit case-sensitivity check step in the prompt: "Keys that differ only in case are distinct. Flag them as potential collision risks." Test with { "id": 1, "ID": 2 }.

06

Convention Fix Suggestion That Breaks Semantics

What to watch: The model suggests renaming customerID to customer_id but the downstream system expects the original key name. The suggestion is technically correct for convention but operationally destructive. Guardrail: Separate the audit into two outputs: a violation report and an optional rename map. Never let the model rewrite keys without explicit approval. Add a warning in the prompt: "Suggest corrections only. Do not assume renaming is safe."

IMPLEMENTATION TABLE

Evaluation Rubric

Test cases for evaluating the Naming Convention and Case Format Audit Prompt against common edge cases. Use these criteria to validate the prompt's output quality before integrating it into a CI pipeline or format compliance harness.

CriterionPass StandardFailure SignalTest Method

Acronym Handling

Acronyms like 'API' or 'HTML' are correctly flagged only if their case violates the target convention (e.g., 'api' in camelCase is a violation, 'API' is not).

Prompt flags 'API' as a violation in camelCase or suggests 'aPI'.

Provide a payload with mixed-case acronyms and assert the violation list matches a known-good set.

Abbreviation Consistency

Common abbreviations (e.g., 'ID', 'URL') are treated consistently; the report does not suggest conflicting corrections for the same abbreviation across different fields.

Report suggests 'Id' for 'userID' but 'Id' for 'orderID' in the same output.

Inject a payload with the same abbreviation in multiple keys and check for identical suggested corrections.

Reserved Word Collision Detection

Keys that match language or framework reserved words (e.g., 'class', 'import') are flagged with a warning, even if the case format is correct.

Prompt passes a key named 'class' without any warning or suggestion to rename.

Include a key named 'class' in the input payload and verify the output contains a specific warning for reserved word usage.

Mixed Convention Detection

A single output containing both snake_case and camelCase keys is flagged as an inconsistent convention error, with a clear root-cause summary.

Prompt evaluates each key in isolation and reports a 50% pass rate without noting the inconsistency.

Provide a payload where half the keys are snake_case and half are camelCase; assert the report includes an 'Inconsistent Convention' top-level finding.

Nested Object Key Audit

Keys in nested objects are audited recursively; a violation in a deeply nested key is reported with its full JSON path.

Prompt only audits top-level keys and ignores violations in nested structures.

Provide a payload with a violation at user.profile.first_name and assert the violation report includes the full path.

False Positive Rate on Valid Input

A payload with 100% compliant keys produces zero violations and a 'pass' verdict.

Prompt flags a correctly formatted key due to an incorrect regex or substring match (e.g., flagging 'ip_address' as a violation for containing 'add').

Run the prompt against a golden payload of 20+ compliant keys and assert violations.length === 0.

Correction Suggestion Accuracy

For each violation, the suggested correction is the minimal edit to achieve compliance (e.g., 'user_name' -> 'userName' for camelCase).

Suggestion is a completely different word, drops characters, or applies the wrong case transformation.

Provide a payload with known violations and assert each suggestion matches a pre-computed expected correction using a string distance metric.

Empty or Null Key Handling

An empty string key or a null key is flagged as a structural error, not a naming convention violation.

Prompt crashes, ignores the key, or reports it as a 'case format violation'.

Include "": "value" and null: "value" in the input and assert the output contains a distinct 'Invalid Key Structure' error.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a flat list of expected conventions. Use a simple markdown table output instead of a structured JSON report. Skip the severity scoring and just flag violations as pass or fail per field.

code
[CONVENTIONS]
camelCase for all keys
PascalCase for component names
UPPER_SNAKE_CASE for constants

[INPUT]
{ ... }

Flag any key that violates these conventions.

Watch for

  • The model may miss violations in deeply nested objects if you don't explicitly ask it to traverse all levels.
  • Without a strict output schema, the report format will drift across runs.
  • Reserved word collisions (e.g., class, import) may be flagged inconsistently.
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.