xd-contract
Markdown explains intent and decisions. The application contract describes data, operations and explicit rules. Code and tests provide evidence that an implementation conforms.
Import → read → export
- In Application contract, choose Import contract and select a YAML file. Structural errors prevent replacement; replacing an existing contract requires confirmation.
- The imported file lives at
api/x-md-openapi.yaml. Click its name to open it in your usual editor. - Choose Export contract to save a copy elsewhere. The plugin validates the saved content and preserves its bytes, including comments and line endings.
These buttons exchange a document. They do not extract a contract from source code or rebuild an application. Ask your agent to perform those tasks, review its findings and test the resulting implementation.
Download the minimal example · Structural schema · Grammar and limits
From a running application to a portable contract
Extract observed models, configuration and operations. Assess whether a formal contract is useful. Describe the intended contract and record differences from the observed application as debt. Adapt the original implementation before using the contract for a port. UI appearance and details outside the contract still need documentation and acceptance tests.
What validation means
Version 1.0 checks the YAML document, the OpenAPI 3.1 structural profile, the extension grammar, internal JSON-pointer references, operation identifiers and declared state transitions. It accepts one autonomous file, up to 4 MiB, without YAML aliases or external references. Errors identify a document path; YAML parser errors include source positions.
Structural validation is not proof of business correctness. CEL expressions are retained as strings; the plugin does not execute or type-check them. A contract can pass structural checks and still describe incorrect behavior. Use application tests for conformance and dedicated OpenAPI tooling for exhaustive standard validation.
Ownership and reuse
The contract survives New Task and New Vision. Markdown references it instead of duplicating its models. Existing application-specific contracts are not silently upgraded to another grammar version. Their authorship and reuse conditions belong in project documentation and relevant licenses. Read our call on generic code, knowledge and rights.