Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Thomas G. Lopes
commited on
Commit
·
2a40f3a
1
Parent(s):
7c08d14
agents md
Browse files
AGENTS.md
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Agent Guidelines for inference-playground
|
2 |
+
|
3 |
+
## Build/Test/Lint Commands
|
4 |
+
|
5 |
+
- `npm run dev` - Start development server
|
6 |
+
- `npm run build` - Build for production
|
7 |
+
- `npm run lint` - Run prettier and eslint checks
|
8 |
+
- `npm run format` - Format code with prettier
|
9 |
+
- `npm run check` - Run svelte-check for type checking
|
10 |
+
- `npm run test` or `npm run test:unit` - Run unit tests with vitest
|
11 |
+
- `npm run test:e2e` - Run e2e tests with playwright
|
12 |
+
|
13 |
+
## Code Style Guidelines
|
14 |
+
|
15 |
+
- **Formatting**: Uses tabs (tabWidth: 2), printWidth: 120, trailing commas, avoid arrow parens
|
16 |
+
- **Imports**: Use `.js` extensions for local imports (enforced by custom eslint rule)
|
17 |
+
- **Path aliases**: Use `$lib/` for src/lib imports
|
18 |
+
- **Types**: Strict TypeScript with `noUncheckedIndexedAccess`, no explicit `any` allowed
|
19 |
+
- **Naming**: Use camelCase for variables/functions, PascalCase for components/classes
|
20 |
+
- **Files**: `.svelte` for components, `.svelte.ts` for reactive state files
|
21 |
+
- **Icons**: Import from `~icons/carbon/` or `~icons/lucide/` or other unplugin-icons import
|
22 |
+
- **Error handling**: Use try/catch blocks, display user-friendly error messages via toasts
|
23 |
+
- **State**: Use Svelte 5 runes (`$state`, `$derived`) and reactive patterns
|
24 |
+
- **Unused vars**: Prefix with `_` to ignore eslint warnings
|
25 |
+
- **Object syntax**: Use object shorthand notation when possible
|
26 |
+
|
27 |
+
## Svelte general guidelines
|
28 |
+
|
29 |
+
### 1. **General Code Style**
|
30 |
+
|
31 |
+
- **Use Svelte 5 with runes** for all component state and reactivity.
|
32 |
+
- **Use snake_case** for all variable, function, and file names.
|
33 |
+
- **Do not use snake_case** for type/interface names; use **PascalCase** instead.
|
34 |
+
- **Do not use the `any` type** anywhere in the codebase.
|
35 |
+
- **Do not prefix private class properties with an underscore**.
|
36 |
+
- **Use `const` by default**; use `let` only when reassignment is necessary.
|
37 |
+
- **Prefer explicit over implicit**: always be clear about what your code is doing.
|
38 |
+
|
39 |
+
### 2. **Component Structure**
|
40 |
+
|
41 |
+
- **One component per file**. Name the file after the component, using kebab-case.
|
42 |
+
- **Export only what is necessary** from each file.
|
43 |
+
|
44 |
+
### 3. **Reactivity and State**
|
45 |
+
|
46 |
+
- **Use runes for all reactivity** (`$state`, `$derived`, etc.).
|
47 |
+
- **Avoid using Svelte’s legacy `$:` label**; prefer runes-based reactivity.
|
48 |
+
- **Keep state as local as possible**; lift state up only when needed.
|
49 |
+
- Dont start the dev server.
|
50 |
+
- **Dont use $app/stores**; use $app/state
|
51 |
+
- \*\*Dont use on:click handler; use the native onclick. this counts for all events.
|
52 |
+
- \*\*Dont use :global in the style blocks.
|
53 |
+
|
54 |
+
### 4. **TypeScript Practices**
|
55 |
+
|
56 |
+
- **Use TypeScript for all code**.
|
57 |
+
- **Never use `any`**. Use `unknown` or proper types/interfaces.
|
58 |
+
- **Type names must be PascalCase** (e.g., `UserProfile`).
|
59 |
+
- **Prefer type inference** where possible, but always type function arguments and return values.
|
60 |
+
|
61 |
+
### 5. **Class and Object Practices**
|
62 |
+
|
63 |
+
- **Do not prefix private properties with an underscore**.
|
64 |
+
- **Favor composition over inheritance**.
|
65 |
+
|
66 |
+
### 6. **File and Folder Organization**
|
67 |
+
|
68 |
+
- **Use kebab-case for all file and folder names**.
|
69 |
+
- **Group related components, stores, and helpers** in folders.
|
70 |
+
- **Keep a flat structure unless complexity demands nesting**.
|
71 |
+
|
72 |
+
### 7. **Comments and Documentation**
|
73 |
+
|
74 |
+
- **Write clear, concise comments** for complex logic.
|
75 |
+
- **Use JSDoc for function and class documentation**.
|
76 |
+
- **Remove commented-out code** before merging.
|
77 |
+
|
78 |
+
### 8. **Testing and Linting**
|
79 |
+
|
80 |
+
- **Write tests for all logic-heavy code** (use your preferred testing framework).
|
81 |
+
- **Use a linter and formatter** (e.g., ESLint, Prettier) with rules enforcing the above conventions.
|
82 |
+
|
83 |
+
### 9. **Other Good Practices**
|
84 |
+
|
85 |
+
- **Avoid magic numbers and strings**; use constants.
|
86 |
+
- **Handle errors gracefully**; never swallow errors silently.
|
87 |
+
- **Keep dependencies up to date** and avoid unnecessary packages.
|
88 |
+
|
89 |
+
- https://svelte.dev/docs/svelte/llms.txt
|
90 |
+
- https://svelte.dev/docs/kit/llms.txt
|
91 |
+
|