-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Introduce claude code and setting files (#3143) #3144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e637b14
feat: Introduce claude code (#3143)
KATO-Hiro 2ae0827
docs: Remove old instructions for copilot (#3143)
KATO-Hiro 82171f1
docs: Remove old instructions for copilot (#3143)
KATO-Hiro 9b0dc1a
docs: Simplify CLAUDE.md and restructure settings (#3143)
KATO-Hiro e210c96
chore: Fix typo (#3143)
KATO-Hiro 75408d6
chore: Add coverage to AGENTS.md (#3143)
KATO-Hiro 998abd8
chore: Fix test path (#3143)
KATO-Hiro 1307217
chore: Add language identifier (#3143)
KATO-Hiro f3fa648
chore: Add language identifier (#3143)
KATO-Hiro a32c57e
chore: Update
KATO-Hiro 4be7c1a
chore: Remove --frozen-lockfile (#3143)
KATO-Hiro 9fc1fc2
chore: Ensure to make dir for claude (#3143)
KATO-Hiro e959c42
docs: Add lessons from review (#3143)
KATO-Hiro 7bb5ee4
chore: Fix typo (#3143)
KATO-Hiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| --- | ||
| description: Authentication rules | ||
| globs: | ||
| - 'src/lib/server/auth.ts' | ||
| - 'src/routes/(auth)/**' | ||
| - 'src/hooks.server.ts' | ||
| --- | ||
|
|
||
| # Authentication | ||
|
|
||
| ## Lucia v2 | ||
|
|
||
| - Session validation in `src/hooks.server.ts` | ||
| - Session data attached to `event.locals.user` | ||
| - User properties: `id`, `name`, `role`, `atcoder_name`, `is_validated` | ||
|
|
||
| ## Protected Routes | ||
|
|
||
| - Validate `event.locals.user` in `+page.server.ts` load functions | ||
| - Redirect unauthenticated users to `/login` | ||
| - Validate `role` for admin-only routes | ||
|
|
||
| ## Form Validation | ||
|
|
||
| - Use Superforms + Zod for auth forms | ||
| - Server-side validation is authoritative | ||
| - Return structured error responses | ||
|
|
||
| ## Key Files | ||
|
|
||
| - `src/lib/server/auth.ts`: Lucia configuration | ||
| - `src/hooks.server.ts`: Global request handler | ||
| - `prisma/schema.prisma`: User, Session, Key models | ||
|
|
||
| ## Security | ||
|
|
||
| - Never expose session secrets in client code | ||
| - Use HTTPS in production | ||
| - Validate all user inputs server-side | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| description: Prisma and database rules | ||
| globs: | ||
| - 'prisma/**' | ||
| - 'src/lib/server/**' | ||
| - 'src/lib/services/**' | ||
| --- | ||
|
|
||
| # Prisma & Database | ||
|
|
||
| ## Schema Changes | ||
|
|
||
| 1. Edit `prisma/schema.prisma` | ||
| 2. Run `pnpm exec prisma migrate dev --name <description>` to create migration | ||
| 3. Run `pnpm exec prisma generate` to update client (auto-runs after migrate) | ||
|
|
||
| ## Naming | ||
|
|
||
| - Model names: `PascalCase` (e.g., `User`, `TaskAnswer`) | ||
| - Field names: `camelCase` (preferred) or `snake_case` (legacy) | ||
| - Relation fields: Descriptive names matching the relation | ||
|
|
||
| ## Key Models | ||
|
|
||
| - `User`: User accounts with AtCoder validation status | ||
| - `Task`: Tasks with difficulty grades (Q11-D6) | ||
| - `TaskAnswer`: User submission status per task | ||
| - `WorkBook`: task collections | ||
| - `Tag` / `TaskTag`: task categorization | ||
|
|
||
| ## Server-Only Code | ||
|
|
||
| - Import database client only in `src/lib/server/` | ||
| - Use `$lib/server/database` for Prisma client access | ||
| - Never import server code in client components | ||
|
|
||
| ## Transactions | ||
|
|
||
| - Use `prisma.$transaction()` for multi-step operations | ||
| - Handle errors with try-catch and proper rollback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| description: Svelte component development rules | ||
| globs: | ||
| - 'src/**/*.svelte' | ||
| - 'src/lib/components/**' | ||
| - 'src/lib/stores/**/*.svelte.ts' | ||
| --- | ||
|
|
||
| # Svelte Components | ||
|
|
||
| ## Runes Mode (Required) | ||
|
|
||
| - Use `$props()` for component props | ||
| - Use `$state()` for reactive state | ||
| - Use `$derived()` for computed values | ||
| - Use `$effect()` for side effects | ||
|
|
||
| ## Props Pattern | ||
|
|
||
| ```svelte | ||
| <script lang="ts"> | ||
| interface Props { | ||
| title: string; | ||
| count?: number; | ||
| } | ||
|
|
||
| let { title, count = 0 }: Props = $props(); | ||
| </script> | ||
| ``` | ||
|
|
||
| ## Stores | ||
|
|
||
| - Place store files in `src/lib/stores/` with `.svelte.ts` extension | ||
| - Use class-based stores with `$state()` for internal state | ||
| - Export singleton instances | ||
|
|
||
| ## Flowbite Svelte | ||
|
|
||
| - Import components from `flowbite-svelte` | ||
| - Use Tailwind CSS v4 utility classes | ||
| - Dark mode: Use `dark:` prefix for dark mode variants | ||
|
|
||
| ## File Naming | ||
|
|
||
| - Components: `PascalCase.svelte` | ||
| - Stores: `snake_case.svelte.ts` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| description: Testing rules and patterns | ||
| globs: | ||
| - '**/*.test.ts' | ||
| - '**/*.spec.ts' | ||
| - 'tests/**' | ||
| - 'src/test/**' | ||
| --- | ||
|
|
||
| # Testing | ||
|
|
||
| ## Test Types | ||
|
|
||
| | Type | Tool | Location | Run Command | | ||
| | ----------- | ---------- | ----------------------- | ----------------------- | | ||
| | Unit | Vitest | `src/test/**/*.test.ts` | `pnpm test:unit` | | ||
| | Integration | Vitest | `src/test/` | `pnpm test:unit` | | ||
| | E2E | Playwright | `tests/*.test.ts` | `pnpm test:integration` | | ||
|
|
||
| ## Unit Tests | ||
|
|
||
| - Place tests in `src/test/` mirroring `src/lib/` structure | ||
| - Use `@quramy/prisma-fabbrica` for test data factories | ||
| - Mock external APIs with Nock | ||
|
|
||
| ## E2E Tests | ||
|
|
||
| - Place in `tests/` directory | ||
| - Use Playwright test utilities | ||
| - Test user flows, not implementation details | ||
|
|
||
| ## Patterns | ||
|
|
||
| ```typescript | ||
| import { describe, test, expect, vi } from 'vitest'; | ||
|
|
||
| describe('functionName', () => { | ||
| test('expects to do something', () => { | ||
| // Arrange | ||
| // Act | ||
| // Assert | ||
| }); | ||
| }); | ||
| ``` | ||
|
|
||
| ## Coverage | ||
|
|
||
| - Run `pnpm coverage` for coverage report | ||
| - Target: 80% lines, 70% branches | ||
KATO-Hiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## HTTP Mocking | ||
|
|
||
| - Use Nock for mocking external HTTP calls | ||
| - See `src/test/lib/clients/` for examples | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # AtCoder NoviSteps | ||
|
|
||
| A web service for tracking submissions on AtCoder and other competitive programming sites, which are graded by difficulty (Q11-D6). | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| SvelteKit 2 + Svelte 5 (Runes) + TypeScript | PostgreSQL + Prisma | Flowbite Svelte + Tailwind 4 | Vitest + Playwright | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| pnpm dev # Start dev server (localhost:5174) | ||
KATO-Hiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pnpm build # Build for production | ||
| pnpm test # Run all tests | ||
| pnpm test:unit # Vitest unit tests | ||
| pnpm test:integration # Playwright E2E tests | ||
| pnpm coverage # Report test coverage | ||
| pnpm lint # ESLint check | ||
| pnpm format # Prettier format | ||
| pnpm check # Svelte type check | ||
| pnpm exec prisma generate # Generate Prisma client | ||
| pnpm exec prisma migrate dev --name # Create migration (with description) | ||
| pnpm db:seed # Seed database | ||
| ``` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ```md | ||
| src/routes/ # SvelteKit file-based routing | ||
| src/lib/ | ||
| ├── actions/ # SvelteKit actions | ||
| ├── clients/ # External API clients (AtCoder Problems, AOJ) | ||
| ├── components/ # Svelte components | ||
| ├── constants/ | ||
| ├── server/ # Server-only (auth.ts, database.ts) | ||
| ├── services/ # Business logic | ||
| ├── stores/ # Svelte stores (.svelte.ts with Runes) | ||
| ├── types/ # TypeScript types | ||
| ├── utils/ # Pure utility functions | ||
| └── zod/ # Validation schemas | ||
| src/test/ # Unit tests (mirrors src/lib/) | ||
| tests/ # E2E tests (Playwright) | ||
| prisma/schema.prisma # Database schema | ||
| ``` | ||
|
|
||
| ## Key Conventions | ||
|
|
||
| - **Svelte 5 Runes**: Use `$props()`, `$state()`, `$derived()` in all new components | ||
| - **Server data**: `+page.server.ts` → `+page.svelte` via `data` prop | ||
| - **Forms**: Superforms + Zod validation | ||
| - **Tests**: Factories via `@quramy/prisma-fabbrica`, HTTP mocking via Nock | ||
| - **Naming**: `camelCase` variables, `PascalCase` types/components, `snake_case` files/routes, `kebab-case` directories | ||
| - **Pre-commit**: Lefthook runs Prettier + ESLint (bypass: `LEFTHOOK=0 git commit`) | ||
|
|
||
| ## References | ||
|
|
||
| - See `package.json` for versions and scripts | ||
| - See `prisma/schema.prisma` for database models | ||
| - See `docs/guides/` for detailed documentation | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # CLAUDE.md | ||
|
|
||
| @AGENTS.md | ||
|
|
||
| ## Claude Code Specific | ||
|
|
||
| - Path-specific rules are in `.claude/rules/` | ||
| - Run `pnpm format` before committing | ||
| - When uncertain about project conventions, see existing code in `src/lib/` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.