This file provides context and guidelines for AI assistants (like Claude, ChatGPT, GitHub Copilot, etc.) working on the Terramedic project.
Terramedic is a SvelteKit-powered climate action platform that provides:
- Educational content about climate change and warming stripes
- Connections to volunteer opportunities at climate organizations
- Donation options for effective climate action groups
- Resources for climate advocates and activists
- Daily actions for sustainable living
- Framework: SvelteKit (Svelte 5)
- Styling: Tailwind CSS v4
- Component Library: Flowbite Svelte
- Testing: Vitest (unit tests), Playwright (e2e tests)
- Linting: ESLint, Prettier
- Type Checking: TypeScript
- Package Manager: Yarn
- Hosting: Netlify
terramedic/
├── src/
│ ├── routes/ # SvelteKit pages and routes
│ ├── lib/
│ │ ├── components/ # Reusable Svelte components
│ │ ├── data/ # Data files (transitioning to database)
│ │ └── ...
│ └── ...
├── static/ # Static assets
├── tests/ # Playwright e2e tests
├── e2e/ # Additional e2e tests
└── .storybook/ # Storybook configuration
- Always run
yarn formatbefore committing - Prettier is enforced - Run
yarn lintto check for ESLint issues - Use TypeScript where beneficial, avoid
anytypes - Follow existing patterns in the codebase
- Use Svelte 5 runes (
$state,$derived,$effect, etc.) - Prefer composition over inheritance
- Keep components focused and single-responsibility
- Use
export letfor component props
- Use Tailwind CSS utility classes
- Mobile-first responsive design
- Follow existing color scheme and design patterns
- Ensure accessibility (semantic HTML, ARIA labels, keyboard navigation)
- Unit tests: Vitest with
@testing-library/svelte - E2E tests: Playwright
- Test files:
- Unit:
*.test.tsor*.spec.ts(server/general) - Component:
*.svelte.test.ts(Svelte components) - E2E:
e2e/*.test.ts
- Unit:
- Important: Run
yarn testbefore submitting PRs
-
Test Configuration: The project uses Vitest workspace mode with separate configurations for client (jsdom) and server (node) environments. SvelteKit modules are marked as external dependencies to avoid mocking issues.
-
Database Migration: The project is transitioning from hardcoded organization data to a database. Don't add new hardcoded organization data.
-
Tailwind v4: The project uses Tailwind CSS v4, which has some syntax differences from v3.
yarn dev # Start development server
yarn build # Build for production
yarn preview # Preview production build
yarn test # Run all tests
yarn test:unit # Run unit tests only
yarn test:e2e # Run e2e tests only
yarn lint # Check linting
yarn format # Format code
yarn storybook # Launch Storybook- Create in
src/lib/components/ - Use TypeScript for props when beneficial
- Add Storybook story if it's a reusable component
- Write unit tests for complex logic
- Ensure accessibility
- Create in
src/routes/[route-name]/ - Use
+page.sveltefor the page component - Use
+page.tsor+page.server.tsfor data loading - Add e2e test for critical user flows
- Review the existing codebase before implementing new patterns
- Follow the project's conventions even if you know alternative approaches
- Test thoroughly - run
yarn testandyarn lint - Keep commits focused - one logical change per commit
- Use conventional commits format (see CONTRIBUTING.md)
- Don't introduce new dependencies without discussion
- Don't refactor working code unless specifically requested
- Don't add hardcoded organization data (use database)
- Don't skip writing tests for new features
- Don't ignore ESLint/Prettier errors
- Check existing similar code in the project
- Refer to CONTRIBUTING.md for contribution guidelines
- Ask for clarification rather than making assumptions
- Suggest multiple approaches when appropriate
The project's core educational content centers around "warming stripes" - visualizations showing temperature change over time created by climate scientist Ed Hawkins.
- Code: GPL-3.0
- Non-code content: CC BY 4.0
The project aims to make climate action accessible and actionable for everyone. When contributing, consider:
- Accessibility for all users
- Clear, approachable language
- Mobile-first design
- Performance and efficiency
- Data accuracy and trustworthiness
- Check CONTRIBUTING.md for detailed guidelines
- Review existing issues and PRs for context
- When in doubt, ask for clarification