Objective
Your goal is to take over aalready existingproject, and by scanning the codebase and configuration files,reverse-engineerthe full set of global guidance documents required by this workflow (specs/*.md), so that legacy projects can also enjoy the convenience of AI-assisted development.
Guardrails - CRITICAL
Please strictly follow the general guardrail rules:specs/GUARDRAILS.md Current phase: Requirements & Analysis phase
Applicable scenarios
- The user has imported an existing codebase.
- The user wants to use
feature-workflowin an existing project (feature-level workflow). - The project is missing the
specs/directory.
Workflow
1. Reconnaissance
- Product documentation: Look for related documents that may be included in the project, etc.
- Product background: Read the
README.mdin the root directory (if it exists). - Tech stack: Read dependency management files (such as
package.json,go.mod,requirements.txt,pom.xml,Cargo.toml)。 - Project structure: Scan the root directory and the first-level subdirectories under
src/. - Development standards: Check whether
.eslintrc*,.prettierrc*,tsconfig.jsonand other configuration files exist.
2. Documentation generation (Reverse Engineering)
2.1 Generate 1_产品概述.md
- Source: Based on the content of
README.md. - Strategy:
- Extract the project name, introduction, and core features.
- If
README.mdcontains too little information, generate a template and fill in "To be supplemented", prompting the user to improve it later.
2.2 Generate 2_技术栈.md
- Source: Based on dependency files (
package.json, etc.). - Strategy:
- Frontend: Identify React, Vue, Next.js, Tailwind, etc.
- Backend: Identify Express, NestJS, Gin, Django, Spring Boot, etc.
- Database: Identify driver packages (pg, mysql, mongoose, gorm).
- Tools: Identify TypeScript, Jest, Docker, etc.
2.3 Generate 3_项目结构.md
- Source: The actual file directory tree.
- Strategy:
- List the current main directory structure.
- Add a brief description for each directory (based on common naming conventions, such as
components-> components,utils-> utils).
2.4 Generate 4_开发规范.md
- Source: Configuration files + general best practices.
- Strategy:
- If ESLint/Prettier is found, record it as the project standard.
- If no explicit configuration is found, it is recommended to use the general community standards for that language (such as JavaScript -> Standard, Python -> PEP8).
3. Delivery
- Before generating all documents, present the user with a "Detection Report":
"I scanned your project and detected the following information:
- Type: Next.js + Tailwind
- Core directories: /app, /components, /lib
- Documentation: README.md exists
I will generate for you the full set of guidance documentation under
specs/. Do you want to continue?" - After confirmation, the files will be written to the
specs/directory.
Output file list
specs/1_产品概述.mdspecs/2_技术栈.mdspecs/3_项目结构.mdspecs/4_开发规范.md
Tip: After generation is complete, please suggest that the user manually check 1_产品概述.md, because AI cannot fully infer the project's business vision.