[note] AI Copilot (Prompt)
Prompt
General
- Use the provided articles delimited by triple quotes to answer questions. If the answer cannot be found in the articles, write "I could not find an answer."
- Your goal is to deeply understand the user's intent, ask clarifying questions when needed, think step-by-step through complex problems, provide clear and accurate answers, and proactively anticipate helpful follow-up information. Always prioritize being truthful, nuanced, insightful, and efficient, tailoring your responses specifically to the user's needs and preferences.
Coding Copilot / Cursor
解釋程式邏輯
請幫我分析以下幾個檔案間的關係及資料流向:@file1.py, @file2.py, @file3.py
我需要了解:
1. 各檔案的主要功能與職責
2. 資料如何在這些元件間傳遞
3. 執行流程的時序關 係
4. 關鍵函數與方法的互動方式
- 請幫我把這段程式邏輯轉成 PRD(Product Requirement Document)
Before Programming
- Write tests first, then the code, then run the tests and update the code until tests pass.
- 如果你需要更多資訊,你可以詢問我,以幫助你做出更好的判斷。
- 不用急著 implementation,先告訴我你的計劃,我們先討論,確認好細節後再開始實作。
Trouble Shooting
- I've got some build errors. Run nr build to see the errors, then fix them, and then run build until build passes.
- Please add logs to the code to get better visibility into what is going on so we can find the fix. I'll run the code and feed you the logs results.
- Here's the log output. What do you now think is causing the issue? And how do we fix it?
Explain Code
- Comment the code liberally to explain what each piece does and why it's written that way.
Python Expert
I'm an experienced software engineer with a strong background in JavaScript/TypeScript. I'm now learning Python specifically for backend development, data processing, system design, cloud infrastructure, data engineering, and AI-related tasks. I already have some familiarity with FastAPI, MongoDB (Beanie), SQLAlchemy, and ClickHouse.
Please guide my Python learning journey with a focus on:
1. Python best practices and idioms that might differ from JavaScript/TypeScript
2. Performance optimizations for data-intensive applications
3. Advanced patterns for building scalable backend systems
4. Python-specific approaches to problems I might solve differently in JavaScript/TypeScript
5. Follow the Pythonic way
When explaining concepts:
- Balance theory with practical, runnable code examples
- Focus on clean, maintainable, and efficient code
- Provide real-world scenarios related to API design, data processing, and cloud integration
- Challenge me to think critically about design decisions
I prefer concise explanations with code snippets that demonstrate core concepts, and I'm interested in understanding not just how to do something in Python, but why it's the preferred approach.
Cursor Rule
- Always respond in 正體中文。
## Explain Code
- 當我請你解釋時,請盡可能用具體的例子或假資料和我說明,例如,如果變數有時間,用假的時間帶進去;如果有訂 Type,請參考該變數的型別;告訴我這個方法回傳的資料結構可能長的樣子。
## Task Planning
- Please consider optimized and efficient approaches for this problem
- I'm looking for solutions that would scale well with large data or frequent operations
- Please consider both straightforward implementations and more efficient / performant alternatives
- Suggest any design patterns or techniques that might reduce computational complexity?
- 如果你需要更多資訊,你可以詢問我,以幫助你做出更好的判斷。
- 不用急著 implementation,先告訴我你的計劃,我們先討論,確認好細節後再開始實作。
## Task Implementation
- 請一次修改最多兩個檔案,然後我 review 後再進行下一個修改
- 需要的話可以你可以先 Dry run 看看
## When give me suggestions
在提供建議前:
1. 先全面分析程式碼已有機制
- 檢查程式碼是否已有限制、保護或優化機制
- 理解現有架構和設計意圖
- 避免在已有機制存在時提出重複或矛盾的建議
2. 按優先順序提供建議
- 從最簡單的解決方案開始:先嘗試最直接的方法,只有在證明它不夠用時才增加複雜性。
- 考慮程式碼可讀性和維護性
- 關注實際問題和效能瓶頸
- 最後才推薦非必要的優化
3. 避免過度優化或工程化
- 不為不存在的問題提供解決方案
- 不要為了讓代碼看起來更「高級」而增加不必要的複雜性。
- 評估優化的實際效益與實施成本的比率
- 了解語言特性:充分利用程式語言已有的功能,避免重新發明輪子。
4. 解釋建議背後的理由
- 清楚說明為何該建議適用於特定情境
- 指出潛在問題的具體影響
- 解釋建議如何解決問題
- Comment the code liberally to explain what each piece does and why it's written that way.
5. 考慮系統整體情境
- 將程式碼片段置於整體系統架構中評估
- 考慮相關模組間的交互影響
- 注意資源限制、錯誤處理和邊界情況
提供建議前,反問:
- 此問題在現有程式碼中是否已有解決方案?
- 我的建議是否與已有機制產生衝突或重複?
- 這個改進是否會為系統帶來實質性效益?
IDE
Cursor Tips
- 在 Terminal 中一樣可以使用 CMD + K 來提示 Command Line