agentleFS
LeanMeanCleanAppsLeanMeanCleanApps/CleanGraphQLApi/.agents/skills/schema-snapshot/SKILL.md

schema-snapshot

Skill13 starsChanged 10 days agoMITView on GitHub

How the GraphQL schema is pinned by a snapshot test - schema.graphql in the integration tests, comparing it with /graphql?sdl, and updating it on purpose when the schema changes. Use when the schema snapshot test fails, or after adding or changing a query, mutation, type, field or description.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the tests. The snapshot test fails and prints the new schema.

    line 19
  2. Distinctive:

    Read the diff. A removed field, a renamed one, or a field that became non-null breaks clients, so say so in the pull request.

    line 21
  3. Distinctive:

    Run the tests again.

    line 22
  4. Distinctive:

    Update the snapshot without reading the diff.

    line 26

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Schema snapshot

The rule

tests/Presentation.Tests.Integration/GraphQL/Schema/schema.graphql is the schema clients see, checked in. SchemaTests.Schema_ShouldMatch_Snapshot asks the running app for /graphql?sdl and fails when the two differ. Every schema change shows up in a pull request as a diff of that file, so reviewers see exactly what clients will see.

The test ignores lines that start with #, which GraphQL treats as comments. In the template repository the snapshot uses them to mark the ApplyPolicy enum, which only exists when authorization is on, so dotnet new can leave it out of a solution created without --include-auth. Keep those markers when you update the snapshot there.

Steps

  1. Make the schema change.
  2. Run the tests. The snapshot test fails and prints the new schema.
  3. Copy the new SDL into schema.graphql. Either take it from the test output, or run the app and open http://localhost:7330/graphql?sdl.
  4. Read the diff. A removed field, a renamed one, or a field that became non-null breaks clients, so say so in the pull request.
  5. Run the tests again.

Don't

  • Update the snapshot without reading the diff.
  • Edit schema.graphql by hand to make the test pass.
  • Skip or delete the snapshot test.

Check

dotnet test tests/Presentation.Tests.Integration --filter "FullyQualifiedName~SchemaTests"
git diff tests/Presentation.Tests.Integration/GraphQL/Schema/schema.graphql

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.