audit-prompt-schema-sync
Skill8 starsChanged 7 months agoApache-2.0View on GitHub
Prompts describe output fields in prose ("For each finding, include: name, category, evidence_files"). Schemas enforce field types. When they drift, the agent either drops fields (prompt describes them but schema doesn't declare them) or returns unexpected fields (schema has them but prompt doesn't describe them). Neither case errors — both silently produce wrong findings. For each gather prompt, find the output contract section. Look for patterns like "For each X, determine: field1, field2" or "Returns: { field1, field2 }": For…
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/workflows/CLAUDE.mdCLAUDE.md
- lib/CLAUDE.mdCLAUDE.md
- prompts/CLAUDE.mdCLAUDE.md
- schemas/CLAUDE.mdCLAUDE.md
- scripts/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- add-bats-testSkill
- add-edge-testSkill
- add-gather-agentSkill
- add-integration-testSkill
- add-synthesis-fixtureSkill
- bundle-and-verifySkill
- check-ci-locallySkill
- debug-agent-failureSkill
- fixture-syncSkill
- pre-pr-checklistSkill
- rebuild-test-imageSkill
- release-ultrainitSkill
- run-testsSkill
- tune-synthesis-contextSkill
- validate-generated-artifactSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 63
Always fix both the prompt and schema in the same commit:
- Very specific: line 80
After any schema change, update tests/fixtures/findings/<agent-name>.json to match.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Before You Start
prompts/— 14 markdown prompt files; output sections describe field names in proseschemas/— 14 JSON schema files;propertieskeys are the actual field namesschemas/CLAUDE.md— notes on which schema issues are known (MCP shape mismatch, developer-answers has no schema)
The Problem
Prompts describe output fields in prose ("For each finding, include: name, category, evidence_files"). Schemas enforce field types. When they drift, the agent either drops fields (prompt describes them but schema doesn't declare them) or returns unexpected fields (schema has them but prompt doesn't describe them). Neither case errors — both silently produce wrong findings.
Steps
1. Extract prompt-described field names
For each gather prompt, find the output contract section. Look for patterns like "For each X, determine: field1, field2" or "Returns: { field1, field2 }":
# Manually read the output contract in each prompt
grep -n 'determine\|Returns\|output\|For each' prompts/patterns.md | head -20
cat prompts/patterns.md | grep -A20 'output'2. Extract schema-declared field names
# Top-level properties
jq -r '.properties | keys[]' schemas/patterns.json
# Properties of array items
jq -r '.properties.patterns.items.properties | keys[]' schemas/patterns.json3. Diff the two sets
For patterns.md → schemas/patterns.json:
# Fields in prompt but not schema: agent may emit them, schema drops them
# Fields in schema but not prompt: agent may not populate them, findings are empty
# Example manual diff for patterns agent:
prompt_fields="name type evidence_files description is_consistent"
schema_fields=$(jq -r '.properties.patterns.items.properties | keys[]' schemas/patterns.json)
for f in $prompt_fields; do
echo "$schema_fields" | grep -q "^$f$" || echo "IN PROMPT, NOT SCHEMA: $f"
done4. Fix the drift
Always fix both the prompt and schema in the same commit:
Adding a missing field to schema:
// In schemas/patterns.json, add to items.properties:
"new_field": {
"type": "string",
"description": "..."
}
// Do NOT add to required[] — add as optionalRemoving a field from prompt that schema doesn't support:
Edit the prose in prompts/<name>.md to remove the field description from the output section.
5. Update the fixture
After any schema change, update tests/fixtures/findings/<agent-name>.json to match. Run make test-all to catch breakage.
Verify
bash -n lib/gather.sh
jq empty schemas/<agent-name>.json
make test-unitCommon Mistakes
developer-answers.jsonhas no schema — it is hand-assembled bylib/ask.sh. Any change to field names requires updating alljqexpressions inlib/synthesize.shthat read from it.- Two MCP schema shapes exist —
schemas/mcp-recommendations.jsonhasrelevanceand a nestedconfigurationobject.schemas/synthesis-tooling.jsonflattenscommand/args/env. The synthesizer must reshape MCP data between passes. When debugging MCP config, check both schemas.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

