

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# CLAUDE.md23This file provides guidance to Claude Code when working with this repository.45## Project Overview67Neroli's Lab (SleepAPI) is a full-stack Pokémon Sleep application with three packages:89- **backend**: Express API (Bun dev, Node.js production)10- **frontend**: Vue 3 SPA with Vuetify 311- **common**: Shared TypeScript library1213## Essential Commands1415### Development1617```bash18# Start development servers19cd backend && npm run dev # Backend with Bun hot reload20cd frontend && npm run dev # Frontend with Vite2122# Build common library (build first when changing shared types)23cd common && npm run build24cd common && npm run build-watch # Watch mode for development25```2627### Testing & Quality2829```bash30# Run tests31npm run test # All tests in package32npm run test -- testname.test.ts # Specific test file33npx vitest --run -- testname.test.ts # Direct vitest execution3435# Code quality (REQUIRED after changes)36npx eslint . # Lint current directory37npm run type-check # Frontend type checking (in frontend/)38npm run _compile # Backend type checking (in backend/)39```4041## Architecture Quick Reference4243### File Structure4445- **Backend**: `controllers/` → `services/` → `daos/` → database46- **Frontend**: `pages/` (routes) → `components/` → `stores/` (Pinia)47- **Common**: Shared types and utilities4849### Key Patterns5051- Controllers use TSOA decorators (minimal, non-sensitive routes only)52- DAOs extend AbstractDAO with repository pattern53- Vue components follow atomic design54- API clients in `frontend/src/services/` match backend endpoints5556## Required Workflows5758### Code Changes Checklist59601. **Write/update tests** for any functionality changes612. **Run tests** to verify: `npx vitest --run -- testname.test.ts`623. **Lint changed files**: `npx eslint .`634. **Type check**: `npm run type-check` (frontend) or `npm run _compile` (backend)645. **Build common** if shared types changed: `cd common && npm run build`6566### Testing Patterns6768**Vue Component Tests (required structure):**6970```typescript71import type { VueWrapper } from '@vue/test-utils';72import { mount } from '@vue/test-utils';73import { beforeEach, afterEach, describe, expect, it } from 'vitest';74import MyComponent from './my-component.vue';7576describe('MyComponent', () => {77 let wrapper: VueWrapper<InstanceType<typeof MyComponent>>;7879 beforeEach(() => {80 wrapper = mount(MyComponent, {81 props: { someProp: 'value' }82 });83 });8485 afterEach(() => {86 wrapper.unmount();87 });8889 it('renders correctly', () => {90 expect(wrapper.exists()).toBe(true);91 });92});93```9495**Mocking Strategy:**9697- Only mock external dependencies (APIs, HTTP requests, browser features)98- Don't mock utility functions or internal services99- **Use mock factories from `{package}/src/vitest/mocks/`** instead of hard-coded inline mocks100- Avoid `as any` casts - complex interfaces have proper mock factory methods101- Each package has its own mocks directory that extends common mocks102103### Frontend Design Work104105- Use Playwright MCP with screenshots for self-feedback loops106- Follow TDD approach for feature development107- Prefer utility classes from `frontend/src/assets/common.scss` over Vuetify utilities108109## Environment & Setup110111### Environment Files112113- Frontend: `.env` (copy from `.env.example`)114- Backend: `.env` (copy from `.env.example`, set `DATABASE_MIGRATION=UP`)115116### Database117118```bash119docker-compose up -d # Start MySQL120# Migrations run automatically on backend start121```122123### Package Installation124125```bash126npm install # Root (git hooks)127cd backend && bun install # Backend dependencies128cd frontend && npm install # Frontend dependencies129cd common && npm install # Common dependencies130```131132## Commit Guidelines133134Follow conventional commits (enforced by commitlint):135136- `feat:` new features137- `fix:` bug fixes138- `style:` design/UI changes139- `chore:` maintenance140- `refactor:` code restructuring141- `test:` test changes142- `perf:` performance improvements143144**Rules:**145146- Header ≤72 characters147- No sentence case (avoid capitals unless proper nouns)148- No period at end149- No Claude Code references in commit messages150151## Key Technologies152153- **Backend**: Express 5, TypeScript, Knex, MySQL, TSOA154- **Frontend**: Vue 3, Vuetify 3, Pinia, Vite, Chart.js155- **Testing**: Vitest across all packages156- **Runtime**: Bun (dev), Node.js (production)157158## Common Tasks159160### Adding API Endpoint1611621. Controller in `backend/src/controllers/`1632. Service in `backend/src/services/`1643. Types in `common/src/types/`1654. Build common package1665. API client in `frontend/src/services/`167168### Database Changes1691701. Migration in `backend/src/database/migration/migrations/`1712. Update types in `common/src/types/`1723. Update DAOs173174### CSS Styling175176- Use utility classes from `frontend/src/assets/common.scss`177- Common flex classes: `.flex-center`, `.flex-between`, `.flex-column`178- Responsive text classes available179- Prefer utility classes over Vuetify utilities or custom CSS180- **Mobile-first:** default / base styles for narrow layouts, then `min-width` (or shared mixins) for larger breakpoints—see `.cursor/rules/frontend-rules/mobile-first-css-agent.mdc` for guides and `frontend/**/*.scss`181- **Never use inline styles** - always use CSS classes or scoped styles182183## Code Comments Guidelines184185- Only use code comments if vital for explaining the code block186- Avoid unnecessary comments that do not add meaningful context or explanation187188## Best Practices189190- Never use inline styles191- Never use any as a type unless working with generics192193### Typography (repo-wide)194195Whenever you author or edit text anywhere in this repository (guides, docs, READMEs, UI copy, comments, commits when you propose message text, examples in code, configuration strings, etc.):196197- **Never** use curly/smart apostrophes (U+2019) or curly double quotes (U+201C, U+201D). Use ASCII `'` (U+0027) and `"` (U+0022) only.198- **Never** use the Unicode ellipsis character (U+2026). Use three ASCII periods: `...`199- **Minimize** em dash (U+2014) and en dash (U+2013): prefer hyphen-minus (`-`, U+002D), commas, or rephrasing unless a non-hyphen dash is clearly the right editorial choice.200201Strip invisible formatting characters (for example U+2060 word joiner) that may come from pasted content.202203## Pokemon Sleep Game Mechanics204205This section provides a comprehensive understanding of Pokemon Sleep's core mechanics as implemented in this application.206207### Core Gameplay Loop208209Pokemon Sleep is a sleep-tracking game where players:2102111. Track their sleep to gain Sleep Score (max 100 per session)2122. Helper Pokemon gather berries and ingredients throughout the day2133. Feed Snorlax berries to increase its strength2144. Cook meals 3x daily using gathered ingredients2155. Weekly cycle resets every Monday at 04:00 local time216217### Helper Pokemon Mechanics218219#### Helping Frequency220221- Pokemon "help" at regular intervals measured in seconds (see @common/src/types/pokemon/)222- Example: A Pokemon with 2400s frequency helps every 40 minutes223- Frequency is affected by energy level and various bonuses224225#### Energy System (@backend/src/services/simulation-service/team-simulator/member-state/member-state.ts)226227- Energy decreases by 1 every 10 minutes linearly throughout the day228- Energy affects helping frequency:229 - 80+ energy: 45% of base frequency (fastest)230 - 60-79 energy: 52% of base frequency231 - 40-59 energy: 58% of base frequency232 - 1-39 energy: 66% of base frequency233 - 0 energy: 100% of base frequency (slowest)234- Energy recovery occurs during sleep and from skills/meals235236#### Sneaky Snacking237238- When Pokemon reach their carry limit, they automatically deliver berries to Snorlax239- During sneaky snacking: only berries are delivered (no ingredients or skill procs)240- Pokemon continue gathering at the same rate but auto-deliver241242#### Production Types243244- **Berries**: Directly increase Snorlax strength245- **Ingredients**: Used for cooking meals246- Pokemon roll for ingredient finding based on their ingredient percentage (which may be boosted by subskills or nature)247- Base rates vary by species (see @common/src/types/pokemon/)248249### Pokemon Specialties250251Three main types of specialists with different strengths:2522531. **Berry Specialists**: Higher berry output, lower ingredient/skill rates. Always 2 berries per drop baseline, and lower ingredient amounts (1 at level 1)2542. **Ingredient Specialists**: Higher ingredient rates, lower skill rate. Always 1 berry per drop baseline, but higher ingredient amounts (2 at level 1)2553. **Skill Specialists**: Higher skill trigger rates, can store 2 skill triggers before collecting. Lower ingredient rate and always 1 berry per drop and lower ingredient amounts (1 ingredient at level 1)256257The "all" specialist also exists, and is currently only used on Darkrai.258Darkrai259260### Main Skills261262Skills trigger based on skill percentage (varies by Pokemon and specialty):263264- See skills here: (@common/src/types/mainskill/mainskills/)265- Skills include energy recovery, strength boosts, ingredient gathering, crit boosts, etc.266267### Cooking System (@backend/src/services/simulation-service/team-simulator/cooking-state/cooking-state.ts)268269#### Meal Times270271- **Breakfast**: 04:00 - 12:00272- **Lunch**: 12:00 - 18:00273- **Dinner**: 18:00 - 04:00274275#### Cooking Mechanics276277- Base critical hit chance: 10% (weekday), 30% (Sunday)278- Critical hits: 2x strength (weekday), 3x strength (Sunday)279- Pot size determines max ingredients per dish280- Good Camp bonus: +50% pot size, +20% helper speed/capacity281282#### Recipe Types283284- Three categories: Curries, Salads, Desserts285- Snorlax requests one type per week286- Higher level recipes provide more strength287288### Snorlax & Islands289290#### Research Areas2912921. **Greengrass Isle**: Random berry preference weekly2932. **Cyan Beach**: Oran, Pecha, Pamtre berries2943. **Taupe Hollow**: Leppa, Figy, Sitrus berries2954. **Snowdrop Tundra**: Rawst, Persim, Wiki berries2965. **Lapis Lakeside**: Cheri, Mago, Durin berries2976. **Old Gold Power Plant**: Electric/Steel types298299#### Snorlax Strength & Drowsy Power300301- Strength calculation: @frontend/src/services/strength/strength-service.ts302- Favorite berries provide 2x strength303- Drowsy Power = Snorlax Strength × Sleep Score304- Higher Drowsy Power attracts more/rarer Pokemon305306### Pokemon Stats & Progression307308#### Natures (@common/src/types/nature/nature.ts)309310Affect five key attributes:311312- Speed of Help (helping frequency)313- Energy Recovery314- EXP Gains315- Ingredient Finding rate316- Main Skill Chance317318#### Subskills (@common/src/types/subskill/subskills.ts)319320- Unlocked at levels 10, 25, 50, 75, 100321- Include bonuses like Berry Finding S, Helping Speed M, Energy Recovery Bonus322- Cannot be changed after catching323324#### Evolution325326- Stats change upon evolution (see @common/src/types/pokemon/)327- Instanced properties remain (nature, subskills, ingredients)328- Some Pokemon have special requirements (stones, items)329330### Sleep Tracking331332#### Sleep Types3333341. **Dozing**: Light sleep with movement/noise3352. **Snoozing**: REM sleep with snoring3363. **Slumbering**: Deep sleep, minimal movement3374. **Balanced**: Mix of multiple types338339#### Sleep Score340341- Based on sleep duration (90 minutes minimum)342- Max score: 100 points343- Directly converts to Pokemon EXP344- Multiplied with Snorlax Strength for Drowsy Power345346### Items & Bonuses347348#### Good Camp Ticket349350- +50% pot size351- +20% helper speed352- +20% carry capacity353- Extra hungry Pokemon appears354- Lasts 7 days355356#### Incense357358- Recovery Incense: +5% energy recovery for box Pokemon359- Various types affect different aspects of gameplay360361### Instance Properties (@common/src/types/instance/pokemon-instance.ts)362363When catching Pokemon, these properties are rolled:364365- Nature (unchangeable) (@common/src/types/nature/nature.ts)366- Subskills (5 total, unlocked at certain levels) (@common/src/types/subskill/subskills.ts)367- Ingredient sets (which specific ingredients from possibilities)368- Gender369- Shiny status (cosmetic only)370371### Simulation Engine372373The game simulation is implemented in:374375- @backend/src/services/simulation-service/team-simulator/376- Handles energy decay, help timing, skill activations, cooking377- Runs Monte Carlo simulations for accurate predictions378
One 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-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 7 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 46 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 14 days ago | |
| tyrchen/geektime-bootcamp-aiw7/genslides/backend/CLAUDE.md · 230 | CLAUDE.md | testlint-formatstylearch+6 | 100/100 | 9 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.5k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 14 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 14 days ago | |
| microsoft/playwrightCLAUDE.md · 95k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 7 days ago | |
| tphakala/birdnet-goCLAUDE.md · 1.6k | CLAUDE.md | buildtestlint-formatstyle+8 | 100/100 | today | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/nerolis-lab-nerolis-lab-claude)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.