agentleFS
8beeeaaat8beeeaaat/touchdesigner-mcp/.claude/skills/integration-test-guard/SKILL.md

integration-test-guard

Skill563 starsChanged 2 months agoMITView on GitHub

Ensure MCP-server / API changes in the touchdesigner-mcp repo ship with integration-test coverage. Use when you modify the MCP server, tool definitions/handlers, the OpenAPI schema, the TD HTTP client, the transport layer, or the TD-side Python API (src/api, src/features/tools, src/server, src/tdClient, src/transport, td/modules/mcp). Also triggered by the integration-test-guard PreToolUse hook, which blocks a `git push` whose outgoing commits touch those paths without a tests/integration or tests/e2e change. Decide which suite fits, add or update the test, and run it.

  • Installs packages
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When you change the MCP server / API surface, add or update a test in tests/integration/ or tests/e2e/.

    line 16
  2. Distinctive:

    If the change spans two categories, cover each in its suite.

    line 36
  3. Distinctive:

    Follow the existing patterns in the chosen file:

    line 40
  4. Very specific:

    touchDesignerClientAndWebServer: use the shared tdClient and the test_base_comp sandbox (created in beforeAll).

    line 44
  5. Distinctive:

    Prefer reconciliation (compute a value, compare to an invariant) over assertions that can be satisfied without the behavior actually …

    line 49

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

Integration Test Guard

When you change the MCP server / API surface, add or update a test in tests/integration/ or tests/e2e/. The integration-test-guard hook blocks git push when the outgoing commits touch API/MCP source without one (override with SKIP_ITEST_GUARD=1 only when a test genuinely does not apply).

What counts as "API/MCP surface"

src/api/** (OpenAPI schema) · src/features/tools/** (tool defs + handlers) · src/server/** (MCP server) · src/tdClient/** (TD HTTP client) · src/transport/** (stdio/HTTP transport) · td/modules/mcp/** (TD-side Python API).

Step 1 — pick the right suite (by what the change affects)

Change affectsSuiteNeeds live TD (9981)?
MCP tool response shape / formatting, tool registration, manifesttests/integration/mcpToolsResponse.test.tsNo — uses server.getTool(...) with mocked client
Client ↔ WebServer behavior (create/update/delete/exec, TD-side Python)tests/integration/touchDesignerClientAndWebServer.test.tsYes — real TouchDesignerClient over HTTP
HTTP transport (stateless /mcp serving, /health)tests/integration/httpTransport.test.tsNo live TD, but starts the HTTP server
Protocol-era behavior of the built CLI (2026-07-28 negotiation via server/discover, 2025-era fallback, serveStdio / createMcpHandler wiring, CLI args)tests/e2e/*.e2e.test.tsNo — spawns dist/cli.js, drives it with the real MCP SDK client

If the change spans two categories, cover each in its suite.

Step 2 — add / update the test

Follow the existing patterns in the chosen file:

  • mcpToolsResponse: get the tool via server.getTool(TOOL_NAMES.X), invoke its handler with a mocked TD client, assert the formatted response shape.
  • touchDesignerClientAndWebServer: use the shared tdClient and the test_base_comp sandbox (created in beforeAll); exercise the real call path, then reconcile against a runtime value (read it back and compare) rather than trusting the response alone. Clean up created nodes.

Prefer reconciliation (compute a value, compare to an invariant) over assertions that can be satisfied without the behavior actually working.

Step 3 — run it

# TD-independent suites:
npx vitest run tests/integration/mcpToolsResponse.test.ts
npx vitest run tests/integration/httpTransport.test.ts
npm run test:e2e   # builds dist/ then drives dist/cli.js with the real SDK client

# Live-TD suite (needs TouchDesigner running with the .tox on 9981):
TD_WEB_SERVER_HOST=http://127.0.0.1 TD_WEB_SERVER_PORT=9981 \
  npx vitest run tests/integration/touchDesignerClientAndWebServer.test.ts -t "<your test name>" \
  --hookTimeout=60000 --testTimeout=60000

Notes:

  • The live-TD suite's beforeAll creates a sandbox base COMP; on a cold connection the default 10s hook timeout can trip — pass --hookTimeout=60000.
  • To bring up a real TD and load the .tox, use the touchdesigner-self-debug skill.
  • A fresh worktree needs npm install && npm run gen before the client/schema exist.

Step 4 — commit & push

Once the test is added and green, commit and push normally. If a change legitimately needs no integration test (pure refactor, comment, type-only), push with SKIP_ITEST_GUARD=1 git push ... and say why.

Related

  • touchdesigner-self-debug — start TD, load the .tox, verify TD-side Python.
  • Hook: .claude/hooks/integration-test-guard.mjs (Node; PreToolUse on git push).

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.