跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 momentic-test

Momentic Test

创建,运行并维护 Momentic浏览器 E2E 测试和模块存储为 *.test.yaml和 *.module.yaml 文件.

50908 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

创建,运行并维护 Momentic浏览器 E2E 测试和模块存储为 *.test.yaml和 *.module.yaml 文件.

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Momentic model、Project files and formats、Choose the workflow、Before editing、Authoring rules、AI Action V3。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 scripts/v2-json-schema/build/v2-format-reference.md、assets/resource-usage.ndjson,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Create, run, and maintain Momentic browser E2E tests and modules stored as *.test.yaml and *.module.yaml files.

Momentic modelProject files and formatsChoose the workflowBefore editingAuthoring rulesAI Action V3Test execution behaviorCache and memoryReadiness and timingTest contextJavaScriptWorking with v2 YAML

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
momentic-test
description
Create, run, and maintain Momentic browser E2E tests and modules stored as *.test.yaml and *.module.yaml files.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 2
  • scripts/v2-json-schema/build/v2-format-reference.md
  • assets/resource-usage.ndjson

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「momentic-test」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-e15f1ea718ae5ab7-%E7%9E%AC%E9%97%B4%E6%B5%8B%E8%AF%95.html
请存为 .cursor/skills/momentic-test/SKILL.md 或 .claude/skills/momentic-test/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/momentic-ai/skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/momentic-ai/skills' --list

npx skills add 'https://github.com/momentic-ai/skills' --skill 'momentic-test'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: momentic-test description: Create, run, and maintain Momentic browser E2E tests and modules stored as *.test.yaml and *.module.yaml files. --- # Momentic model Momentic turns structured natural language into browser automation using forked Playwright, CDP, and custom agents. Interactive steps resolve natural-language targets, assertions can use multimodal models, and AI actions can complete broader goals. # Project files and formats Tests use `*.test.yaml`; reusable modules use `*.module.yaml`. Test IDs live in the test file's `id` field. Check `momentic.config.yaml` and test-level metadata before assuming project defaults apply. `fileType: momentic/test/v2` and `fileType: momentic/module/v2` identify v2 files. Treat missing or different `fileType` as deprecated v1. Never edit v1 YAML directly; persist changes through `momentic_test_splice_steps`. A v2 test selects its environment with `defaultEnv`, and `--env ` overrides it. There is no fallback to the only environment in the config. The base URL comes from `--url-override`, then the test's own `url`, then `env.BASE_URL`, so a test that sets `url` keeps it in every environment. With no base URL the run fails: "Cannot run test with no base URL and no BASE_URL variable defined in its environment". V2 can reference modules, JavaScript, and auth state with relative paths. Paths resolve from the YAML file containing the reference. Use `./...` or `../...`, never absolute paths or `~`. Before moving, renaming, or deleting a referenced file, grep its path and update or remove every reference. Do not add internal or generated fields to v2 YAML. # Choose the workflow Prefer these compact workflows unless the user requests something else: - **Known v2 change:** inspect nearby patterns -> edit YAML -> lint when syntax or references are uncertain -> reload or restart if validating -> run the relevant range. This is fastest and produces the clearest reviewable diff. - **V1, unknown UI, or interactive validation:** start MCP session -> run any prerequisites -> preview a logical checkpoint -> splice it -> validate the saved range -> terminate. This grounds each edit in the live app without repeatedly running the whole test. - **New test:** create with `momentic_test_create` -> author a known v2 sequence in one YAML edit, or use MCP step-by-step when discovery is needed. `momentic_session_start` only opens an existing test. Use MCP as the default interactive interface: it returns structured results, screenshots, artifacts, step refs, and pollable execution. Preview and run tools wait 30 seconds by default, then return a `stepRunnerId` while work continues. Leave `timeoutSeconds` unset for most calls, especially single preset steps. Set it below 30 seconds only when the coding agent's tool-call timeout is shorter. Raise it only to wait longer within a larger tool-call timeout; poll returned handles with `momentic_poll_runner`. Polling has a separate `timeoutSeconds` (default 0, maximum 30). Pass the returned `stepRunnerId` and use a nonzero wait within the coding agent's tool-call timeout instead of repeatedly polling without a wait. # Before editing Confirm the test goal, user-visible success criteria, start environment, auth, and env requirements. Ask before previewing or running any step or AI Action that may submit, purchase, delete, send, create, or cause another non-idempotent side effect. If approved, execute it at most once. Also ask before editing a shared module, restarting a long flow, or running an expensive full test. # Authoring rules - Prefer natural-language targets. Use selectors or coordinates only when the AI cannot see the target or the user requires selector-level precision. - Use native Momentic steps for browser actions and checks. See **JavaScript** under **Test execution behavior** for the exceptions. - Do not add initial navigation; a session starts at the test's base URL. - Keep assertions minimal and user-driven. After navigation or a material state change, validate the contract before dependent actions. - Prefer `waitForUrl` for URL contracts, page/element checks for stable text or structure, and AI assertions for semantic visual state. - Prefer AI Action V3 for new tests unless the exact interaction sequence is part of the contract. - Do not add optional or default-valued fields unless correctness requires them. - Keep changes narrow. Preserve unrelated values, comments, ordering, and step style. Do not weaken a test to hide a broken app or service. - Preserve the existing `before` / `steps` / `after` structure unless the test intent requires a change. ## AI Action V3 AI Action V3 takes a natural-language goal and determines the browser steps. - **Cached by default:** save and replay a successful flow, self-healing failed replay steps. Use for repeatable flows. - **Uncached:** run the agent fresh each time. Set `cache: false` in v2 or use `--disable-cache` with `AI_ACTION_DYNAMIC`. Prefer this for chats, agentic workflows, exploratory tests, and other dynamic or nondeterministic behavior. Treat “make sure you can do X” as goal-based testing unless the user specifies a route. Use granular steps when controls, order, intermediate assertions, deterministic replay, speed, or a risky side effect is itself under test. Keep existing granular tests granular unless asked to change strategy. # Test execution behavior ## Cache and memory Momentic caches resolved selectors, text, coordinates, and other metadata so most runs avoid repeated AI calls. AI assertions may also reuse past-result memory. Stale cache or memory can explain a fast wrong-element match or a repeated borderline verdict. Cache is scoped by git metadata, including branch. Protected branches read cache but do not write it unless `--save-cache` is used or `CI` is set. - Change a granular step description when its intent changes. Never add `DANGEROUS_FORCE_DYNAMIC` or `--disable-cache` to locator steps; built-in cache validation handles changing content. - Carry a successful preview's `CacheId` into the exact step being spliced. - Reword an assertion when old memory no longer matches its intended condition. - For AI Action V3 cache behavior, see **AI Action V3** above. ## Readiness and timing Smart waiting runs before targeting steps and defaults to five seconds. Within that window, do not add sleeps. For longer or semantic readiness, wait for a URL or use a page, element, or AI check that describes the required positive state. Checks retry until their timeout; increase that timeout instead of polling the UI with JavaScript. See the [browser configuration](https://momentic.ai/docs/configuration/browser) for project-wide timing settings. ## Test context Each run has a test-scoped `env` that persists across steps and modules. - In v2, save returned values with `saveAs`; in MCP step strings, use `--env-key`. Use `setVariable(name, value)` in JavaScript when saving several values. - Use `env.NAME` in JavaScript and module input expressions. Use `{{ env.NAME }}` in string fields, but not inside JavaScript source. - Module inputs are JavaScript fragments stored as strings. Quote literal strings and use `env.X` for variables. ## JavaScript Use native click, type, hover, wait, and check steps for browser behavior. They retain Momentic's smart waiting, cache, traces, and retries. Do not use browser JavaScript to click or type, and do not poll the UI when a check can retry until its timeout. Use Node JavaScript for test setup, data generation, APIs, databases, OTP/email/SMS, and Momentic helpers. Use Browser JavaScript to access `window`, `document`, client-side state, or inject page scripts when no native step expresses the operation. Keep one-off code short and follow nearby project conventions for reusable v2 scripts. See the [JavaScript guide](https://momentic.ai/docs/integrations/javascript) for runtime APIs and timeout details. # Working with v2 YAML V2 is human-editable. Tests use `before`, `steps`, and `after`; modules use `steps`. Each step has one command key, with options nested beneath it. Durations are milliseconds, and step IDs are not stored in YAML. Make the smallest edit and match nearby syntax. If syntax is unclear, consult the generated v2 format reference at `infra/scripts/v2-json-schema/build/v2-format-reference.md` when working in the Momentic monorepo, or https://static.momentic.ai/v2-format-reference.md in an installed skill. Run `npx momentic lint` when schema or file-reference risk warrants it; `momentic app` and `momentic run` also lint automatically. After a disk edit, reload the active MCP test if the tool is available; otherwise terminate and restart the session. `momentic_test_get` reads persisted state but does not refresh an active session unless its description says so. # MCP browser workflow Use the tool descriptions and the Step Authoring Guide returned by session start for current arguments and step syntax. Do not duplicate that reference material from this skill. ## Start and fetch context Do not call context tools as session-start boilerplate. Use them on demand and follow their descriptions, especially when they offer filters or return large project data. - If the test ID is known, start `momentic_session_start` by itself. Its Test Content provides the active steps and runnable IDs. - Use `momentic_get_artifacts` only to discover project paths, tests, modules, or environments that are not already known. Avoid redundant refreshes. - Use `momentic_test_get` to inspect persisted state before starting, or to read a different test. Prefer active session and splice responses afterward. - Use filtered `momentic_get_environment_variables` only when a step needs env data that is not already known. - Use `momentic_module_recommend` -> `momentic_module_get` only when evaluating reuse; recommendation invokes AI and is not required to start a session. V2 YAML has no runnable step IDs. Use IDs returned by session start or later splice responses. Only one browser operation may run per session. Do not issue concurrent preview, run, state, or splice operations against the same session. ## Preview -> splice -> validate 1. For mid-test work, run through the preceding step once and keep the same session. This avoids authoring against the wrong page state. 2. Preview forward in logical checkpoints such as login complete, form ready, or submission complete. Checkpoints make the browser state reusable and keep persistence calls reviewable. 3. Use `momentic_preview_steps` for adjacent steps. It supports the same preset, AI Action, and module steps as `momentic_preview_step`. 4. Read the returned screenshot first. Request browser state only when the image lacks enough targeting or diagnostic context; request it again once if the page may still be settling. 5. Splice the successful checkpoint. Attach each returned `CacheId` only to its exact step; cacheless steps are normal. Read the splice response immediately for the active step refs. 6. Run the next dependent saved step or range. If any preview or run returns a `stepRunnerId`, poll it instead of starting another browser operation. 7. Before finishing, when safe, run the smallest saved range covering the prerequisites, changed step, and next dependent contract. Reset first when accumulated state could mask a failure. 8. Terminate the session when finished. Batch obvious low-risk fields. Preview uncertain locators individually. For submit, purchase, delete, send, or other non-idempotent actions, preview setup, splice the checkpoint, then run the approved saved action at most once. Do not reset between routine edits. For nested steps, use the parent chain returned by the active session or splice response. # Modules For a logical flow of roughly four or more reusable steps, check `momentic_module_recommend` -> `momentic_module_get` -> reuse or inline. Reuse reduces duplicated setup and keeps tests focused on their unique contract. Modules cannot contain modules. Ask before changing a shared module. Respect its declared parameters, defaults, and enum values; module inputs are JavaScript fragments, not `{{ }}` templates. # Troubleshooting ## Page state and timing - Wrong or stale page: inspect the latest screenshot or session state; retry state capture once if the page is settling. - Slow readiness at one checkpoint: add the narrowest page, element, or AI check, or increase the existing check's timeout. Checks already retry; do not poll with JavaScript. - Broadly slow targeting across the project: consider increasing `browser.smartWaitingTimeoutMs`. Do not use it to mask one slow assertion. - Long jobs or uploads: check for a stable positive result with an appropriate timeout, not a sleep. - Drifted session: rerun the required saved range with `resetSession: true`. ## Browser and host resource pressure Retry or reset once after a browser, CDP, page-load, screenshot, or snapshot timeout. If it persists or affects several browser tools, stop changing the test. Do not hide resource pressure with waits, weaker assertions, cache flags, or repeated browser calls. Signals include an unresponsive page, document-tree or page-execution timeout, empty HTML snapshot, browser or inspector crash, and `data-momentic-id` timeout. A page-load timeout alone may instead indicate the app or network. Inspect CPU, memory, and top processes with available host tools. Check the browser, Momentic, app server, compiler/bundler, database, and unrelated workloads. For completed runs, correlate with `attempts//assets/resource-usage.ndjson` when present. Report the error, step, URL, retry result, resource pressure, largest consumers, and supported cause. If evidence cannot distinguish the host, app, services, or Momentic, say so. ## Targeting and assertions - Element absent: debug the prerequisite. Element visible but not found: use a stable description based on visible text, role, and nearby context. - Fast wrong-element match: consider stale cache, then correct the description. - In normal mode, errors that an element is hidden, disabled, detached, covered, moving, or outside the viewport originate in Playwright's actionability enforcement, which Momentic surfaces; they are not failures in Momentic's locator AI. Fix the page state or prerequisite. Use force only when bypassing actionability is part of the intended behavior. - For controls that intentionally cannot satisfy Playwright actionability, such as some rich-text editors, `browser.visualActions: true` uses coordinate-based actions instead. It avoids those checks but also gives up their stability guarantees. See [Visual actions](https://momentic.ai/docs/configuration/browser#browser-visualactions). - Use quoted text only when the exact text must appear; otherwise describe meaning. Make assertions concrete about region, object, count, or state. - Scroll visual targets into view. Use vision-only assertion mode for subtle visual conditions. - Assert stable final state with step assertions. For brief toasts or change-over-time comparisons, use video-backed [run assertions](https://momentic.ai/docs/core-concepts/writing-assertions#run-assertions). ## Format and data - V2 load failure: lint the file and check relative references. - Module failure: re-check parameters, defaults, enums, and input expressions. - Missing env value: verify the producing save and `env.X` versus `{{ env.X }}` at the consumer. - JavaScript failure: verify Node versus Browser context. After about three attempts at the same failure, stop and ask the user for direction.

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…