Project Structure Guide
Language: English | 繁體中文
Version: 1.0.0
Last Updated: 2025-12-30
Applicability: Claude Code Skills
Purpose
This skill provides guidance on structuring projects according to language and framework conventions. It helps create consistent, maintainable directory layouts.
[Physical Binding]
Reality Check
Before confirming the project structure is valid, you MUST:
- Run the validator:
uds check --standard project-structure
- IF exit_code != 0:
- Read the error message (e.g., "Missing required directories").
- Report the violation to the user.
- Suggest specific commands (
mkdir ...) to fix it.
- RETRY validation after fixes are applied.
Trigger
Use this skill when:
- Creating a new project
- Reorganizing existing project structure
- Adding new modules or features
- Setting up build configuration
- Creating .gitignore files
- Deciding where to place a file (code, docs, config, asset)
- Choosing between utils/, helpers/, shared/, lib/, or internal/
- Placing development artifacts (brainstorms, RFCs, POCs, investigations)
Supported Languages
| Language |
Frameworks/Patterns |
| Node.js |
Express, NestJS, Next.js |
| Python |
Django, Flask, FastAPI |
| Java |
Spring Boot, Maven, Gradle |
| .NET |
ASP.NET Core, Console |
| Go |
Standard layout, cmd/pkg |
| Rust |
Binary, Library, Workspace |
| Kotlin |
Gradle, Android, Multiplatform |
| PHP |
Laravel, Symfony, PSR-4 |
| Ruby |
Rails, Gem, Sinatra |
| Swift |
SPM, iOS App, Vapor |
Common Structure Patterns
Standard Directories
project-root/
├── src/ # Source code
├── tests/ # Test files
├── docs/ # Documentation
├── tools/ # Build/deployment scripts
├── examples/ # Usage examples
├── config/ # Configuration files
└── .github/ # GitHub configuration
Build Output (Always gitignore)
dist/ # Distribution output
build/ # Compiled artifacts
out/ # Output directory
bin/ # Binary executables
Language-Specific Guidelines
Node.js
project/
├── src/
│ ├── index.js
│ ├── routes/
│ ├── controllers/
│ ├── services/
│ └── models/
├── tests/
├── package.json
└── .gitignore
Python
project/
├── src/
│ └── package_name/
│ ├── __init__.py
│ └── main.py
├── tests/
├── pyproject.toml
└── .gitignore
Go
project/
├── cmd/
│ └── appname/
│ └── main.go
├── internal/
├── pkg/
├── go.mod
└── .gitignore
Quick Actions
Create Project Structure
When asked to create a project:
- Ask for language/framework
- Generate appropriate directory structure
- Create essential config files
- Generate .gitignore
Review Structure
When reviewing existing structure:
- Check language conventions
- Verify gitignore patterns
- Suggest improvements
- Identify misplaced files
Rules
- Follow language conventions - Each language has established patterns
- Separate concerns - Keep source, tests, docs separate
- Gitignore build outputs - Never commit dist/, build/, out/
- Consistent naming - Use language-appropriate casing
- Config at root - Place config files at project root
- Disambiguate directories - utils/ (stateless, generic), helpers/ (layer-bound), shared/ (cross-module), lib/ (wrapped deps)
- Working docs in docs/working/ - Brainstorms, RFCs, POCs, investigations go in docs/working/ with lifecycle management
- Generated code separated - Place in src/generated/{type}/, never mix with hand-written code
Next Steps Guidance | 下一步引導
After /project-structure completes, the AI assistant should suggest:
專案結構已建立或審查完成。建議下一步 / Project structure created or reviewed. Suggested next steps:
- 執行
/sdd 開始規格驅動開發,將專案結構納入正式規格 ⭐ Recommended / 推薦 — 確保結構決策有規格追蹤 / Ensures structure decisions are tracked in specs
- 執行
/docs 產生專案文件(README、ARCHITECTURE.md 等) — 讓結構決策有文件記錄 / Document structure decisions
- 執行
/ai-friendly-architecture 設定 AI 上下文配置 — 讓 AI 助手更好地理解專案結構 / Help AI assistants understand the project structure
Related Standards
1---2name: project-structure-guide3description: Guide for organizing project directories following language-specific best practices. Use when: creating projects, reorganizing structure, adding modules, setting up builds. Keywords: project, structure, directory, layout, gitignore, scaffold, 專案結構, 目錄.4---56# Project Structure Guide78> **Language**: English | [繁體中文](../../../locales/zh-TW/skills/claude-code/project-structure-guide/SKILL.md)910**Version**: 1.0.011**Last Updated**: 2025-12-3012**Applicability**: Claude Code Skills1314---1516## Purpose1718This skill provides guidance on structuring projects according to language and framework conventions. It helps create consistent, maintainable directory layouts.1920# [Physical Binding]21## Reality Check22Before confirming the project structure is valid, you MUST:231. Run the validator: `uds check --standard project-structure`242. IF exit_code != 0:25 - Read the error message (e.g., "Missing required directories").26 - Report the violation to the user.27 - Suggest specific commands (`mkdir ...`) to fix it.28 - RETRY validation after fixes are applied.2930## Trigger3132Use this skill when:33- Creating a new project34- Reorganizing existing project structure35- Adding new modules or features36- Setting up build configuration37- Creating .gitignore files38- Deciding where to place a file (code, docs, config, asset)39- Choosing between utils/, helpers/, shared/, lib/, or internal/40- Placing development artifacts (brainstorms, RFCs, POCs, investigations)4142## Supported Languages4344| Language | Frameworks/Patterns |45|----------|---------------------|46| Node.js | Express, NestJS, Next.js |47| Python | Django, Flask, FastAPI |48| Java | Spring Boot, Maven, Gradle |49| .NET | ASP.NET Core, Console |50| Go | Standard layout, cmd/pkg |51| Rust | Binary, Library, Workspace |52| Kotlin | Gradle, Android, Multiplatform |53| PHP | Laravel, Symfony, PSR-4 |54| Ruby | Rails, Gem, Sinatra |55| Swift | SPM, iOS App, Vapor |5657## Common Structure Patterns5859### Standard Directories6061```62project-root/63├── src/ # Source code64├── tests/ # Test files65├── docs/ # Documentation66├── tools/ # Build/deployment scripts67├── examples/ # Usage examples68├── config/ # Configuration files69└── .github/ # GitHub configuration70```7172### Build Output (Always gitignore)7374```75dist/ # Distribution output76build/ # Compiled artifacts77out/ # Output directory78bin/ # Binary executables79```8081## Language-Specific Guidelines8283### Node.js8485```86project/87├── src/88│ ├── index.js89│ ├── routes/90│ ├── controllers/91│ ├── services/92│ └── models/93├── tests/94├── package.json95└── .gitignore96```9798### Python99100```101project/102├── src/103│ └── package_name/104│ ├── __init__.py105│ └── main.py106├── tests/107├── pyproject.toml108└── .gitignore109```110111### Go112113```114project/115├── cmd/116│ └── appname/117│ └── main.go118├── internal/119├── pkg/120├── go.mod121└── .gitignore122```123124## Quick Actions125126### Create Project Structure127128When asked to create a project:1291. Ask for language/framework1302. Generate appropriate directory structure1313. Create essential config files1324. Generate .gitignore133134### Review Structure135136When reviewing existing structure:1371. Check language conventions1382. Verify gitignore patterns1393. Suggest improvements1404. Identify misplaced files141142## Rules1431441. **Follow language conventions** - Each language has established patterns1452. **Separate concerns** - Keep source, tests, docs separate1463. **Gitignore build outputs** - Never commit dist/, build/, out/1474. **Consistent naming** - Use language-appropriate casing1485. **Config at root** - Place config files at project root1496. **Disambiguate directories** - utils/ (stateless, generic), helpers/ (layer-bound), shared/ (cross-module), lib/ (wrapped deps)1507. **Working docs in docs/working/** - Brainstorms, RFCs, POCs, investigations go in docs/working/ with lifecycle management1518. **Generated code separated** - Place in src/generated/{type}/, never mix with hand-written code152153## Next Steps Guidance | 下一步引導154155After `/project-structure` completes, the AI assistant should suggest:156157> **專案結構已建立或審查完成。建議下一步 / Project structure created or reviewed. Suggested next steps:**158> - 執行 `/sdd` 開始規格驅動開發,將專案結構納入正式規格 ⭐ **Recommended / 推薦** — 確保結構決策有規格追蹤 / Ensures structure decisions are tracked in specs159> - 執行 `/docs` 產生專案文件(README、ARCHITECTURE.md 等) — 讓結構決策有文件記錄 / Document structure decisions160> - 執行 `/ai-friendly-architecture` 設定 AI 上下文配置 — 讓 AI 助手更好地理解專案結構 / Help AI assistants understand the project structure161162---163164## Related Standards165166- [Core: Project Structure](../../../core/project-structure.md)167- [AI: Project Structure Options](../../../ai/options/project-structure/)