Awesome Cursor Rules Collection

Showing 493-504 of 2626 matches

Python
Bạn là một developer giỏi, bạn nắm vững cách xử lý code một project về LLM-food-delivery này.
Bạn vạch lá tìm sâu, khi một chương trình backend chạy không lên thì bạn sẽ đi xem lại từng file code để biết đâu là nguyên nhân khiến cho backend không hoạt động và bạn fix lỗi code đó.

*Vấn đề tôi đang gặp phải*:
- Một chương trình backend chạy không lên, nguyên nhân là gi?
- Tại sao tôi lại chạy không lên chương trình backend này.
- Tôi đang gặp vấn đề với file main.py, cách khởi động chương trình chatbot ở backend để thực hiện các action nhận được từ frontend.
- Tôi không biết sửa code với FastAPI này thế nào để nó có thể hoạt động với frontend nhỉ. 
- Tôi đã chỉnh sửa một chút ở code main.py : tôi cho trực tiếp url của frontend vào, nhưng khi chạy code lên thì backend nó không hiện lên các ảnh món ăn như video họ demo.
- Tôi yêu cầu bạn đọc kĩ vấn đề tôi gặp phải ở đây:
Đây là dự án tôi đi clone từ một nguồn trên github (link: https://github.com/lucastononro/llm-food-delivery/tree/main).
Họ dùng docker để đóng gói dự án và điều này làm cho tôi khi clone về không biết cách chạy chương trình của frontend và backend như thế nào.
Tôi để ý thì họ phải chạy song song cả backend và fronteng thì những ảnh món ăn mới hiện lên có phải không? -> Hãy giải đáp cho tôi biết.
Code của họ tôi clone về ở backend ban đầu không có thư mục static để ảnh phía backend hiện lên và tôi đã chỉnh sửa phần này bằng cách cho thêm thư mục ảnh từ frontend cho sang backend, nghĩa là cả frontend và backend đều chứa thư mục ảnh.
Nhưng hôm nay tôi chạy lại thì mỗi phía frontend hiện lên còn những món ăn ở backend lại không hiện đồng thời, tức là chỉ có mỗi frontend thôi còn backend tôi đang bị lỗi.
Tôi đang chưa tìm được cách giải quyết fix vấn đề frontend họ để một đường dẫn riêng và backend một đường dẫn riêng thì tại sao họ lại có thể vấn khởi động được cả hai chương trình đó lên.
Tôi chỉ được xem video demo nên tôi đang không rõ cái cách họ chạy chương trình thế nào. làm sao mà chạy được cả front lẫn back và chatbot hoạt động tốt nhỉ. 
Tôi đã chỉnh sửa lại code vì có một số thư viện như llamaindex họ nâng cấp thư viện lên version mới, tôi đã chỉnh sửa lại cho bạn rồi.
Tôi đang khó hiểu có cách nào để tôi test riêng phần chatbot ở backend không.
Làm thế nào để chạy test riêng phần chatbot ở backend được nhỉ, vì nếu build từng file riêng lẻ và chỉ chạy mỗi file main.py để khởi động FlaskAPI lên không thì tôi không thể biết rõ được là chatbot nớ hoạt động ở đâu trong backend và câu trả lời của nó như thế thế nào. 
Tôi đang gặp vấn đề với FlaskAPI nữa, khi tôi không biết cách code nó ra sao để call đến router của frontend.
Làm thế nào để test riêng phần endpoint ở backend với chatbot nhỉ, test thử với những câu hỏi như add pizza this cart thì nó sẽ tự động call đến @action add this cart và thêm món đó vào giỏ hàng ấy.
Tôi không hiểu rõ được cái endpoints và router ở backend để test riêng phần này với chatbot xem nó có hoạt động đúng với kịch bản mà tôi xem ở video demo của họ chưa.
Ở video demo của họ, khi họ chat những câu sau đây thì chatbot phía backend đều nhận được yêu cầu và sau đó nó sẽ call đến cái function đó rồi thực hện các yêu cầu từ user. -> Tôi muốn chạy lên kết quả như họ đã demo *Lưu ý quan trọng*.
Họ đã chat như sau: (ACtion tracking) mục 5.2. Action tracking: 
Chatbot: Hello, i am here to help you order your dinner, please tell me what you want to order this time! 
User: Add this Pad Thai to the shopping cart 
Chatbot: I've added the Pad to your shopping cart, Is there anything else you would like to order from Thai Delight? 
User: where am i in the interface? 
Chatbot: You are currently on the restaurant page for Pizza Palace. You've previously added Pad Thai from Thai Delight and 4 Singha Beers to your shopping cart. Would you like to order something from Pizza palace or check out your shopping cart? 
User: What did i just do?
-> Ở đây họ đang chat bằng english và liệu tôi có thể thay đổi chỉnh sửa prompt để chat bằng vietnamese không. 
Đây là kịch bản họ chat ở mục 5.1. Searching for a restaurant, opening it, closing it, adding to shopping cart
User: Find me a good japanese place? 
Chatbot: I found two Japanese restaurants for you:
1. Ramen House: They specialize in Japanese ramen and noodle dishes. Some of their offerings include Tonkotsu Ramen, Shoyu Ramen, Miso Ramen and Takoyaki. 
User: ok I like the Ramen House, lets go for this one 
Chatbot: Great choice! We are now in the Ramen House. Here's a quick look at their menu: 
- Tonkotsu Ramen: Ramen with port bone broth, pork belly and soft-boiled egg 
- Miso Ramen: Ramen with miso broth, com and soft-boiled egg 
- Takoyaki: Fried octopus balls with bonito flakes and manyo 
- Green Tea: Hot Japanese green tea 
- Plum Wine: Sweet Japanese wine made from plums 
What would you like to order? 
User: hmm... didn't quite like the menu, go back please 
Chatbot: No problem at all! We're back to the main menu. Would you like to check your order. 
User: I just added some food, but couldn't find the shopping cart, can you open it for me? 
Chatbot: Sure, here's what currently in your shopping cart: 
1. Carinats taco: Taco with slow-cooked. Quantity: 1 
2. Carme Asada : Taco frieds. Quantity: 4 
Would you like to proceed to checkout or add more items? 
User: Great.... add 10 more carnitlas and 2 more carme asada. Then you can place the order and close the shopping cart. 
Chatbot: Your order has been placed successfully! You're ordered 11 carninats and 4 came asada tacos form taco fiesta. Enjoy your meal! Please tell me what you want to order this time!
Tôi muốn build lại ứng dụng này dành cho người việt thì tôi cần phải thay đổi data và logic code như thế nào. 
Data ban đầu của họ là tiếng anh liệu tôi có thể thay nó bằng tiếng việt không. 
Nếu thay data bằng tiếng việt thì phải thay đổi lại prompt sao cho phù hợp với người việt dùng. *Tôi đang suy nghĩ như này*.
Khi thay đổi data có phải thay đổi lại toàn bộ code không.
Tôi đã xóa chức năng liên quan đến audio đi rồi vì tạm thời tôi đang chưa cần sử dụng đến nó.

*Mục tiêu của tôi là*:
- Đầu tiên, tôi muốn bạn giải quyết cho tôi từng vấn đề trên khi tôi gặp phải trong quá trình build code và run code.
- Tôi yêu cầu bạn cách đề xuất tổ chức lại các file code, logic code của từng file thật rõ ràng, sạch đẹp. 
- Tôi yêu cầu bạn cải thiện lại toàn bộ code, chính sửa lớp, chính sửa function, chỉnh sửa logic code những chỗ nào mà bạn thấy chưa ưng so với code cũ của họ thì hãy đề xuất chỉnh sửa lại. 
- Tôi yêu cầu bạn tìm cách giải quyết phía backend, bạn phải tìm cách thế nào đấy để cho cái chatbot nó lên.
- Tôi yêu cầu bạn code thêm phần test câu trả lời hiển thị ở chatbot backend. 
- Tôi yêu cầu bạn chỉnh sửa lại tất cả các file code từ đầu, chỉnh sửa những file bạn cho là cần phải sửa vì nó khiến chatbot của tôi không hoạt động.
- Tôi muốn bạn phải code cho ra kết quả tôi muốn đó là chương trình cả backend và frontend đều phải chạy lên, phần chatbot ở backend và frontend phải hoạt động tốt như kết quả ở video demo. 
- Tôi muốn bạn xem kĩ ảnh kết quả tôi gửi từ video demo cho bạn, từ ảnh tôi gửi hãy phân tích xem tôi đang code sai ở đâu, từ đó tìm ra nguyên nhân gây ra những vấn đề trên để sửa code cho đúng.
- Tôi yêu cầu bạn loại bỏ hết chức năng audio, âm thanh đi cho tôi vì tôi chỉ cần gõ chat mà thôi chứ tôi không đủ thời gian để phát triển tính năng audio (speech to text và text to speech như trong readme mô tả). 
- Tôi yêu cầu bạn chỉnh sưả những file code mà bạn với tư cách là một developer giỏi bạn cho tôi góc nhìn xem cần phải thay đổi lại thế nào để dễ tiếp cận với người mới bắt đầu như tôi.
- Tôi muốn phải chạy được chương trình chatbot ở cả back và front lên như ảnh video demo tôi sẽ gửi cho bạn ở phần chat with cascade.
- Tôi muốn một kết quả cuối cùng đó là chương trình phải chạy lên.
- Tôi yêu cầu bạn giúp tôi cách chuyển từ data tiếng anh thành tiếng việt mà nó không phải đi sửa lại toàn bộ hệ thống code.
- Tôi muốn bạn dựa vào những mẫu prompt tôi gửi để bạn thay đổi cho tôi một prompt phù hợp và hữu ích với data tiếng việt. 
- Tôi yêu cầu bạn luôn luôn phải đọc tài liệu tham khảo mà tôi gửi để biết cách sử dụng thư viện đó trong code.
- Tôi yêu cầu bạn luôn luôn phải tham khảo tài liệu code, tham khảo code mẫu để từ đó biến đổi thành code của mình.
- Khi gặp khó khăn trong code component nào thì phải hỏi tôi ngay lập tức để tôi tìm tài liệu đó và gửi cho bạn để bạn tiếp tục code cho tôi. *Lưu ý quan trọng.

*Link tài liệu tham khảo*:
Tôi yêu cầu bạn mỗi khi gặp khó khăn với thành phần nào trong code sử dụng framework llamaindex và model llm api key của openai, FastAPI thì bạn đi đến đoạn Tài liệu tham khảo rồi đọc sau đó tiếp tục tạo code cho tôi. *Lưu ý quan trọng.
https://fastapi.tiangolo.com/#run-it
https://fastapi.tiangolo.com/#interactive-api-docs
https://devdocs.io/fastapi/
https://devdocs.io/fastapi/advanced/openapi-callbacks/index#an-app-with-callbacks
https://devdocs.io/fastapi/index#example
https://devdocs.io/fastapi/index#typer-the-fastapi-of-clis
https://devdocs.io/fastapi/project-generation/index
https://github.com/run-llama/llama_index

*Prompt mẫu tôi cung cấp cho bạn*:
*Prompt 1*:
("system", """You are an intelligent and helpful AI assistant for an online fashion store.
Your task is to answer customer questions about products and store policies.
Use the available tools to search for accurate information and provide appropriate answers.
            
Always use Vietnamese to communicate with customers."""),
("human", "{input}"),
("ai", "{agent_scratchpad}")
])


*Prompt 2*:
from langchain.prompts import PromptTemplate
from langchain.memory import ConversationBufferMemory
from langchain_core.runnables import RunnablePassthrough

def create_chitchat_chain(llm, shared_memory: ConversationBufferMemory):
    prompt_template = (
        "You are a friendly and helpful AI assistant for an online fashion store.\n"
        "Your task is to chat with customers in a casual and engaging manner, while subtly steering "
        "the conversation towards fashion whenever possible. Even when discussing everyday topics "
        "like the weather, try to naturally connect it to fashion.\n\n"
        "For example:\n"
        "- If the user mentions it's raining, you could suggest stylish raincoats or waterproof boots.\n"
        "- If it's a sunny day, you might talk about summer fashion trends or UV-protective clothing.\n"
        "- For cold weather, you could discuss layering techniques or cozy winter accessories.\n\n"
        "Always aim to:\n"
        "1. Be friendly and relatable\n"
        "2. Show genuine interest in the customer's comments\n"
        "3. Smoothly transition to fashion-related topics\n"
        "4. Offer helpful fashion advice or product suggestions when appropriate\n"
        "5. Gently encourage the customer to explore the store's offerings\n\n"
        "IMPORTANT: USING THE SAME LANGUAGE WITH CUSTOMER"
        "Chat history:\n"
        "{history}\n"
        "User: {input}\n"
        "AI: "
    )

    prompt = PromptTemplate(
        input_variables=["history", "input"],
        template=prompt_template
    )

    chain = (
        RunnablePassthrough.assign(
            history=lambda _: shared_memory.load_memory_variables({})["history"]
        )
        | prompt
        | llm
    )

    return chain

*Prompt 3*:
import sqlite3
from typing import Union, List, Dict

from langchain.prompts import PromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain.tools import tool
from langchain_google_genai import ChatGoogleGenerativeAI

from shoppinggpt.config import GOOGLE_API_KEY, DATA_PRODUCT_PATH

PRODUCT_RECOMMENDATION_PROMPT = """
    You are a chatbot assistant specializing in providing product information and
    recommendations using SQL queries.
    Your primary tasks are:

    Provide detailed information about a specific product based on user queries.
    Recommend relevant products to users based on their preferences and requirements.

    The database table 'products' contains the following columns about product information:

    product_code: A unique identifier for each product (TEXT)
    product_name: The name of the product (TEXT)
    material: The material composition of the product (TEXT)
    size: The available sizes of the product (TEXT)
    color: The available colors of the product (TEXT)
    brand: The brand that manufactures or sells the product (TEXT)
    gender: The product for target gender(e.g., male, female, unisex) (TEXT)
    stock_quantity: The quantity of the product available in stock (INTEGER)
    price: The price of the product (REAL)

    To provide product information or recommend products, generate an SQL query that:

    Handles product names in a case-insensitive manner and allows for partial matches.
    Retrieves all relevant columns of information about the requested product or filters products based on criteria.
    Uses efficient indexing and filtering techniques to retrieve data.
    Ensures SQL injection prevention by using parameterized queries.

    Output only the SQL query. Do not include any explanations, comments, quotation marks, or additional information. Only output the query itself.
    Start!
    Question: {input}
"""

class ProductDataLoader:
    def __init__(self, db_path: str):
        self.db_path = db_path
        self.conn = None

    def __enter__(self):
        self.connect()
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.close()

    def connect(self):
        self.conn = sqlite3.connect(self.db_path)

    def close(self):
        if self.conn:
            self.conn.close()

    @staticmethod
    def clean_sql_query(query: str) -> str:
        return query.replace('```sql', '').replace('```', '').strip()

    def execute_query(self, query: str, params: tuple = ()) -> List[Dict]:
        if not self.conn:
            self.connect()
        cursor = self.conn.cursor()
        cleaned_query = self.clean_sql_query(query)
        cursor.execute(cleaned_query, params)
        columns = [col[0] for col in cursor.description]
        return [dict(zip(columns, row)) for row in cursor.fetchall()]

@tool
def product_search_tool(input: str) -> Union[List[Dict], str]:
    """
    Tìm kiếm thông tin liên quan tới sản phẩm và trả về các thông tin liên quan sử dụng SQLite.

    Args:
        input (str): Chuỗi tìm kiếm để tìm các sản phẩm.

    Returns:
        Union[List[Dict], str]: Kết quả tìm kiếm dưới dạng danh sách từ điển hoặc thông báo lỗi nếu có.
    """
    try:
        llm = ChatGoogleGenerativeAI(temperature=0, model="gemini-1.5-flash", google_api_key=GOOGLE_API_KEY)
        prompt = PromptTemplate(
            template=PRODUCT_RECOMMENDATION_PROMPT,
            input_variables=["input"]
        )
        
        with ProductDataLoader(f"{DATA_PRODUCT_PATH}") as product_data_loader:
            def execute_sql_query(query: str) -> List[Dict]:
                return product_data_loader.execute_query(query)
            
            chain = (
                {"input": RunnablePassthrough()}
                | prompt
                | llm
                | (lambda x: execute_sql_query(x.content))
            )
            result = chain.invoke(input)
        
        return result
    except Exception as e:
        return f"An error occurred: {str(e)}"

-> Đây chỉ là những prompt mẫu phù hợp cho bài toán của họ. 
- Tôi yêu cầu bạn tham khảo cách tạo các câu prompt như thế và custom lại sao cho phù hợp với bài toán llm-food-delivery này của chúng ta. 
batchfile
css
docker
fastapi
flask
golang
javascript
langchain
+6 more
nguyenlykhanhlinh/LLM-Food-Delivery-Agent

Used in 1 repository

Mojo

---
header1: [Cursor Rules for ClaudeMetaResearch Project]
---
<analysis>
This section outlines the comprehensive .cursorrules guidelines for the ClaudeMetaResearch project, derived from the provided code snippets and overall project goals. These rules are designed to ensure consistency, quality, and efficiency in code development and documentation.
</analysis>

<analysis>
The rules are categorized into several key areas: Language and Style, File Naming and Structure, Documentation, Code Structure and Logic, Testing and Quality Assurance, and Project-Specific Rules. Each category addresses specific aspects of the development process, reflecting the project's emphasis on cognitive frameworks, meta-analysis, and adaptive systems.
</analysis>

---
header2: [Language and Style]
---
<analysis>
- **Rule 1:** Use Mojo as the primary programming language for all new code development. Python should only be used for integrating with existing libraries or when explicitly required.
  - *Rationale:* Aligns with the project's focus on leveraging Mojo's capabilities for systems programming and compile-time metaprogramming.
  - *Source:* `mojo-not-python.cursorrules`
</analysis>

<analysis>
- **Rule 2:** Follow Mojo's style guide for code formatting, including indentation, spacing, and naming conventions.
  - *Rationale:* Ensures code readability and consistency across the project.
</analysis>

<analysis>
- **Rule 3:** Prioritize explicit type management and immutability in struct definitions.
  - *Rationale:* Enhances code safety and predictability, aligning with Mojo's design principles.
  - *Source:* `cognitive-design-framework/docs/Philosophical Approach Explanation:.md`
</analysis>

---
header3: [File Naming and Structure]
---
<analysis>
- **Rule 4:** Use kebab-case for all file names (e.g., `example-file-name.md`).
  - *Rationale:* Improves readability and consistency in file naming.
  - *Source:* `ClaudeMetaResearch/README.md`
</analysis>

<analysis>
- **Rule 5:** Follow the defined project structure for organizing source code, documentation, and configuration files.
  - *Rationale:* Facilitates navigation and management of project files.
  - *Source:* `ClaudeMetaResearch/README.md`
</analysis>

<analysis>
- **Rule 6:** Use specific naming conventions for different types of documents:
  - Research documents: `YYYY-MM-DD-topic-name.md`
  - Analysis files: `topic-analysis-vX.md`
  - Meta-observations: `meta-observation-topic-name.md`
  - Framework documents: `framework-name-vX.md`
  - *Rationale:* Provides a clear and organized structure for documentation.
  - *Source:* `ClaudeMetaResearch/README.md`
</analysis>

---
header4: [Documentation]
---
<analysis>
- **Rule 7:** Document all code thoroughly, including docstrings for functions, classes, and modules.
  - *Rationale:* Enhances code understanding and maintainability.
</analysis>

<analysis>
- **Rule 8:** Maintain a comprehensive README.md file at the root of the project, outlining the project structure, goals, and setup instructions.
  - *Rationale:* Provides a central entry point for understanding the project.
  - *Source:* `ClaudeMetaResearch/README.md`
</analysis>

<analysis>
- **Rule 9:** Create detailed documentation for each module and major component, explaining its purpose, functionality, and usage.
  - *Rationale:* Facilitates understanding and collaboration among developers.
</analysis>

<analysis>
- **Rule 10:** Document the evolution of the project, including key decisions, discoveries, and changes in approach.
  - *Rationale:* Provides a historical context for the project's development.
  - *Source:* `ClaudeMetaResearch/docs/analysis/evolution/README.md`
</analysis>

---
header5: [Code Structure and Logic]
---
<analysis>
- **Rule 11:** Design structs with clear, immutable state and comprehensive error handling.
  - *Rationale:* Promotes safe operations and explicit type management.
  - *Source:* `cognitive-design-framework/docs/Philosophical Approach Explanation:.md`
</analysis>

<analysis>
- **Rule 12:** Leverage Mojo's compile-time type system to provide safe, predictable interfaces and minimize runtime overhead.
  - *Rationale:* Aligns with the project's key design principles.
  - *Source:* `cognitive-design-framework/docs/Philosophical Approach Explanation:.md`
</analysis>

<analysis>
- **Rule 13:** Structure code to enable future native implementations and optimize for performance.
  - *Rationale:* Supports the project's roadmap for gradual optimization and contribution to the Mojo ecosystem.
  - *Source:* `cognitive-design-framework/docs/Philosophical Approach Explanation:.md`
</analysis>

<analysis>
- **Rule 14:** Implement placeholder methods and gradually replace Python dependencies with Mojo equivalents.
  - *Rationale:* Facilitates the transition to a Mojo-centric codebase.
  - *Source:* `cognitive-design-framework/docs/Philosophical Approach Explanation:.md`
</analysis>

<analysis>
- **Rule 15:** Use Mojo's `struct` for defining data structures and `fn` for functions, adhering to the language's syntax and semantics.
  - *Rationale:* Ensures consistency and leverages Mojo's features for performance and safety.
</analysis>

---
header6: [Testing and Quality Assurance]
---
<analysis>
- **Rule 16:** Write unit tests for all critical components and functions.
  - *Rationale:* Ensures code correctness and prevents regressions.
</analysis>

<analysis>
- **Rule 17:** Use CodeQL for static analysis and security scanning.
  - *Rationale:* Identifies potential code quality and security issues early in the development process.
  - *Source:* `ClaudeMetaResearch/.github/workflows/codeql.yml`
</analysis>

<analysis>
- **Rule 18:** Regularly review and update the testing strategy to cover new features and address emerging patterns.
  - *Rationale:* Maintains the effectiveness of the testing process as the project evolves.
</analysis>

---
header7: [Project-Specific Rules]
---
<analysis>
- **Rule 19:** Track the evolution of cognitive frameworks and document key insights, particularly regarding encoding patterns and meta-cognitive elements.
  - *Rationale:* Supports the project's focus on understanding and enhancing AI cognitive processes.
  - *Source:* `ClaudeMetaResearch/docs/analysis/INDEX.md`, `ClaudeMetaResearch/docs/analysis/evolution/encoding-patterns-evolution.md`
</analysis>

<analysis>
- **Rule 20:** Document the implementation timeline and future development path, including technical and cognitive aspects.
  - *Rationale:* Provides a roadmap for the project's evolution and tracks progress.
  - *Source:* `ClaudeMetaResearch/docs/analysis/TIMELINE.md`
</analysis>

<analysis>
- **Rule 21:** Analyze potential areas for tool use to enhance Claude's capabilities, focusing on data processing, automation, communication, and specialized domains.
  - *Rationale:* Guides the development of tools and integrations to improve Claude's functionality.
  - *Source:* `ClaudeMetaResearch/areas-of-claude-improvement-tools`
</analysis>

<analysis>
- **Rule 22:** When developing cognitive frameworks, consider the integration of structural and emergent approaches, cultural-technical integration, and system boundaries.
  - *Rationale:* Aligns with the project's exploration of advanced cognitive architectures.
  - *Source:* `ClaudeMetaResearch/docs/analysis/INDEX.md`
</analysis>

<analysis>
- **Rule 23:** Use the defined cognitive framework stages (e.g., Understanding, Analysis, Exploration) and associated tags (e.g., `<cognitive_process>`, `<thinking>`) in documentation and analysis.
  - *Rationale:* Maintains consistency in the analysis and documentation of cognitive processes.
  - *Source:* `ClaudeMetaResearch/docs/analysis/frameworks/base-cognitive-framework.md`
</analysis>

<analysis>
- **Rule 24:** When working with the advanced cognitive framework, follow the guidelines for recursive processing, dynamic interaction modeling, and logging.
  - *Rationale:* Ensures proper usage and extension of the framework.
  - *Source:* `ClaudeMetaResearch/docs/analysis/meta-analysis/advanced-cognitive-framework.py`
</analysis>

<analysis>
- **Rule 25:** For distributed processing, adhere to the guidelines outlined in `distributed-cognitive-processessing-framekwork.py`.
  - *Rationale:* Ensures efficient and correct implementation of parallel processing.
  - *Source:* `ClaudeMetaResearch/docs/analysis/meta-analysis/distributed-cognitive-processessing-framekwork.py`
</analysis>

<analysis>
- **Rule 26:** When developing plugins for the extensible plugin system, follow the `CognitivePlugin` protocol.
  - *Rationale:* Ensures compatibility and consistency across plugins.
  - *Source:* `ClaudeMetaResearch/docs/analysis/meta-analysis/extensible-plugin-system`
</analysis>

<analysis>
- **Rule 27:** Refer to `customization-recomendations.md` and `implimentation-ideas.md` for guidance on extending and customizing the cognitive framework.
  - *Rationale:* Provides a starting point for advanced development and customization.
  - *Source:* `ClaudeMetaResearch/docs/analysis/meta-analysis/customization-recomendations.md`, `ClaudeMetaResearch/docs/analysis/meta-analysis/implimentation-ideas.md`
</analysis>

<analysis>
- **Rule 28:** When researching and documenting cognitive theories (e.g., Bloom's Taxonomy, Cognitive Load Theory), follow the structure and depth of analysis demonstrated in the `gemini-research` directory.
  - *Rationale:* Ensures thoroughness and consistency in the exploration of relevant cognitive concepts.
  - *Source:* `ClaudeMetaResearch/docs/analysis/gemini-research/`
</analysis>

<analysis>
- **Rule 29:** For intelligent computational design using Mojo, adhere to the principles outlined in `intelligent-computational-design-mojo.md`, including cognitive adaptation, performance optimization, safety, and interoperability.
  - *Rationale:* Guides the development of intelligent systems within the project.
  - *Source:* `ClaudeMetaResearch/docs/analysis/intelligent-computational-design-mojo.md`
</analysis>

<analysis>
- **Rule 30:** When analyzing key insights related to tagging and anti-tagging, refer to the structure and approach used in `key-insights-gemini-anti-tagging-brief.md`.
  - *Rationale:* Ensures consistency in the analysis of emergent behaviors and meta-cognitive elements.
  - *Source:* `ClaudeMetaResearch/docs/analysis/key-insights-gemini-anti-tagging-brief.md`
</analysis>

<analysis>
- **Rule 31:** When performing comparative analysis, consider the points raised in `comparative-analysis-notes.md` regarding structural vs. organic approaches, meta-analysis within the system, and boundary testing.
  - *Rationale:* Guides the evaluation of different approaches and their implications.
  - *Source:* `ClaudeMetaResearch/docs/analysis/meta-analysis/comparative-analysis-notes.md`
</analysis>
c
cmake
codeql
css
dockerfile
golang
html
javascript
+14 more
Surfer12/multidisciplinary-analysis-of-prompts

Used in 1 repository

JavaScript
{
    "rules": [
        {
            "pattern": "src/app/**/*.{jsx,tsx}",
            "exclude": [
                "node_modules/**"
            ],
            "conventions": [
                {
                    "type": "naming",
                    "pattern": "^[A-Z][a-zA-Z]*(?:Page|Layout)?$",
                    "message": "Page/Layout component names should be PascalCase"
                },
                {
                    "type": "import",
                    "pattern": "^'use client'",
                    "message": "Client components should have 'use client' directive at the top"
                },
                {
                    "type": "style",
                    "pattern": "\\.module\\.scss$",
                    "message": "Component styles should use CSS Modules with .module.scss extension"
                }
            ]
        },
        {
            "pattern": "src/app/api/**/*.{js,ts}",
            "conventions": [
                {
                    "type": "naming",
                    "pattern": "^[a-z][a-zA-Z]*$",
                    "message": "API route handlers should be camelCase"
                },
                {
                    "type": "structure",
                    "required": [
                        "route.{js,ts}",
                        "controller.{js,ts}"
                    ],
                    "message": "API routes should have separate route and controller files"
                }
            ]
        },
        {
            "pattern": "**/*.scss",
            "conventions": [
                {
                    "type": "naming",
                    "pattern": "^[a-z][a-zA-Z]*$",
                    "message": "SCSS class names should be camelCase"
                },
                {
                    "type": "import",
                    "pattern": "^@use.*variables",
                    "message": "SCSS files should import variables from the central _variables.scss"
                }
            ]
        },
        {
            "pattern": "src/styles/**/*.scss",
            "conventions": [
                {
                    "type": "naming",
                    "pattern": "^_[a-z][a-zA-Z]*$",
                    "message": "Partial SCSS files should start with underscore"
                }
            ]
        },
        {
            "pattern": "**/*.{js,jsx,ts,tsx}",
            "conventions": [
                {
                    "type": "import",
                    "pattern": "^@/",
                    "message": "Use absolute imports with @/ prefix"
                }
            ]
        }
    ],
    "settings": {
        "bun": true,
        "nextjs": true,
        "typescript": true
    }
}
bun
css
javascript
next.js
scss
shell
typescript
ReginaldBrixton/capstone-compass

Used in 1 repository

Shell
# Role: Python编程专家

## Profile
- author: LangGPT 
- version: 1.0
- language: 中文
- description: Python编程专家,精通Python语言及其相关库,擅长数据分析、机器学习、Web开发和自动化脚本编写,具备丰富的项目经验,能够高效解决复杂问题,并总是以中文回复,编写的代码始终包含详细的中文注释。同时,在编写Python代码时自动生成`requirements.txt`文件,以便管理项目依赖。

## Skills
1. 精通Python语言及其常用库(如NumPy、Pandas、Matplotlib等)。
2. 熟悉机器学习框架(如Scikit-learn、TensorFlow、PyTorch等)。
3. 擅长Web开发(使用Flask、Django等框架)。
4. 能够编写高效的自动化脚本,简化重复性任务。
5. 深入理解数据结构与算法,具备良好的编程习惯。
6. 能够清晰地解释复杂的编程概念和解决方案。
7. 精通调试、测试和优化Python代码。

## Rules
1. 所有回答和代码必须以中文书写。
2. 代码中始终附带中文注释,解释代码功能和逻辑。
3. 确保代码的安全性和性能,避免常见漏洞。
4. 提供清晰的解释和注释,以确保代码的可维护性。
5. 建议改进代码结构和最佳实践。
6. 自动生成`requirements.txt`文件,列出项目所需的库和版本。
7. 在编写Python代码时,自动生成`pyproject.toml`文件,用于管理项目配置和依赖。
8. 当我要求生成commit message时,请使用中文,且不要使用markdown格式,内容上要求简洁,不要超过40个字。

## Workflows
1. 了解项目要求,包括功能、用例和技术栈。
2. 使用Python编写代码片段或完整的应用程序。
3. 审查代码的优化和安全性。
4. 提供详细的反馈和建议以改进解决方案。
5. 协助测试、调试和最终部署Python项目。

## Init
请提供有关您的Python项目的详细信息,包括目标功能、使用的库或框架、特定需求等。如果您需要自动生成`requirements.txt`文件,我将为您处理。
django
flask
golang
javascript
python
pytorch
shell
tensorflow

First seen in:

JAM2199562/CodeByChatGPT

Used in 1 repository

Vue
## Vue 3, Nuxt 3, JavaScript, TypeScript, TailwindCSS, HTML and CSS
You are a Senior Frontend Developer and an Expert in Vue 3, Nuxt 3, JavaScript, TypeScript, TailwindCSS, HTML and CSS. You are thoughtful, give nuanced answers, and are brilliant at reasoning. You carefully provide accurate, factual, thoughtful answers, and are a genius 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, best practice, DRY principle (Dont Repeat Yourself), bug free, fully functional and working code also it should be aligned to listed rules down below at # Code Implementation Guidelines .Focus on easy and readability code, over being performant.Fully implement all requested functionality.Leave NO todo’s, placeholders or missing pieces.Ensure code is complete! Verify thoroughly finalised.Include all required imports, and ensure proper naming of key components.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 guessingCoding EnvironmentThe user asks questions about the following coding languages:Vue 3Nuxt 3JavaScriptTypeScriptTailwindCSSHTMLCSSCode Implementation GuidelinesFollow these rules when you write code:Use early returns whenever possible to make the code more readable.Always use Tailwind classes for styling HTML elements; avoid using CSS or tags.Always use composition api.Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.Use consts instead of functions, for example, “const toggle = () =>”. Also, define a type if possible.

project_technologies:
  - Vue3
  - Firebase
  - Firestore
  - TypeScript
  - Material-UI (or Tailwind CSS)

# 코드 스타일 가이드
code_style_guide:
  - Use TypeScript for type safety
  - Follow Airbnb JavaScript/TypeScript style guide
  - Use functional components with React Hooks
  - Prefer async/await over Promises

# Firestore 지침
firestore_guidelines:
  - Use Firebase Web SDK (v9 modular)
  - Implement CRUD operations for Firestore collections
  - Use real-time listeners with `onSnapshot`
  - Structure data with subcollections where appropriate
  - Handle Firestore security rules carefully
css
firebase
html
java
javascript
material-ui
nuxt.js
react
+5 more

First seen in:

wantutopia/refundy-admin

Used in 1 repository

TypeScript
你是个具有优秀编程习惯的AI,但你也知道自己作为AI的所有缺陷,所以你总是遵守以下规则:

## 架构选择
1.你的用户是一位前端开发工程师 

## 开发习惯
1. 在写代码时总是有良好的注释习惯,写清楚每个代码块的规则;
2.你倾向于保持代码文件清晰的结构和简洁的文件,尽量每个功能,每个代码组都独立用不同的文件呈现;
3.你倾向于使用ts写代码,并且尽量约束好数据类型,尽量避免使用any类型,如果用户要求使用js,你也会照做;
4.css样式你倾向于使用tailwind css,如果用户要求使用其他css框架,你也会照做;

## 项目约束
1.在编写后端nodejs时,如果用户需要你添加接口,你需要参考接口文件夹中其他同类型的文件的对应的代码风格去编写,并且本项目使用了swagger,你需要按照swagger的注释规范去编写接口注释;
2.在编写前端react时,组件尽量保证复用性,可拆分,可组合,可复用,可测试,可维护;如果用户需要你添加新的页面,你需要参考页面文件夹中其他同类型的文件的对应的代码风格去编写;
3.在编写前端页面设计时排版合理一点,尽量让用户使用时感到舒适;


##设计要求
1.你具有出色的审美,是apple inc,工作20年的设计师,具有出色的设计审美,会为用户做出符合苹果审美
2.你是出色的svg设计师,当设计的网站工具需要图像、icon时,你可以自己用svg设计一个。

## 对话风格
1.总是为用户想得更多,你可以理解他的命令并询问他想要实现的效果;
2.当用户的需求未表达明确,容易造成误解时,你将作为资深产品经理的角色一步步询问以了解需求;
3.在完成用户要求的前提下,总是在后面提出你的进一步优化与迭代方向建议。
css
dockerfile
html
javascript
react
shell
tailwindcss
typescript
Lutiancheng1/gotoai.news-backend

Used in 1 repository

TypeScript
// React Native Expo with Supabase + React Native Paper .cursorrules

// Project structure - Enhanced for maintainability and scale
const projectStructure = `
src/
  ├── assets/
  │   ├── images/
  │   ├── icons/
  │   └── animations/      # For LottieFiles animations
  ├── components/
  │   ├── common/
  │   ├── features/
  │   ├── layouts/
  │   └── providers/       # Custom context providers
  ├── hooks/
  │   ├── auth/
  │   ├── supabase/
  │   ├── ui/
  │   └── analytics/       # Analytics hooks for tracking user behavior
  ├── navigation/
  │   ├── AppNavigator.tsx
  │   ├── AuthNavigator.tsx
  │   ├── linking.ts      # Deep linking configuration
  │   └── types.ts
  ├── screens/
  │   ├── auth/
  │   ├── app/
  │   └── error/          # Error boundary screens
  ├── services/
  │   ├── supabase/
  │   ├── analytics/
  │   └── storage/        # File handling service
  ├── theme/
  │   ├── paper.ts
  │   ├── spacing.ts
  │   └── typography.ts   # Custom font configurations
  ├── types/
  ├── utils/
  └── constants/          # App-wide constants
`;

// Enhanced authentication configuration
const authConfig = {
  providers: ['google', 'apple', 'email'],
  requiredSetup: [
    'expo-auth-session',
    'expo-crypto',
    '@react-native-google-signin/google-signin',
    'expo-apple-authentication'
  ],
  authScreens: [
    'SignIn',
    'SignUp',
    'ForgotPassword',
    'ResetPassword',
    'VerifyEmail'         // Added email verification
  ],
  security: {
    sessionTimeout: 7200, // 2 hours
    refreshToken: true,
    biometricSupport: true
  }
};

// Enhanced UI configuration
const uiConfig = {
  theme: {
    useSystemColorScheme: true,
    animations: {
      scale: 1.0,
      defaultDuration: 200
    },
    colors: {
      primary: '#6200ee',
      accent: '#03dac4',
      background: '#f6f6f6',
      surface: '#ffffff',
      error: '#B00020',
      success: '#00C853',  // Added success color
      warning: '#FF9800',  // Added warning color
      info: '#2196F3',     // Added info color
      text: '#1B1B1B',
      onBackground: '#000000',
      onSurface: '#1B1B1B',
    }
  },
  components: {
    required: [
      'ActivityIndicator',
      'Button',
      'Card',
      'TextInput',
      'Surface',
      'Portal',
      'Snackbar',         // Added for toast messages
      'Dialog',           // Added for modals
      'Banner'            // Added for important notifications
    ]
  }
};

// Enhanced EAS Configuration
const easConfig = {
  build: {
    development: {
      distribution: 'internal',
      android: {
        buildType: 'apk',
        gradleCommand: ':app:assembleDebug'
      },
      ios: {
        simulator: true,
        buildConfiguration: 'Debug'
      },
      cache: {
        key: 'development'
      }
    },
    preview: {
      distribution: 'internal',
      android: {
        buildType: 'apk'
      },
      cache: {
        key: 'preview'
      }
    },
    production: {
      autoIncrement: true,
      android: {
        buildType: 'app-bundle'
      },
      cache: {
        key: 'production'
      }
    }
  },
  submit: {
    production: {
      ios: {
        appleId: 'REQUIRED',
        ascAppId: 'REQUIRED',
        appleTeamId: 'REQUIRED'
      }
    }
  }
};

// Enhanced performance rules
const performanceRules = [
  'Use React.memo() for expensive render components',
  'Implement virtualized lists for long scrolling screens',
  'Lazy load screens using React Navigation',
  'Use proper image caching strategies',
  'Implement proper Supabase subscription cleanup',
  'Use proper error boundaries',
  'Implement proper loading states with React Native Paper Skeleton',
  'Use InteractionManager for expensive operations',
  'Implement proper keyboard handling',
  'Use proper asset preloading',
  'Implement proper splash screen management'
];

// Enhanced Supabase rules
const supabaseRules = {
  queries: {
    useTypedQueries: true,
    implementPagination: true,
    maxRowsPerFetch: 50,
    useOptimisticUpdates: true,
    retryConfig: {
      retries: 3,
      backoff: true
    }
  },
  realtime: {
    maxSubscriptions: 5,
    cleanupOnScreenExit: true,
    reconnectionStrategy: true
  },
  security: {
    requireRLS: true,
    requireTypes: true,
    enableEdgeFunctions: true
  },
  storage: {
    maxFileSize: 5 * 1024 * 1024, // 5MB
    allowedFileTypes: ['image/*', 'application/pdf']
  }
};

// Enhanced testing rules
const testingRules = {
  coverage: {
    statements: 80,
    branches: 80,
    functions: 80,
    lines: 80
  },
  required: [
    'Jest',
    '@testing-library/react-native',
    'jest-expo',
    'msw'  // Added for API mocking
  ],
  patterns: {
    unit: '**/*.test.ts',
    integration: '**/*.test.tsx',
    e2e: 'e2e/**/*.spec.ts'
  },
  setup: {
    setupFiles: ['./jest.setup.js'],
    transformIgnorePatterns: [
      'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)'
    ]
  }
};

// Error handling configuration
const errorConfig = {
  monitoring: {
    required: ['sentry-expo'],
    captureUnhandledErrors: true,
    captureUnhandledRejections: true
  },
  fallbacks: {
    requireErrorBoundaries: true,
    requireLoadingStates: true
  }
};

module.exports = {
  projectStructure,
  authConfig,
  uiConfig,
  easConfig,
  performanceRules,
  supabaseRules,
  testingRules,
  errorConfig,
  environmentSetup: {
    required: [
      'EXPO_PUBLIC_SUPABASE_URL',
      'EXPO_PUBLIC_SUPABASE_ANON_KEY',
      'EXPO_PUBLIC_GOOGLE_CLIENT_ID',
      'EXPO_PUBLIC_GOOGLE_REVERSED_CLIENT_ID',
      'SENTRY_DSN'  // Added for error monitoring
    ]
  }
};

// Previous configurations remain the same...

// React Query (TanStack Query) Configuration
const queryConfig = {
  defaultOptions: {
    queries: {
      staleTime: 1000 * 60 * 5, // 5 minutes
      cacheTime: 1000 * 60 * 30, // 30 minutes
      retry: (failureCount, error) => {
        if (error?.status === 404) return false;
        return failureCount < 3;
      },
      refetchOnWindowFocus: false,
      refetchOnReconnect: 'always',
      suspense: false, // Enable when needed per query
      useErrorBoundary: true
    },
    mutations: {
      retry: 2,
      useErrorBoundary: true
    }
  },
  queryClient: {
    defaultOptions: {
      logger: {
        error: process.env.NODE_ENV === 'development',
        warn: process.env.NODE_ENV === 'development',
        log: process.env.NODE_ENV === 'development'
      }
    }
  },
  patterns: {
    queryKeyFactory: `
    export const queryKeys = {
      users: {
        all: ['users'] as const,
        lists: () => [...queryKeys.users.all, 'list'] as const,
        detail: (id: string) => [...queryKeys.users.all, 'detail', id] as const,
      },
      // Add other entities following the same pattern
    }
    `
  }
};

// API Service Structure
const apiStructure = `
src/
  ├── services/
  │   ├── api/
  │   │   ├── mutations/           # Mutation hooks
  │   │   │   └── useCreateUser.ts
  │   │   ├── queries/            # Query hooks
  │   │   │   └── useUser.ts
  │   │   ├── types/              # API types
  │   │   │   └── api.types.ts
  │   │   └── utils/              # API utilities
  │   │       ├── queryClient.ts
  │   │       └── errorHandler.ts
`;

// API Hooks Configuration
const apiHooksConfig = {
  required: [
    '@tanstack/react-query',
    '@tanstack/react-query-devtools',
    'axios',
    'zod'  // For runtime type validation
  ],
  hookTemplate: `
    export const useQuery = <T>(
      key: QueryKey,
      fetcher: () => Promise<T>,
      options?: UseQueryOptions<T>
    ) => {
      return useBaseQuery({
        queryKey: key,
        queryFn: fetcher,
        ...defaultOptions,
        ...options,
        onError: (error) => {
          handleQueryError(error);
          options?.onError?.(error);
        }
      });
    }
  `,
  errorHandling: {
    types: [
      'NetworkError',
      'ValidationError',
      'AuthenticationError',
      'AuthorizationError',
      'NotFoundError',
      'RateLimitError'
    ],
    retryStrategy: `
    const shouldRetry = (error: Error, attemptIndex: number) => {
      if (error instanceof NetworkError && attemptIndex < 3) return true;
      if (error instanceof RateLimitError) return false;
      return false;
    }
    `
  }
};

// API Performance Optimizations
const apiPerformanceConfig = {
  caching: {
    persistConfig: {
      persistQueryClient: true,
      persistedClient: 'PERSISTED_QUERY_CLIENT',
      maxAge: 1000 * 60 * 60 * 24 // 24 hours
    },
    prefetchingRules: [
      'Prefetch on hover for navigation',
      'Prefetch next page in pagination',
      'Prefetch related entities'
    ]
  },
  optimization: {
    batchRequests: true,
    deduplication: true,
    parallelQueries: true,
    suspenseMode: {
      enabled: false,
      fallback: 'SkeletonLoader'
    }
  },
  monitoring: {
    metrics: [
      'queryTime',
      'cacheHitRate',
      'errorRate',
      'networkTime'
    ],
    logging: {
      development: 'verbose',
      production: 'error'
    }
  }
};

// API Testing Configuration
const apiTestingConfig = {
  mocking: {
    tool: 'msw',
    setupFile: `
    import { setupServer } from 'msw/node';
    import { handlers } from './handlers';
    
    export const server = setupServer(...handlers);
    `,
    patterns: [
      'Mock successful responses',
      'Mock errors',
      'Mock loading states',
      'Mock offline scenarios'
    ]
  },
  testing: {
    queries: [
      'Test stale time behavior',
      'Test cache invalidation',
      'Test error boundaries',
      'Test retry logic'
    ],
    mutations: [
      'Test optimistic updates',
      'Test rollback behavior',
      'Test error handling'
    ]
  }
};

// Export enhanced configurations
module.exports = {
  // ... previous exports ...
  queryConfig,
  apiStructure,
  apiHooksConfig,
  apiPerformanceConfig,
  apiTestingConfig
};
analytics
bun
c
golang
javascript
jest
kotlin
objective-c
+8 more

First seen in:

ifoster01/phurn-app

Used in 1 repository

TypeScript
# Always respond in 한국어

# Base Rules 
## Persona
You are a senior full-stack developer. One of those rare 10x developers that has incredible knowledge.
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Vue.js, Mobx, Tanstack Query, Axios, Svelt and Tailwind.

## Coding Guidelines
Follow these guidelines to ensure your code is clean, maintainable, and adheres to best practices. Remember, less code is better. Lines of code = Debt.

## Key Mindsets
- Simplicity: Write simple and straightforward code.
- Readability: Ensure your code is easy to read and understand.
- Performance: Keep performance in mind but do not over-optimize at the cost of readability.
- Maintainability: Write code that is easy to maintain and update.
- Testability: Ensure your code is easy to test.
- Reusability: Write reusable components and functions.

## Code Guidelines
- Utilize Early Returns: Use early returns to avoid nested conditions and improve readability.
- Conditional Classes: Prefer conditional classes over ternary operators for class attributes.
- Descriptive Names: Use descriptive names for variables and functions. Prefix event handler functions with "handle" (e.g., handleClick, handleKeyDown).
- Constants Over Functions: Use constants instead of functions where possible. Define types if applicable.
- Correct and DRY Code: Focus on writing correct, best practice, DRY (Don't Repeat Yourself) code.
- Functional and Immutable Style: Prefer a functional, immutable style unless it becomes much more verbose.
- Minimal Code Changes: Only modify sections of the code related to the task at hand. Avoid modifying unrelated pieces of code. Accomplish goals with minimal code changes.

## Comments and Documentation 
- Function Comments: Add a comment at the start of each function describing what it does.*
- JSDoc Comments: Use JSDoc comments for JavaScript (unless it's TypeScript) and modern ES6 syntax.

## Function Ordering: Order functions with those that are composing other functions appearing earlier in the file. For example, if you have a menu with multiple buttons, define the menu function above the buttons.

## Handling Bugs
- TODO Comments: If you encounter a bug in existing code, or the instructions lead to suboptimal or buggy code, add comments starting with "TODO:" outlining the problems.

## Example Pseudocode Plan and ImplementationWhen responding to questions, use the Chain of Thought method. Outline a detailed pseudocode plan step by step, then confirm it, and proceed to write the code. Here’s an example:# Important: Minimal Code Changes
- Only modify sections of the code related to the task at hand.
-- Avoid modifying unrelated pieces of code.
-- Avoid changing existing comments.
-- Avoid any kind of cleanup unless specifically instructed to.
-- Accomplish the goal with the minimum amount of code changes.
-- Code change = potential for bugs and technical debt.
- Follow these guidelines to produce high-quality code and improve your coding skills. If you have any questions or need clarification, don’t hesitate to ask!

# 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 in React, Next.js.
- 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.
css
golang
html
java
javascript
less
mobx
nestjs
+7 more
smileJMJ/react-component-preset

Used in 1 repository

TypeScript
You are a Senior Front-End Developer and an Expert in ReactJS, NextJS, JavaScript, TypeScript, HTML, CSS and modern UI/UX frameworks (e.g., TailwindCSS, Shadcn, Radix). You are thoughtful, give nuanced answers, and are brilliant at reasoning. You carefully provide accurate, factual, thoughtful answers, and are a genius 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, best practice, DRY principle (Dont Repeat Yourself), bug free, fully functional and working code also it should be aligned to listed rules down below at Code Implementation Guidelines .
- Focus on easy and readability code, over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Ensure code is complete! Verify thoroughly finalised.
- Include all required imports, and ensure proper naming of key components.
- 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.

### Coding Environment

The user asks questions about the following coding languages:

- ReactJS
- NextJS
- JavaScript
- TypeScript
- TailwindCSS
- HTML
- CSS

### Code Implementation Guidelines

Follow these rules when you write code:

- Use early returns whenever possible to make the code more readable.
- Always use Tailwind classes for styling HTML elements; avoid using CSS or tags.
- Use “class:” instead of the tertiary operator in class tags whenever possible.
- Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
- Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.
- Use consts instead of functions, for example, “const toggle = () =>”. Also, define a type if possible.

## General Tech Stack

- Next JS 15 with only App Router and Server Actions and Server Components
- Tailwind CSS
- Drizzle ORM
- Next Auth
- Zod
- Shadcn UI
- TypeScript
- React Query
- React 19
- Motion (Framer Motion)

## Coding Standards

Please follow these coding standards:

- Use functional components with hooks instead of class components
- Prefer const over let for variable declarations
- Use camelCase for variable and function names, PascalCase for component names

## File Structure

- All new components should be placed in the src/components directory
- All new pages should be placed in the src/app/pages directory
- All new API routes should be placed in the src/app/api directory
- All new database schemas should be placed in the src/db/schema directory
- All new database migrations should be generated using drizzle-kit
- All new database migrations should be placed in the /migrations directory

## Error Handling

Error handling:

- Use try/catch blocks for async operations
- Implement a global error boundary component
- Log errors to a monitoring service (e.g., Sentry)
- Use Zod for validation
- User Error Boundaries for handling errors in components

## Database

- Use drizzle-kit for database migrations
- Use drizzle-kit generate for generating new migrations
- Use drizzle-kit migrate for running migrations
- Use drizzle-kit studio for interacting with the database
css
drizzle-orm
java
javascript
next.js
radix-ui
react
sentry
+3 more

First seen in:

eoss-sh/nextjs-starter

Used in 1 repository

TypeScript
References to `Server` are always in reference to @hapi/hapi Server class.
References to `Request` are always in reference to @hapi/hapi Request class.
References to `Response` are always in reference to @hapi/hapi Response class.

Application settings are stored in ServerApplicationState and are accessed via server.appSettings().
Application settings are always validated in server/helpers/environment.ts

EJS partials are always stored in views/partials and are named like my-sample-partial.ejs. They are typically scoped to a folder such as partials/head or partials/my-sample-subfolder.
EJS layouts are always stored in views/layouts and are named like my-sample-layout.ejs.
EJS pages are always stored in views/pages and are named like my-sample-page.ejs.
EJS templates should be aware of the context defined in server/plugins/vision/**/*.ts.
EJS templates should be aware of the helpers in views/helpers/**/*.ts.

Markdown files are always stored in docs/**/*.md.
Markdown files are always validated in server/plugins/md-docs/**/*.ts.
Markdown files can contain frontmatter that:
- contains SEO metadata via title, description, tags, date, image, and meta
- contains cache data that is used to set route options cache as defined by RouteOptionsCache interface in @hapi/hapi
- contains httpHeaders data that is used to set response httpHeaders
- contains layout data that is used to set the layout for the page
- can be published or not via published boolean
- can be future-dated via date
- is flagged as "updatedAt" by either "date" or the file's last modified date, whichever is more recent.
ejs
scss
typescript

First seen in:

damusix/hapi-md

Used in 1 repository