Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
96/100
Scores the file, not the repository.Length
1,159 words
35 headings · 9 code blocksRepository
32
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# Copilot Instructions for Neroli's Lab23## Project Overview45Neroli's Lab (SleepAPI) is a full-stack Pokémon Sleep application with a monorepo structure:67- **backend**: Express API with Bun dev runtime, Node.js production (TypeScript, Knex, MySQL, TSOA)8- **frontend**: Vue 3 SPA with Vuetify 3 (Pinia state, Vite, Chart.js)9- **common**: Shared TypeScript library bundled with Rollup (types, utilities, mocks)10- **docs**: VitePress documentation site11- **guides**: Vitepress player-facing Pokemon Sleep guides1213## Development Workflow1415### Starting Development1617```bash18# Backend (Bun with hot reload)19cd backend && npm run dev2021# Frontend (Vite)22cd frontend && npm run dev2324# Guides (Vitepress)25cd guides && npm run dev2627# Common library watch mode (when changing shared types)28cd common && npm run build-watch29```3031### Required Pre-Push Checklist3233**Always run these before committing:**34351. **Test**: `npm run test` or `npx vitest --run -- filename.test.ts`362. **Lint**: `npx eslint .` in the modified package373. **Type check**:38 - Frontend: `npm run type-check`39 - Backend: `npm run _compile`40 - Guides: `npm run type-check`414. **Build common** if types changed: `cd common && npm run build`4243### Test-Driven Development4445**Always run tests after creating/modifying test files:**4647```bash48npx vitest --run -- filename.test.ts49```5051Use the output to iterate until tests pass. This is non-negotiable for quality assurance.5253## Architecture Patterns5455### Backend Layer Structure5657**Controllers → Services → DAOs → Database**5859- **Controllers** (`backend/src/controllers/`): TSOA-decorated endpoints (minimal, non-sensitive routes only)60- **Services** (`backend/src/services/`): Business logic and orchestration61- **DAOs** (`backend/src/database/dao/`): Data access extending `AbstractDAO` with repository pattern62- **Database**: MySQL with Knex query builder6364Example DAO pattern:6566```typescript67class UserDAO extends AbstractDAO<typeof DBUserSchema, DBUser> {68 get tableName() {69 return 'user';70 }71 protected get schema() {72 return DBUserSchema;73 }74}75```7677### Frontend Component Organization7879**Pages → Components → Stores → Services**8081- **Pages** (`frontend/src/pages/`): Route-level components82- **Components** (`frontend/src/components/`): Reusable UI following atomic design83- **Stores** (`frontend/src/stores/`): Pinia state management84- **Services** (`frontend/src/services/`): API clients matching backend endpoints8586### Shared Code (Common Package)8788All shared types, utilities, and test mocks live in `common/`:8990```typescript91// common/src/types/ - Types used by both backend and frontend92// common/src/utils/ - Shared utility functions93// common/src/vitest/mocks/ - Mock factories for testing94```9596**After changing common types:** Always run `cd common && npm run build` to update consumers.9798## Testing Conventions99100### Vue Component Testing Pattern101102**Required structure for all Vue component tests:**103104```typescript105import type { VueWrapper } from '@vue/test-utils';106import { mount } from '@vue/test-utils';107import { beforeEach, afterEach, describe, expect, it } from 'vitest';108import MyComponent from './my-component.vue';109110describe('MyComponent', () => {111 let wrapper: VueWrapper<InstanceType<typeof MyComponent>>;112113 beforeEach(() => {114 wrapper = mount(MyComponent, {115 props: { someProp: 'value' }116 });117 });118119 afterEach(() => {120 wrapper.unmount();121 });122123 it('renders correctly', () => {124 expect(wrapper.exists()).toBe(true);125 });126});127```128129### Mocking Strategy (Critical)130131**Only mock external dependencies:**132133✅ **DO Mock:**134135- HTTP requests (axios, fetch)136- Browser APIs (IntersectionObserver, matchMedia)137138❌ **DON'T Mock:**139140- Internal utility functions (formatters, calculators, validators)141- Functions from `sleepapi-common` that work in Node.js test environment142- Internal services without external dependencies143144**Use mock factories from `{package}/src/vitest/mocks/` instead of inline hard-coded mocks.**145146Example:147148```typescript149// Good - using mock factory150import { mocks } from '@/vitest';151const pokemon = mocks.pokemonInstanceExt({ level: 50 });152153// Bad - hard-coded inline mock154const pokemon = { level: 50, name: 'Test' } as any;155```156157### Test Setup158159- Frontend tests use `jsdom` environment with Vuetify/Pinia configured in `frontend/src/vitest/setup.ts`160- All packages use Vitest with coverage reporting161- Common mocks are exported from `sleepapi-common` and extended by package-specific mocks162163## Code Style Guidelines164165### CSS/Styling166167**Always use utility classes from `frontend/src/assets/common.scss`:**168169```scss170.flex-center // display: flex; align-items: center; justify-content: center171.flex-between // display: flex; align-items: center; justify-content: space-between172.flex-column // display: flex; flex-direction: column173.flex-wrap // display: flex; flex-wrap: wrap174```175176**Rules:**177178- Never use inline styles179- Prefer utility classes over Vuetify utilities or custom CSS180- Use scoped styles for component-specific CSS181182### TypeScript183184- Never use `any` unless working with generics185- Prefer type inference over explicit types when clear186- Use strict type checking (enabled in all packages)187188### Code Comments189190**Only add comments when necessary:**191192- Explain WHY, not WHAT (code should be self-documenting)193- Document complex business logic or non-obvious decisions194- Remove obvious comments like `// Mock the module` or `// Set variable to X`195196## Environment Setup197198### Database199200```bash201docker-compose up -d # Starts MySQL202# Migrations run automatically when backend starts with DATABASE_MIGRATION=UP203```204205### Environment Files206207Copy `.env.example` to `.env` in both frontend and backend directories. Key variables:208209- Backend: `DATABASE_MIGRATION=UP` for auto-migrations210- Frontend: API endpoint configuration211212### Package Installation213214```bash215npm install # Root (installs git hooks)216cd backend && bun install217cd frontend && npm install218cd common && npm install219```220221## Commit Conventions222223Follow [Conventional Commits](https://www.conventionalcommits.org/) (enforced by commitlint):224225- `feat:` new features226- `fix:` bug fixes227- `style:` design/UI changes228- `chore:` maintenance tasks229- `refactor:` code restructuring230- `test:` test changes231- `perf:` performance improvements232233**Rules:**234235- Header ≤72 characters236- No sentence case (lowercase unless proper nouns)237- No period at end238- No AI tool references in messages239240## Pokémon Sleep Game Mechanics241242This application simulates Pokémon Sleep mechanics. Key concepts:243244### Core Gameplay245246- Players track sleep (max 100 Sleep Score per session)247- Helper Pokémon gather berries/ingredients throughout the day248- Cook meals 3x daily (breakfast 04:00-12:00, lunch 12:00-18:00, dinner 18:00-04:00)249- Feed Snorlax to increase strength250- Weekly cycle resets Monday 04:00251252### Helper Pokémon System253254**Energy & Frequency** (`backend/src/services/simulation-service/team-simulator/member-state/`):255256- Energy decreases 1 per 10 minutes linearly257- Energy affects helping speed (80+ energy = 45% faster, 0 energy = slowest)258- Helping frequency measured in seconds (e.g., 2400s = 40 minutes between helps)259260**Specialties**:261262- Berry Specialist: 2 berries/drop, lower ingredients (1 at level 1)263- Ingredient Specialist: 1 berry/drop, more ingredients (2 at level 1)264- Skill Specialist: Higher skill rate, can store 2 skill triggers265266**Production**: Pokémon collect berries or ingredients. When carry limit reached, they auto-deliver (sneaky snacking).267268### Simulation Engine269270**Location**: `backend/src/services/simulation-service/team-simulator/`271272- Monte Carlo simulations for predictions273- Handles energy decay, help timing, skill activations, cooking274- Pre-generated random numbers for performance (`pre-generated-random.ts`)275276### Natures, Subskills, & Instance Properties277278- **Natures** (`common/src/types/nature/`): Affect 5 stats (speed, energy recovery, exp, ingredient rate, skill chance)279- **Subskills** (`common/src/types/subskill/`): Unlocked at levels 10, 25, 50, 75, 100 (unchangeable after catch)280- **Instance Properties** (`common/src/types/instance/`): Nature, subskills, ingredient sets rolled at catch time281282## Key File References283284- **Types**: `common/src/types/{pokemon,mainskill,subskill,nature,instance}/`285- **Simulation**: `backend/src/services/simulation-service/team-simulator/`286- **API Controllers**: `backend/src/controllers/`287- **Frontend Pages**: `frontend/src/pages/`288- **Shared Mocks**: `common/src/vitest/mocks/`289- **CSS Utilities**: `frontend/src/assets/common.scss`290291## Multi-Workspace Structure292293This VS Code workspace uses a multi-folder setup (`sleepapi.code-workspace`):294295- Root folder for shared configs (ESLint, Prettier, commitlint)296- Individual folders for each package (backend, frontend, common, docs, guides)297- Relative imports configured via TypeScript path aliases (`@src/`, `@/`)298299**Import preference**: Use path aliases, not relative imports (configured in workspace settings).300
Also in nerolis-lab/nerolis-lab
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nerolis-lab/nerolis-labCLAUDE.md · 32 | CLAUDE.md | setupbuildtestlint-format+11 | 88/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| HerringtonDarkholme/megarepo.github/copilot-instructions.md · 17 | Copilot instructions | setupbuildtestlint-format+7 | 100/100 | 3 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 3 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 24 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| keycloak/keycloak.github/copilot-instructions.md · 36k | Copilot instructions | setupbuildtestlint-format+6 | 93/100 | 3 days ago |
