AgentSkillsCN

project-structure

提供全面的项目文件夹结构设计指南与最佳实践。针对多种项目类型(如单体仓库、Web 框架、后端服务、库与扩展)制定标准化目录组织方案,通过一致的文件组织模式,确保架构的可扩展性与可维护性。擅长关注点分离、模块化架构,以及工具链的无缝集成。 适用场景:设计全新项目结构、借助 Turborepo/Nx 等工具组织单体仓库工作空间、规划 NestJS 后端项目结构、整理 React/Next.js 前端应用、设计 Go 服务架构、创建 NPM 包结构、组织 VSCode 扩展项目、梳理 Chrome 扩展代码库、规划目录层级、迁移旧版项目结构,或为团队制定统一的代码组织规范。

SKILL.md
--- frontmatter
name: project-structure
description: |
  Provides comprehensive project folder structure design guidelines and best practices. Defines standard directory organizations for diverse project types including monorepos, web frameworks, backend services, libraries, and extensions. Ensures scalable, maintainable architecture through consistent file organization patterns. Specializes in separation of concerns, modular architecture, and tooling integration.
  Use when: designing new project structures, organizing monorepo workspaces with tools like Turborepo/Nx, structuring NestJS backend projects, organizing React/Next.js frontend applications, designing Go service architectures, creating NPM package structures, organizing VSCode extension projects, structuring Chrome extension codebases, planning directory hierarchies, migrating legacy project structures, or establishing code organization conventions for teams.

Project Structure Guide

Monorepo

code
project-root/
├── src/                         # All services/apps
├── infra/                       # Shared infrastructure
├── docs/                        # Documentation
├── .devcontainer/               # Dev Container configuration
├── .github/                     # Workflows, templates
├── .vscode/                     # VSCode settings
├── .claude/                     # Claude settings
├── .gemini/                     # Gemini settings
├── package.json                 # Root package.json. For releases, version management
├── go.work                      # Go workspace (when using Go)
├── justfile                     # Just task runner
├── .gitignore
├── .prettierrc
├── .prettierignore
└── README.md

NestJS

code
project-root/
├── src/
│   ├── domains/
│   ├── common/
│   ├── config/
│   ├── database/
│   ├── app.module.ts
│   └── main.ts
├── tests/
├── package.json
└── tsconfig.json

React

code
project-root/
├── src/
│   ├── pages/              # Page modules
│   ├── domains/            # Domain-shared code
│   ├── components/         # Common UI components
│   ├── layouts/            # Layout-related
│   ├── libs/               # Feature libraries (auth, api, theme)
│   ├── shared/             # Pure utilities
│   ├── app.tsx
│   └── main.tsx
├── public/
├── package.json
├── vite.config.ts
└── tsconfig.json

Next.js

code
project-root/
├── app/
│   ├── (routes)/           # Pages (route groups)
│   ├── actions/            # Server Actions (internal mutations)
│   └── api/                # API Routes (external integrations only)
├── components/             # Shared components
├── lib/                    # Utilities and clients
├── public/                 # Static assets
├── middleware.ts           # Edge/Node.js middleware
├── next.config.js
├── package.json
└── tsconfig.json

Go

code
project-root/
├── cmd/                    # Execution entry points (main.go)
├── internal/               # Private packages
├── pkg/                    # Public packages
├── configs/                # Configuration files
├── scripts/                # Utility scripts
├── tests/                  # Integration tests
├── docs/                   # Documentation
├── go.mod
└── go.sum

NPM

code
project-root/
├── cli/                        # CLI execution entry point
├── internal/                   # Private packages
├── pkg/                        # Public packages
├── configs/                    # Configuration files
├── scripts/                    # Utility scripts
├── tests/                      # Integration tests
├── docs/                       # Documentation
├── dist/                       # Build artifacts
├── package.json
├── tsconfig.json
└── README.md

IDE Extension

code
project-root/
├── extension/                   # Extension entry point (activate/deactivate)
├── internal/                    # Private packages
├── pkg/                         # Public packages
├── view/                        # WebView (if applicable)
├── configs/                     # Configuration files
├── scripts/                     # Utility scripts
├── tests/                       # Integration tests
├── public/                      # Static resources (icons, etc.)
├── dist/                        # Build artifacts
├── package.json
├── tsconfig.json
└── .vscodeignore

Chrome Extension

code
project-root/
├── background/                  # Service Worker (Background Script)
├── content/                     # Content Scripts
├── popup/                       # Popup (Extension UI)
├── internal/                    # Private packages
├── pkg/                         # Public packages
├── configs/                     # Configuration files
├── scripts/                     # Utility scripts
├── tests/                       # Integration tests
├── public/                      # Static resources
├── dist/                        # Build artifacts
├── package.json
└── tsconfig.json