Concerns (6 files): - coding-style.md (163 lines): patterns, anti-patterns, error handling, SOLID - naming.md (105 lines): naming conventions table per language - documentation.md (149 lines): docstrings, WHY vs WHAT, README standards - testing.md (134 lines): AAA pattern, mocking philosophy, TDD - git-workflow.md (118 lines): conventional commits, branch naming, PR format - project-structure.md (82 lines): directory layout, entry points, config placement Languages (4 files): - python.md (224 lines): uv, ruff, pyright, pytest, pydantic, idioms, anti-patterns - typescript.md (150 lines): strict mode, discriminated unions, satisfies, as const - nix.md (129 lines): flake structure, module patterns, alejandra, anti-patterns - shell.md (100 lines): set -euo pipefail, shellcheck, quoting, POSIX Frameworks (1 file): - n8n.md (42 lines): workflow design, node patterns, Error Trigger, security Context budget: 975 lines (concerns + python) < 1500 limit Refs: T6-T16 of rules-system plan
83 lines
1.8 KiB
Markdown
83 lines
1.8 KiB
Markdown
# Project Structure
|
|
|
|
## Python
|
|
|
|
Use src layout for all projects. Place application code in `src/<project>/`, tests in `tests/`.
|
|
|
|
```
|
|
project/
|
|
├── src/myproject/
|
|
│ ├── __init__.py
|
|
│ ├── main.py # Entry point
|
|
│ └── core/
|
|
│ └── module.py
|
|
├── tests/
|
|
│ ├── __init__.py
|
|
│ └── test_module.py
|
|
├── pyproject.toml # Config
|
|
├── README.md
|
|
└── .gitignore
|
|
```
|
|
|
|
**Rules:**
|
|
- One module per directory file
|
|
- `__init__.py` in every package
|
|
- Entry point in `src/myproject/main.py`
|
|
- Config in root: `pyproject.toml`, `requirements.txt`
|
|
|
|
## TypeScript
|
|
|
|
Use `src/` for source, `dist/` for build output.
|
|
|
|
```
|
|
project/
|
|
├── src/
|
|
│ ├── index.ts # Entry point
|
|
│ ├── core/
|
|
│ │ └── module.ts
|
|
│ └── types.ts
|
|
├── tests/
|
|
│ └── module.test.ts
|
|
├── package.json # Config
|
|
├── tsconfig.json
|
|
└── README.md
|
|
```
|
|
|
|
**Rules:**
|
|
- One module per file
|
|
- Index exports from `src/index.ts`
|
|
- Entry point in `src/index.ts`
|
|
- Config in root: `package.json`, `tsconfig.json`
|
|
|
|
## Nix
|
|
|
|
Use `modules/` for NixOS modules, `pkgs/` for packages.
|
|
|
|
```
|
|
nix-config/
|
|
├── modules/
|
|
│ ├── default.nix # Module list
|
|
│ └── my-service.nix
|
|
├── pkgs/
|
|
│ └── my-package/
|
|
│ └── default.nix
|
|
├── flake.nix # Entry point
|
|
├── flake.lock
|
|
└── README.md
|
|
```
|
|
|
|
**Rules:**
|
|
- One module per file in `modules/`
|
|
- One package per directory in `pkgs/`
|
|
- Entry point in `flake.nix`
|
|
- Config in root: `flake.nix`, shell.nix
|
|
|
|
## General
|
|
|
|
- Use hyphen-case for directories
|
|
- Use kebab-case for file names
|
|
- Config files in project root
|
|
- Tests separate from source
|
|
- Docs in root: README.md, CHANGELOG.md
|
|
- Hidden configs: .env, .gitignore
|