agentleFS
joelbarmettlerUZHjoelbarmettlerUZH/ultrainit.sh/.claude/skills/audit-prompt-schema-sync/SKILL.md

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…

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
  1. Distinctive:

    Always fix both the prompt and schema in the same commit:

    line 63
  2. Very specific:

    After any schema change, update tests/fixtures/findings/<agent-name>.json to match.

    line 80

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Before You Start

  • prompts/ — 14 markdown prompt files; output sections describe field names in prose
  • schemas/ — 14 JSON schema files; properties keys are the actual field names
  • schemas/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.json

3. 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"
done

4. 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 optional

Removing 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-unit

Common Mistakes

  1. developer-answers.json has no schema — it is hand-assembled by lib/ask.sh. Any change to field names requires updating all jq expressions in lib/synthesize.sh that read from it.
  2. Two MCP schema shapes exist — schemas/mcp-recommendations.json has relevance and a nested configuration object. schemas/synthesis-tooling.json flattens command/args/env. The synthesizer must reshape MCP data between passes. When debugging MCP config, check both schemas.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.