通用 Web 项目构建工具,自动检测项目类型(Vue、React、Ant Design Pro 等),执行依赖安装和生产构建,生成可部署的静态文件并返回预览链接。
/plugin marketplace add SeSiTing/siti-claude-marketplace/plugin install coder-web-plugin@siti-claude-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
templates/mes-dashboard/index.htmltemplates/report-app/README.mdtemplates/report-app/api_doc/工单列表_BLACKLAKE-1686655055663532.jsontemplates/report-app/api_doc/批量报工_BLACKLAKE-1681109889053798.jsontemplates/report-app/api_doc/批量报工_简化版.jsontemplates/report-app/api_doc/报工物料列表_BLACKLAKE-1681369551143844.jsontemplates/report-app/api_doc/报工记录列表_BLACKLAKE-1681109889053794.jsontemplates/report-app/api_doc/接口说明.txttemplates/report-app/api_doc/生产任务列表_BLACKLAKE-1681109889053785.jsontemplates/report-app/config.jsontemplates/report-app/css/custom.csstemplates/report-app/index.htmltemplates/report-app/js/common.jstemplates/report-app/js/main.jstemplates/report-app/services/business.jstemplates/report-app/services/core.jstemplates/report-h5/index.html自动执行 Web 项目的完整构建流程:
本 skill 目录下的 templates/ 包含纯 HTML/CSS/JS 参考模板,供 frontend-html agent 使用:
| 模板 | 类型 | 特点 |
|---|---|---|
templates/mes-dashboard/ | 单文件 | 科技感大屏看板、深色主题、动画效果 |
templates/report-h5/ | 单文件 | 移动端响应式、简洁表单 |
templates/report-app/ | 多文件 | Tailwind CSS、模块化 JS、完整 API 调用 |
使用方式:可用 Read 工具读取上述模板文件,参考其风格和结构。
ls -la package.json
如果不存在,提示用户:
❌ 未找到 package.json 文件
请先创建 Web 项目或使用相应的 Agent 创建项目
通过分析 package.json 中的依赖自动检测项目类型:
| 项目类型 | 检测依赖 | 构建工具 | 输出目录 |
|---|---|---|---|
| Vue 3 + Vite | vue + vite | Vite | dist/ |
| React + Vite | react + vite | Vite | dist/ |
| Ant Design Pro | @umijs/max 或 umi | UmiJS | dist/ |
| Create React App | react-scripts | Webpack | build/ |
| Next.js | next | Next.js | .next/ 或 out/ |
# 检查 node_modules 是否存在
if [ ! -d "node_modules" ]; then
echo "📦 安装项目依赖..."
npm install
else
echo "✓ 依赖已存在,跳过安装"
fi
说明:
node_modules/ 目录npm run build
说明:
# 检查输出目录是否存在
if [ -d "dist" ]; then
echo "✓ dist/ 目录已生成"
elif [ -d "build" ]; then
echo "✓ build/ 目录已生成"
else
echo "❌ 构建产物目录未找到"
fi
构建成功后,生成可访问的预览链接。
链接格式:
{WEB_BASE_URL}/ai-coder/code/{project_type}/o_{org_id}/w_{coder_id}/{output_dir}/
示例:
http://localhost:8080/ai-coder/code/web_ant/o_20251114/w_102/dist/
http://localhost:8080/ai-coder/code/web/o_20251114/w_102/dist/
路径提取:
/workspace/code/{project_type}/o_{org_id}/w_{coder_id}/http://localhost:8080构建成功后,以 Markdown 格式输出:
✅ Web 应用构建完成!
📦 构建信息:
- 项目类型:Ant Design Pro (UmiJS)
- 构建工具:UmiJS 4.x
- 输出目录:dist/
- 入口文件:index.html
🌐 预览地址:
[点击访问应用](http://localhost:8080/ai-coder/code/web_ant/o_20251114/w_102/dist/)
💡 使用提示:
- 点击上方链接即可在浏览器中预览应用
- 应用已部署到工作区,可随时访问
- 如需修改,请重新编辑代码并再次构建
❌ 构建失败:未找到 package.json
请先创建 Web 项目:
1. 使用 frontend-vue Agent 创建 Vue 项目
2. 使用 frontend-ant Agent 创建 Ant Design Pro 项目
3. 或手动创建 package.json 配置文件
❌ 依赖安装失败
可能原因:
- 网络连接问题
- npm 配置错误
- package.json 配置错误
建议操作:
1. 检查网络连接
2. 检查 package.json 中的依赖版本
3. 尝试使用国内镜像源:npm config set registry https://registry.npmmirror.com
4. 尝试清理缓存:npm cache clean --force
❌ 构建失败
可能原因:
- 代码存在语法错误
- 依赖缺失或版本不兼容
- 构建工具配置错误
建议操作:
1. 仔细检查错误信息中的具体错误
2. 修复代码中的语法错误
3. 确保所有依赖已正确安装
4. 检查构建工具配置文件(vite.config.js、config/config.ts 等)
环境要求:
路径配置:
vite.config.js 中 base 设置为 './'(相对路径)config/config.ts 中 publicPath 设置为 './'构建时间:
预览链接:
WEB_BASE_URL 决定http://localhost:8080.env 文件中修改路径映射:
/ai-coder/code/{path}/workspace/code/{path}/ai-coder/code/{path:path} → 映射到 /workspace/code/{path}This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.