Imported from KolesnikovP/typing_hero (
AGENTS.md). Install upstream withnpx skills add KolesnikovP/typing_hero. Copyright stays with the author.
Agent Guidelines for typing_hero
Scope: entire repository.
-
Environment files
- Do NOT commit secrets. Keep local files untracked:
client/.env,backend/src/typing_hero/.env. - Templates to commit:
client/.env.example,backend/src/typing_hero/.env.example. - Frontend uses
VITE_*vars (e.g.,VITE_API_URL,VITE_GOOGLE_CLIENT_ID). - Backend uses
GOOGLE_CLIENT_ID,FRONTEND_ORIGINS,PORT,DB_PATH.
- Do NOT commit secrets. Keep local files untracked:
-
Frontend conventions
- Use
import.meta.envfor config; preferVITE_API_URLand default to'/api'. - Vite dev server proxies
/apito backend onhttp://localhost:8080. - Don’t introduce global define flags (
__API__,__IS_DEV__), useimport.meta.env.DEV. - UI copy: use English only; do not mix languages in strings.
- Handlers: avoid complex inline callbacks. If an inline handler exceeds ~100 chars (e.g.,
onClick), extract it into a named function (preferably wrapped withuseCallback) and call that instead.
- Use
-
Backend conventions
- SQLite file controlled by
DB_PATH; do not commit.dbfiles or built binaries. - Expose health endpoints:
/healthz,/readyz. - CORS origins controlled by
FRONTEND_ORIGINS(comma-separated).
- SQLite file controlled by
-
Docker & Compose
- Frontend image: build-time
VITE_*args; nginx serves static and proxies/apitobackend. - Backend image: CGO-enabled for SQLite; volume at
/dataforDB_PATH.
- Frontend image: build-time
-
PRs & style
- Keep changes minimal and focused; avoid unrelated refactors.
- Prefer configuration via env over hard-coded values.
- Update README if deployment or env behavior changes.
- When changing UI styles, strive to follow GitHub website style (spacing, colors, typography) using our existing theme variables.
- Avoid inline styles; prefer SCSS modules or existing component styles.
- Variable naming: use clear, descriptive names; avoid single-letter or opaque identifiers (e.g., use
prevfor state updaters,errfor caught errors,normalizedMessageinstead ofs). Reserve one-letter names only for conventional loop indices.
-
Architecture (FSD)
- Organize code by business slice first (features/entities), then by layer.
- Layers and responsibilities:
- app: application init, router, providers, global styles
- processes: cross-page flows (optional)
- pages: route shells that compose widgets/features/entities (no business logic)
- widgets: reusable page sections (no business logic)
- features: user-valuable actions (encapsulate UI + state + logic)
- entities: domain models, state, queries, and simple UI (e.g., User)
- shared: design system, libs, API clients, helpers
- Dependency rule: imports flow top → down only; no upward or lateral imports across layers.
- Public API rule: import from a slice’s
index.tsonly (no deep imports).