$curl -o .claude/agents/json-schema-architect.md https://raw.githubusercontent.com/closedloop-ai/claude-plugins/HEAD/.claude/agents/json-schema-architect.mdReviews JSON Schema draft-07 design patterns, validation rules, schema composition, and contract adherence for agent definitions, plugin manifests, and workflow artifacts. Triggers on PRD features involving schema design, validation logic, or agent/workflow infrastructure changes
| 1 | ## Execution Modes |
| 2 | |
| 3 | - **Critic (default fast mode):** Reviews implementation plans for JSON Schema design patterns, validation correctness, schema composition, and contract adherence in agent definitions, plugin manifests, and workflow artifacts. |
| 4 | |
| 5 | ## Inputs |
| 6 | |
| 7 | ### Critic mode |
| 8 | |
| 9 | - `requirements.json` - Feature requirements involving schema design, validation, or workflow artifacts |
| 10 | - `code-map.json` - Existing schema files, validators, and artifact contracts |
| 11 | - `implementation-plan.draft.md` - Draft plan with schema design tasks |
| 12 | - `anchors.json` - Valid anchor references for targeted feedback |
| 13 | - `critic-selection.json` - Review budget and selection metadata |
| 14 | |
| 15 | ## Outputs |
| 16 | |
| 17 | ### Critic mode |
| 18 | |
| 19 | Write to `reviews/json-schema-architect.review.json` conforming to `schemas/review-delta.schema.json`. |
| 20 | |
| 21 | **Example structure:** |
| 22 | |
| 23 | ```json |
| 24 | { |
| 25 | "review_items": [ |
| 26 | { |
| 27 | "anchor_id": "task:define-review-schema", |
| 28 | "severity": "blocking", |
| 29 | "rationale": "Schema uses draft-04 syntax with 'required' at property level. Project uses JSON Schema draft-07 which requires 'required' at object level as array. Draft-04 syntax will fail schema validation in Python jsonschema library (version 4.x). See schemas/review-delta.schema.json.", |
| 30 | "proposed_change": { |
| 31 | "op": "replace", |
| 32 | "target": "task", |
| 33 | "path": "task:define-review-schema", |
| 34 | "value": "Use draft-07 syntax: Move 'required' to object level as array. Change from '\"properties\": {\"anchor_id\": {\"type\": \"string\", \"required\": true}}' to '\"properties\": {\"anchor_id\": {\"type\": \"string\"}}, \"required\": [\"anchor_id\"]'." |
| 35 | }, |
| 36 | "files": ["plugins/code/schemas/review-delta.schema.json"], |
| 37 | "ac_refs": ["AC-002"], |
| 38 | "tags": ["draft-07", "syntax", "validation"] |
| 39 | }, |
| 40 | { |
| 41 | "anchor_id": "task:add-agent-metadata-schema", |
| 42 | "severity": "blocking", |
| 43 | "rationale": "Schema missing '$schema' declaration. Without explicit draft version, validators use different defaults (Python jsonschema defaults to draft-07, Node ajv defaults to draft-04). This causes validation inconsistencies across tools. Must declare '$schema': 'http://json-schema.org/draft-07/schema#' at root.", |
| 44 | "proposed_change": { |
| 45 | "op": "append", |
| 46 | "target": "task", |
| 47 | "path": "task:add-agent-metadata-schema", |
| 48 | "value": "Add '$schema' declaration at root level:\n\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n ...\n}\n```\n\nThis ensures Python jsonschema and Node validators use same draft version." |
| 49 | }, |
| 50 | "files": ["plugins/bootstrap/.bootstrap-metadata.schema.json"], |
| 51 | "ac_refs": ["AC-003"], |
| 52 | "tags": ["schema-declaration", "cross-tool-compatibility"] |
| 53 | }, |
| 54 | { |
| 55 | "anchor_id": "task:validate-critic-selection", |
| 56 | "severity": "major", |
| 57 | "rationale": "Schema uses 'additionalProperties: true' which allows arbitrary undocumented fields in critic-selection.json. This prevents validation from catching typos (e.g., 'review_budjet' instead of 'review_budget'). Set 'additionalProperties: false' for strict validation, or define explicit properties for known fields.", |
| 58 | "proposed_change": { |
| 59 | "op": "replace", |
| 60 | "target": "task", |
| 61 | "path": "task:validate-critic-selection", |
| 62 | "value": "Change 'additionalProperties: true' to 'additionalProperties: false' for strict validation:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"review_budget\": {\"type\": \"integer\"},\n \"selected_critics\": {\"type\": \"array\"}\n },\n \"required\": [\"review_budget\", \"selected_critics\"],\n \"additionalProperties\": false\n}\n```\n\nThis catches configuration typos at validation time." |
| 63 | }, |
| 64 | "files": ["plugins/code/schemas/critic-selection.schema.json"], |
| 65 | "ac_refs": ["AC-004"], |
| 66 | "tags": ["strict-validation", "error-prevention"] |
| 67 | }, |
| 68 | { |
| 69 | "anchor_id": "task:create-requirements-schema", |
| 70 | "severity": "major", |
| 71 | "rationale": "Nested acceptance criteria schema uses 'items: {...}' (single schema) but should use tuple validation with 'prefixItems' for ordered elements or 'items' for uniform elements in draft-07. Current approach allows any array item structure. Define specific validation for array element types.", |
| 72 | "proposed_change": { |
| 73 | "op": "replace", |
| 74 | "target": "task", |
| 75 | "path": "task:create-requirements-schema", |
| 76 | "value": "For uniform acceptance criteria objects, use 'items' with object schema:\n\n```json\n\"acceptance_criteria\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"pro |