Skip to content
docs / prompting2 min read

Specifications and context

Structure requests around contracts, invariants, dependencies, and observable acceptance criteria.

Open Markdown
On this page

Define a contract for the change

Treat a request as a specification the generated result can be checked against. Identify the target screen or component, data shape, supported actions, failure states, and explicit non-goals. For an existing project, name the behavior that must remain unchanged.

  • Inputs: field names, types, valid and invalid examples, and the source of truth.
  • State transitions: initial, loading, success, empty, error, and retry behavior.
  • Dependencies: distinguish fixtures, browser storage, shared backend data, and external providers.
  • Invariants: authorization rules, immutable fields, ordering, and existing public behavior.

Request a bounded implementation

Change specification
text
Target: existing issue-list screen.
Change: add a status filter with all/open/closed values.
Data contract: { id: string, title: string, status: 'open' | 'closed' }.
Preserve: item IDs, existing sort order, detail navigation, and visual tokens.
Empty state: show a clear message and a Reset filters action.
Acceptance:
- Filter and text search compose.
- Reset returns the original order.
- No network request is added for local filtering.
- Controls have accessible labels and keyboard focus.
Return: changed files, validation performed, and unresolved dependencies.

Supply bounded source context

The Sites composer supports source mentions, reference URLs, supported text files, and images. Explain which aspect of a reference is authoritative: schema, content, layout, or behavior. A URL supplies context; it does not authorize account access or import the referenced system's backend.

Supported text formats include TXT, Markdown, CSV, JSON, HTML, CSS, JavaScript, and TypeScript. The text path expects UTF-8 rather than binary documents. Mention context is bounded separately from file size; use the smallest excerpt that preserves the contract instead of attaching an entire dependency tree.

Make evaluation independent of generation

Keep acceptance criteria concrete enough to execute manually or in your own test environment. A request to add tests is not evidence that tests ran: inspect the reported validation and reproduce critical behavior. Distinguish implemented, mocked, and unavailable dependencies in the result.

Use synthetic records and placeholders for credentials. Connect services through their dedicated controls after defining the data flow, permissions, and expected cost boundary.