- Added .cursor/sessions/* to .gitignore to prevent session files from being tracked. - Enhanced coding standards in SKILL.md by adding semicolons to TypeScript examples for consistency. - Improved formatting in continuous learning, detail layout, and other SKILL.md files for better readability. These changes aim to streamline development processes and maintain code quality across the project.
5.3 KiB
5.3 KiB
name, description
| name | description |
|---|---|
| project-guidelines-example | Frontend monorepo guidelines for this pnpm + Turborepo React/Vite/Electron workspace. Use when scaffolding features, reviewing structure, or aligning code with this repo's conventions. |
Project Guidelines
Project skill for this frontend monorepo. Architecture, file layout, patterns, testing, and scripts as they exist in the repo today.
When to Use
Reference this skill when working on this project. It contains:
- Architecture overview
- File structure
- Code patterns
- Testing requirements
- Related skills
Architecture Overview
Stack:
- Apps: React 19 + Vite (
apps/web,apps/showcase,apps/landing) + Electron (apps/desktop) + VitePress (apps/docs-dev) - Packages:
@repo/ui(Mantine),@repo/core-api,@repo/core-storage,@repo/core-i18n,@repo/core-events,@repo/utils,@repo/brand,packages/configs - Testing: Vitest; Testing Library in
packages/uiandpackages/core-events - Package manager: pnpm 8.15.6 + Turbo
Where to work: product in apps/web; copy UI/API usage from apps/showcase; concepts from apps/docs-dev. Do not invent a parallel UI kit.
File Structure
.
├── apps/
│ ├── web/ # Product app
│ ├── showcase/ # Living cookbook for @repo/*
│ ├── docs-dev/ # VitePress
│ ├── desktop/ # Electron wrapper of apps/web
│ └── landing/ # Marketing SPA
├── packages/
│ ├── ui/ # @repo/ui — components, form, foundations
│ ├── core-api/ # HTTP client + remote data services
│ ├── core-storage/
│ ├── core-i18n/
│ ├── core-events/
│ ├── utils/
│ ├── brand/
│ └── configs/
└── package.json # Root scripts
Web module (copy example/full-page)
apps/web/src/apps/main/modules/<group>/<feature>/
data/ # *RemoteDataServices
domain/
constants/ # ModuleConfigEntity
entities/
factories/ # apiClient + service + transformer
transformers/
validators/ # Zod factories
presentation/
factory/ # registerModuleNamespace + EnterpriseModuleProvider + routes
pages/ # index | form | detail
components/
store/ # optional zustand
languages/{en,id}/
Auth lives under src/apps/auth/. Shared-across-modules code lives in src/core/.
Code Patterns
Module config + factory
import { ModuleConfigEntity } from '@repo/ui/foundations';
export const fullPageModuleConfig: ModuleConfigEntity = {
moduleKey: 'EXAMPLE_FULL_PAGE',
translationNamespace: 'EXAMPLE_FULL_PAGE',
apiUrl: '/full-page',
webUrl: '/app/example/full-page',
moduleCategory: 'FULL_PAGE',
moduleType: 'MASTER_DATA',
};
import { EnterpriseModuleProvider } from '@repo/ui/foundations';
import { registerModuleNamespace } from '@repo/core-i18n';
import { apiClient } from '../../../../../../../core/lib/api-client';
registerModuleNamespace(fullPageModuleConfig.translationNamespace, { id, en });
Validators (Zod)
import { z } from 'zod';
import { compose, required, rangeLength } from '@repo/ui/validators';
export const createFullPageSchema = (t: (key: string) => string) =>
z.object({
code: compose(z.string(), required(t('common:fields.code'))),
name: compose(z.string(), required(t('common:fields.name')), rangeLength(3, 50, t('common:fields.name'))),
});
Forms and HTTP
- Form fields:
FieldTextInputand otherField*from@repo/ui/form - HTTP:
apiClientfromsrc/core/lib/api-client(built withcreateHttpClient). Never raw axios. - Env:
ENVfromsrc/core/environment. Files only inapps/web/.env*.
Testing Requirements
pnpm test
pnpm --filter web test
pnpm --filter @repo/ui test
pnpm typecheck:web
pnpm check:all
- Unit tests colocated as
*.test.ts(x) - Component tests with Testing Library in packages that already have it
- App journeys: browser-verify login and FULL_PAGE index / form / detail
- Minimum 80% coverage; TDD (red → green → refactor)
Scripts
pnpm dev:web
pnpm dev:showcase
pnpm dev:docs-dev
pnpm lint
pnpm typecheck:web
pnpm test
pnpm check:all
Env (apps/web)
See apps/web/.env.example. Typical VITE_* keys: VITE_APP_ENV, VITE_API_BASE_URL, telemetry URLs. All VITE_* values are public to the client.
Critical Rules
- No emojis in code, comments, or documentation
- Immutability — never mutate objects or arrays
- TDD — tests before implementation
- 80% coverage minimum
- Many small files — 200–400 lines typical, 800 max
- No console.log in production code
- No raw Mantine/axios — use
@repo/uiandapiClient - Input validation with Zod +
@repo/ui/validators - Copy
example/full-page; do not invent a third layout
Related Skills
.agents/skills/coding-standards/— TypeScript/React practices.agents/skills/form-layout/— form layout.agents/skills/detail-layout/— detail page layout.agents/skills/tdd-workflow/— TDD.agents/skills/security-review/— frontend/Electron security