SuperAPI AI Directory

shared/tech-stack-detection

Data & analytics

View repository

Updated 10-15 21:36

About this skill

Tech Stack Detection Method

Use Cases

Before technology selection, architecture design, or code generation, you need to first understand the tech stack currently used by the project, in order to:

  • Follow the project's existing technology choices
  • Generate code that conforms to project standards
  • Avoid introducing incompatible technologies

Detection Methods

1. Detect configuration files

Use Read or Glob tools to detect configuration files in the project root directory:

JavaScript/TypeScript Ecosystem

File Description Detection Content
package.json Node.js project configuration dependencies, devDependencies, scripts
tsconfig.json TypeScript configuration Confirm TypeScript is used
next.config.js Next.js configuration Confirm Next.js is used
vite.config.js Vite configuration Confirm Vite is used
nuxt.config.js Nuxt configuration Confirm Nuxt is used

Detection Command:

# 检测是否存在
ls package.json tsconfig.json next.config.js vite.config.js 2>/dev/null

# 读取 package.json
Read(file_path: "package.json")

Key Dependency Identification:

  • react: React project
  • vue: Vue project
  • next: Next.js project
  • @angular/core: Angular project
  • express: Express backend
  • fastify: Fastify backend
  • prisma: Prisma ORM
  • typeorm: TypeORM

Python Ecosystem

File Description Detection Content
requirements.txt pip dependencies Dependency list
pyproject.toml Poetry/PDM configuration Dependencies and project configuration
Pipfile Pipenv configuration Dependencies
setup.py Package configuration Project metadata

Key Dependency Identification:

  • django: Django project
  • flask: Flask project
  • fastapi: FastAPI project
  • sqlalchemy: SQLAlchemy ORM
  • pytest: Uses pytest for testing

Go Ecosystem

File Description Detection Content
go.mod Go module configuration Dependencies and Go version
go.sum Dependency checksums Confirm dependencies are locked

Key Dependency Identification:

  • github.com/gin-gonic/gin: Gin framework
  • github.com/gofiber/fiber: Fiber framework
  • gorm.io/gorm: GORM ORM

Rust Ecosystem

File Description Detection Content
Cargo.toml Cargo configuration Dependencies and project configuration
Cargo.lock Dependency locking Confirm dependency versions

Key Dependency Identification:

  • actix-web: Actix Web framework
  • axum: Axum framework
  • tokio: Async runtime

Java/Kotlin Ecosystem

File Description Detection Content
pom.xml Maven configuration Dependencies and plugins
build.gradle Gradle configuration Dependencies and tasks

Key Dependency Identification:

  • spring-boot-starter: Spring Boot project
  • quarkus: Quarkus project
  • micronaut: Micronaut project

Ruby Ecosystem

File Description Detection Content
Gemfile Bundler configuration Dependencies
Gemfile.lock Dependency locking Confirm dependency versions

Key dependency identification:

  • rails: Ruby on Rails project
  • sinatra: Sinatra project

2. Detect database configuration

File/Directory Description
prisma/schema.prisma Prisma database configuration
drizzle.config.ts Drizzle ORM configuration
ormconfig.json TypeORM configuration
alembic/ Python Alembic migrations
migrations/ Database migration directory

Database type identification:

  • postgresql://: PostgreSQL
  • mysql://: MySQL
  • mongodb://: MongoDB
  • sqlite:: SQLite
  • redis://: Redis

3. Detect deployment configuration

File Description
Dockerfile Docker containerization
docker-compose.yml Docker Compose multi-container
vercel.json Vercel deployment
.github/workflows/ GitHub Actions CI/CD
netlify.toml Netlify deployment
railway.json Railway deployment

4. Detect testing framework

JavaScript/TypeScript

File/Dependency Framework
jest.config.js Jest
vitest.config.js Vitest
playwright.config.js Playwright
cypress.json Cypress

Python

Dependency Framework
pytest pytest
unittest unittest (built-in)

Go

File Framework
*_test.go Go built-in testing

Detection process

Step 1: Detect project type

# 使用 Glob 查找配置文件
Glob(pattern: "{package.json,go.mod,Cargo.toml,pom.xml,requirements.txt,Gemfile}")

Step 2: Read configuration files

# 读取主配置文件
Read(file_path: "package.json")  # 或其他检测到的文件

Step 3: Analyze dependencies

Extract from configuration files:

  • Language and version: e.g. Node.js 18, Python 3.11, Go 1.21
  • Main framework: e.g. Next.js 14, Django 5.0, Gin
  • Database: e.g. PostgreSQL, MongoDB
  • ORM: e.g. Prisma, SQLAlchemy, GORM
  • Testing framework: e.g. Jest, pytest
  • Build tool: e.g. Vite, Webpack, esbuild

Step 4: Output detection results

Output in a structured format:

## 技术栈检测结果

### 语言和运行时
- **语言**: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

Usage examples

Example 1: Detect a Next.js project

# 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

Example 2: Detect a Python project

# 1. 检测配置文件
Glob(pattern: "{requirements.txt,pyproject.toml}")

# 2. 读取配置
Read(file_path: "pyproject.toml")

# 3. 分析依赖
# 发现: fastapi, sqlalchemy, pytest

# 4. 输出结果
技术栈:FastAPI + SQLAlchemy + PostgreSQL + pytest

Notes

  1. Prioritize detecting existing projects: If the project already has configuration files, the existing tech stack must be followed
  2. Only choose a stack for new projects: Only perform technology selection when there are no configuration files
  3. Version compatibility: Pay attention to version compatibility between dependencies
  4. Ecosystem consistency: Do not mix tools from different ecosystems (such as npm + poetry)

Common mistakes

❌ Assuming without detecting: Directly assuming a project uses a certain technology without detecting configuration files ❌ Ignoring versions: Only detecting framework names, not version numbers ❌ Mixing ecosystems: Recommending Python tools in a Node.js project ❌ Duplicate detection: Detecting the same configuration files multiple times in the same task