JSON Data Auditor
Purpose
Validate, audit, and score JSON data for quality, consistency, and schema compliance. Use this skill when reviewing API responses, configuration files, data exports, fixtures, or any structured JSON data.
Activation
Use this skill when the user asks to:
- Validate JSON data against a schema
- Audit data quality or consistency
- Score JSON data for completeness
- Find anomalies in JSON datasets
- Check JSON configuration files
Schema Validation
JSON Schema Validation Checklist
When validating JSON against a schema (JSON Schema draft-07 or later):
- Type correctness - Every field matches its declared type (
string, number, boolean, array, object, null)
- Required fields - All
required properties are present
- Enum constraints - Values match allowed enum sets
- Format validation - Strings match declared formats (
date-time, email, uri, uuid, ipv4, ipv6)
- Range constraints - Numbers satisfy
minimum, maximum, exclusiveMinimum, exclusiveMaximum
- String constraints - Strings satisfy
minLength, maxLength, pattern
- Array constraints - Arrays satisfy
minItems, maxItems, uniqueItems
- Nested validation - Recursively validate nested objects and arrays
- Additional properties - Flag unexpected properties when
additionalProperties: false
- Conditional schemas - Evaluate
if/then/else, oneOf, anyOf, allOf, not
Schema Inference
When no schema is provided, infer one:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": { "type": "string", "format": "uuid" },
"name": { "type": "string", "minLength": 1 },
"email": { "type": "string", "format": "email" },
"createdAt": { "type": "string", "format": "date-time" },
"tags": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
}
},
"required": ["id", "name", "email"]
}
Consistency Checks
Cross-Record Consistency
For arrays of objects (datasets), check:
- Field presence consistency - Same fields across all records (flag optional vs missing)
- Type consistency - Same field has same type across records (flag type coercion issues)
- Referential integrity - Foreign key references point to valid records
- Uniqueness - Fields expected to be unique (IDs, emails) are actually unique
- Enum consistency - Categorical fields use consistent values (no "active" vs "Active" vs "ACTIVE")
Value Pattern Consistency
- Date formats - All dates use the same format (ISO 8601 preferred)
- Naming conventions - Keys follow consistent casing (
camelCase, snake_case, kebab-case)
- Null handling - Consistent use of
null vs missing key vs empty string
- Number precision - Consistent decimal places for monetary/measurement values
- String encoding - UTF-8 throughout, no mixed encoding
Data Quality Scoring
Quality Dimensions (0-100 each)
| Dimension |
What It Measures |
| Completeness |
Percentage of non-null, non-empty required fields |
| Validity |
Percentage of values passing format/type validation |
| Consistency |
Cross-record uniformity of types, formats, casing |
| Uniqueness |
No unintended duplicate records or values |
| Accuracy |
Values within plausible ranges (dates not in future, ages 0-150) |
| Timeliness |
Timestamps are recent and not stale |
Scoring Formula
Overall Score = (Completeness * 0.25) + (Validity * 0.25) + (Consistency * 0.20)
+ (Uniqueness * 0.15) + (Accuracy * 0.10) + (Timeliness * 0.05)
Output Format
## JSON Data Audit Report
**File/Source:** `data.json`
**Records:** 1,247
**Fields per record:** 12
### Quality Score: 87/100
| Dimension | Score | Issues |
|---------------|-------|--------|
| Completeness | 92 | 3 records missing `email` |
| Validity | 85 | 47 invalid date formats |
| Consistency | 88 | Mixed casing in `status` field |
| Uniqueness | 95 | 2 duplicate `userId` values |
| Accuracy | 78 | 15 records with future `createdAt` |
| Timeliness | 90 | 12 records older than 1 year |
### Critical Issues
1. **[CRITICAL]** Duplicate primary keys: records 45, 892
2. **[HIGH]** Invalid email format in 23 records
3. **[MEDIUM]** Inconsistent null handling: `address` uses both `null` and `""`
### Recommendations
1. Add unique constraint on `userId`
2. Normalize date format to ISO 8601
3. Standardize null representation
Common JSON Anti-Patterns
Flag these when found:
| Anti-Pattern |
Example |
Fix |
| Stringified numbers |
"age": "25" |
"age": 25 |
| Stringified booleans |
"active": "true" |
"active": true |
| Nested stringified JSON |
"meta": "{\"key\":\"val\"}" |
"meta": {"key": "val"} |
| Inconsistent arrays |
"tags": "a,b,c" |
"tags": ["a","b","c"] |
| Date as epoch only |
"created": 1700000000 |
"created": "2023-11-14T22:13:20Z" |
| Deeply nested structures |
6+ levels of nesting |
Flatten or normalize |
| Massive single objects |
1000+ top-level keys |
Split into sub-objects |
| Mixed null semantics |
null, "", "N/A", "none" |
Use null consistently |
Tooling Integration
When suggesting fixes, provide actionable code:
// Validate with Zod
import { z } from "zod";
const UserSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
email: z.string().email(),
age: z.number().int().min(0).max(150),
createdAt: z.string().datetime(),
tags: z.array(z.string()).default([]),
});
type User = z.infer<typeof UserSchema>;
// Validate array of records
const UsersSchema = z.array(UserSchema);
const result = UsersSchema.safeParse(data);
if (!result.success) {
console.error(result.error.format());
}
// Validate with ajv (JSON Schema)
import Ajv from "ajv";
import addFormats from "ajv-formats";
const ajv = new Ajv({ allErrors: true });
addFormats(ajv);
const validate = ajv.compile(schema);
const valid = validate(data);
if (!valid) {
console.error(validate.errors);
}
1---2name: json-data-auditor3description: JSON data validation, audit, and quality scoring. Use when reviewing API responses, configuration files, data exports, or schema compliance.4---56# JSON Data Auditor78## Purpose910Validate, audit, and score JSON data for quality, consistency, and schema compliance. Use this skill when reviewing API responses, configuration files, data exports, fixtures, or any structured JSON data.1112## Activation1314Use this skill when the user asks to:15- Validate JSON data against a schema16- Audit data quality or consistency17- Score JSON data for completeness18- Find anomalies in JSON datasets19- Check JSON configuration files2021## Schema Validation2223### JSON Schema Validation Checklist2425When validating JSON against a schema (JSON Schema draft-07 or later):26271. **Type correctness** - Every field matches its declared type (`string`, `number`, `boolean`, `array`, `object`, `null`)282. **Required fields** - All `required` properties are present293. **Enum constraints** - Values match allowed enum sets304. **Format validation** - Strings match declared formats (`date-time`, `email`, `uri`, `uuid`, `ipv4`, `ipv6`)315. **Range constraints** - Numbers satisfy `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`326. **String constraints** - Strings satisfy `minLength`, `maxLength`, `pattern`337. **Array constraints** - Arrays satisfy `minItems`, `maxItems`, `uniqueItems`348. **Nested validation** - Recursively validate nested objects and arrays359. **Additional properties** - Flag unexpected properties when `additionalProperties: false`3610. **Conditional schemas** - Evaluate `if/then/else`, `oneOf`, `anyOf`, `allOf`, `not`3738### Schema Inference3940When no schema is provided, infer one:4142```json43{44 "$schema": "http://json-schema.org/draft-07/schema#",45 "type": "object",46 "properties": {47 "id": { "type": "string", "format": "uuid" },48 "name": { "type": "string", "minLength": 1 },49 "email": { "type": "string", "format": "email" },50 "createdAt": { "type": "string", "format": "date-time" },51 "tags": {52 "type": "array",53 "items": { "type": "string" },54 "uniqueItems": true55 }56 },57 "required": ["id", "name", "email"]58}59```6061## Consistency Checks6263### Cross-Record Consistency6465For arrays of objects (datasets), check:66671. **Field presence consistency** - Same fields across all records (flag optional vs missing)682. **Type consistency** - Same field has same type across records (flag type coercion issues)693. **Referential integrity** - Foreign key references point to valid records704. **Uniqueness** - Fields expected to be unique (IDs, emails) are actually unique715. **Enum consistency** - Categorical fields use consistent values (no "active" vs "Active" vs "ACTIVE")7273### Value Pattern Consistency74751. **Date formats** - All dates use the same format (ISO 8601 preferred)762. **Naming conventions** - Keys follow consistent casing (`camelCase`, `snake_case`, `kebab-case`)773. **Null handling** - Consistent use of `null` vs missing key vs empty string784. **Number precision** - Consistent decimal places for monetary/measurement values795. **String encoding** - UTF-8 throughout, no mixed encoding8081## Data Quality Scoring8283### Quality Dimensions (0-100 each)8485| Dimension | What It Measures |86|---|---|87| **Completeness** | Percentage of non-null, non-empty required fields |88| **Validity** | Percentage of values passing format/type validation |89| **Consistency** | Cross-record uniformity of types, formats, casing |90| **Uniqueness** | No unintended duplicate records or values |91| **Accuracy** | Values within plausible ranges (dates not in future, ages 0-150) |92| **Timeliness** | Timestamps are recent and not stale |9394### Scoring Formula9596```97Overall Score = (Completeness * 0.25) + (Validity * 0.25) + (Consistency * 0.20)98 + (Uniqueness * 0.15) + (Accuracy * 0.10) + (Timeliness * 0.05)99```100101### Output Format102103```markdown104## JSON Data Audit Report105106**File/Source:** `data.json`107**Records:** 1,247108**Fields per record:** 12109110### Quality Score: 87/100111112| Dimension | Score | Issues |113|---------------|-------|--------|114| Completeness | 92 | 3 records missing `email` |115| Validity | 85 | 47 invalid date formats |116| Consistency | 88 | Mixed casing in `status` field |117| Uniqueness | 95 | 2 duplicate `userId` values |118| Accuracy | 78 | 15 records with future `createdAt` |119| Timeliness | 90 | 12 records older than 1 year |120121### Critical Issues1221. **[CRITICAL]** Duplicate primary keys: records 45, 8921232. **[HIGH]** Invalid email format in 23 records1243. **[MEDIUM]** Inconsistent null handling: `address` uses both `null` and `""`125126### Recommendations1271. Add unique constraint on `userId`1282. Normalize date format to ISO 86011293. Standardize null representation130```131132## Common JSON Anti-Patterns133134Flag these when found:135136| Anti-Pattern | Example | Fix |137|---|---|---|138| Stringified numbers | `"age": "25"` | `"age": 25` |139| Stringified booleans | `"active": "true"` | `"active": true` |140| Nested stringified JSON | `"meta": "{\"key\":\"val\"}"` | `"meta": {"key": "val"}` |141| Inconsistent arrays | `"tags": "a,b,c"` | `"tags": ["a","b","c"]` |142| Date as epoch only | `"created": 1700000000` | `"created": "2023-11-14T22:13:20Z"` |143| Deeply nested structures | 6+ levels of nesting | Flatten or normalize |144| Massive single objects | 1000+ top-level keys | Split into sub-objects |145| Mixed null semantics | `null`, `""`, `"N/A"`, `"none"` | Use `null` consistently |146147## Tooling Integration148149When suggesting fixes, provide actionable code:150151```typescript152// Validate with Zod153import { z } from "zod";154155const UserSchema = z.object({156 id: z.string().uuid(),157 name: z.string().min(1),158 email: z.string().email(),159 age: z.number().int().min(0).max(150),160 createdAt: z.string().datetime(),161 tags: z.array(z.string()).default([]),162});163164type User = z.infer<typeof UserSchema>;165166// Validate array of records167const UsersSchema = z.array(UserSchema);168const result = UsersSchema.safeParse(data);169if (!result.success) {170 console.error(result.error.format());171}172```173174```typescript175// Validate with ajv (JSON Schema)176import Ajv from "ajv";177import addFormats from "ajv-formats";178179const ajv = new Ajv({ allErrors: true });180addFormats(ajv);181182const validate = ajv.compile(schema);183const valid = validate(data);184if (!valid) {185 console.error(validate.errors);186}187```