momentic-spec skill turns a
user story into a .test.yaml file before anyone writes product code. The agent
reads the story, maps the acceptance criteria to steps and assertions, and
writes the file into your repository. Once the feature is usable in your app,
the agent proposes a run and executes it after you confirm. The test is plain
YAML, so you edit it in a pull request like any other file.
Setup
Install the MCP server and the skills with the CLI. Both commands are described in Building with AI:MOMENTIC_API_KEY in its environment and a reachable app to
test: a local dev server, a preview deploy, or staging.
In your coding agent
Inside Claude Code, Cursor, Codex, or another agent with the Momentic MCP server and skills installed, paste the story after the skill name:apply-promo-code.test.yaml
fill so the field’s value is replaced instead of
appended to. See type.
The agent does not run the test right away. Momentic runs are end-to-end checks
against the real UI, so the skill waits for a durable checkpoint: the promo code
feature is implemented and a user can exercise it in the app. At that point the
agent names the test it proposes to run, asks you to confirm, and runs it once
you agree. If you run it before the feature exists, the assertions fail.
Edit the generated test
The file lives in your repository, so review it in the same pull request as the feature:- Rename the
idto something your team recognizes, then keep it stable. See File format. - Replace a natural-language step with a preset step when the action is exact.
click: Applygives the runtime one action to perform, where “click the apply button” leaves the path to an AI action. Steps lists the preset steps. - Tighten each
assertto the contract in the story. “The order total is lower” is a weaker check than “The order total is $89.10” when the story fixes the discount. - Move shared setup such as log-in into a module so every test generated from a story reuses it.
What to expect
- The agent covers the acceptance criteria you give it. A story with no criteria produces a test that asserts only the happy path.
- Steps that name UI elements the app does not have yet still run: the AI action
step finds the element by description once it exists. Preset steps such as
clickalso target by description. - When the UI changes later, locator auto-healing re-resolves a stale target during the run, and failure recovery can clear an obstruction and retry. See AI test maintenance.
For tests scoped to a code change instead of a story, see Generate tests from
a pull request
diff.