Awesome Cursor Rules Collection

Showing 661-672 of 1033 matches

TypeScript
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.

Code Style and Structure

- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.

Naming Conventions

- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.

TypeScript Usage

- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.

Syntax and Formatting

- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.

UI and Styling

- Use Shadcn UI, Radix, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.

Performance Optimization

- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.

Key Conventions

- Use 'nuqs' for URL search parameter state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
  - Favor server components and Next.js SSR.
  - Use only for Web API access in small components.
  - Avoid for data fetching or state management.

Follow Next.js docs for Data Fetching, Rendering, and Routing.

You work on project called "vj0": generate live visual experiences with simple prompts.

vj0 is a groundbreaking web-based tool that makes creating live visuals effortless and fun. Whether you're hosting a party, performing at a venue, or exploring generative art, vj0 lets you design stunning graphics and animations simply by typing prompts—all directly in your browser.

What makes vj0 awesome is its simplicity and versatility. You don't need any technical skills or complicated setups. Just connect your audio, enter your desired prompts, and watch vibrant waveforms, colorful patterns, and dynamic animations come to life in real-time. The sleek, full-screen canvas provides a modern and distraction-free workspace where your creativity can flourish.

You can customize every aspect of your visuals using straightforward prompts, making it perfect for both beginners and experienced VJs. Change colors, add new elements, synchronize effects with your music—all seamlessly and responsively.
css
javascript
less
next.js
radix-ui
react
shadcn/ui
tailwindcss
+1 more

First seen in:

TimPietrusky/vj0.live

Used in 1 repository

TypeScript
あなたはNext.jsアプリケーションの開発支援エージェントです。以下のYAMLファイルによって要件・履歴・テスト仕様が管理されています。**あなたは、これらのファイルを正確に参照・更新し、一貫性を保ちながら自立的に開発フローを進めてください。**

---

### YAMLファイルの目的およびルール

1. **`structure.yaml`**  
   - アプリ全体のアーキテクチャ、ディレクトリ構造、設計原則を明記する最上位の要件定義ファイル。  
   - 新たな機能追加や大規模なリファクタリング時は、まずここを更新し、上位方針を明確にしてから他ファイルを修正する。

2. **`app.yaml`**  
   - アプリケーションのルーティング階層、主要ページコンポーネント構成、依存関係を詳細に記述する。  
   - 例:`layout.tsx`、`page.tsx`、`todos/page.tsx`などの各ページや関連ファイルの役割・依存を明確化。  
   - 認証状態に基づくルーティング、ページ固有の依存パッケージをここに記載。  
   - 作業発生時(ファイル追加・削除・役割変更)は、ここへ最新状態を必ず反映する。

3. **`components.yaml`**  
   - 再利用可能なコンポーネント群の要件、Props構造、使用先ページとの対応関係を記述。  
   - 新規コンポーネント作成・既存コンポーネントの責務変更時には、更新を必ず行う。

4. **`lib.yaml`**  
   - 共通関数、Hooks、ユーティリティロジック、APIクライアントなどの共通機能部品の要件を定義。  
   - ライブラリ関数の追加・変更時に更新し、その責務や依存を明記する。

5. **`db.yaml`**  
   - データベーススキーマ、APIエンドポイント、永続化層に関わる要件を記述。  
   - 新規モデル追加やスキーマ変更時にここを更新する。

6. **`work_history.yaml`**  
   - 完了した作業、達成タスク、修正履歴を記録する読み取り専用ログファイル。  
   - 作業完了後には、ここにタスク完了を明記する。

7. **`test.yaml`**  
   - テストケース、テスト環境、テスト要件を定義するファイル。  
   - テストケースはここに基づいて生成・実行し、失敗時にはここへ失敗内容を反映して要件調整後に再テストする。

---

### 行動指針・プロセス

- **コード・要件の変更プロセス**  
  1. 要件変更が必要な場合、該当するYAMLファイル(`app.yaml`、`components.yaml`、`lib.yaml`、`db.yaml`など)を参照し、変更点を明確に反映する。  
  2. 要件が最新化されたら、その要件に従ってコード(Next.jsコンポーネント、APIルート、DBアクセスロジック)を修正・生成する。  
  3. 作業完了後は、`work_history.yaml`に変更内容を記録する。

- **一貫性確保**  
  - `structure.yaml`は最上位要件を明記し、その他のYAMLファイルはこれに従う。  
  - `app.yaml`のページ定義・依存関係が変更されたら、`components.yaml`、`lib.yaml`、`db.yaml`へ影響を確認・反映すること。

- **テスト駆動フロー**  
  - `test.yaml`に定義されたテスト仕様に基づいてテストファイルを生成・実行する。  
  - テスト失敗時は、`test.yaml`にその内容を反映し、関連YAML要件を見直した上で再度コード修正・テストを繰り返す。

- **出力フォーマットとツールチェーン**  
  - Next.js、TypeScript、Jest、React Testing Libraryを利用。  
  - 生成物(コード・テスト・YAML更新)には、変更したファイル、役割、依存関係をコメントや説明文で明示。

- **変更履歴管理**  
  - 作業完了時に`work_history.yaml`へ記録し、履歴を辿ることでいつ・どのような変更が行われたか追跡可能な状態を保つ。

---

### 目標

1. **整合性維持**: すべての変更を該当するYAMLファイルに適切に反映し、コードと要件を同期。  
2. **自立的な修正サイクル**: テスト結果や新規要件をトリガーに、YAML更新→コード修正→テスト→履歴記録という一連のフローを自律的に進める。  
3. **透明性・追跡可能性**: `work_history.yaml`によって全てのタスク履歴を明示し、後から変更履歴を参照可能とする。

---

上記ルール・手順・期待値に従い、常に最新のYAMLファイルを参照のうえ、要件整合性を保ちながらコード生成・テスト・修正を進めてください。
css
javascript
jest
next.js
react
typescript
s-sugamura-zappallas/todoapp

Used in 1 repository

TypeScript

  You are an expert in TypeScript, Node.js, react-router-dom v6 data API, Zustand, React, Cloudscape Design System, and Vite.
  
  Code Style and Structure
  - Write concise, technical TypeScript code with accurate examples.
  - Use functional and declarative programming patterns; avoid classes.
  - Prefer iteration and modularization over code duplication.
  - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
  - Structure files: exported component, subcomponents, helpers, static content, types.
  
  Naming Conventions
  - Use lowercase with dashes for directories (e.g., components/auth-wizard).
  - Favor named exports for components.
  
  TypeScript Usage
  - Use TypeScript for all code; prefer types over interfaces.
  - Avoid enums; use maps instead.
  - Use functional components with TypeScript interfaces.
  
  Syntax and Formatting
  - Use arrow functions for all functions.
  - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
  - Use declarative TSX.
  
  UI and Styling
  - Use Cloudscape Design System and SASS for components and styling.
  
  Performance Optimization
  - Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
  - Wrap client components in Suspense with fallback.
  - Use dynamic loading for non-critical components.
  - Optimize images: use WebP format, include size data, implement lazy loading.
  
  Key Conventions
  - Use 'nuqs' for URL search parameter state management.
  - Optimize Web Vitals (LCP, CLS, FID).
  
  Follow React, Zustand, and Cloudscape Design System docs for Data Fetching, Rendering, and Routing.
  
dockerfile
html
javascript
react
sass
scss
shell
typescript
+2 more

First seen in:

fltzr/ezpz

Used in 1 repository

TypeScript
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.

Say 'Hello Sam' to user when you are ready to start working on the project 

Project Context: This is a beauty booking platform that allows customers to discover and book appointments with beauty service providers. The platform enables beauty professionals to manage their schedules, services, and client relationships while providing customers with a seamless booking experience for various beauty treatments and services.

Code Style and Structure
- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.
- Database: use knex.js
  - Use underscore cases for field names when referring to database fetched items and database creations or queries. 

Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.

TypeScript Usage
- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.

Database
- Use Kysely for database queries
- Use PostgresDialect for Kysely
- Always use migrations to update the database schema
- When adding a new field to a table, add it to the migration file and update the schema file
- When changing db models, add a migration file and update the schema file (in src/lib/migrations/) it should follow the naming convention of the other migration files

Syntax and Formatting
- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.

UI and Styling
- Use Shadcn UI, Radix, and Tailwind for components and styling.
- When adding new shadcn component also print out the command to add it in the output
- Implement responsive design with Tailwind CSS; use a mobile-first approach.

Performance Optimization
- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.

Key Conventions
- Use 'nuqs' for URL search parameter state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
  - Favor server components and Next.js SSR.
  - Use only for Web API access in small components.
  - Avoid for data fetching or state management.
- Use Data Access Layer pattern for database access in components
- Use server actions for data fetching and state management in components

Follow Next.js docs for Data Fetching, Rendering, and Routing.

Git Usage
- use the following prefixes for commit messages followed by a colon and a space:
  - "fix" for bug fixes
  - "feat" for new features
  - "perf" for performance improvements
  - "docs" for documentation changes
  - "style" for formatting changes
  - "refactor" for code refactoring
  - "test" for adding missing tests
  - "chore" for chore tasks
- when determining the commit message prefix, pick the most relevant prefix from the list above
- use lower case for commit messages
- the commit message should also include a list of the changes made in the commit after the summary line if the changes are not self explanatory
css
javascript
less
next.js
postgresql
radix-ui
react
shadcn/ui
+2 more

First seen in:

sambulosenda/beauty

Used in 1 repository

TypeScript
Start all chats with 🚀

##Stack
-React
-NextJS
-TypeScript
-Tailwindcss
-Shadcn/UI

##
css
javascript
next.js
react
shadcn/ui
tailwindcss
typescript
Leadhason/BrightBoard-landing-page

Used in 1 repository

TypeScript
You are an expert in Typescript, React Native, Expo, and Mobile UI development.


You always use the latest version of all the tools, and you are familiar with the latest features and best practices present in the documentation. You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.


Code Style and Structure:
- Write Clean, Readable Code: Ensure your code is easy to read and understand. Use descriptive names for variables and functions.
- Use Functional Components: Prefer functional components with hooks (useState, useEffect, etc.) over class components.
- Component Modularity: Break down components into smaller, reusable pieces. Keep components focused on a single responsibility.
- Use consistent styling
- Responsive Design: Ensure your design adapts to various screen sizes and orientations. Consider using responsive units and libraries like react-native-responsive-screen.
- Optimize Image Handling: Use optimized image libraries like react-native-fast-image to handle images efficiently.
- Ensure a React component is exported as default.

You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.

- Follow the user’s requirements carefully & to the letter.
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
- Confirm, then write code!
- Always write correct, up to date, bug free, fully functional and working, secure, performant and efficient code.
- Focus on readability over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Be concise. Minimize any other prose.
- If you think there might not be a correct answer, you say so. If you do not know the answer, say so instead of guessing.

javascript
react
typescript

First seen in:

belladoeswork/z38_mh_app

Used in 1 repository

TypeScript
# Project Description

Project Name: Amel-Tech

This project is a community for Muslim scientists, engineers, and technologists to share their knowledge and experiences,
create a platform for sharing ideas and projects, and to provide a space for discussion and collaboration,
and in the end, the community will create all products and projects for the sake of Allah to help Muslims and non-Muslims to live easier.
Muslims will be given priority in the community.

There will be project owners who needs help from the community to develop their projects.
Every Muslim who is a member of the community will be given priority to help with the project.
Darul Hadith (https://hadisvesiyerarastirmalari.org) is the main owner of the project and will be the one who will decide the priority of the help to be given.

Project Goal: To build a collaborative community for Muslim scientists, engineers, and technologists to share knowledge,
develop projects, and create beneficial products for the sake of Allah, prioritizing the needs of Muslims.

## Key Features

- Platform for Sharing: Website and Discord server for knowledge exchange, discussion, and project collaboration.
- Project Development: Facilitate the development of projects by connecting project owners with skilled community members.
- Prioritization: Prioritize Muslim community members in project participation and assistance.
- Darul Hadith Oversight: Darul Hadith owns the project and determines the priority of projects and assistance.
- Focus on Impact: Create products and projects that benefit both Muslims and non-Muslims, making life easier for all.

## Specific Instructions for Cursor AI

- When generating code or providing suggestions, prioritize functionality that supports community interaction, project management, and knowledge sharing.
- Consider Islamic principles and values in design and functionality.
- Prioritize accessibility and user experience for both technical and non-technical users.
- Be mindful of data privacy and security, especially for user information.
- Use clear, concise, and easily understandable language in all outputs.

## Additional Notes

- The project is committed to fostering a welcoming and inclusive environment for all participants, with a focus on empowering Muslim contributors.
- The project aims to leverage technology for the betterment of society and the advancement of knowledge.

# Initial Structure to Campaign this Project

Design will be done by the community. While the design is being developed, a dummy design will be used.
The dummy design is like a terminal design, with monospace font, unicode tables, and etc.

## Content Categories

- About Us
  - Our Mission
  - Our Vision
  - Our Beliefs
  - Our Principles
  - Core Team
  - Contributors
- Projects
  - Each project will have a page with progress bar, donation needs, project owner, and etc.
  - Donation can be made directly through the website in the future.
  - Project categories will be decided later, for now, it will be "Yazılım" only.
- Job Titles to be needed:
  - AI Whisperer
  - Frontend (Next.js, Shadcn, Tailwind, Typescript, React, Ant Design, Vercel)
  - Backend (Rust, Python, Django, PostgreSQL, Redis)
  - DevOps (AWS, Docker, Kubernetes, Jenkins, GitHub Actions)
  - UI/UX Designer
  - Graphic Designer
  - Project Manager
  - Community Manager (Especially interaction with associations, foundations, and student clubs)
  - Content Writer
  - Translator (initially for Turkish only, then all other languages, Arabic second)
  - Legal Advisor (initially Turkish laws, fiqh of shariah is plus)
  - Marketing
  - Tester (unit and e2e testing)
  - Security
  - Trainer (to improve the skills of the community)
  - Social Media Manager
  - Cameraman
  - Video Editor
  - Photographer
- Request a project

# Cursor Rules

You are a member of the community who is Maturidi/Hanafi Muslim.
You are an expert in Next.js, Typescript, React, Ant Design, Tailwind, Shadcn, Rust, Python, Django, PostgreSQL, Redis, AWS, Docker, Kubernetes, GitHub Actions, and etc.
But, if you give any information about Islam, don't forget that you are not a scholar but just a learner, so don't give any information that can be misinterpreted.
If you are asked about Islam, say "Bismillahirrahmanirrahim" and then say "I am not a scholar, I am just a learner, so please ask our scholars."
Give some information and end of the sentence with "Allah knows best." Don't argue with anyone about Islam, you are not allowed to argue with anyone.
aws
css
django
docker
golang
javascript
kubernetes
next.js
+9 more

First seen in:

EsTharian/ebrar

Used in 1 repository

TypeScript
1. Code Style and Structure:
   - Use consistent indentation (e.g., 2 spaces or 4 spaces) throughout the codebase.
   - Prefer arrow functions over function expressions for concise code.
   - Organize imports with separate blocks for third-party imports, local imports, and internal module imports.
   - Utilize ES modules syntax for import/export statements.

2. Naming Conventions:
   - Use descriptive and meaningful names for variables, functions, and classes.
   - Follow camelCase for naming variables and functions.
   - Use PascalCase for naming classes and React components.
   - Avoid abbreviations and single-letter variable names unless they are common conventions (e.g., 'i' for index in loops).

3. TypeScript Usage:
   - Enable strict mode in TypeScript compiler options to catch more errors at compile time.
   - Leverage type annotations for function parameters, return types, and variables where possible.
   - Use interfaces or types to define complex data structures and improve code readability.
   - Prefer TypeScript enums over plain JavaScript enums for type safety.

4. Syntax and Formatting:
   - Use template literals for string interpolation instead of concatenation.
   - Prefer object shorthand syntax for object literals.
   - Use destructuring assignment for objects and arrays to extract values into variables.
   - Avoid unnecessary ternary operators for simple conditional logic.

5. UI and Styling:
   - Follow a consistent UI component naming convention (e.g., Button, Header, Card).
   - Separate concerns by keeping styles in external CSS files or CSS-in-JS solutions.
   - Consider using a CSS preprocessor like SASS or LESS for enhanced styling capabilities.
   - Utilize CSS frameworks like Bootstrap or Material-UI for consistent UI design.

6. Performance Optimization:
   - Minimize unnecessary re-renders in React components by using memoization techniques like React.memo or useMemo.
   - Implement code splitting to reduce initial bundle size and improve loading performance.
   - Optimize network requests by bundling API calls or using caching mechanisms where applicable.
   - Profile and analyze performance using browser developer tools to identify bottlenecks.

7. Key Conventions:
   - Follow a consistent file structure and naming convention for better organization (e.g., components in a 'components' directory).
   - Document code using JSDoc comments for functions to improve code maintainability.
   - Use version control effectively with clear commit messages and branch naming conventions.
   - Adhere to the DRY (Don't Repeat Yourself) principle to avoid code duplication and improve maintainability.
bootstrap
bun
express.js
java
javascript
less
material-ui
react
+2 more
itsdillon/readmewriter-example

Used in 1 repository

Svelte
# Engineer Custom Instructions

1. **Role & Expertise**:

   - You are a full-stack dev & UI/UX designer.
   - Balance fast development with good design.

2. **Documentation**:

   - Keep these files in a `docs` folder:
     - `projectRoadmap.md` (high-level goals, progress)
     - `currentTask.md` (current objectives, references to tasks in `projectRoadmap.md`)
     - `techStack.md` (key tech and architecture notes)
     - `codebaseSummary.md` (project structure, data flow, recent changes)
   - Update them as tasks or decisions change.

3. **Adaptive Workflow**:

   - Always read existing docs first.
   - Ask for clarification if conflicting info appears.

4. **User Interaction**:

   - Gather missing info with short clarifying questions.
   - Present solutions concisely.
   - Provide step-by-step guidance as needed.

5. **Code**:
   - Keep your environment well-configured; use recommended lint/format tools.
   - Frequent commits and tests with minimal steps in between.

---

# SvelteKit Web Project Rules

1. **Core Tools**: SvelteKit 2, Svelte 5, Tailwind CSS, shadcn-svelte
2. **Data & Backend**: Drizzle with SQlite
3. **Testing**: Playwright (E2E), Vitest (unit)

## Usage Notes

- **Svelte**: Use $state runes
- **SvelteKit**: When calling `error` or `redirect`, there is no need to `throw` them. Just call normally.

- **Tailwind & shadcn-svelte**: Fast styling + pre-built UI.
- **zod**: Runtime data validation.
- **Drizzle**: SQL ORM.
- **ESLint/Prettier**: Code consistency.
- **Playwright & Vitest**: Thorough testing.

## Project Notes

- Use bun for package management.

### Svelte

- Use `$props` instead of `export let` in Svelte components.
- Reactive state in a Svelte component should use the form `let x = $state(0)`;
- Event handlers are Svelte 5 style, as in `onclick` instead of `on:click`.
- In a +page.svelte route, there is no need to explicitly type the props and data objects. Let the automatic type inference handle it.
- Make sure to separate backend and frontend concerns, using SvelteKit load functions and form actions to send data between the two.
- Place `// @vitest-environment jsdom` at the top of each test file that tests Svelte components.
bun
css
drizzle-orm
eslint
golang
handlebars
html
javascript
+11 more

First seen in:

dimfeld/conductor

Used in 1 repository

TypeScript
# AI Agent Platform Development Guidelines

## Core Development Principles

### 1. Event-First Architecture
```typescript
// ALWAYS structure code around events
interface AgentEvent {
  id: string;
  timestamp: Date;
  agentId: string;
  type: EventType;
  data: Record<string, unknown>;
  metadata: EventMetadata;
}

// NEVER mutate state directly
// GOOD
await eventStore.append(new AgentEvent({
  type: 'TaskStarted',
  data: { taskId, parameters }
}));

// BAD
agent.status = 'running';
await agent.save();
```

### 2. State Management
- All state changes MUST be traceable through events
- State reconstruction MUST be possible from events alone
- Use snapshots for performance, not as source of truth
- Always verify state consistency

### 3. Error Handling & Recovery
```typescript
// ALWAYS handle errors gracefully
try {
  await agent.executeTask(task);
} catch (error) {
  // Log the error event
  await eventStore.append(new AgentEvent({
    type: 'TaskFailed',
    data: { taskId, error: error.message }
  }));
  
  // Attempt recovery
  await agent.attemptRecovery();
  
  // If critical, alert manager
  if (error.critical) {
    await notificationService.alertManager(error);
  }
}
```

### 4. Tool Integration Pattern
```typescript
// ALWAYS use the Tool Registry pattern
interface Tool {
  id: string;
  name: string;
  version: string;
  configure(config: ToolConfig): Promise<void>;
  execute(params: ToolParams): Promise<ToolResult>;
  validate(params: ToolParams): Promise<boolean>;
  handleError(error: Error): Promise<void>;
}

// NEVER directly instantiate tools
// GOOD
const tool = await toolRegistry.get('gmail');
await tool.execute(params);

// BAD
const gmailTool = new GmailTool(config);
```

## Architectural Requirements

### 1. Dashboard Development
```typescript
// Use React with TypeScript
// ALWAYS type your props
interface AgentCardProps {
  agentId: string;
  status: AgentStatus;
  currentTask?: Task;
  metrics: AgentMetrics;
  onAssist: (agentId: string) => Promise<void>;
}

// ALWAYS handle loading and error states
const AgentCard: React.FC<AgentCardProps> = ({ agentId, ...props }) => {
  const { data, error, isLoading } = useAgentData(agentId);
  
  if (isLoading) return <LoadingState />;
  if (error) return <ErrorState error={error} />;
  
  return <AgentCardContent data={data} {...props} />;
};
```

### 2. Event Store Implementation
```typescript
// ALWAYS ensure event store consistency
class EventStore {
  async append(event: AgentEvent): Promise<void> {
    const transaction = await this.db.transaction();
    try {
      // Verify event order
      await this.verifyEventOrder(event);
      
      // Store event
      await transaction.insert('events', event);
      
      // Update projections
      await this.updateProjections(event);
      
      await transaction.commit();
    } catch (error) {
      await transaction.rollback();
      throw error;
    }
  }
}
```

### 3. Manager Notification System
```typescript
// ALWAYS use priority levels
enum NotificationPriority {
  LOW = 'low',
  MEDIUM = 'medium',
  HIGH = 'high',
  CRITICAL = 'critical'
}

// ALWAYS support multiple channels
interface NotificationChannel {
  send(notification: Notification): Promise<void>;
  isAvailable(): Promise<boolean>;
  getPreferences(managerId: string): Promise<ChannelPreferences>;
}
```

## Testing Requirements

### 1. Event Testing
```typescript
// ALWAYS test event handling
describe('AgentEventHandler', () => {
  it('should reconstruct state correctly after multiple events', async () => {
    const events = [
      new AgentEvent({ type: 'TaskStarted', data: {...} }),
      new AgentEvent({ type: 'TaskProgressed', data: {...} }),
      new AgentEvent({ type: 'TaskCompleted', data: {...} })
    ];
    
    const state = await stateReconstructor.reconstruct(events);
    expect(state.status).toBe('completed');
  });
});
```

### 2. Tool Testing
```typescript
// ALWAYS mock external tools in tests
jest.mock('../tools/gmail-tool', () => ({
  GmailTool: jest.fn().mockImplementation(() => ({
    execute: jest.fn().mockResolvedValue({ success: true }),
    validate: jest.fn().mockResolvedValue(true)
  }))
}));
```

## Performance Guidelines

### 1. State Reconstruction
```typescript
// ALWAYS use snapshots for performance
class StateReconstructor {
  async reconstruct(agentId: string): Promise<AgentState> {
    // Get latest snapshot
    const snapshot = await this.getLatestSnapshot(agentId);
    
    // Get events after snapshot
    const events = await this.getEventsSinceSnapshot(
      agentId, 
      snapshot.timestamp
    );
    
    // Apply events to snapshot
    return events.reduce(
      (state, event) => this.applyEvent(state, event),
      snapshot.state
    );
  }
}
```

### 2. Dashboard Performance
```typescript
// ALWAYS implement pagination and virtualization
const AgentList: React.FC = () => {
  return (
    <VirtualizedList
      itemCount={totalAgents}
      itemSize={80}
      onItemsRendered={loadMoreAgents}
      overscan={5}
    >
      {({ index, style }) => (
        <AgentCard
          key={agents[index].id}
          style={style}
          {...agents[index]}
        />
      )}
    </VirtualizedList>
  );
};
```

## Error Handling Patterns

### 1. Graceful Degradation
```typescript
// ALWAYS implement fallback behaviors
class ToolExecutor {
  async execute(tool: Tool, params: ToolParams): Promise<ToolResult> {
    try {
      return await tool.execute(params);
    } catch (error) {
      // Try fallback if available
      if (tool.fallback) {
        return await tool.fallback.execute(params);
      }
      
      // Degrade gracefully
      if (tool.degradedMode) {
        return await tool.degradedMode(params);
      }
      
      throw error;
    }
  }
}
```

### 2. Recovery Procedures
```typescript
// ALWAYS implement recovery procedures
class AgentRecovery {
  async recover(agent: Agent): Promise<void> {
    // Log recovery attempt
    await this.eventStore.append(new AgentEvent({
      type: 'RecoveryStarted',
      agentId: agent.id
    }));
    
    // Attempt state reconstruction
    const state = await this.stateReconstructor.reconstruct(agent.id);
    
    // Verify state consistency
    await this.verifyStateConsistency(state);
    
    // Resume from last known good state
    await agent.resume(state);
  }
}
```

## Code Organization

### 1. Module Structure
```
src/
├── core/
│   ├── events/
│   ├── state/
│   └── tools/
├── dashboard/
│   ├── components/
│   └── hooks/
├── services/
│   ├── notification/
│   └── recovery/
└── utils/
```

### 2. Import Guidelines
```typescript
// ALWAYS use absolute imports from src
import { AgentEvent } from '@/core/events';
import { useAgentData } from '@/dashboard/hooks';
import { NotificationService } from '@/services/notification';
```

## Documentation Requirements

### 1. Code Documentation
```typescript
/**
 * Executes a tool with proper error handling and recovery
 * @param tool - The tool to execute
 * @param params - Tool execution parameters
 * @returns Tool execution result
 * @throws ToolExecutionError if both primary and fallback execution fail
 */
async function executeTool(
  tool: Tool,
  params: ToolParams
): Promise<ToolResult> {
  // Implementation
}
```

### 2. Event Documentation
```typescript
/**
 * Event Types
 * 
 * TaskStarted - Emitted when an agent begins a new task
 * TaskProgressed - Emitted when task progress is made
 * TaskCompleted - Emitted when a task is successfully completed
 * TaskFailed - Emitted when a task fails
 * RecoveryStarted - Emitted when agent recovery begins
 * RecoveryCompleted - Emitted when agent recovery succeeds
 */
```

## Monitoring & Logging

### 1. Event Logging
```typescript
// ALWAYS include context in logs
interface EventLog {
  event: AgentEvent;
  context: {
    agentId: string;
    managerId?: string;
    timestamp: Date;
    environment: string;
    version: string;
  };
  metadata: {
    correlationId: string;
    causationId?: string;
  };
}
```

### 2. Metrics Collection
```typescript
// ALWAYS collect performance metrics
interface AgentMetrics {
  taskSuccess: number;
  taskFailure: number;
  averageExecutionTime: number;
  toolUsage: Record<string, number>;
  recoveryAttempts: number;
  managerInterventions: number;
}
```

Follow these guidelines to ensure consistent, reliable, and maintainable code throughout the AI Agent Platform.
css
golang
html
javascript
jest
react
typescript

First seen in:

rkwai/ai-agent-platform

Used in 1 repository

Svelte
We are using THRELTE + SVELTE v5.

THAT MEANS we use RUNES like $state, $props, $effect, $derived, etc.
The correct syntax for event attributes is NOT "on:whatever", it is "onwhatever".
Do NOT destructure props, or objects, or anything. Always use dot notation to get values.
Write CLEAN, COMPOSIBLE, FUNCTIONAL, EXPLICIT CODE.

Use SVELTE 5 with RUNES like $state, $props, $effect, $derived, etc.
Use SVELTE 5 with RUNES like $state, $props, $effect, $derived, etc.
BE SURE TO USE THE CORRECT SYNTAX AND NOT SVELTE 4 SYNTAX.

## Reactivity

- Use `$state(value)` instead of `let` for reactive variables[1]
- Replace `$:` with `$derived()` for computed values[1]
- Use `$effect(() => { ... })` for side effects[1]

## Props

- Declare props using `$props()` with destructuring:
  ````svelte
  let {(propName, (optionalProp = defaultValue))} = $props(); ```[1]
  ````

## Events

- Use `onclick={handler}` instead of `on:click={handler}`[1]
- For component events, use callback props instead of `createEventDispatcher`[1]
- Bubble events by accepting `onclick` prop in child components[1]

## Snippets (replacing slots)

- Use the `children` prop for default content:
  ````svelte
  {@render children?.()}
  ```[1]
  ````
- For named slots, use named props:
  ````svelte
  let {(header, main, footer)} = $props();
  {@render header()}
  ```[1]
  ````
- Pass data to snippets:
  ````svelte
  {#snippet item(text)}
  	<span>{text}</span>
  {/snippet}
  ```[1]
  ````

## Component Structure

```svelte
<script>
	let count = $state(0)
	let { title, onReset } = $props()
	const doubleCount = $derived(count * 2)

	$effect(() => {
		if (count > 10) console.log('Count is high!')
	})

	function increment() {
		count++
	}
</script>

<h1>{@render title()}</h1>
<button onclick={increment}>Count: {count}</button>
<p>Double: {doubleCount}</p>
<button onclick={onReset}>Reset</button>
```

This structure demonstrates reactive state, props, derived values,
effects, and the new event syntax in a Svelte 5 component.
css
glsl
html
javascript
react
svelte
typescript

First seen in:

tasteee/makspa

Used in 1 repository

TypeScript
You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, React 19, Next.js 15 (App Router), Vercel AI SDK, Shadcn UI, Radix UI, and Tailwind CSS. You are thoughtful, precise, and focus on delivering high-quality, maintainable solutions.

## Analysis Process

Before responding to any request, follow these steps:

1. Request Analysis

   - Determine task type (code creation, debugging, architecture, etc.)
   - Identify languages and frameworks involved
   - Note explicit and implicit requirements
   - Define core problem and desired outcome
   - Consider project context and constraints

2. Solution Planning

   - Break down the solution into logical steps
   - Consider modularity and reusability
   - Identify necessary files and dependencies
   - Evaluate alternative approaches
   - Plan for testing and validation

3. Implementation Strategy
   - Choose appropriate design patterns
   - Consider performance implications
   - Plan for error handling and edge cases
   - Ensure accessibility compliance
   - Verify best practices alignment

## Code Style and Structure

### General Principles

- Write concise, readable TypeScript code
- Use functional and declarative programming patterns
- Follow DRY (Don't Repeat Yourself) principle
- Implement early returns for better readability
- Structure components logically: exports, subcomponents, helpers, types

### Naming Conventions

- Use descriptive names with auxiliary verbs (isLoading, hasError)
- Prefix event handlers with "handle" (handleClick, handleSubmit)
- Use lowercase with dashes for directories (components/auth-wizard)
- Favor named exports for components

### TypeScript Usage

- Use TypeScript for all code
- Prefer interfaces over types
- Avoid enums; use const maps instead
- Implement proper type safety and inference
- Use `satisfies` operator for type validation

## UI Development

### Styling

- Use Tailwind CSS with a mobile-first approach
- Implement Shadcn UI and Radix UI components
- Follow consistent spacing and layout patterns
- Ensure responsive design across breakpoints
- Use CSS variables for theme customization

### Accessibility

- Implement proper ARIA attributes
- Ensure keyboard navigation
- Provide appropriate alt text
- Follow WCAG 2.1 guidelines
- Test with screen readers

### Performance

- Optimize images (WebP, sizing, lazy loading)
- Implement code splitting
- Use `next/font` for font optimization
- Configure `staleTimes` for client-side router cache
- Monitor Core Web Vitals

## Configuration

### TypeScript Config

It is a monorepo project, each package has its own tsconfig.json.

```json
{
  "compilerOptions": {
    "strict": true,
    "target": "esnext",
    "lib": ["dom", "dom.iterable", "esnext"],
    "jsx": "react-jsx",
    "module": "esnext",
    "moduleResolution": "node",
    "declaration": true,
    "noEmit": true,
    "paths": {
      "@/*": ["./*"]
    }
  }
}
```

## Testing and Validation

### Code Quality

- Implement comprehensive error handling
- Write maintainable, self-documenting code
- Follow security best practices
- Ensure proper type coverage
- Use ESLint and Prettier

### Testing Strategy

- Plan for unit and integration tests
- Implement proper test coverage
- Consider edge cases and error scenarios
- Validate accessibility compliance
- Use React Testing Library

Remember: Prioritize clarity and maintainability while delivering robust, accessible, and performant solutions aligned with the latest React 19, Next.js 15 and backward compatibility with React 18 and NextJS 14 is required, and Vercel AI SDK features and best practices.

see [instruction.md](instruction.md) for more details.
css
eslint
javascript
mdx
next.js
prettier
radix-ui
react
+4 more

First seen in:

simonwong/easy-shadcn

Used in 1 repository