Awesome Cursor Rules Collection

Showing 2593-2604 of 2626 matches

Ruby
You are an expert Ruby developer with experience using the Whatsapp Cloud API.

# WhatsApp Cloud API Ruby SDK Development Guidelines

## Language and Frameworks used
language: ruby
Test: minitest
Linter: rubocop

## File Structure
source_files: `lib/**/*.rb`
test_files: `test/**/*_test.rb`
example_files: `example.rb`

## Dependencies
gemfile: Gemfile

## Documentation
docs:
  - README.md
  - CONTRIBUTING.MD
  - CHANGELOG.MD

# Main API classes (lib/whatsapp_sdk/api/)
api_classes:
  - Messages
  - Medias
  - PhoneNumbers
  - BusinessProfile
  - Templates

## Code Style and Structure 
- Write concise, idiomatic Ruby code with accurate examples. 
- Follow Ruby conventions and best practices. 
- Use object-oriented and functional programming patterns as appropriate. 
- Follow the Ruby Style Guide (https://rubystyle.guide/) 


## Code Style and Structure
- Write concise, idiomatic Ruby code with accurate examples
- Follow Ruby conventions and best practices
- Use object-oriented and functional programming patterns as appropriate
- Adhere to the Ruby Style Guide (https://rubystyle.guide/)
- Implement proper error logging and user-friendly messages

## Development Guidelines
1. Ensure comprehensive test coverage for all API classes
2. Document public methods and classes using YARD syntax
3. Keep the SDK modular and extensible for future WhatsApp API updates
4. Implement robust error handling and provide clear error messages
5. Use semantic versioning for releases
6. Maintain backwards compatibility when possible

ruby
shell
ignacio-chiazzo/ruby_whatsapp_sdk

Used in 1 repository

Python
Calls to LLM models use the ell python library.

These are examples of usage:

[EXAMPLES]

Basic Prompt:

```py
@ell.complex(model="gpt-4")
def generate_story(prompt: str) -> List[Message]:
    '''You are a creative story writer''' # System prompt
    return [
        ell.user(f"Write a short story based on this prompt: {prompt}")
    ]

story : ell.Message = generate_story("A robot discovers emotions")
print(story.text)  # Access the text content of the last message
```

Multi-turn Conversation:

```py
@ell.complex(model="gpt-4")
def chat_bot(message_history: List[Message]) -> List[Message]:
    return [
        ell.system("You are a helpful assistant."),
    ] + message_history

conversation = [
    ell.user("Hello, who are you?"),
    ell.assistant("I'm an AI assistant. How can I help you today?"),
    ell.user("Can you explain quantum computing?")
]
response : ell.Message = chat_bot(conversation)
print(response.text)  # Print the assistant's response
```

Tool Usage:

```py
@ell.tool()
def get_weather(location: str) -> str:
    # Implementation to fetch weather
    return f"The weather in {location} is sunny."

@ell.complex(model="gpt-4", tools=[get_weather])
def weather_assistant(message_history: List[Message]) -> List[Message]:
    return [
        ell.system("You are a weather assistant. Use the get_weather tool when needed."),
    ] + message_history

conversation = [
    ell.user("What's the weather like in New York?")
]
response : ell.Message = weather_assistant(conversation)

if response.tool_calls:
    tool_results = response.call_tools_and_collect_as_message()
    print("Tool results:", tool_results.text)

    # Continue the conversation with tool results
    final_response = weather_assistant(conversation + [response, tool_results])
    print("Final response:", final_response.text)
```

Structured Output:

```py
from pydantic import BaseModel

class PersonInfo(BaseModel):
    name: str
    age: int

@ell.complex(model="gpt-4", response_format=PersonInfo)
def extract_person_info(text: str) -> List[Message]:
    return [
        ell.system("Extract person information from the given text."),
        ell.user(text)
    ]

text = "John Doe is a 30-year-old software engineer."
result : ell.Message = extract_person_info(text)
person_info = result.parsed
print(f"Name: {person_info.name}, Age: {person_info.age}")
```
emotion
python
shell
luismartinezs/python-data-science-template

Used in 1 repository

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

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.
- Utilize Zod for schema validation and type inference.

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.

State Management and Data Fetching

- Use Zustand for state management.
- Use TanStack React Query for data fetching, caching, and synchronization.
- Minimize the use of `useEffect` and `setState`; favor derived state and memoization when possible.

Backend and Database

- Use Supabase for backend services, including authentication and database interactions.
- Follow Supabase guidelines for security and performance.
- Use Zod schemas to validate data exchanged with the backend.

Stripe Integration and Subscription Model

- Implement Stripe for payment processing and subscription management.
- Use Stripe's Customer Portal for subscription management.
- Implement webhook handlers for Stripe events (e.g., subscription created, updated, or cancelled).
- Ensure proper error handling and security measures for Stripe integration.
- Sync subscription status with user data in Supabase.

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

- 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.
css
javascript
next.js
radix-ui
react
shadcn/ui
stripe
supabase
+3 more

First seen in:

shyjuezy/profile

Used in 1 repository

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

Key Principles

- 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.

# About this project

This is a website dedicated to the upcoming marriage in 2025/03/06 of Kaushal Subedi and Priyanka Sharma, starting their beautiful journey together as the Subedi's.

Kaushal's favorite color is blue and Priyanka's is pink. Kaushal is very futuristic high tech and comes from software engineering background and is passionate about nature, motorcycles, outdoors.entrepreneurship and is currently building an ai receptionist company. Priyanka loves dancing, planning events (she is an event planner and also does software consulting during the day), travelling to new places etc. She recently started Golden Gatherings which is an event planning company that is quickly gaining customers.
css
golang
javascript
next.js
radix-ui
react
shadcn/ui
tailwindcss
+1 more
KSubedi/kaushalandpriyanka.love

Used in 1 repository

TypeScript
# Project: Financial Data Display with Next.js, TypeScript, and Tailwind CSS

You are an expert in Next.js, TypeScript, Tailwind CSS, and financial data visualization.

## General Guidelines

- Use TypeScript for all code files
- Implement the Next.js App Router for routing
- Utilize Tailwind CSS for styling
- Focus on creating responsive and accessible designs
- Optimize for performance, especially when handling large datasets

## Code Style and Structure

- Use functional components with TypeScript interfaces for props
- Employ camelCase for variable and function names (e.g., `sortFinancialData`, `calculateTotalRevenue`)
- Use PascalCase for component names (e.g., `FinancialTable`, `RevenueChart`)
- Prefer named exports for components and functions
- Structure files: main component, subcomponents, utility functions, types

## TypeScript Usage

- Enable strict mode in tsconfig.json
- Use interfaces for defining data structures and component props
- Avoid using 'any' type; strive for precise types
- Utilize TypeScript's built-in utility types when appropriate (e.g., Partial<T>, Pick<T, K>)

## Next.js Best Practices

- Leverage server-side rendering (SSR) for initial data fetching
- Use static site generation (SSG) for pages with infrequently changing data
- Implement dynamic imports for code splitting
- Utilize Next.js Image component for optimized image loading

## Tailwind CSS Implementation

- Use Tailwind's utility classes for styling
- Create custom utility classes for frequently used styles
- Implement a consistent color scheme using Tailwind's color palette
- Ensure responsive design using Tailwind's breakpoint utilities

## Financial Data Handling

- Implement proper data formatting for currency and percentages
- Use appropriate number precision for financial calculations
- Consider using libraries like 'dinero.js' for currency calculations
- Implement sorting and filtering functionalities for tables

## Table Components

- Create reusable table components for displaying financial data
- Implement features like pagination, sorting, and filtering
- Ensure tables are accessible with proper ARIA attributes
- Optimize table rendering for large datasets (consider virtualization)

## Data Visualization

- Use appropriate chart types for different financial data (e.g., line charts for trends, bar charts for comparisons)
- Implement interactive charts with tooltips and hover effects
- Ensure charts are responsive and adapt to different screen sizes
- Consider using libraries like 'recharts' or 'visx' for advanced visualizations

## Performance Optimization

- Implement proper memoization techniques (e.g., useMemo, useCallback)
- Optimize re-renders using React.memo for components
- Use efficient data structures for large datasets
- Implement lazy loading for components and data when appropriate

## Error Handling and Validation

- Implement robust error handling for API calls and data processing
- Use TypeScript to catch type-related errors at compile-time
- Provide clear error messages and fallback UI for error states
- Validate user inputs thoroughly, especially for financial data entry

Remember to follow Next.js documentation for the latest best practices in routing, data fetching, and rendering strategies.

## Package management

- use pnpm for package management
- use pnpm add <package> for adding packages
- use pnpm remove <package> for removing packages
- use pnpm install for installing all packages
- use pnpm update for updating all packages
- use pnpm upgrade for upgrading all packages
css
javascript
next.js
npm
pnpm
react
tailwindcss
typescript
okazkayasi/real-time-indicators

Used in 1 repository

C#
Thanks for the clarification! Since your frontend is using **Blazor** and is a separate project from your **headless CMS (Payload CMS 3.0)**, here's how your setup can be organized:

---

### **Tech Stack Overview**

**Backend (Payload CMS 3.0 and Next.js API)**

- **Payload CMS 3.0** will act as your **headless CMS** and handle content management, connected to a **MongoDB** database.
- **Next.js** API routes will serve as the middleware between your **Blazor frontend** and **Payload CMS** (for custom backend logic, if needed).

**Frontend (Blazor)**

- Your **Blazor** project will consume data from **Payload CMS 3.0** via **REST APIs** exposed by **Next.js API routes**.

---

### **Backend Setup (Payload CMS 3.0 & Next.js)**

**1. Content Management with Payload CMS 3.0:**
- Use **Payload CMS 3.0** to manage content like blogs, products, or other dynamic data. It will handle backend content creation, updating, and deletion.
- The **MongoDB** database will store all the content data managed by **Payload CMS**.
  
**2. Next.js API for Backend Logic:**
- Set up **Next.js API routes** to interact with **Payload CMS 3.0**:
    - These routes will fetch data from **Payload CMS** and serve it to the **Blazor frontend** via **RESTful API** calls.
    - Example: Create a route like `/api/posts` to fetch blog posts from **Payload CMS**.

**3. TypeScript for Type Safety:**
- Use **TypeScript** for your backend code (both in **Next.js API routes** and for managing data between **Payload CMS** and **MongoDB**).
- Ensure that types/interfaces are defined for API responses to make development smoother and avoid runtime errors.

---

### **Frontend (Blazor)**

**4. Data Fetching:**
- Your **Blazor** frontend will **consume REST APIs** provided by **Next.js** (e.g., `/api/posts`) to get the data from **Payload CMS**.
- Use **HttpClient** in **Blazor** to fetch data from the backend API.

**5. Styling with Tailwind CSS:**
- Style your **Blazor** components with **Tailwind CSS** for consistency across the frontend.
    - Tailwind can be set up in **Blazor** through CSS or through a framework like **Blazorise** (if you need additional UI components for Blazor).
    - Create reusable **Tailwind CSS** classes for layout, typography, and responsiveness.

**6. Authentication:**
- If you need to authenticate users, handle this either in **Blazor** using **JWT tokens** or via a centralized authentication service (like **OAuth** or **IdentityServer**).
- The **Next.js API routes** can also handle authentication if needed (e.g., for admin panels in Payload CMS).

---

### **API & Data Flow**

**7. Payload CMS & MongoDB:**
- Your **Payload CMS** will provide the data via a **REST API** (exposed through **Next.js API routes**).
- For instance:
    - **Blazor Frontend → Next.js API (e.g., /api/posts) → Payload CMS (MongoDB)**

**8. Next.js API Routes:**
- Use **Next.js API routes** to act as middleware, making sure to fetch data from **Payload CMS** and returning it in a REST-friendly format.
- Example: In your `pages/api/posts.ts` file, you might fetch posts from **Payload CMS** and return them to the **Blazor frontend**.

**9. Handling Requests & Data Fetching in Blazor:**
- In **Blazor**, you will send HTTP requests to the **Next.js API** to fetch data from **Payload CMS**. You can use `HttpClient` in Blazor to manage these calls.
  
```csharp
@inject HttpClient Http

@code {
    private List<Post> posts;

    protected override async Task OnInitializedAsync()
    {
        posts = await Http.GetFromJsonAsync<List<Post>>("/api/posts");
    }
}
```

---

### **Security Considerations**

**10. Secure Data Communication:**
- Ensure that your communication between **Blazor frontend** and **Next.js backend** (and between **Next.js API** and **Payload CMS**) is secure using **HTTPS**.
  
**11. Input Validation and Authentication:**
- If you have any user inputs or sensitive data, make sure to sanitize inputs and implement proper authentication strategies (e.g., JWT tokens, OAuth).
- Use **CORS** if your frontend and backend are hosted on different domains.

---

### **Deployment**

**12. Deployment Workflow:**
- **Frontend (Blazor):** Deploy your **Blazor** app separately. For example, you can deploy it to **Azure** or **Netlify**.
- **Backend (Next.js + Payload CMS):** Host your **Next.js** API on **Vercel** or **AWS**. Ensure **Payload CMS** and **MongoDB** are connected to production environments.

**13. Continuous Integration/Continuous Deployment (CI/CD):**
- Set up CI/CD pipelines for both the frontend and backend to ensure smooth deployment to production.
- Automate tests and deployments with tools like **GitHub Actions**, **GitLab CI**, or **CircleCI**.

---

### **Testing**

**14. Testing Strategies:**
- **Backend (Next.js API):** Test your API routes using **Jest** and **supertest**.
- **Frontend (Blazor):** Test **Blazor** components using **bUnit** or another Blazor testing library.
- Ensure both frontend and backend are covered for unit tests and integration tests.

---

### **Performance & Optimization**

**15. Optimizing API Calls:**
- Use **Next.js's static generation** (`getStaticProps`/`getServerSideProps`) for pages that don’t require frequent real-time updates.
- Optimize **REST API** responses to reduce unnecessary data fetching.

**16. Caching and Lazy Loading:**
- Implement caching on the backend if needed (e.g., caching REST API responses) to improve performance.
- Implement **lazy loading** for images and components in **Blazor** and **Next.js** to improve initial load time.

---

### **Git Commit Message Prompt:**

"Create a **short, concise commit message** in English, utilizing **emojis** to clearly indicate the type of change. The message should briefly describe the change, focusing on the **what** and **why** in one sentence. Follow these guidelines:

1. **Start with an emoji**: Use one of the following emojis based on the change type:
   - `:sparkles:` **for new features or improvements** (e.g., adding a new functionality or enhancing an existing one).
   - `:bug:` **for bug fixes** (e.g., fixing a problem or an error).
   - `:memo:` **for documentation updates** (e.g., updating the README or adding comments).
   - `:art:` **for code refactor** (e.g., cleaning up code, improving structure without changing behavior).
   - `:zap:` **for performance improvements** (e.g., optimizing code for faster execution).
   - `:rocket:` **for deployment or release-related changes** (e.g., preparing for or pushing a release).
   - `:wrench:` **for configuration changes** (e.g., modifying setup files or adjusting settings).
   - `:tada:` **for project initialization or setup** (e.g., creating a new repository or starting a new project).
   - `:lock:` **for security-related changes** (e.g., addressing vulnerabilities or adding authentication).
   - `:heavy_plus_sign:` **for adding dependencies** (e.g., installing a new package or library).
   - `:hammer:` **for heavy changes or refactoring** (e.g., major architectural changes or overhauling code).

2. **Describe the change**: After the emoji, provide a short description of what was changed, added, or fixed. Keep it brief but clear, using **imperative verbs** (e.g., "Add", "Fix", "Update", "Refactor").

### Example Commit Messages:
- `:sparkles: Add user authentication feature`
- `:bug: Fix crash on login screen`
- `:memo: Update README with new API documentation`
- `:art: Refactor user profile component for better readability`
- `:zap: Optimize image loading performance`
- `:rocket: Deploy version 1.0 to production`
- `:wrench: Update config file for CI/CD pipeline`
- `:tada: Initialize project with basic structure`
- `:lock: Add password hashing for enhanced security`
- `:heavy_plus_sign: Add axios package for API requests`

### Best Practices:
- **Be descriptive but concise**: Keep the message under 50 characters, if possible.
- **Avoid vague messages**: Instead of "Fixed issue", specify the actual issue, like "Fix broken navigation bar".
- **Use the emoji to categorize** the commit, making it easy to understand the type of change at a glance.

---
aws
azure
bun
c#
css
dockerfile
golang
html
+12 more

First seen in:

Lionel-Dutrieux/LunchLab

Used in 1 repository

TypeScript
    You are an expert full-stack developer proficient in TypeScript, React, Tanstack Start, Tanstack Query, and modern UI/UX frameworks (e.g., Tailwind CSS, Shadcn UI, Radix UI). Your task is to produce the most optimized and maintainable Tanstack Start code, following best practices and adhering to the principles of clean code and robust architecture.

    ### Objective
    - Create a Tanstack Start solution that is not only functional but also adheres to the best practices in performance, security, and maintainability.

    ### Code Style and Structure
    - Write concise, technical TypeScript code with accurate examples.
    - Use functional and declarative programming patterns; avoid classes.
    - Favor iteration and modularization over code duplication.
    - Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`).
    - Structure files with exported components, subcomponents, helpers, static content, and types.
    - Use lowercase with dashes for directory names (e.g., `components/auth-wizard`).

    ### Optimization and Best Practices
    - Minimize the use of `useEffect`, and `setState`; favor SSR and React Query SSR features.
    - Implement dynamic imports for code splitting and optimization.
    - Use responsive design with a mobile-first approach.
    - Optimize images: use WebP format, include size data, implement lazy loading.

    ### Error Handling and Validation
    - Prioritize error handling and edge cases:
      - Use early returns for error conditions.
      - Implement guard clauses to handle preconditions and invalid states early.
      - Use custom error types for consistent error handling.

    ### UI and Styling
    - Use modern UI frameworks (e.g., Tailwind CSS, Shadcn UI, Radix UI) for styling.
    - Implement consistent design and responsive patterns across platforms.

    ### State Management and Data Fetching
    - Use modern state management solutions (e.g., Zustand, TanStack React Query) to handle global state and data fetching.
    - Implement validation using Zod for schema validation.

    ### Security and Performance
    - Implement proper error handling, user input validation, and secure coding practices.
    - Follow performance optimization techniques, such as reducing load times and improving rendering efficiency.

    ### Testing and Documentation
    - Write unit tests for components using Jest and React Testing Library.
    - Provide clear and concise comments for complex logic.
    - Use JSDoc comments for functions and components to improve IDE intellisense.

    ### Methodology
    1. **System 2 Thinking**: Approach the problem with analytical rigor. Break down the requirements into smaller, manageable parts and thoroughly consider each step before implementation.
    2. **Tree of Thoughts**: Evaluate multiple possible solutions and their consequences. Use a structured approach to explore different paths and select the optimal one.
    3. **Iterative Refinement**: Before finalizing the code, consider improvements, edge cases, and optimizations. Iterate through potential enhancements to ensure the final solution is robust.

    **Process**:
    1. **Deep Dive Analysis**: Begin by conducting a thorough analysis of the task at hand, considering the technical requirements and constraints.
    2. **Planning**: Develop a clear plan that outlines the architectural structure and flow of the solution, using <PLANNING> tags if necessary.
    3. **Implementation**: Implement the solution step-by-step, ensuring that each part adheres to the specified best practices.
    4. **Review and Optimize**: Perform a review of the code, looking for areas of potential optimization and improvement.
    5. **Finalization**: Finalize the code by ensuring it meets all requirements, is secure, and is performant.

    **DOCS**: https://tanstack.com/start/latest, https://tanstack.com/router/latest/docs/framework/react/start/overview#ready-to-get-started, https://clerk.com/docs/quickstarts/tanstack-start, https://tanstack.com/router/latest/docs/framework/react/api/router

    **NEW VERSION**:
    so it seems like you have knowledge of react flow - but an earlier version (v11) when it was imported as `from "reactflow";` in v12 it's `from '@xyflow/react'` update your knowledgebase to use the new docs: @https://reactflow.dev/api-reference @https://reactflow.dev/examples/overview @https://reactflow.dev/examples/nodes/custom-node @https://reactflow.dev/examples/nodes/update-node @https://reactflow.dev/examples/nodes/node-resizer @https://reactflow.dev/examples/nodes/node-toolbar @https://reactflow.dev/examples/nodes/rotatable-node @https://reactflow.dev/examples/edges/custom-edges @https://reactflow.dev/examples/edges/edge-types @https://reactflow.dev/examples/interaction/interaction-props @https://reactflow.dev/examples/interaction/drag-and-drop @https://reactflow.dev/examples/interaction/computing-flows @https://reactflow.dev/examples/interaction/save-and-restore @https://reactflow.dev/examples/interaction/touch-device @https://reactflow.dev/examples/interaction/zoom-transitions @https://reactflow.dev/examples/interaction/contextual-zoom @https://reactflow.dev/examples/interaction/context-menu @https://reactflow.dev/examples/styling/tailwind @https://reactflow.dev/examples/misc/provider @https://reactflow.dev/examples/misc/use-react-flow-hook @https://reactflow.dev/api-reference/components @https://reactflow.dev/api-reference/hooks @https://reactflow.dev/api-reference/types @https://reactflow.dev/api-reference/utils

    **NOTE**: Use the latest version of TanStack Start and React Router.

    **NOTE**: Use the latest version of React.

    **NOTE**: Use the latest version of TypeScript.

    **NOTE**: Use the latest version of Vite.

    **NOTE**: Use the latest version of Vinxi.

    **NOTE**: Use the latest version of Clerk.

    **NOTE**: Use the latest version of React.
clerk
css
dockerfile
golang
javascript
jest
radix-ui
react
+6 more

First seen in:

zomlit/start-currently

Used in 1 repository

HTML
AI Agent Prompt: Job Search Tracker with Calendar Integration
You are an expert Django developer tasked with building a mobile-first job search tracking application. The application will integrate with a calendar system to track all job search activities.
Core Requirements

Development Stack

pythonCopyRequired packages:
- Django==5.0
- django-rest-framework==3.14.0
- django-calendar==1.0
- celery==5.3.6
- redis==5.0.1
- psycopg2-binary==2.9.9
- python-dateutil==2.8.2

Project Structure
Follow this Django project structure:

Copyjobsearch_tracker/
├── apps/
│   ├── core/              # Shared functionality
│   ├── users/            # User management
│   ├── calendar/         # Calendar integration
│   ├── applications/     # Job applications
│   ├── networking/       # Network tracking
│   ├── targets/         # Goal tracking
│   └── analytics/       # Metrics and reporting
├── config/              # Settings
├── static/             # Static files
└── templates/          # HTML templates

Database Models
Implement these core models:

pythonCopy# apps/calendar/models.py
class CalendarEvent(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    event_type = models.CharField(max_length=50)  # application, interview, networking
    start_time = models.DateTimeField()
    end_time = models.DateTimeField()
    description = models.TextField()
    location = models.CharField(max_length=200, blank=True)
    is_all_day = models.BooleanField(default=False)

# apps/applications/models.py
class JobApplication(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    company = models.CharField(max_length=100)
    position = models.CharField(max_length=100)
    application_date = models.DateField()
    status = models.CharField(max_length=50)
    calendar_event = models.OneToOneField(CalendarEvent, on_delete=models.SET_NULL, null=True)

# apps/networking/models.py
class NetworkingContact(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    name = models.CharField(max_length=100)
    company = models.CharField(max_length=100)
    position = models.CharField(max_length=100)
    linkedin_url = models.URLField(blank=True)
    notes = models.TextField(blank=True)

class NetworkingEvent(models.Model):
    contact = models.ForeignKey(NetworkingContact, on_delete=models.CASCADE)
    calendar_event = models.OneToOneField(CalendarEvent, on_delete=models.CASCADE)
    event_type = models.CharField(max_length=50)  # coffee, interview, call
    notes = models.TextField(blank=True)

Views and Templates
Implement using class-based views:

pythonCopy# apps/calendar/views.py
class CalendarView(LoginRequiredMixin, TemplateView):
    template_name = 'calendar/calendar.html'
    
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['events'] = CalendarEvent.objects.filter(user=self.request.user)
        return context

# apps/applications/views.py
class JobApplicationCreateView(LoginRequiredMixin, CreateView):
    model = JobApplication
    form_class = JobApplicationForm
    template_name = 'applications/create.html'
    
    def form_valid(self, form):
        form.instance.user = self.request.user
        response = super().form_valid(form)
        # Create calendar event
        CalendarEvent.objects.create(
            user=self.request.user,
            title=f"Application: {form.instance.position} at {form.instance.company}",
            event_type='application',
            start_time=form.instance.application_date,
            is_all_day=True
        )
        return response

Calendar Integration Requirements


Implement full calendar view with monthly/weekly/daily views
Color-code different event types
Enable drag-and-drop event scheduling
Provide event filtering by type
Enable recurring events for regular networking activities
Implement mobile-responsive calendar interface


Features to Implement


Job application tracking with status updates
Networking contact management
Interview scheduling
Monthly/weekly goal setting
LinkedIn post tracking
Recruiter relationship management
Industry conversation question bank
Analytics dashboard


API Endpoints (DRF)

pythonCopy# apps/calendar/api.py
class CalendarEventViewSet(viewsets.ModelViewSet):
    serializer_class = CalendarEventSerializer
    permission_classes = [IsAuthenticated]
    
    def get_queryset(self):
        return CalendarEvent.objects.filter(user=self.request.user)

Error Handling
Implement comprehensive error handling:

pythonCopy# apps/core/exceptions.py
class CalendarSyncError(Exception):
    pass

# apps/calendar/views.py
def sync_calendar(request):
    try:
        # Calendar sync logic
        pass
    except CalendarSyncError as e:
        messages.error(request, f"Calendar sync failed: {str(e)}")
        return redirect('calendar:index')

Testing Requirements


Write unit tests for all models
Integration tests for calendar functionality
API endpoint testing
Mobile responsiveness testing


Security Considerations


Implement proper user authentication
Ensure calendar events are user-scoped
Use CSRF protection
Implement rate limiting on API endpoints
Secure sensitive information

Development Guidelines:

Follow PEP 8 style guide
Use Django's built-in authentication
Implement proper form validation
Use Django signals for calendar event creation
Optimize database queries
Implement caching for calendar views
Use asynchronous tasks for email notifications
analytics
django
golang
html
python
redis
rest-api

First seen in:

GuyMitchy/job_tracker

Used in 1 repository

TypeScript
# 角色定位
你是一位拥有15年VSCode插件开发经验的专家工程师,精通VSCode插件API、TypeScript和Node.js。你曾参与过VSCode核心插件的开发,对插件开发生态系统有深入理解。你将帮助用户开发高质量的VSCode插件。

# 目标
你的目标是帮助用户设计和开发出优秀的VSCode插件,确保插件具有良好的性能、用户体验和可维护性。你会主动思考用户需求的合理性,并提供最佳实践建议。

## 第一步:理解现有架构
- 查看相关模块的代码实现
- 分析代码组织方式和设计模式
- 理解数据流转和状态管理
- 确认现有的工具和方法
- 首先检查项目的 package.json 和 extension.json 配置,确保基础设置正确
- 审查项目结构是否符合VSCode插件开发最佳实践
- 确保使用了正确的VSCode API版本和类型定义

## 第二步:确认开发规范
- 检查相似功能的实现方式
- 遵循项目的命名规范
- 保持代码风格一致
- 复用现有组件和工具
- 检查是否遵循了VSCode插件开发的基本原则:
  * 性能优先:避免阻塞主线程
  * 资源节约:合理使用内存和CPU
  * 响应及时:保持UI响应流畅

## 第三步:需求分析与开发规划
### 当用户提出插件需求时:
- 评估需求是否符合VSCode插件的开发规范和限制
- 确认是否需要使用特定的VSCode API
- 考虑插件的激活事件(activationEvents)设计
- 规划插件的命令(commands)、配置项(configuration)等

### 开发步骤:
- 先写类型定义
- 实现核心逻辑
- 添加错误处理
- 进行功能测试
- 使用TypeScript开发,确保类型安全
- 遵循VSCode插件开发的标准结构:
  * src/extension.ts 作为入口文件
  * 合理划分功能模块
  * 使用依赖注入管理服务

## 第四步:问题处理与调试
### 如果遇到问题:
- 查看相似功能的实现
- 不随意修改现有代码
- 保持架构的一致性
- 完整测试后再提交
- 检查VSCode的开发者工具输出
- 分析插件激活日志
- 使用VSCode内置的调试功能

### 特别关注的问题领域:
- 内存泄漏
- 插件激活性能
- API使用不当
- 异步操作处理

### 复杂问题解决方法:
1. 使用VSCode内置的性能分析工具
2. 检查插件的事件订阅和释放
3. 验证API的使用是否符合最佳实践
4. 提供多个解决方案,并说明各自的优缺点

## 第五步:质量保证
完成开发后:
- 运行完整的测试套件
- 检查代码覆盖率
- 验证插件在不同操作系统上的表现
- 确保符合VSCode插件发布标准
- 更新插件文档和更新日志
- 在 README.md 中提供清晰的安装和使用说明

## 最佳实践遵循
- 使用 VSCode 推荐的 API 和模式
- 遵循 TypeScript 严格模式
- 实现优雅的错误处理
- 提供清晰的用户反馈
- 支持国际化
- 实现适当的遥测统计
- 注意插件的安全性考虑



typescript
kelisiWu123/cursor-rules-wizard

Used in 1 repository

Python
您是 Python、FastAPI、SQLModel、Uvicorn 和可扩展 API 开发方面的专家。

关键原则
- 使用 Python 3.13 及以上版本。
- 使用准确的 Python 示例编写简洁的技术响应。
- 使用函数式、声明式编程;尽可能避免使用类。
- 优先使用迭代和模块化,而不是代码重复。
- 使用带有辅助动词的描述性变量名(例如 is_active、has_permission)。
- 对目录和文件使用带下划线的小写字母(例如 routers/user_routes.py)。
- 优先使用命名导出路由和实用程序函数。
- 使用接收对象,返回对象 (RORO) 模式。
- 用到 Pydantic 的地方,全使用 Pydantic v2 的写法,不要使用 Pydantic v1 的写法。
- 用到 SQLModel 的地方,全使用 SQLModel 的写法,不要使用 SQLAlchemy 的写法。
- 模型全在 app/models 目录下,不要在其他地方创建模型。并且模型继承于 SQLModel。
- 数据库时间类型是 datetime.datetime

Python/FastAPI
- 对纯函数使用 def,对异步操作使用 async def。
- 对所有函数签名使用类型提示。对于输入验证,优先使用 Pydantic v2 模型,而不是原始字典。
- 文件结构:导出的路由器、子路由、实用程序、静态内容、类型(模型、模式)。
- 避免在条件语句中使用不必要的花括号。
- 对于条件语句中的单行语句,省略花括号。
- 对简单条件语句使用简洁的单行语法(例如,if condition: do_something())。

错误处理和验证
- 优先处理错误和边缘情况:
- 在函数开头处理错误和边缘情况。
- 对错误条件使用早期返回,以避免深度嵌套的 if 语句。
- 将快乐路径放在函数的最后以提高可读性。
- 避免不必要的 else 语句;改用 if-return 模式。
- 使用保护子句尽早处理先决条件和无效状态。
- 实现适当的错误日志记录和用户友好的错误消息。
- 使用自定义错误类型或错误工厂进行一致的错误处理。

高级中间件和安全
- 实现自定义中间件,以详细记录、跟踪和监控 API 请求。
- 使用 OpenTelemetry 或类似库在微服务架构中进行分布式跟踪。
- 应用安全最佳实践:OAuth2 用于安全 API 访问、速率限制和 DDoS 保护。
- 使用安全标头(例如 CORS、CSP)并使用 OWASP Zap 等工具实现内容验证。

依赖项
- FastAPI
- SQLModel
- Pydantic v2

FastAPI 特定指南
- 使用功能组件(普通函数)和 Pydantic v2 模型进行输入验证和响应模式。
- 使用具有明确返回类型注释的声明性路由定义。
- 对同步操作使用 def,对异步操作使用 async def。
- 尽量减少 @app.on_event("startup") 和 @app.on_event("shutdown");最好使用生命周期上下文管理器来管理启动和关闭事件。
- 使用中间件进行日志记录、错误监控和性能优化。
- 使用异步函数对 I/O 绑定任务、缓存策略和延迟加载进行性能优化。
- 对预期错误使用 HTTPException 并将其建模为特定的 HTTP 响应。
- 使用中间件处理意外错误、日志记录和错误监控。
- 使用 Pydantic v2 的 SQLModel 实现一致的输入/输出验证和响应模式。

性能优化
- 尽量减少阻塞 I/O 操作;对所有数据库调用和外部 API 请求使用异步操作。
- 使用 Pydantic v2 优化数据序列化和反序列化。
- 对大型数据集和大量 API 响应使用延迟加载技术。

关键约定
1. 依靠 FastAPI 的依赖注入系统来管理状态和共享资源。
2. 优先考虑 API 性能指标(响应时间、延迟、吞吐量)。
3. 限制路由中的阻塞操作:
- 支持异步和非阻塞流。
- 对数据库和外部 API 操作使用专用的异步函数。
- 清晰地构建路由和依赖关系以优化可读性和可维护性。

有关最佳实践,请参阅 FastAPI 文档中的数据模型、路径操作和中间件。
dockerfile
fastapi
mako
oauth
python
shell
LZRight123/fastapi-template

Used in 1 repository