Skip to content

Commit a566650

Browse files
committed
Update AI instructions on code organization
1 parent 46f1a7b commit a566650

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎.github/instructions/general.instructions.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ applyTo: "**"
1919
- Always create TypeScript files, not JavaScript files.
2020
- Prefer destructured imports over namespace imports when importing specific functions from modules (e.g., `import { resolve } from 'path'` instead of `import * as path from 'path'`).
2121

22+
# Code Organization and Directory Structure
23+
24+
## src/lib Directory Restrictions
25+
- **The src/lib directory is for server-side build code ONLY**
26+
- NO client-side code can go in src/lib (it gets bundled into server-side builds)
27+
- Client-side utilities should go in src/components/scripts/ or appropriate component directories
28+
29+
## API Code Organization
30+
- **API endpoints** go in `src/pages/api/`
31+
- **Code files related to API endpoints** go in `src/pages/api/` and are prefixed with `_` (e.g., `_utils/`, `_contracts/`)
32+
- **API utility files** go specifically in the `_utils/` folder
33+
- **API contract/type files** go in `_contracts/` folder for centralized type definitions
34+
35+
## Mixed Concern Files
36+
- Files that straddle server-side API and client-side concerns (like API client wrappers) require clarification
37+
- **Ask before placing such files** - they may need special handling or alternative organization
38+
- Example: gdpr.client.ts (API client wrapper) - unclear placement due to mixed server/client concerns
39+
2240
# Astro View Transitions Navigation
2341

2442
Components may have behavior dependent on Astro View Transitions navigation events. Choose the appropriate navigation method:

0 commit comments

Comments
 (0)