skill/skills/shared/tech-stack-detection/SKILL.md
检测项目技术栈的通用方法,通过分析配置文件识别语言、框架、工具链
npx skillsauth add echovic/boss-skill shared/tech-stack-detectionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
在进行技术选型、架构设计、代码生成前,需要先了解项目当前使用的技术栈,以便:
使用 Read 或 Glob 工具检测项目根目录的配置文件:
| 文件 | 说明 | 检测内容 |
|------|------|----------|
| package.json | Node.js 项目配置 | dependencies, devDependencies, scripts |
| tsconfig.json | TypeScript 配置 | 确认使用 TypeScript |
| next.config.js | Next.js 配置 | 确认使用 Next.js |
| vite.config.js | Vite 配置 | 确认使用 Vite |
| nuxt.config.js | Nuxt 配置 | 确认使用 Nuxt |
检测命令:
# 检测是否存在
ls package.json tsconfig.json next.config.js vite.config.js 2>/dev/null
# 读取 package.json
Read(file_path: "package.json")
关键依赖识别:
react: React 项目vue: Vue 项目next: Next.js 项目@angular/core: Angular 项目express: Express 后端fastify: Fastify 后端prisma: Prisma ORMtypeorm: TypeORM| 文件 | 说明 | 检测内容 |
|------|------|----------|
| requirements.txt | pip 依赖 | 依赖列表 |
| pyproject.toml | Poetry/PDM 配置 | 依赖和项目配置 |
| Pipfile | Pipenv 配置 | 依赖 |
| setup.py | 包配置 | 项目元数据 |
关键依赖识别:
django: Django 项目flask: Flask 项目fastapi: FastAPI 项目sqlalchemy: SQLAlchemy ORMpytest: 使用 pytest 测试| 文件 | 说明 | 检测内容 |
|------|------|----------|
| go.mod | Go 模块配置 | 依赖和 Go 版本 |
| go.sum | 依赖校验和 | 确认依赖锁定 |
关键依赖识别:
github.com/gin-gonic/gin: Gin 框架github.com/gofiber/fiber: Fiber 框架gorm.io/gorm: GORM ORM| 文件 | 说明 | 检测内容 |
|------|------|----------|
| Cargo.toml | Cargo 配置 | 依赖和项目配置 |
| Cargo.lock | 依赖锁定 | 确认依赖版本 |
关键依赖识别:
actix-web: Actix Web 框架axum: Axum 框架tokio: 异步运行时| 文件 | 说明 | 检测内容 |
|------|------|----------|
| pom.xml | Maven 配置 | 依赖和插件 |
| build.gradle | Gradle 配置 | 依赖和任务 |
关键依赖识别:
spring-boot-starter: Spring Boot 项目quarkus: Quarkus 项目micronaut: Micronaut 项目| 文件 | 说明 | 检测内容 |
|------|------|----------|
| Gemfile | Bundler 配置 | 依赖 |
| Gemfile.lock | 依赖锁定 | 确认依赖版本 |
关键依赖识别:
rails: Ruby on Rails 项目sinatra: Sinatra 项目| 文件/目录 | 说明 |
|-----------|------|
| prisma/schema.prisma | Prisma 数据库配置 |
| drizzle.config.ts | Drizzle ORM 配置 |
| ormconfig.json | TypeORM 配置 |
| alembic/ | Python Alembic 迁移 |
| migrations/ | 数据库迁移目录 |
数据库类型识别:
postgresql://: PostgreSQLmysql://: MySQLmongodb://: MongoDBsqlite:: SQLiteredis://: Redis| 文件 | 说明 |
|------|------|
| Dockerfile | Docker 容器化 |
| docker-compose.yml | Docker Compose 多容器 |
| vercel.json | Vercel 部署 |
| .github/workflows/ | GitHub Actions CI/CD |
| netlify.toml | Netlify 部署 |
| railway.json | Railway 部署 |
| 文件/依赖 | 框架 |
|-----------|------|
| jest.config.js | Jest |
| vitest.config.js | Vitest |
| playwright.config.js | Playwright |
| cypress.json | Cypress |
| 依赖 | 框架 |
|------|------|
| pytest | pytest |
| unittest | unittest (内置) |
| 文件 | 框架 |
|------|------|
| *_test.go | Go 内置测试 |
# 使用 Glob 查找配置文件
Glob(pattern: "{package.json,go.mod,Cargo.toml,pom.xml,requirements.txt,Gemfile}")
# 读取主配置文件
Read(file_path: "package.json") # 或其他检测到的文件
从配置文件中提取:
以结构化格式输出:
## 技术栈检测结果
### 语言和运行时
- **语言**:TypeScript
- **运行时**:Node.js 20.x
- **包管理器**:pnpm
### 前端框架
- **框架**:Next.js 14 (App Router)
- **UI 库**:React 18
- **样式**:Tailwind CSS
- **状态管理**:Zustand
### 后端框架
- **框架**:Next.js API Routes
- **ORM**:Prisma
- **数据库**:PostgreSQL
### 测试
- **单元测试**:Vitest
- **E2E 测试**:Playwright
### 部署
- **容器化**:Docker
- **CI/CD**:GitHub Actions
- **托管**:Vercel
# 1. 检测配置文件
Glob(pattern: "package.json")
# 2. 读取 package.json
Read(file_path: "package.json")
# 3. 分析依赖
# 发现: "next": "14.0.0", "react": "18.2.0", "prisma": "5.0.0"
# 4. 输出结果
技术栈:Next.js 14 + React 18 + Prisma + PostgreSQL
# 1. 检测配置文件
Glob(pattern: "{requirements.txt,pyproject.toml}")
# 2. 读取配置
Read(file_path: "pyproject.toml")
# 3. 分析依赖
# 发现: fastapi, sqlalchemy, pytest
# 4. 输出结果
技术栈:FastAPI + SQLAlchemy + PostgreSQL + pytest
❌ 不检测就假设:直接假设项目使用某技术,而不检测配置文件 ❌ 忽略版本:只检测框架名称,不检测版本号 ❌ 混淆生态:在 Node.js 项目中推荐 Python 工具 ❌ 重复检测:在同一个任务中多次检测相同的配置文件
testing
交互规范,定义加载状态、空状态、反馈机制、动效、无障碍等交互细节
content-media
设计变体模式,产出2-3个设计方案及 tradeoff 分析,供用户选择后确定最终方案
content-media
设计系统规范,包含颜色、字体、间距、圆角、阴影、动效等基础设计token
testing
UI组件规范,定义按钮、输入框、卡片等基础组件的变体、尺寸、状态