@@ -5,6 +5,7 @@ This document provides essential context for AI coding agents (Claude, Gemini, G
55## Project Overview
66
77** brylie.music** is a personal music website built with modern web technologies, featuring:
8+
89- Music releases with Creative Commons licensing
910- Blog posts about music and technology
1011- Interactive musical applications (Svelte-based)
@@ -14,22 +15,25 @@ This document provides essential context for AI coding agents (Claude, Gemini, G
1415## Technology Stack
1516
1617### Core Framework
18+
1719- ** Astro 5.x** : Static site generator with content collections
1820 - File-based routing in ` src/pages/ `
1921 - Type-safe content collections in ` src/content/ `
2022 - MDX support for enhanced markdown
2123 - Server-side rendering capabilities
2224
2325### UI & Styling
26+
2427- ** Svelte 5** : Interactive components with runes (modern reactive patterns)
2528 - Use ` $state ` , ` $derived ` , ` $effect ` runes
26- - Components in ` src/components/ ` and ` src/components/ apps/ `
29+ - Components in ` src/components/ ` and ` src/apps/ `
2730- ** Tailwind CSS 4.x** : Utility-first CSS framework
2831 - Modern Vite integration (` @tailwindcss/vite ` )
2932 - Typography plugin for markdown styling
3033 - Custom configuration in ` tailwind.config.js `
3134
3235### Development
36+
3337- ** TypeScript 5.x** : Type-safe development
3438 - Strict mode enabled
3539 - Configuration in ` tsconfig.json `
@@ -41,6 +45,7 @@ This document provides essential context for AI coding agents (Claude, Gemini, G
4145## Coding Conventions
4246
4347### Astro Components
48+
4449``` astro
4550---
4651// TypeScript in frontmatter for SSR logic
@@ -60,6 +65,7 @@ const { prop1, prop2 } = Astro.props;
6065```
6166
6267### Svelte 5 Components
68+
6369``` svelte
6470<script lang="ts">
6571 // Use runes for reactive state
@@ -78,22 +84,24 @@ const { prop1, prop2 } = Astro.props;
7884```
7985
8086### TypeScript
81- - Use explicit types for function parameters and return values
87+
88+ - Use explicit types for function parameters and return values (including ` : void ` )
8289- Prefer ` interface ` over ` type ` for object shapes
8390- Use ` const ` by default, ` let ` when mutation is needed
8491- Avoid ` any ` ; use ` unknown ` if type is truly unknown
8592
8693### Styling with Tailwind
94+
8795- Prefer Tailwind utilities over custom CSS
8896- Use semantic class names when combining multiple utilities
8997- Dark theme optimized: use ` dark: ` variants sparingly
9098- Component-specific styles: use Astro's scoped ` <style> ` tags if needed
9199
92100### File Organization
101+
93102``` text
94103src/
95104├── components/ # Reusable Astro/Svelte components
96- │ ├── apps/ # Interactive musical apps (Svelte)
97105│ └── *.astro # Layout components
98106├── content/ # Content collections (type-safe)
99107│ ├── blog/ # Blog posts (MDX)
@@ -105,12 +113,13 @@ src/
105113│ ├── blog/ # Blog routes
106114│ └── releases/ # Release routes
107115├── styles/ # Global CSS
108- └── utils / # Utility functions (with tests )
116+ └── apps / # Interactive musical apps (Svelte + Logic + Tests )
109117```
110118
111119## Content Collections
112120
113121### Schema Definitions
122+
114123Content collections use Zod schemas in ` src/content.config.ts ` :
115124
116125``` typescript
@@ -131,12 +140,14 @@ const blog = defineCollection({
131140### Testing Strategy
132141
133142#### Unit Tests (Vitest)
143+
134144- Test utility functions in isolation
135145- Place tests adjacent to implementation: ` bpm.ts ` → ` bpm.test.ts `
136146- Use descriptive test names: ` test('converts BPM to whole note duration', ...) `
137147- Run with ` npm run test ` or ` npm run test:ui `
138148
139149#### Example Test Structure
150+
140151``` typescript
141152import { describe , test , expect } from ' vitest' ;
142153import { functionName } from ' ./module' ;
@@ -154,16 +165,18 @@ describe('functionName', () => {
154165
155166## Musical Apps Guidelines
156167
157- Interactive musical applications are built with Svelte and documented in ` src/content/APPS_README .md ` .
168+ Interactive musical applications are built with Svelte and documented in ` src/apps/README .md ` .
158169
159170### App Structure
160- - Component: ` src/components/apps/AppName.svelte ` (interactive UI)
171+
172+ - Component: ` src/apps/AppName.svelte ` (interactive UI)
173+ - Logic: ` src/apps/appName.ts ` (business logic)
174+ - Tests: ` src/apps/appName.test.ts ` (unit tests)
161175- Metadata: ` src/content/apps/app-name.mdx ` (description, documentation)
162- - Utils: ` src/utils/appName.ts ` (business logic, with tests)
163- - Route: ` src/pages/apps/[...slug].astro ` (dynamic routing)
164176
165177### App Best Practices
166- 1 . ** Separation of Concerns** : Business logic in utils, UI in Svelte components
178+
179+ 1 . ** Separation of Concerns** : Business logic in ` .ts ` files, UI in Svelte components, both co-located in ` src/apps/ `
1671802 . ** Type Safety** : TypeScript for all logic functions
1681813 . ** Testing** : Unit tests for all utility functions
1691824 . ** Accessibility** : WCAG 2.1 AA compliance (semantic HTML, ARIA labels)
@@ -172,12 +185,15 @@ Interactive musical applications are built with Svelte and documented in `src/co
172185## Git Workflow
173186
174187### Branch Strategy
188+
175189- ` main ` : Production-ready code
176190- Feature branches: ` feature/description ` or ` fix/description `
177191- Create PR for review before merging
178192
179193### Commit Messages
194+
180195Follow conventional commits:
196+
181197``` text
182198feat(apps): add BPM calculator with millisecond subdivisions
183199fix(blog): correct date formatting in post metadata
@@ -186,6 +202,7 @@ test(utils): add edge cases for bpm calculations
186202```
187203
188204### Code Review Focus Areas
205+
1892061 . ** Type Safety** : Ensure TypeScript types are properly defined
1902072 . ** Performance** : Check for unnecessary re-renders, large bundle sizes
1912083 . ** Accessibility** : Verify semantic HTML and ARIA attributes
@@ -196,22 +213,26 @@ test(utils): add edge cases for bpm calculations
196213## Common Pitfalls to Avoid
197214
198215### Astro
216+
199217- ❌ Don't use React hooks in Astro components (use Svelte or vanilla JS)
200218- ❌ Don't import client components without proper directives
201219- ✅ Use ` client:load ` , ` client:visible ` , etc. for interactive islands
202220
203221### Svelte 5
222+
204223- ❌ Don't use legacy ` $: ` reactive statements (use ` $derived ` instead)
205224- ❌ Don't use ` onMount ` for simple effects (use ` $effect ` instead)
206225- ✅ Embrace runes: ` $state ` , ` $derived ` , ` $effect ` , ` $props `
207226
208- ### TypeScript
227+ ### TypeScript Common Errors
228+
209229- ❌ Don't use ` any ` type
210230- ❌ Don't ignore TypeScript errors (fix them properly)
211231- ✅ Use explicit return types for functions
212232- ✅ Leverage type inference when appropriate
213233
214234### Tailwind
235+
215236- ❌ Don't create duplicate utility classes in custom CSS
216237- ❌ Don't use overly complex class strings (consider component extraction)
217238- ✅ Use Tailwind's built-in responsive and dark mode utilities
@@ -227,6 +248,7 @@ test(utils): add edge cases for bpm calculations
227248## SEO Requirements
228249
229250All pages should include:
251+
230252- Canonical URLs
231253- OpenGraph metadata
232254- Twitter card metadata
0 commit comments