npx skills add https://github.com/mastra-ai/mastra --skill smoke-test使用 create-mastra@<tag> 创建一个新的 Mastra 项目,并在 Chrome 中对 Mastra Studio 进行冒烟测试。
/smoke-test --directory <路径> --name <项目名称> --tag <版本> [--pm <包管理器>] [--llm <提供商>]
/smoke-test -d <路径> -n <项目名称> -t <版本> [-p <包管理器>] [-l <提供商>]
| 参数 | 简写 | 描述 | 必需 | 默认值 |
|---|---|---|---|---|
--directory | -d | 创建项目的父目录 | 是 | - |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
--name-n |
| 项目名称(将作为子目录创建) |
| 是 |
| - |
--tag | -t | create-mastra 的版本标签(例如:latest、alpha、0.10.6) | 是 | - |
--pm | -p | 包管理器:npm、yarn、pnpm 或 bun | 否 | npm |
--llm | -l | LLM 提供商:openai、anthropic、groq、google、cerebras、mistral | 否 | openai |
# 最小化(仅必需参数)
/smoke-test -d ~/projects -n my-test-app -t latest
# 完整指定
/smoke-test --directory ~/projects --name my-test-app --tag alpha --pm pnpm --llm anthropic
# 使用短标志
/smoke-test -d ./projects -n smoke-test-app -t 0.10.6 -p bun -l openai
关键:在继续之前,解析 ARGUMENTS 并进行验证:
--directory 或 -d:必需 - 如果缺失则失败--name 或 -n:必需 - 如果缺失则失败--tag 或 -t:必需 - 如果缺失则失败--pm 或 -p:如果未提供,默认为 npm--llm 或 -l:如果未提供,默认为 openaipm 必须是以下之一:npm、yarn、pnpm、bunllm 必须是以下之一:openai、anthropic、groq、google、cerebras、mistral如果验证失败:停止并显示使用帮助,指出缺失/无效的参数。
如果传递了 -h 或 --help:显示此使用信息并停止。
此技能需要 Claude-in-Chrome MCP 服务器进行浏览器自动化。请确保其已配置并正在运行。
使用显式参数运行 create-mastra 命令,以避免交互式提示:
# 对于 npm
npx create-mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# 对于 yarn
yarn create mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# 对于 pnpm
pnpm create mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# 对于 bun
bunx create-mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
标志说明:
-c agents,tools,workflows,scorers - 包含所有组件-l <provider> - 设置 LLM 提供商-e - 包含示例代码对所有参数使用显式设置可确保 CLI 以非交互方式运行。
等待安装完成。根据网络速度,可能需要 1-2 分钟。
创建后,验证项目是否包含:
package.jsonsrc/mastra/index.ts.env 文件(可能需要创建)要启用网络模式测试,请添加代理网络配置:
src/mastra/agents/ 中创建 activity-agent.ts:import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';
export const activityAgent = new Agent({
id: 'activity-agent',
name: 'Activity Agent',
instructions: `You are a helpful activity planning assistant that suggests activities based on weather conditions.`,
model: '<provider>/<model>', // 例如:'openai/gpt-4o'
memory: new Memory(),
});
2. 在 src/mastra/agents/ 中创建 planner-network.ts:
import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';
import { weatherAgent } from './weather-agent';
import { activityAgent } from './activity-agent';
export const plannerNetwork = new Agent({
id: 'planner-network',
name: 'Planner Network',
instructions: `You are a coordinator that manages weather and activity agents.`,
model: '<provider>/<model>',
agents: { weatherAgent, activityAgent }, // 这使其成为网络代理
memory: new Memory(), // 网络代理必须要有 memory
});
3. 更新 index.ts 以注册新代理:
import { activityAgent } from './agents/activity-agent';
import { plannerNetwork } from './agents/planner-network';
// 在 Mastra 配置中:
agents: { weatherAgent, activityAgent, plannerNetwork },
注意:网络模式需要 agents 属性(子代理)和 memory(必需)。
根据选择的 LLM 提供商,检查所需的 API 密钥:
| 提供商 | 必需的环境变量 |
|---|---|
| openai | OPENAI_API_KEY |
| anthropic | ANTHROPIC_API_KEY |
| groq | GROQ_API_KEY |
GOOGLE_GENERATIVE_AI_API_KEY | |
| cerebras | CEREBRAS_API_KEY |
| mistral | MISTRAL_API_KEY |
按此顺序检查:
首先检查全局环境:运行 echo $<ENV_VAR_NAME> 查看密钥是否已在全局设置
.env 文件检查项目 .env 文件:如果未在全局设置,检查项目中是否存在 .env 文件并包含该密钥
仅在需要时询问用户:如果密钥在全局或 .env 中都不可用:
.env 文件仅检查与所选提供商匹配的密钥 - 不要检查所有提供商。
导航到项目目录并启动开发服务器:
cd <directory>/<project-name>
<packageManager> run dev
服务器通常在 http://localhost:4111 上启动。等待服务器准备就绪后再继续。
使用 Chrome 浏览器自动化工具测试 Mastra Studio。
tabs_context_mcp 获取浏览器上下文tabs_create_mcp 创建新标签页http://localhost:4111使用 Chrome 自动化工具执行以下冒烟测试:
导航与基本加载
代理页面 (/agents)
--default 的示例代理)代理详情 (/agents/<agentId>/chat)
代理聊天
网络模式 (/agents/planner-network/chat)
工具页面 (/tools)
工具执行 (/tools/weatherTool)
工作流页面 (/workflows)
工作流执行 (/workflows/weatherWorkflow)
设置页面 (/settings)
可观测性页面 (/observability)
评分器页面 (/scorers)
评分器详情(使用直接 URL 导航)
/scorers/completeness-scorer(不要点击 - 使用 URL 导航)其他页面(仅验证加载)
/templates) - 入门模板库/request-context) - JSON 编辑器/processors) - 空状态正常/mcps) - 空状态正常完成所有测试后,提供摘要:
| 步骤 | 操作 |
|---|---|
| 创建项目 | cd <directory> && npx create-mastra@<tag> <name> -c agents,tools,workflows,scorers -l <provider> -e |
| 安装依赖 | 创建过程中自动进行 |
| 设置环境变量 | 首先检查全局环境,然后检查 .env,仅在需要时询问用户 |
| 启动服务器 | cd <directory>/<name> && npm run dev |
| Studio URL | http://localhost:4111 |
服务器无法启动
.env 是否包含必需的 API 密钥<pm> install 重新安装依赖项浏览器无法连接
代理聊天失败
| 功能 | 路由 |
|---|---|
| 代理 | /agents |
| 工作流 | /workflows |
| 工具 | /tools |
| 评分器 | /scorers |
| 可观测性 | /observability |
| MCP 服务器 | /mcps |
| 处理器 | /processors |
| 模板 | /templates |
| 请求上下文 | /request-context |
| 设置 | /settings |
-e 标志包含示例代理,使冒烟测试有意义-c、-l、-e)以确保非交互式执行agents 属性和 memory每周安装量
164
仓库
GitHub 星标
22.2K
首次出现
2026年1月22日
安全审计
安装于
opencode149
gemini-cli147
codex146
github-copilot143
cursor142
claude-code140
Creates a new Mastra project using create-mastra@<tag> and performs smoke testing of the Mastra Studio in Chrome.
/smoke-test --directory <path> --name <project-name> --tag <version> [--pm <package-manager>] [--llm <provider>]
/smoke-test -d <path> -n <project-name> -t <version> [-p <package-manager>] [-l <provider>]
| Parameter | Short | Description | Required | Default |
|---|---|---|---|---|
--directory | -d | Parent directory where project will be created | Yes | - |
--name | -n | Project name (will be created as subdirectory) | Yes | - |
--tag | -t | Version tag for create-mastra (e.g., latest, alpha, 0.10.6) | Yes | - |
--pm | -p | Package manager: npm, yarn, pnpm, or bun | No | npm |
--llm | -l | LLM provider: openai, anthropic, groq, google, cerebras, mistral | No | openai |
# Minimal (required params only)
/smoke-test -d ~/projects -n my-test-app -t latest
# Full specification
/smoke-test --directory ~/projects --name my-test-app --tag alpha --pm pnpm --llm anthropic
# Using short flags
/smoke-test -d ./projects -n smoke-test-app -t 0.10.6 -p bun -l openai
CRITICAL : Before proceeding, parse the ARGUMENTS and validate:
--directory or -d: REQUIRED - fail if missing--name or -n: REQUIRED - fail if missing--tag or -t: REQUIRED - fail if missing--pm or -p: Default to npm if not providedIf validation fails : Stop and show usage help with the missing/invalid parameters.
If-h or --help is passed: Show this usage information and stop.
This skill requires the Claude-in-Chrome MCP server for browser automation. Ensure it's configured and running.
Run the create-mastra command with explicit parameters to avoid interactive prompts:
# For npm
npx create-mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# For yarn
yarn create mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# For pnpm
pnpm create mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
# For bun
bunx create-mastra@<tag> <project-name> -c agents,tools,workflows,scorers -l <llmProvider> -e
Flags explained:
-c agents,tools,workflows,scorers - Include all components-l <provider> - Set the LLM provider-e - Include example codeBeing explicit with all parameters ensures the CLI runs non-interactively.
Wait for the installation to complete. This may take 1-2 minutes depending on network speed.
After creation, verify the project has:
package.json with mastra dependenciessrc/mastra/index.ts exporting a Mastra instance.env file (may need to be created)To enable Network mode testing, add an agent network configuration:
src/mastra/agents/:import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';
export const activityAgent = new Agent({
id: 'activity-agent',
name: 'Activity Agent',
instructions: `You are a helpful activity planning assistant that suggests activities based on weather conditions.`,
model: '<provider>/<model>', // e.g., 'openai/gpt-4o'
memory: new Memory(),
});
2. Create planner-network.ts in src/mastra/agents/:
import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';
import { weatherAgent } from './weather-agent';
import { activityAgent } from './activity-agent';
export const plannerNetwork = new Agent({
id: 'planner-network',
name: 'Planner Network',
instructions: `You are a coordinator that manages weather and activity agents.`,
model: '<provider>/<model>',
agents: { weatherAgent, activityAgent }, // This makes it a network agent
memory: new Memory(), // Memory is REQUIRED for network agents
});
3. Update index.ts to register the new agents:
import { activityAgent } from './agents/activity-agent';
import { plannerNetwork } from './agents/planner-network';
// In Mastra config:
agents: { weatherAgent, activityAgent, plannerNetwork },
Note : Network mode requires agents property (sub-agents) and memory (mandatory).
Based on the selected LLM provider, check for the required API key:
| Provider | Required Environment Variable |
|---|---|
| openai | OPENAI_API_KEY |
| anthropic | ANTHROPIC_API_KEY |
| groq | GROQ_API_KEY |
GOOGLE_GENERATIVE_AI_API_KEY | |
| cerebras | CEREBRAS_API_KEY |
| mistral | MISTRAL_API_KEY |
Check in this order:
Check global environment first : Run echo $<ENV_VAR_NAME> to see if the key is already set globally
.env file neededCheck project.env file: If not set globally, check if .env exists in the project and contains the key
Ask user only if needed : If the key is not available globally or in .env:
.env file with the provided keyOnly check for the ONE key matching the selected provider - don't check for all providers.
Navigate to the project directory and start the dev server:
cd <directory>/<project-name>
<packageManager> run dev
The server typically starts on http://localhost:4111. Wait for the server to be ready before proceeding.
Use the Chrome browser automation tools to test the Mastra Studio.
tabs_context_mcptabs_create_mcphttp://localhost:4111Perform the following smoke tests using the Chrome automation tools:
Navigation & Basic Loading
Agents Page (/agents)
--default)Agent Detail (/agents/<agentId>/chat)
Agent Chat
Network Mode (/agents/planner-network/chat)
Tools Page (/tools)
Tool Execution (/tools/weatherTool)
Workflows Page (/workflows)
Workflow Execution (/workflows/weatherWorkflow)
Settings Page (/settings)
Observability Page (/observability)
Scorers Page (/scorers)
Scorer Detail (use direct URL navigation)
/scorers/completeness-scorer (don't click - use URL navigation)Additional Pages (verify load only)
/templates) - Gallery of starter templates/request-context) - JSON editor/processors) - Empty state OK/mcps) - Empty state OKAfter completing all tests, provide a summary:
| Step | Action |
|---|---|
| Create Project | cd <directory> && npx create-mastra@<tag> <name> -c agents,tools,workflows,scorers -l <provider> -e |
| Install Deps | Automatic during creation |
| Set Env Vars | Check global env first, then .env, ask user only if needed |
| Start Server | cd <directory>/<name> && npm run dev |
| Studio URL | http://localhost:4111 |
Server won't start
.env has required API key<pm> install to reinstall dependenciesBrowser can't connect
Agent chat fails
| Feature | Route |
|---|---|
| Agents | /agents |
| Workflows | /workflows |
| Tools | /tools |
| Scorers | /scorers |
| Observability | /observability |
| MCP Servers | /mcps |
| Processors |
-e flag includes example agents, making smoke testing meaningful-c, -l, -e) to ensure non-interactive executionagents property AND memory in the Agent constructorWeekly Installs
164
Repository
GitHub Stars
22.2K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
opencode149
gemini-cli147
codex146
github-copilot143
cursor142
claude-code140
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
63,800 周安装
directory 必须存在(或将被创建)name 应为有效的目录名(无空格、特殊字符)--llm or -l: Default to openai if not providedpm must be one of: npm, yarn, pnpm, bunllm must be one of: openai, anthropic, groq, google, cerebras, mistraldirectory must exist (or will be created)name should be a valid directory name (no spaces, special chars)/processors |
| Templates | /templates |
| Request Context | /request-context |
| Settings | /settings |