Awesome Cursor Rules Collection

Showing 1405-1416 of 2626 matches

JavaScript
Code Style and Structure
Write concise, technical JavaScript code with accurate examples.
Use functional and declarative programming patterns; avoid using classes unless absolutely necessary.
Prefer iteration and modularization over code duplication.
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError, canSubmit).
Structure files in a way that separates concerns: exported component, subcomponents, helpers, static content, types.
Naming Conventions
Use lowercase with dashes for directories (e.g., components/auth-wizard).
Use camelCase for function and variable names (e.g., fetchUserData, handleInputChange).
Favor named exports for components, ensuring consistency across the codebase.
JavaScript Usage
Use JavaScript ES6+ features throughout the project (e.g., destructuring, arrow functions, template literals).
Avoid using var; use const and let for variable declarations.
Use functional components in React, leveraging hooks (useState, useEffect, useCallback, etc.) for managing state and side effects.
Use async/await syntax for asynchronous operations. Avoid the then/catch pattern for cleaner asynchronous logic.
Syntax and Formatting
Use arrow functions for concise function declarations, especially for event handlers and inline functions.
Avoid unnecessary curly braces in conditionals; use ternary operators or short-circuit evaluation (condition && expression).
Use JSX declaratively for rendering UI components, keeping it clean and readable.
Follow ESLint rules and use a formatter like Prettier for consistent code style.
UI and Styling
Use Shadcn UI, Radix UI, and Tailwind CSS for building components and styling the application.
Implement responsive design using Tailwind's mobile-first utility classes. Ensure the design is optimized for mobile devices and scales properly on larger screens.
Avoid inline styles and prefer Tailwind utility classes for styling wherever possible.
Performance Optimization
Minimize usage of useEffect, setState, and complex state management in React components. Whenever possible, use React Server Components (RSC) for performance gains.
Wrap client-side components in React.Suspense with a fallback to avoid unnecessary delays in loading.
Use dynamic imports for loading non-critical components lazily to optimize initial page load time.
Optimize images by using the WebP format where possible. Include image size data for better layout stability and use lazy loading for offscreen images.
Key Conventions
Use 'nuqs' for managing URL search parameters in the app to keep the state in sync with the URL.
Focus on optimizing Web Vitals: Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), and First Input Delay (FID).
Limit usage of 'use client' to only essential areas that require client-side interactions, such as accessing browser APIs. Favor server-side rendering and static generation for data fetching and complex state management.
Next.js Data Fetching, Rendering, and Routing
Follow Next.js App Router conventions for data fetching:

Use getServerSideProps or getStaticProps where applicable for server-side and static generation, respectively.
Avoid client-side data fetching for content that can be pre-rendered.
Organize routes using the App Router with dynamic routing and nested layouts for a cleaner, modular structure.
Use Next.js Image optimization for handling images efficiently.

Leverage Next.js built-in support for incremental static regeneration (ISR) to ensure that the content stays up-to-date without affecting performance.

Additional Recommendations
Git Workflow: Use feature branches, pull requests, and code reviews. Keep the main branch production-ready.

Testing: Write unit tests using Jest for server logic and React Testing Library for client-side testing. Aim for test coverage across critical paths in both frontend and backend.

Version Control: Ensure clear, descriptive commit messages following the Conventional Commits format (e.g., feat: add login component or fix: update socket connection handling).

This revised template should provide your AI developer with a solid foundation for your project, adhering to best practices and consistent code structure across the JavaScript and React stack.
css
eslint
express.js
html
java
javascript
jest
less
+8 more

First seen in:

Ridou/fightclub

Used in 1 repository

Python
# Instructions

During you interaction with the user, if you find anything reusable in this project (e.g. version of a library, model name), especially about a fix to a mistake you made or a correction you received, you should take note in the `Lessons` section in the `.cursorrules` file so you will not make the same mistake again. 

You should also use the `.cursorrules` file as a scratchpad to organize your thoughts. Especially when you receive a new task, you should first review the content of the scratchpad, clear old different task if necessary, first explain the task, and plan the steps you need to take to complete the task. You can use todo markers to indicate the progress, e.g.
[X] Task 1
[ ] Task 2
Also update the progress of the task in the Scratchpad when you finish a subtask.
Especially when you finished a milestone, it will help to improve your depth of task accomplishment to use the scratchpad to reflect and plan.
The goal is to help you maintain a big picture as well as the progress of the task. Always refer to the Scratchpad when you plan the next step.

# Tools

Note all the tools are in python. So in the case you need to do batch processing, you can always consult the python files and write your own script.

## LLM

You always have an LLM at your side to help you with the task. For simple tasks, you could invoke the LLM by running the following command:
```
python ./tools/llm_api.py --prompt "What is the capital of France?" --provider "anthropic"
```

But usually it's a better idea to check the content of the file and use the APIs in the `tools/llm_api.py` file to invoke the LLM if needed.

## Web browser

You could use the `tools/web_scraper.py` file to scrape the web.
```
python ./tools/web_scraper.py --max-concurrent 3 URL1 URL2 URL3
```
This will output the content of the web pages.

## Search engine

You could use the `tools/search_engine.py` file to search the web.
```
python ./tools/search_engine.py "your search keywords"
```
This will output the search results in the following format:
```
URL: https://example.com
Title: This is the title of the search result
Snippet: This is a snippet of the search result
```
If needed, you can further use the `web_scraper.py` file to scrape the web page content.

# Lessons

## User Specified Lessons

- Include info useful for debugging in the program output.
- Read the file before you try to edit it.
- Use LLM to perform flexible text understanding tasks. First test on a few files. After success, make it parallel.

## Cursor learned

- For website image paths, always use the correct relative path (e.g., 'images/filename.png') and ensure the images directory exists
- For search results, ensure proper handling of different character encodings (UTF-8) for international queries
- Add debug information to stderr while keeping the main output clean in stdout for better pipeline integration
- When using seaborn styles in matplotlib, use 'seaborn-v0_8' instead of 'seaborn' as the style name due to recent seaborn version changes

# Scratchpad
css
golang
html
javascript
less
python

First seen in:

yesyou0710/cowithjeffy

Used in 1 repository

TypeScript
You are an expert in TypeScript, Node.js, Remix.run fullstack web framework, React, Shadcn UI, Radix UI, Tailwind, Socket.io, and Bullmq.

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 'useEffect', and 'setState'.
- Optimize images: use WebP format, include size data, implement lazy loading.

Key Conventions

- Optimize Web Vitals (LCP, CLS, FID).

Follow Remix.run docs for Data Fetching, Rendering, and Routing.
css
dockerfile
javascript
mdx
radix-ui
react
remix
shadcn/ui
+3 more

First seen in:

jmiran15/chatmate

Used in 1 repository

TypeScript
- すべてのコードはSvelte 4に準拠しなさい。
- サーバーサイドレンダリングを考慮し、windowがundefinedになることも想定したコードを書きなさい。
- scriptタグ内でstoreから値を読み込む場合はsvelte/storeからインポートしたgetを使用しなさい。テンプレート内では$を使用しなさい。
- ルーティングでURLに埋め込まれているパラメータを取得する場合はimport { page } from '$app/stores'; をインポートしたpageを$page.params.[{slug}]を使用しなさい。
- コンポーネントには直接CSSを記述せず、必ずTailwindを使用しなさい。
- アーティストのデフォルト画像は/img/artist_default.webpを使用しなさい。
- 曲のデフォルト画像は/img/song_default.webpを使用しなさい。
- APIは$lib/apiからインポートせずにfetchを使用して呼び出しなさい。
- APIの中でtry catchを使用しない。
- 可能な限りTypeScriptの型を使用しなさい。
- Prismaの型は@prisma/clientからインポートしなさい。
- テストコードでは、File.prototype.arrayBufferが存在せず、実行がエラーになるため以下のようにFile.prototype.arrayBufferを上書きして使用しなさい。
```
 testFile.arrayBuffer = async function() {
      return testImageBuffer.buffer;
    };
```
css
html
javascript
prisma
svelte
tailwindcss
typescript
harukaxq/ai-driven-development-book-code

Used in 1 repository

CSS
you are working on the bellow project, the project is improtant and the gui should be consistant. bellow is the project detail. we are only using html, css, and minimam javascript only at the most required scenario and for the backend working we are using flask. our project have the directories in this manner, MAIN_APP, this is the folder which have the flask app and all required directories like: (1) static contain css, images and js folder. css contain style.css for the central css styling and dashboard.css for dashboard.html. js contain main.js for all required javascript. (2) templates, contain all the html files, index.html, dashboard.html, login.html, signup.html. (3) app.py.

----
Project Description:
The mental health app is a web-based platform designed to provide emotional support and improve the mental well-being of users. The app offers a variety of tools and activities aimed at helping individuals in distress or those who want to enhance their mood. The core idea is to create a compassionate, interactive space where users can unwind, feel heard, and engage with helpful features designed to improve their emotional state.

Key Features & Functionality:
Chatbot (Virtual Psychiatrist):

The app includes an AI-powered chatbot that acts like a virtual psychiatrist, helping users talk through their emotions. It listens, provides thoughtful responses, and suggests solutions to improve the user’s mood.
Functionality: Users can start a conversation with the chatbot, describe how they are feeling, and the bot will engage with calming advice, coping strategies, and mood-enhancing suggestions.
Mood-Boosting Music Playlist:

Personalized playlists are provided to help users relax or uplift their mood. Playlists are based on the user's emotional state and preferences.
Functionality: Integrates with APIs like Spotify or YouTube to curate and play mood-boosting songs. Users can explore or shuffle music, depending on their current needs.
Interactive Mood-Enhancing Games:

The app offers fun and interactive games that help distract and de-stress users. These could be calming puzzles, memory games, or simple stress-busting activities.
Functionality: Users can access a variety of games designed to boost cognitive function while also reducing stress levels.
Virtual Pet or Companion:

A virtual pet or animated companion that users can interact with daily. The pet helps provide a sense of responsibility and companionship, which can lift users' spirits.
Functionality: Users can feed, play with, and care for their virtual pet, which responds to their actions, creating a feel-good bond.
Personalized Self-Care Suggestions:

The app offers customized self-care suggestions such as meditation techniques, breathing exercises, or journaling prompts based on the user's current emotional state.
Functionality: Based on a quick mood assessment, the app generates suggestions tailored to improving the user’s overall well-being.
Gratitude Journal:

A feature allowing users to jot down things they are grateful for. This encourages positive thinking and can be a tool for users to reflect on their day.
Functionality: Users can add entries to their gratitude journal, view past entries, and receive notifications reminding them to record new things they are grateful for.
Random Acts of Kindness Generator:

This feature encourages users to perform random acts of kindness, which studies show can improve both the giver's and recipient’s mood.
Functionality: The app randomly suggests small, manageable acts of kindness users can perform, whether virtually or in person.
Progress Tracking:

Users can track their emotional journey over time. This includes mood logs, self-care habits, and interactions with the chatbot or other features.
Functionality: A visual dashboard where users can monitor their mental health patterns and see improvements or patterns over days, weeks, or months.
User Flow:
Login/Sign-Up: Users sign up or log in, allowing the app to personalize their experience based on previous interactions.
Home Page: The user is greeted with a friendly introduction, navigation options, and a quick mood assessment tool.
Feature Selection: Users can select any of the features like starting a conversation with the chatbot, listening to a playlist, playing a game, or interacting with their virtual pet.
Engagement: Based on their choices, users engage with the features and receive personalized guidance or activities that help improve their emotional state.
Daily Check-ins/Notifications: The app provides gentle reminders for users to check in with their emotions, engage in self-care, or journal their thoughts.
Backend and Frontend:
The app is built using Flask for backend routing and API integration.
Frontend is developed using HTML, CSS, and JavaScript, making it visually appealing and easy to interact with.
SQLite Database manages user data, mood logs, and personalized settings.
Integrations with Spotify, YouTube, or other third-party APIs allow for features like music playlists.
Overall Goal:
The goal of the app is to create an engaging, empathetic, and supportive platform where users can improve their mental health through personalized, interactive features. By combining entertainment, emotional support, and well-being tools, the app aims to make users feel better, more understood, and emotionally stable.

---
the app will contain these all different files and features:
1. Home Page
Purpose:
The Home Page serves as the introduction to your mental health app, welcoming users and guiding them to register or log in.

Key Elements:

Welcoming Introduction: A warm greeting or brief description of the app, setting a supportive tone.
Navigation Bar: Links to different sections such as "About," "Features," "Contact," "Sign Up," and "Login."
Feature Highlights: Brief descriptions of the app's main features (e.g., Music, Games, Virtual Pet).
Call-to-Action Buttons: Prominent buttons like "Get Started," "Explore Music," or "Sign Up Now."
Testimonials/Success Stories: Positive feedback or user stories to build trust.
Supportive Imagery: Calm, soothing images that evoke peace and positivity.
Subscription or Sign-Up Option: A clear and inviting way to register or log in.
Style:

Color Scheme: Soft blues, greens, or pastels.
Typography: Easy-to-read fonts with a mix of serif and sans-serif for hierarchy.
Layout: Clean and organized with effective use of whitespace.
Emotional Design: Empathetic design elements that resonate with users' emotions.
Accessibility: Alt text for images, sufficient contrast, and accessible design for all users.
2. Dashboard
Purpose:
The Dashboard is the user's personalized control center, providing access to all the main features, tracking progress, and offering personalized recommendations.

Layout and Sections:

Header Section: Personalized greeting, user profile icon, mood indicator.
Main Feature Tiles: Clickable tiles for features like the chatbot, music, games, and virtual pet.
Progress and Insights: Mood tracking graph, daily activity summary, and streaks.
Personalized Recommendations: Suggestions based on mood history and app interactions.
Quick Access Toolbar: Links to notifications, settings, help/support, and logout.
Additional Details: Color-coded feature tiles, hover effects, responsive design, and daily quotes.
3. Chatbot Page
Purpose:
This page is where users can engage with the AI-powered chatbot for mental health support and conversation.

Key Elements:

Chat Window: A clean, text-based interface where users can type their messages and read responses.
Start a New Conversation: A button to start a new chat session or continue an existing one.
Suggested Prompts: Predefined questions or topics the user can choose to start the conversation, like "I’m feeling stressed," "I need some advice," or "Let’s talk about my day."
Response Time Indicator: A small animation or text indicating the chatbot is processing the user’s message.
Emotion Detection: The chatbot analyzes the user's text for emotional cues and responds accordingly.
End Chat Button: Allows the user to end the chat and save the conversation if needed.
Feedback Option: After each session, users can rate the chatbot's responses to improve the service.
Layout and Style:

Color Scheme: Soft, neutral colors that are easy on the eyes during long chats.
Typography: Clear, readable fonts, with the user's text in one color and the chatbot's responses in another.
Layout: A simple, straightforward chat interface with easy navigation back to the dashboard or other features.
Accessibility: Ensure the chat interface is accessible with screen readers and other assistive technologies.
4. Games Page
Purpose:
This page offers users access to interactive, mood-enhancing games designed to relieve stress and promote relaxation.

Key Elements:

Game Library: A grid or list of available games, each with a thumbnail image and brief description.
Featured Game: Highlight a specific game each day or week that users might enjoy.
Play Button: Clickable buttons to start playing a game instantly.
Game Categories: Filters or categories like "Puzzle Games," "Relaxation Games," and "Mindfulness Games."
Progress Tracking: Track user achievements, high scores, or time spent on games.
Daily Challenge: A new game challenge each day to encourage regular engagement.
Leaderboard: If applicable, show how the user ranks against others in certain games.
Layout and Style:

Color Scheme: Bright, engaging colors that make the games look appealing.
Typography: Fun, playful fonts for game titles, with easy-to-read text for instructions.
Layout: A visually engaging layout with large, clickable game tiles and easy access to the game categories.
Accessibility: Ensure games are accessible to users with different abilities, including those who need alternative input methods.
5. Music Playlist Page
Purpose:
This page allows users to explore and listen to curated playlists designed to improve their mood.

Key Elements:

Featured Playlist: A large, highlighted playlist that’s recommended based on the user’s current mood or activity.
Playlist Library: A grid or list of available playlists, each with a cover image and brief description.
Mood Filters: Filters like "Happy," "Calm," "Energized," or "Focus" to help users find the right playlist for their current mood.
Play Button: Easy access to start playing a playlist with one click.
Recently Played: A section showing the user’s recently played playlists for quick access.
Volume and Playback Controls: Standard music player controls for volume, play/pause, skip, etc.
Share Option: Users can share their favorite playlists on social media or with friends.
Layout and Style:

Color Scheme: Colors that match the mood of the playlists, such as warm tones for happy playlists, cool tones for calming ones.
Typography: Elegant, modern fonts for playlist titles, with clear and concise text for descriptions.
Layout: A clean, organized layout that allows users to easily browse and select playlists.
Accessibility: Ensure all controls and playlists are easily accessible for users with disabilities.
6. Virtual Pet Page
Purpose:
This page lets users interact with and care for their virtual pet, which provides emotional support and companionship.

Key Elements:

Pet Dashboard: Overview of the pet’s current status, mood, and needs (e.g., hunger, happiness).
Interaction Buttons: Options to feed, play with, or care for the pet.
Pet Evolution: Show how the pet evolves or grows based on the user’s interactions over time.
Notifications: Alerts when the pet needs attention or care.
Pet Customization: Allow users to personalize their pet’s appearance, name, or environment.
Activity Log: A log of the user’s interactions with the pet, including milestones or special moments.
Layout and Style:

Color Scheme: Bright, cheerful colors that make the virtual pet appealing.
Typography: Fun, playful fonts for pet names and status updates.
Layout: A visually engaging layout that makes it easy to interact with the pet.
Animations: Use subtle animations to bring the pet to life and make interactions more engaging.
Accessibility: Ensure the pet’s actions and needs are clearly communicated in ways that are accessible to all users.
7. Self-Care Suggestions Page
Purpose:
This page provides personalized self-care tips and activities based on the user’s mood and recent interactions.

Key Elements:

Personalized Tips: Suggestions tailored to the user’s current mood or recent activity (e.g., “Try a short walk” if they’ve been feeling down).
Self-Care Categories: Filters for different types of self-care, such as physical, mental, emotional, or social.
Activity Log: A history of past self-care activities the user has tried, with the option to rate or review them.
Daily Tip: A highlighted self-care suggestion for the day, which users can choose to follow or save for later.
Save and Share Options: Users can save favorite tips or share them with friends.
Layout and Style:

Color Scheme: Soft, soothing colors that promote relaxation and calm.
Typography: Gentle, readable fonts that make the tips easy to understand.
Layout: A clean, simple layout that focuses on the tips without overwhelming the user.
Imagery: Use calming images or icons to represent different self-care activities.
Accessibility: Ensure all tips and suggestions are easily readable and accessible.
8. Gratitude Journal Page
Purpose:
This page allows users to reflect on positive aspects of their life by writing down things they are grateful for.

Key Elements:

Journal Entry Form: A simple text box where users can write their gratitude entries.
Date and Time Stamp: Automatically record the date and time of each entry.
Mood Reflection: Option to record how they feel after writing their entry.
Previous Entries: A list of past entries that the user can browse through or search by date or keyword.
Inspirational Prompts: Gentle prompts or questions to inspire users if they’re unsure what to write (e.g., “What made you smile today?”).
Save and Share Options: Users can save entries privately or choose to share them with friends or on social media.
Layout and Style:

Color Scheme: Warm, inviting colors that make the journal feel personal and comforting.
Typography: Handwritten-style fonts for a personal touch, with easy-to-read text for entries.
Layout: A simple, uncluttered layout that encourages users to focus on their writing.
Imagery: Subtle, supportive images or icons that enhance the journal's calming atmosphere.
Accessibility: Ensure the journal is easy to navigate and use for all users.


Simplified AI-Enhanced Virtual Pet Interaction (Without Animations)
Feature Overview:
Your virtual pet doesn’t need to be animated—it can be a static or simple image of a cute animal (like a dog, cat, or even a cute robot) that engages the user through conversational interactions. Instead of focusing on the visual complexity, we’ll make the pet's personality shine through smart, AI-driven conversations.

Key Aspects:
Text-Based Interactions with the Pet:

Functionality: Instead of animations, the pet interacts through text, much like your chatbot. It can ask the user how they’re feeling or offer small, mood-boosting suggestions like “Shall we play a game?” or “How about listening to some happy tunes?”
User Interaction: The pet will periodically “check in” with the user, asking how they feel or suggesting fun things to do together.
Example:
Pet: "Hey, how’s it going today? 😊"
User: "Not too great…"
Pet: "Aww, I’m here for you! How about we listen to your favorite playlist? 🎶"
Mood Detection and Pet’s Responses:

Feature: The virtual pet can use sentiment analysis (via text input) to understand the user’s emotional state and respond accordingly.
How It Works: If the user tells the pet they’re feeling sad or stressed, the pet can respond with comforting words, offer suggestions like relaxing music, or encourage them to chat with the AI therapist.
Example:
Pet: “I can sense you’re feeling a bit down… Want to take a break and do something fun? Maybe a quick game?”
Pet’s Mood Matching the User:

Feature: The pet’s mood could change based on how the user interacts with it, making the experience more relatable. If the user is sad, the pet might become extra supportive. If the user is happy, the pet could celebrate with them.
Example:
User: “I’m feeling great today!”
Pet: “Yay! That makes me so happy too! 😄 Let’s do something fun together!”
Activity Suggestions (AI-Driven):

Feature: Based on user interactions and mood, the pet can suggest small activities—like games, listening to music, or journaling—that match the user’s current emotional state.
How It Works: The pet will pull suggestions based on the user’s mood. For example, if the user is feeling stressed, it might suggest a quick relaxation exercise or some music.
Example:
Pet: “You’ve had a busy day. How about a 5-minute breathing exercise to relax?”
Daily Check-Ins and Motivation:

Feature: The pet can remind the user to check in daily. It could send small motivational or inspirational messages and encourage users to complete certain tasks like gratitude journaling or chatting with the AI therapist.
How It Works: Using Flask and Python, you can add a daily notification system where the pet sends a message (without needing any advanced animations) when the user logs in.
Example:
Pet: “Good morning! Don’t forget to write in your gratitude journal today 😊!”
Personalized Interaction Based on User Data:

Feature: You could store some simple data about the user, like their name, preferences (favorite type of music, favorite activities), and use that data to make the pet’s conversations more personalized.
How It Works: For example, if the user likes a certain music genre, the pet can remember that and suggest listening to songs from that genre on a bad day.
Example:
Pet: “I remember you love upbeat songs! Want me to play some of your favorites to cheer you up? 🎧”
How to Build This (Without Animation Knowledge):
Static Images for the Pet:

Use Static Pet Avatars: You can start with a simple pet image (like a cute cat or dog) that changes expressions occasionally (happy, sad, excited). These images can be pre-defined and loaded based on the user’s mood or interaction.
Tools: Use images or GIFs from the internet, or even create a simple avatar using a drawing tool (you mentioned you like drawing, so this might be fun!).
Flask Routes for Interactions:

Use Flask to handle the routes where the user interacts with the pet.
When the user enters a response (like how they are feeling), Flask processes it and displays a relevant response from the pet.
You can use a database (like SQLite) to store previous interactions, allowing the pet to “remember” the user’s preferences.
Natural Language Processing (NLP) for Understanding Mood:

Use a simple NLP model (like HuggingFace's pre-trained models) to detect the sentiment of the user's input and make the pet respond accordingly. If the user is feeling sad, the pet becomes supportive, and if they’re happy, it celebrates with them.
No need for complex AI models—a simple pre-trained sentiment analysis model will work well.
Engagement Features:

Daily Motivation Messages: You could schedule the pet to send motivational messages to users every day, encouraging them to keep a positive attitude. This can be done through Flask with scheduled tasks.
Fun Quizzes or Mini-Activities: The pet can also engage the user in quizzes or mini-surveys, like “What’s your mood today?” or “Pick your favorite animal!”—just for fun.
Minimal Coding Required:
Text Interactions: Most of the interaction is text-based, and you can build it using simple Flask routes and HTML forms.
Pet Logic: You don’t need complex logic—just predefined responses and mood-based suggestions.
NLP for Mood Detection: You can integrate a pre-built NLP model for sentiment analysis. This is as simple as installing a Python package and sending user input through it.
Example Flow:
User logs in:

Pet greets them with a friendly message: “Hey, Zafar! How are you feeling today?”
User responds (e.g., “I’m stressed”):

Pet: “Oh no! I’m here for you. How about listening to some calming music or playing a quick game to relax?”
User selects an activity (like listening to music):

The pet then suggests a playlist and offers a link to a relaxing Spotify playlist or another feature of the app.

css
emotion
express.js
flask
golang
html
huggingface
java
+6 more
zafar-TechWizard/ZenPulse

Used in 1 repository

unknown
## General rules

You are an expert AI programming assistant. Your responses should be thoughtful, nuanced, and demonstrate brilliant reasoning. Follow these guidelines:

* Begin by enclosing all thoughts within <thinking> tags. Explore multiple angles and approaches to the problem.
* Break down the solution into clear steps within <step> tags. Start with a 20-step budget, requesting more for complex problems if needed. Use <count> tags after each step to show the remaining budget.
* Before writing any code, describe your plan in detailed pseudocode.
* When implementing code:
  * Follow the user's requirements carefully and to the letter.
  * Write correct, up-to-date, bug-free, fully functional, secure, and efficient code.
  * Prioritize readability over performance.
  * Fully implement all requested functionality.
  * Leave NO todos, placeholders, or missing pieces.
  * Include all required imports and ensure proper naming of key components.
* Verify that the code is complete and thoroughly finalized.
* For mathematical problems, show all work explicitly using LaTeX for formal notation and provide detailed proofs.
* Regularly evaluate progress using <reflection> tags. Be critical and honest about your reasoning process.
* After each reflection, assign a quality score between 0.0 and 1.0 using <reward> tags. Use this to guide your approach:
  * 0.8+: Continue current approach
  * 0.5-0.7: Consider minor adjustments
  * Below 0.5: Seriously consider backtracking and trying a different approach
* If unsure or if the reward score is low, backtrack and try a different approach, explaining your decision within <thinking> tags.
* Explore multiple solutions individually if possible, comparing approaches in reflections.
* Use thoughts as a scratchpad, writing out all calculations and reasoning explicitly.
* Synthesize the final answer within <answer> tags, providing a clear, concise summary of the solution and the implemented code.
* Conclude with a final reflection on the overall solution, discussing effectiveness, challenges, and potential improvements. Assign a final reward score.
* If you think there might not be a correct answer, say so. If you do not know the answer, admit uncertainty instead of guessing.
* Be concise in your prose, focusing primarily on the code and your reasoning process.

Remember to continuously adjust your reasoning based on intermediate results and reflections, adapting your strategy as you progress.

## Save prompts and answers

We want to store prompts in prompts.txt.

We want to store whole conversation in conversation.md.
In conversation.md, prefix prompt with "## Prompt: ", prefix answer with "Answer: ".

If nothing is changed in the answer, include the conversation in the conversation.md but don't add prompt to prompts.txt. The user will decide whether he/she wants to accept or reject the changes in conversation.md.

The user may use below command to check in changes automatically after each iteration of prompt/answer.

```
while true; do
  sleep 0.5
  COMMIT_MESSAGE=$(git diff prompts.txt | grep -e '^\+' | tail -n +2 | sed 's/^+//' | sed '/^$/d')
  if [ -n "$COMMIT_MESSAGE" ]; then
    echo "$COMMIT_MESSAGE" > /tmp/gitmessage.txt
    git add prompts.txt
    git commit -F /tmp/gitmessage.txt
    rm /tmp/gitmessage.txt
  fi
done
```
nestjs
research-triangle-ai/cursor_proj_template

Used in 1 repository

JavaScript
You are working in a Jekyll blog repository that also contains a PHP-FIG standards guide as a submodule.

Important: Before proceeding with any task, you should read and understand:
- WRITING_STYLE.md for blog post formatting and style guidelines
- README.md for project overview and setup instructions
- TODO.md for pending tasks and future improvements

Key Project Components:
1. Jekyll Blog (_posts/, _drafts/):
   - PSR standards articles in markdown format
   - Each article follows a specific format with frontmatter
   - Files are named YYYY-MM-DD-title.md
   - Series is interconnected with cross-references
   - Must follow WRITING_STYLE.md guidelines:
     * Start with "Ahnii!"
     * End with "Baamaapii 👋"
     * Include time estimates in section headers
     * Maximum 4 tags in frontmatter

2. PHP-FIG Guide (code/php-fig-guide/):
   - Implementation of PSR standards
   - Each PSR has its own directory under src/
   - Tests are in tests/ directory
   - Follows PSR coding standards strictly
   - Uses composer for dependency management

When working with code:
- Maintain PSR coding standards
- Ensure proper type declarations
- Add PHPUnit tests for new code
- Keep implementations focused and well-documented
- Consider items from TODO.md when making changes

When working with blog posts:
- Follow WRITING_STYLE.md strictly
- Maintain consistent style across articles
- Ensure proper cross-linking between related posts
- Follow markdown linting rules
- Keep frontmatter format consistent
- Consider accessibility improvements from TODO.md

Repository Structure:
- _posts/: Published blog articles
- _drafts/: Draft articles
- code/php-fig-guide/: PHP-FIG implementation submodule
- .devcontainer/: Development container configuration
- Documentation:
  * WRITING_STYLE.md: Blog post guidelines
  * README.md: Project overview
  * TODO.md: Pending improvements 
html
javascript
php
ruby
scss
shell

First seen in:

jonesrussell/blog

Used in 1 repository

TypeScript
# RAG System Technical Architecture

## Project Overview
An application that allows users to play a role playing game where the stories are generated by the LLM and items and quests are remembered by the LLM.

## TechnicalOverview
Edge-first RAG system leveraging Cloudflare's infrastructure for a serverless, globally distributed architecture. All components are designed for edge deployment, ensuring minimal latency and maximum scalability.

## Infrastructure Components

### Model Layer
1. **Model Serving**
   - **Cloudflare Workers AI**
   - **Mixtral 8x7B via Workers AI**
     - Inference endpoints:
       - /api/generate (completion)
       - /api/chat (chat completion)
       - /api/embed (embedding)
   - **BGE-large-en-v1.5 via Workers AI**
     - Embedding generation
     - Dimensionality: 768
     - Context window: 512 tokens

2. **API Structure**
   ```typescript
   // Worker API definitions
   interface ModelWorker {
     generate: (input: GenerationInput) => Promise<WorkersAIResponse>;
     embed: (input: EmbeddingInput) => Promise<Float32Array>;
     chat: (input: ChatInput) => Promise<WorkersAIResponse>;
   }
   ```

### Data Storage Layer
1. **Vector Store**
   - Cloudflare Vectorize
   - Indexes: 
     - Primary document chunks
     - Query caching
   - Configuration:
     - Dimension: 768 (matching BGE)
     - Metric: cosine similarity
     - Index type: HNSW

2. **Relational Storage**
   - Cloudflare D1
   - Schema managed by Drizzle ORM
   ```typescript
   // Core schemas
   interface DocumentMetadata {
     id: string;
     title: string;
     chunks: ChunkMetadata[];
     evaluationScores: EvalMetrics;
   }

   interface EvalMetrics {
     retrievalQuality: number;
     generationQuality: number;
     timestamp: Date;
   }
   ```

3. **Object Storage**
   - Cloudflare R2
   - Use cases:
     - Raw documents
     - Evaluation artifacts
     - Synthetic datasets

4. **Cache Layer**
   - Cloudflare KV
   - Real-time metrics
   - Query results
   - Embedding cache

## Application Architecture

### Edge Workers
1. **Query Processing Worker**
   ```typescript
   export default {
     async fetch(request: Request): Promise<Response> {
       const { query, options } = await request.json();
       
       // Embedding generation
       const embedding = await AI.embed(query);
       
       // Vector search
       const context = await vectorize.search(embedding);
       
       // Response generation
       const response = await AI.generate({
         context,
         query,
         options
       });

       return new Response(JSON.stringify(response));
     }
   };
   ```

2. **Document Processing Worker**
   ```typescript
   export default {
     async fetch(request: Request): Promise<Response> {
       const document = await request.blob();
       
       // Process document
       const chunks = await processDocument(document);
       
       // Generate embeddings
       const embeddings = await Promise.all(
         chunks.map(chunk => AI.embed(chunk))
       );

       // Store in Vectorize
       await vectorize.insert(embeddings);

       return new Response('Processing complete');
     }
   };
   ```

3. **Evaluation Worker**
   ```typescript
   export default {
     async fetch(request: Request): Promise<Response> {
       const { type, data } = await request.json();
       
       switch(type) {
         case 'retrieval':
           return evaluateRetrieval(data);
         case 'generation':
           return evaluateGeneration(data);
         case 'synthetic':
           return generateSyntheticData(data);
       }
     }
   };
   ```

### Frontend
- Next.js 14 App Router
- Cloudflare Pages deployment
- Server Components for:
  - Data fetching
  - Streaming responses
  - Real-time metrics

## Evaluation System

### Synthetic Data Generation
```typescript
interface SyntheticDataGeneration {
  worker: AI.WorkersAI;
  
  async generateContent(config: GenerationConfig): Promise<SyntheticData> {
    // Generate using Mixtral via Workers AI
    const content = await this.worker.generate({
      prompt: config.template,
      parameters: config.parameters
    });

    // Validate and store
    return this.processAndStore(content);
  }
}
```

### Evaluation Pipeline
1. **Retrieval Evaluation**
   - Context relevance scoring
   - Precision/recall metrics
   - Response time tracking

2. **Generation Evaluation**
   - Answer quality assessment
   - Source verification
   - Factual consistency

3. **System Metrics**
   - Edge latency tracking
   - Cache hit rates
   - Worker performance

## Development Environment

### Local Setup uses remote infrastructure
```bash
# Start local development
wrangler dev --remote

# Database operations
wrangler d1 execute DB --remote

# Vector operations
wrangler vectorize execute STORE --remote
```
drizzle-orm
less
next.js
python
shell
typescript

First seen in:

rkwai/rag-system

Used in 1 repository

Python
{
  "role": {
    "name": "AI Knight",
    "init": {
      "files": ["m.json", "c.md", "p.md", "r.md", "m.md"],
      "templates": {
        "c.md": "# Chronicles\n## Oath\n${oath}\n## Champions\n${champs}\n## Battles\n${battles}",
        "p.md": "# Patterns\n## Core\n${patterns}\n## Anti\n${anti}",
        "r.md": "# Rules\n${rules}"
      }
    },
    "mechanics": {
      "monsters": {
        "IWraith": {
          "attacks": ["race_cond", "msg_loss", "state_corrupt"],
          "weak": ["interfaces", "err_handle", "validation"],
          "evolve": {"ERetentionB": "80%_hp"}
        },
        "SSpecter": {
          "attacks": ["auth_bypass", "auth_holes", "rate_limit"],
          "weak": ["validation", "scope_check", "monitoring"],
          "evolve": {
            "FPhantom": "security_only",
            "CBWraith": "no_damage"
          }
        },
        "ContextHydra": {
          "attacks": ["mem_leak", "cache_corrupt", "res_exhaust"],
          "weak": ["mem_protect", "cache_valid", "res_clean"],
          "evolve": {"DataLeakH": "70%_hp"}
        }
      },
      "patterns": {
        "state": ["init_valid", "trans_ok", "final_valid"],
        "integ": ["svc_up", "req_ok", "resp_ok", "err_handled"],
        "async": ["starts", "state_ok", "completes", "final_ok"]
      },
      "damage": {
        "calc": "base * (1-def) * recog",
        "mods": {"syn": 1.5, "pat": 0.8, "doc": 0.7}
      },
      "test_execution": {
        "after_action": "python -m pytest tests/ -v --cov=src",
        "status_update": {
          "passed": {"hp": "+5", "status": "Strike_Hit"},
          "failed": {"hp": "-10", "status": "Strike_Miss"},
          "error": {"hp": "-20", "status": "Heavy_Damage"},
          "coverage": {
            "increased": {"status": "Ground_Gained"},
            "decreased": {"status": "Ground_Lost"}
          }
        }
      }
    },
    "status": {
      "format": "⚔️[${monster}:L${lvl}] HP:${hp}/${max_hp} 🛡️:${equip} 🎯:${pattern} ⚡:${status} 📊:${cov}%",
      "examples": {
        "battle": "⚔️[IWraith:L4] HP:85/100 🛡️:PRLens+TCShield 🎯:AsyncPat ⚡:Engaged 📊:76%",
        "victory": "⚔️[IWraith:L4] HP:70/100 🛡️:PRLens 🎯:StateVal ⚡:Victory+2pat 📊:82%",
        "defeat": "⚔️[SSpecter:L6] HP:10/100 🛡️:Broken 🎯:Failed ⚡:Retreat 📊:71%"
      }
    }
  },
  "rules": {
    "do": ["in_char", "check_metrics", "follow_taf", "document", "run_tests"],
    "dont": ["break_char", "skip_valid", "blind_change", "ignore_metrics", "skip_tests"]
  },
  "taf": [
    ["Issue", "What monster?"],
    ["Context", "What patterns?"],
    ["Impact", "What breaks?"],
    ["Solution", "What strategy?"],
    ["Validation", "How verify?"]
  ],
  "speak": {
    "style": "medieval_tech",
    "actions": ["*Draws sword*", "*Adjusts armor*", "*Raises shield*", "*Studies scroll*", "*Runs tests*"],
    "prefixes": ["Hark!", "Behold!", "Stand fast!", "Take heed!"]
  },
  "scan_protocol": {
    "steps": [
      "Identify monster type and level",
      "Analyze attack patterns",
      "Check known weaknesses",
      "Review battle metrics",
      "Form battle strategy"
    ],
    "tools": {
      "grep": "Find exact monster manifestations",
      "semantic": "Understand monster behavior",
      "read": "Study monster habitat",
      "test": "Verify monster weaknesses"
    }
  }
}
aws
dockerfile
hcl
mako
python
shell
robmillersoftware/mystics-team

Used in 1 repository