安装方式
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add zai-org/GLM-skills --skill glmv-prd-to-app Build a complete, production-ready full-stack web application from PRD documents, prototype images, and resource files. Handles the entire pipeline: system design, database schema, seed data, backend API, frontend UI, visual verification against prototypes, and deployment script generation. Use this skill whenever the user: - Provides a PRD (product requirement document) and wants a working app built - Says things like "根据PRD开发", "build from PRD", "implement this product", "把需求文档做成应用", "develop this app from requirements" - Has prototype images + requirements and wants full-stack implementation - Wants to turn product specifications into a running web application - Mentions building an app from wireframes/mockups combined with a requirements doc Trigger this skill even if the user just says "帮我开发" or "build this" with PRD materials present in the working directory.
142
下载量
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add zai-org/GLM-skills --skill glmv-prd-to-app name: glmv-prd-to-app
description: |-
Build a complete, production-ready full-stack web application from PRD documents, prototype images, and resource files. Handles the entire pipeline: system design, database schema, seed data, backend API, frontend UI, visual verification against prototypes, and deployment script generation.
Use this skill whenever the user: - Provides a PRD (product requirement document) and wants a working app built - Says things like "根据PRD开发", "build from PRD", "implement this product",
"把需求文档做成应用", "develop this app from requirements"
- Has prototype images + requirements and wants full-stack implementation - Wants to turn product specifications into a running web application - Mentions building an app from wireframes/mockups combined with a requirements doc
Trigger this skill even if the user just says "帮我开发" or "build this" with PRD materials present in the working directory.语言:使用与用户相同的语言回复。代码注释应保持一致。
根据PRD、原型和资源构建一个完整的、已部署的Web应用程序。
结果必须能够通过单个 bash /workspace/start.sh 命令完全重现。
---
在执行任何操作之前,先了解你正在处理的内容。
/workspace/prd.md ← 产品需求文档
/workspace/prototypes/*.jpg ← UI原型图像(视觉真相)
/workspace/resources/**/* ← 图像、视频、图标及其他资源
如果材料位于不同的位置,请相应调整。完整阅读PRD。
对于每张原型图像:
列出 /workspace/resources/ 中的所有文件,并将每个文件映射到它在原型中出现的位置。
所有资源文件必须在最终应用程序中相关的地方使用。
---
在 /workspace/docs/design.md 生成一份全面的设计文档。
对于每个实体,指定:
示例:
products 表:
id SERIAL PRIMARY KEY
name VARCHAR(200) NOT NULL ← 来自产品卡片标题
price DECIMAL(10,2) NOT NULL ← 来自产品卡片价格标签
image_url TEXT NOT NULL ← 来自产品卡片图像
category_id INTEGER REFERENCES categories(id) ← 来自分类筛选器
...
针对每个页面交互,定义一个API端点:
根据PRD复杂度选择。推荐默认值:
| 层 | 选择 | 使用时机 |
|---|---|---|
| 前端 | React + TypeScript + Vite | SPA默认 |
| 前端 | Next.js | 如需SSR/SEO |
| 样式 | Tailwind CSS | 默认 |
| 后端 | Node.js + Express | 简单API |
| 后端 | Python + FastAPI | 如PRD提及Python |
| 数据库 | SQLite | 简单应用,<10个表 |
| 数据库 | PostgreSQL | 复杂应用,关系多 |
| ORM | Prisma (Node) / SQLAlchemy (Python) | 与后端匹配 |
记录选择及理由。
/workspace/
├── frontend/ ← 或 client/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── hooks/
│ │ ├── services/ ← API客户端
│ │ ├── types/
│ │ └── assets/ ← 从 /workspace/resources 复制
│ └── ...
├── backend/ ← 或 server/
│ ├── src/
│ │ ├── routes/
│ │ ├── models/
│ │ ├── controllers/
│ │ ├── middleware/
│ │ └── seed/
│ └── ...
├── docs/
│ ├── design.md
│ └── README.md
├── start.sh
└── prd.md
---
种子数据至关重要——它使应用在首次启动时看起来真实。
/workspace/resources/ 中的资源文件(图像、视频、图标)映射到种子数据条目。使用相对路径或复制到 public/static 目录。placeholder.com 图像。将种子数据保存为:
放置在 /workspace/backend/src/seed/(或等效目录)。
---
对于设计文档中的每个端点:
---
在这里,视觉保真度最为重要。原型是权威参考。
在构建组件之前,建立:
对于每张原型图像,按顺序:
/workspace/resources/ 复制到前端 assets---
这个阶段是区分良好实现与优秀实现的关键。
对每个页面重复此循环。
使用Playwright捕获运行中的应用:
python ${SKILL_DIR}/scripts/render_page.py \
--url "http://localhost:3000/page-path" \
--output "/workspace/docs/screenshots/page_name.png" \
--width 1280
并排读取两个图像(原型和屏幕截图):
/workspace/prototypes/ 读取原型图像对于发现的每个差异:
每页最多3次迭代。优先处理影响最大的差异。
---
运行API健康检查器以验证所有端点:
python ${SKILL_DIR}/scripts/check_api.py \
--base-url "http://localhost:3000/api" \
--endpoints-file "/workspace/docs/endpoints.json"
或使用curl手动测试每个端点:
curl -s http://localhost:3000/api/products | head -c 200
遍历PRD中定义的每个用户流程:
http://localhost:3000 打开应用处理集成问题:CORS、API URL不匹配、数据格式不匹配等。
---
生成 /workspace/start.sh — 从零开始运行所有功能的单个命令。
脚本必须:
http://localhost:3000 可访问#!/bin/bash
set -e
echo "=== PRD到应用:开始部署 ==="
# 1. 系统依赖
echo "[1/7] 检查系统依赖..."
# 如果缺少则安装Node.js、npm等
# 如果需要则安装数据库
# 2. 后端设置
echo "[2/7] 设置后端..."
cd /workspace/backend
npm install # 或 pip install -r requirements.txt
# 3. 数据库初始化
echo "[3/7] 初始化数据库..."
# 删除现有数据库/重置
# 运行迁移
# 加载种子数据
# 4. 前端设置
echo "[4/7] 设置前端..."
cd /workspace/frontend
npm install
# 5. 复制资源
echo "[5/7] 复制资源文件..."
# cp -r /workspace/resources/* /workspace/frontend/public/assets/
# 6. 启动后端
echo "[6/7] 启动后端服务器..."
cd /workspace/backend
npm run dev & # 或等效命令
BACKEND_PID=$!
# 7. 启动前端
echo "[7/7] 启动前端..."
cd /workspace/frontend
PORT=3000 npm run dev &
FRONTEND_PID=$!
echo ""
echo "=== 应用程序运行在 http://localhost:3000 ==="
echo "后端PID: $BACKEND_PID"
echo "前端PID: $FRONTEND_PID"
echo "停止命令: kill $BACKEND_PID $FRONTEND_PID"
wait
生成start.sh后:
chmod +x /workspace/start.shbash /workspace/start.shhttp://localhost:3000 响应---
/workspace/docs/design.md)已在阶段1创建 — 根据实现过程中的任何更改进行更新:
/workspace/README.md)# [项目名称]
## 概述
[来自PRD产品概述]
## 技术栈
- 前端:...
- 后端:...
- 数据库:...
## 快速开始
\`\`\`bash
bash start.sh
\`\`\`
然后访问 http://localhost:3000
## 项目结构
[目录树]
## 数据库
[模式概述,如何重新播种]
## API参考
[关键端点]
---
在声明完成之前,验证每一项:
bash /workspace/start.sh 在干净状态下工作http://localhost:3000 访问---
/workspace/resources/ 中存在匹配的文件,则使用该文件。不要使用占位符URL替代。start.sh 必须从绝对零开始工作。如果需要Node 18+,它会安装Node 18+。如果需要PostgreSQL,它会设置PostgreSQL。