agentleFS
agent-ixagent-ix/spec-skills/spec-write-it/SKILL.md

spec-write-it

Skill1 starsChanged 6 months agoMITView on GitHub

Generate required integration test cases to cover integrations with all external services. These tests will be run in a real env with real services.

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to specify integration test cases that verify connectivity and behavior with external services.

    line 8
  2. Very specific:

    Use Template (REQUIRED): assets/integration-test-template.md

    line 37
  3. Distinctive:

    Test Data: TD-XXX fixtures with rationale

    line 42
  4. Distinctive:

    No Code Examples: Describe behavior, not implementation

    line 55
  5. Distinctive:

    Every IT specification MUST include acceptance criteria from BOTH categories:

    line 71
  6. Distinctive:

    Verify the real, non-mocked environment is correctly established:

    line 74
  7. Distinctive:

    Test data fixtures are loaded into real stores

    line 77
  8. Distinctive:

    Verify REAL OUTPUT from REAL SERVICES — not mocked return values:

    line 81
  9. Distinctive:

    When a mock IS used, the IT MUST state:

    line 108
  10. Very specific:

    CRUD ITs: MUST POST/GET/PUT/DELETE to real endpoints, verify response codes, body structure, and database state after each operation.

    line 116
  11. Distinctive:

    Validation ITs: MUST send invalid payloads and verify real 4xx error responses.

    line 118
  12. Distinctive:

    Auth ITs: MUST send requests with/without credentials, verify real 401/403.

    line 119
  13. Distinctive:

    Migration ITs: MUST run real Alembic migrations, verify schema state.

    line 122
  14. Very specific:

    Query ITs: MUST insert/query/update/delete against real PostgreSQL, verify row state.

    line 123
  15. Distinctive:

    Constraint ITs: MUST violate unique/FK constraints, verify real DB errors propagated.

    line 124
  16. Distinctive:

    Publish ITs: MUST publish to real Kafka/AMQP topic, consume, verify payload.

    line 127
  17. Distinctive:

    Consume ITs: MUST produce test event, verify service processes it and side-effects visible.

    line 128
  18. Distinctive:

    Job ITs: MUST submit real job, verify execution, verify completion state in store.

    line 131
  19. Distinctive:

    Timeout ITs: MUST submit slow job, verify timeout and cleanup behavior.

    line 132
  20. Very specific:

    LLM ITs: MUST use a deterministic scripted LLM (e.g., ScenarioChatModel), invoke via real API, verify tool calls executed and results …

    line 135
  21. Distinctive:

    Tool ITs: MUST execute real tools, verify real file/process state.

    line 137
  22. Distinctive:

    Streaming ITs: MUST connect real SSE/WS endpoints, verify event sequence.

    line 138
  23. Distinctive:

    Every IT file MUST begin with YAML frontmatter:

    line 142

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

Generate Integration Test Cases

Use this skill to specify integration test cases that verify connectivity and behavior with external services. These tests run in real environments (e.g., KIND cluster) against actual service dependencies.

Scope

  • HTTP client integrations (API calls to other services)
  • Event bus connections (Kafka, RabbitMQ)
  • Database connections (Postgres, Redis)
  • External APIs (cloud providers, third-party services)

ID Schema

  • IT-XXX: Integration Test identifier
  • IT-XXX-SC-XX: Success Criteria within a test
  • TD-XXX: Test Data fixture identifier

Each test case is a separate file. Sequential numbering within the service spec.

Cross-Component References

ISO 29148 supports bidirectional traceability across system boundaries. You can reference requirements from other service specs:

  • catalog-service/FR-001: Reference to another service's functional requirement
  • config-service/NFR-002: Reference to another service's non-functional requirement

This is best practice for integration verification where your test validates behavior defined in another service's specification.

Process

  1. Identify Integration Points: List all external service dependencies from the codebase.
  2. Select ID: Next available IT-XXX.
  3. Use Template (REQUIRED): assets/integration-test-template.md
  4. Document Each Section:
    • Dependencies: Other IT-XXX tests and cross-component FR/NFR references
    • Target Integration: Service and protocol
    • Preconditions: Environment and data state
    • Test Data: TD-XXX fixtures with rationale
    • Execution Plan: Atomic steps with timeout and criteria
    • Expected Outcome: Success condition and failure modes
    • Traceability: Link to FR/StR/NFR/TD
  5. Output: Save to spec/integration/IT-XXX-description.md

Output Location

  • Single Repo: spec/integration/IT-XXX-description.md
  • Multi-Repo: specs/<category>/<component>/spec/integration/IT-XXX-description.md

Rules

  • No Code Examples: Describe behavior, not implementation
  • Technical Prose: Explain WHY and WHAT data at each step
  • Atomic Steps: One action per step with independent success criteria
  • Explicit Timeouts: Every action step must have a timeout
  • Traceability Required: Every test links to at least one FR/StR/NFR
  • Cross-Component OK: Reference requirements from other service specs

IT Reality Testing Rules

[!CAUTION] Integration tests are ALWAYS REAL by default. Nothing is mocked unless the spec explicitly says so. An IT that only checks imports or constructs models without exercising real behavior is a GAP.

Mandatory AC Categories

Every IT specification MUST include acceptance criteria from BOTH categories:

Category 1: Real Setup ACs

Verify the real, non-mocked environment is correctly established:

  • Service under test is running and healthy (real health endpoint, real HTTP response)
  • Dependencies are available (real database, real message bus, real external service)
  • Test data fixtures are loaded into real stores
  • Configuration is applied through real config loading paths

Category 2: Real Output ACs

Verify REAL OUTPUT from REAL SERVICES — not mocked return values:

  • HTTP responses from real endpoints (status codes, headers, body structure)
  • Database state changes from real queries (rows inserted, updated, deleted)
  • Event messages published to real event bus topics
  • File system state from real tool execution (files created, content correct)
  • SSE/WebSocket streams from real connections (event types, data payloads)
  • LLM responses through real provider chains (token streaming, tool calls)

What "Real" Means

Real (Required)Not Real (GAP)
POST to API endpoint, assert response bodyassert MyModel is not None
Query database after write, verify rows changedMyModel(field="value") without DB
Publish event, consume from real bus, verify payloadassert EventSchema is not None
GET /health, verify HTTP 200 with status bodyassert app is not None
Load config from file, call API, verify behaviorassert config.key == "value"
Connect WebSocket, send message, read responseassert MessageType.TEXT exists

Mocking Policy

  • Default: NO MOCKS. ITs exercise real service boundaries.
  • Approved mock targets (only when the spec explicitly requires it):
    • External third-party APIs (payment, auth, cloud) → use test doubles with real HTTP
    • External services outside the test boundary → use contract-faithful stubs
  • Never mock: HTTP transport, config loading, database connections, file I/O, session storage, event publishing, health endpoints, WebSocket/SSE connections.
  • When a mock IS used, the IT MUST state:
    • WHY the real service cannot be used
    • WHAT the mock replaces (specific boundary)
    • HOW the mock is verified to be faithful (contract tests, schema validation)

Common IT Patterns by Service Type

API Services (FastAPI, REST)

  • CRUD ITs MUST POST/GET/PUT/DELETE to real endpoints, verify response codes, body structure, and database state after each operation.
  • Validation ITs MUST send invalid payloads and verify real 4xx error responses.
  • Auth ITs MUST send requests with/without credentials, verify real 401/403.

Database Services (pg-data-service)

  • Migration ITs MUST run real Alembic migrations, verify schema state.
  • Query ITs MUST insert/query/update/delete against real PostgreSQL, verify row state.
  • Constraint ITs MUST violate unique/FK constraints, verify real DB errors propagated.

Event-Driven Services (FastStream workers)

  • Publish ITs MUST publish to real Kafka/AMQP topic, consume, verify payload.
  • Consume ITs MUST produce test event, verify service processes it and side-effects visible.

Worker Services (deploy-worker, scenario-runner)

  • Job ITs MUST submit real job, verify execution, verify completion state in store.
  • Timeout ITs MUST submit slow job, verify timeout and cleanup behavior.

Agent Services (LLM orchestration)

  • LLM ITs MUST use a deterministic scripted LLM (e.g., ScenarioChatModel), invoke via real API, verify tool calls executed and results returned.
  • Tool ITs MUST execute real tools, verify real file/process state.
  • Streaming ITs MUST connect real SSE/WS endpoints, verify event sequence.

Frontmatter (Required)

Every IT file MUST begin with YAML frontmatter:

---
id: IT-XXX
title: "<Title>"
artifact_type: IT
status: DRAFT              # DRAFT | APPROVED | IMPLEMENTED | VERIFIED | DEPRECATED
relationships:             # Required: FR/StR/NFR references
  - target: "ix://org/repo/FR-XXX"
    type: "verifies"
    cardinality: "1:1"
---

References

  • Template: assets/integration-test-template.md
  • Example: assets/integration-test-example.md

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.