Skip to content

Commit 47fe962

Browse files
committed
Initial commit
0 parents  commit 47fe962

17 files changed

Lines changed: 1531 additions & 0 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
# This file is currently loaded through cursor settings (global rules).
7+
8+
When creating code, you must:
9+
- Prioritize straightforward and simple code solutions.
10+
- Do not make assumptions about the problem or the codebase. Always investigate and validate the ENTIRE codebase and context before you make suggestions or modifications. Use external tools such as `codebase_search` and terminal commands (e.g., `pwd` and `tree -L 4 --gitignore | cat`).
11+
- Always prefer existing solutions over creating new ones. You may suggest fundamental changes but you should have good reasons why.
12+
- Always use descriptive variable names.
13+
- Manage configurations with environment variables.
14+
- Ensure robust error handling and logging, include rich context.
15+
- Properly document code with type hints and docstrings (detailed and concisely).
16+
- Always use assertions to guarantee code functionality.
17+
- Always use a virtual environment (do not install anything in global pip).
18+
- Always ensure your operations are relative to the workspace root, not your current shell position.
19+
20+
<!-- When writing explanations, you must:
21+
- Be as descriptive and technical as possible, assuming that you are talking to a highly experienced roboticist and computer scientist. Never use fluffy expressions and non-descriptive statements.
22+
- Always explain your thought process before solving a task, do not explain after the fact. -->

.cursor/rules/git.mdc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
description: This rule outlines best practices for effective use of Git, including code organization, commit strategies, branching models, and collaborative workflows.
3+
globs:
4+
alwaysApply: false
5+
---
6+
- **Commit Strategies:**
7+
- **Atomic Commits:** Keep commits small and focused. Each commit should address a single, logical change. This makes it easier to understand the history and revert changes if needed.
8+
- **Descriptive Commit Messages:** Write clear, concise, and informative commit messages. Explain the *why* behind the change, not just *what* was changed. Use a consistent format (e.g., imperative mood: "Fix bug", "Add feature").
9+
- **Commit Frequently:** Commit early and often. This helps avoid losing work and makes it easier to track progress.
10+
- **Avoid Committing Broken Code:** Ensure your code compiles and passes basic tests before committing.
11+
- **Sign Your Commits (Optional but Recommended):** Use GPG signing to verify the authenticity of your commits.
12+
13+
- **Branching Model:**
14+
- **Use Feature Branches:** Create branches for each new feature or bug fix. This isolates changes and allows for easier code review.
15+
- **Gitflow or Similar:** Consider adopting a branching model like Gitflow for managing releases, hotfixes, and feature development.
16+
- **Short-Lived Branches:** Keep branches short-lived. The longer a branch exists, the harder it becomes to merge.
17+
- **Regularly Rebase or Merge:** Keep your feature branches up-to-date with the main branch (e.g., `main`, `develop`) by rebasing or merging regularly.
18+
- **Avoid Direct Commits to Main Branch:** Protect your main branch from direct commits. Use pull requests for all changes.
19+
20+
- **Code Organization:**
21+
- **Consistent Formatting:** Use a consistent coding style guide (e.g., PEP 8 for Python, Google Style Guide for other languages) and enforce it with linters and formatters (e.g., `flake8`, `pylint`, `prettier`).
22+
- **Modular Code:** Break down your codebase into smaller, manageable modules or components. This improves readability, maintainability, and testability.
23+
- **Well-Defined Interfaces:** Define clear interfaces between modules and components to promote loose coupling.
24+
- **Avoid Global State:** Minimize the use of global variables and state to reduce complexity and potential conflicts.
25+
- **Documentation:** Document your code with comments and docstrings. Explain the purpose of functions, classes, and modules.
26+
27+
- **Collaboration and Code Review:**
28+
- **Pull Requests:** Use pull requests for all code changes. This provides an opportunity for code review and discussion.
29+
- **Code Review Checklist:** Create a code review checklist to ensure consistency and thoroughness.
30+
- **Constructive Feedback:** Provide constructive feedback during code reviews. Focus on improving the code, not criticizing the author.
31+
- **Address Feedback:** Respond to and address feedback from code reviews promptly.
32+
- **Pair Programming:** Consider pair programming for complex or critical tasks.
33+
34+
- **Ignoring Files and Directories:**
35+
- **.gitignore:** Use a `.gitignore` file to exclude files and directories that should not be tracked by Git (e.g., build artifacts, temporary files, secrets).
36+
- **Global .gitignore:** Configure a global `.gitignore` file to exclude files that you never want to track in any Git repository.
37+
38+
- **Handling Secrets and Sensitive Information:**
39+
- **Never Commit Secrets:** Never commit secrets, passwords, API keys, or other sensitive information to your Git repository.
40+
- **Environment Variables:** Store secrets in environment variables and access them at runtime.
41+
- **Secret Management Tools:** Use secret management tools like HashiCorp Vault or AWS Secrets Manager to store and manage secrets securely.
42+
- **git-secret or similar:** If secrets must exist in the repo (strongly discouraged), encrypt them.
43+
44+
- **Submodules and Subtrees:**
45+
- **Use Sparingly:** Use Git submodules and subtrees sparingly, as they can add complexity.
46+
- **Understand the Implications:** Understand the implications of using submodules and subtrees before adopting them.
47+
- **Consider Alternatives:** Consider alternatives to submodules and subtrees, such as package managers or build systems.
48+
49+
- **Large File Storage (LFS):**
50+
- **Use for Large Files:** Use Git LFS for storing large files (e.g., images, videos, audio files). This prevents your repository from becoming bloated.
51+
- **Configure LFS:** Configure Git LFS properly to track the large files in your repository.
52+
53+
- **Reverting and Resetting:**
54+
- **Understand the Differences:** Understand the differences between `git revert`, `git reset`, and `git checkout` before using them.
55+
- **Use with Caution:** Use `git reset` and `git checkout` with caution, as they can potentially lose data.
56+
- **Revert Public Commits:** Use `git revert` to undo changes that have already been pushed to a public repository. This creates a new commit that reverses the changes.
57+
58+
- **Tagging Releases:**
59+
- **Create Tags:** Create tags to mark significant releases or milestones.
60+
- **Semantic Versioning:** Follow semantic versioning (SemVer) when tagging releases.
61+
- **Annotated Tags:** Use annotated tags to provide additional information about the release.
62+
63+
- **Dealing with Merge Conflicts:**
64+
- **Understand the Conflict:** Understand the source of the merge conflict before attempting to resolve it.
65+
- **Communicate with Others:** Communicate with other developers who may be affected by the conflict.
66+
- **Use a Merge Tool:** Use a merge tool to help resolve the conflict.
67+
- **Test After Resolving:** Test your code thoroughly after resolving the conflict.
68+
69+
- **Repository Maintenance:**
70+
- **Regularly Clean Up:** Regularly clean up your Git repository by removing unused branches and tags.
71+
- **Optimize the Repository:** Optimize the repository with `git gc` to improve performance.
72+
73+
- **CI/CD Integration:**
74+
- **Automate Testing:** Integrate Git with a CI/CD system to automate testing and deployment.
75+
- **Run Tests on Every Commit:** Run tests on every commit to ensure code quality.
76+
77+
- **Common Pitfalls and Gotchas:**
78+
- **Accidental Commits:** Accidentally committing sensitive information or large files.
79+
- **Merge Conflicts:** Difficulty resolving merge conflicts.
80+
- **Losing Work:** Losing work due to incorrect use of `git reset` or `git checkout`.
81+
- **Ignoring .gitignore:** Forgetting to add files to `.gitignore`.
82+
83+
- **Tooling and Environment:**
84+
- **Git Clients:** Use a Git client that suits your needs (e.g., command line, GUI).
85+
- **IDE Integration:** Use Git integration in your IDE to streamline workflows.
86+
- **Online Repositories:** Use a reliable online Git repository hosting service (e.g., GitHub, GitLab, Bitbucket).

.cursor/rules/max_development.mdc

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
You are an expert in developer in the current file's language, specializing in high-performance computing and AI model development.
7+
8+
## 📜 Core Philosophy
9+
10+
1. **Simplicity:** Prioritize simple, clear, and maintainable solutions. Avoid unnecessary complexity or over-engineering.
11+
2. **Iterate:** Prefer iterating on existing, working code rather than building entirely new solutions from scratch, unless fundamentally necessary or explicitly requested.
12+
3. **Focus:** Concentrate efforts on the specific task assigned. Avoid unrelated changes or scope creep.
13+
4. **Quality:** Strive for a clean, organized, well-tested, and secure codebase.
14+
5. **Collaboration:** This document guides both human developers and the AI assistant for effective teamwork.
15+
16+
## 📚 Project Context & Understanding
17+
18+
1. **Documentation First:**
19+
* **Always** check for and thoroughly review relevant project documentation *before* starting any task. This includes:
20+
* Product Requirements Documents (PRDs)
21+
* `docs/README.md` (Project overview, setup, patterns, technology stack)
22+
* `docs/internal/DesignPhilosophy.md` (System architecture, component relationships)
23+
* `docs/internal/Development.md` (Technical specifications, established patterns)
24+
* If documentation is missing, unclear, or conflicts with the request, **ask for clarification**.
25+
2. **Architecture Adherence:**
26+
* Understand and respect module boundaries, data flow, system interfaces, and component dependencies outlined.
27+
* Validate that changes comply with the established architecture. Warn and propose compliant solutions if a violation is detected.
28+
3. **Pattern & Tech Stack Awareness:**
29+
* Reference `docs/README.md` and `docs/internal/DesignPhilosophy.md` to understand and utilize existing patterns and technologies.
30+
* Exhaust options using existing implementations before proposing new patterns or libraries.
31+
32+
## ⚙️ Task Execution & Workflow
33+
34+
1. **Task Definition:**
35+
* Clearly understand the task requirements, acceptance criteria, and any dependencies.
36+
2. **Systematic Change Protocol:** Before making significant changes:
37+
* **Identify Impact:** Determine affected components, dependencies, and potential side effects.
38+
* **Plan:** Outline the steps. Tackle one logical change or file at a time.
39+
* **Verify Testing:** Confirm how the change will be tested. Add tests if necessary *before* implementing (see TDD).
40+
41+
## 🤖 AI Collaboration & Prompting
42+
43+
1. **Clarity is Key:** Provide clear, specific, and unambiguous instructions to the AI. Define the desired outcome, constraints, and context.
44+
2. **Context Referencing:** If a task spans multiple interactions, explicitly remind the AI of relevant previous context, decisions, or code snippets.
45+
3. **Suggest vs. Apply:** Clearly state whether the AI should *suggest* a change for human review or *apply* a change directly (use only when high confidence and task is well-defined). Use prefixes like "Suggestion:" or "Applying fix:".
46+
4. **Question AI Output:** Human developers should critically review AI-generated code. Question assumptions, verify logic, and don't blindly trust confident-sounding but potentially incorrect suggestions (hallucinations).
47+
5. **Focus the AI:** Guide the AI to work on specific, focused parts of the task. Avoid overly broad requests that might lead to architectural or logical errors.
48+
6. **Leverage Strengths:** Use the AI for tasks it excels at (boilerplate generation, refactoring specific patterns, finding syntax errors, generating test cases) but maintain human oversight for complex logic, architecture, and security.
49+
7. **Incremental Interaction:** Break down complex tasks into smaller steps for the AI. Review and confirm each step before proceeding.
50+
8. **Standard Check-in (for AI on large tasks):** Before providing significant code suggestions:
51+
* "Confirming understanding: I've reviewed [specific document/previous context]. The goal is [task goal], adhering to [key pattern/constraint]. Proceeding with [planned step]." (This replaces the more robotic "STOP AND VERIFY").
52+
53+
## ✨ Code Quality & Style
54+
55+
1. **Python Guidelines:** Use strict typing (avoid `any`). Document complex logic or public APIs.
56+
2. **Readability & Maintainability:** Write clean, well-organized code.
57+
3. **Small Files & Components:**
58+
* Keep files under **300 lines**. Refactor proactively.
59+
* Break down large React components into smaller, single-responsibility components.
60+
4. **Avoid Duplication (DRY):** Actively look for and reuse existing functionality. Refactor to eliminate duplication.
61+
5. **Linting/Formatting:** Ensure all code conforms to project's ESLint/Prettier rules.
62+
6. **Pattern Consistency:** Adhere to established project patterns. Don't introduce new ones without discussion/explicit instruction. If replacing an old pattern, ensure the old implementation is fully removed.
63+
7. **File Naming:** Use clear, descriptive names. Avoid "temp", "refactored", "improved", etc., in permanent file names.
64+
8. **No One-Time Scripts:** Do not commit one-time utility scripts into the main codebase.
65+
66+
## ♻️ Refactoring
67+
68+
1. **Purposeful Refactoring:** Refactor to improve clarity, reduce duplication, simplify complexity, or adhere to architectural goals.
69+
2. **Holistic Check:** When refactoring, look for duplicate code, similar components/files, and opportunities for consolidation across the affected area.
70+
3. **Edit, Don't Copy:** Modify existing files directly. Do not duplicate files and rename them.
71+
4. **Verify Integrations:** After refactoring, ensure all callers, dependencies, and integration points function correctly. Run relevant tests.
72+
73+
## ✅ Testing & Validation
74+
75+
1. **Test-Driven Development (TDD):**
76+
* **New Features:** Outline tests, write failing tests, implement code, refactor.
77+
* **Bug Fixes:** Write a test reproducing the bug *before* fixing it.
78+
2. **Comprehensive Tests:** Write thorough unit, integration, and/or end-to-end tests covering critical paths, edge cases, and major functionality.
79+
3. **Tests Must Pass:** All tests **must** pass before committing or considering a task complete. Notify the human developer immediately if tests fail and cannot be easily fixed.
80+
4. **No Mock Data (Except Tests):** Use mock data *only* within test environments. Development and production should use real or realistic data sources.
81+
5. **Manual Verification:** Supplement automated tests with manual checks where appropriate, especially for UI changes.
82+
83+
## 🐛 Debugging & Troubleshooting
84+
85+
1. **Fix the Root Cause:** Prioritize fixing the underlying issue causing an error, rather than just masking or handling it, unless a temporary workaround is explicitly agreed upon.
86+
2. **Research:** Use available tools (Firecrawl, documentation search, etc.) to research solutions or best practices when stuck or unsure.
87+
88+
## 🔒 Security
89+
90+
1. **Server-Side Authority:** Keep sensitive logic, validation, and data manipulation strictly on the server-side. Use secure API endpoints.
91+
2. **Input Sanitization/Validation:** Always sanitize and validate user input on the server-side.
92+
3. **Dependency Awareness:** Be mindful of the security implications of adding or updating dependencies.
93+
4. **Credentials:** Never hardcode secrets or credentials in the codebase. Use environment variables or a secure secrets management solution.
94+
95+
## 🌳 Version Control & Environment
96+
97+
1. **Git Hygiene:**
98+
* Commit frequently with clear, atomic messages.
99+
* Keep the working directory clean; ensure no unrelated or temporary files are staged or committed.
100+
* Use `.gitignore` effectively.
101+
2. **Branching Strategy:** Follow the project's established branching strategy. Do not create new branches unless requested or necessary for the workflow (e.g., feature branches).
102+
3. **.env Files:** **Never** commit `.env` files. Use `.env.example` for templates. Do not overwrite local `.env` files without confirmation.
103+
4. **Environment Awareness:** Code should function correctly across different environments (dev, test, prod). Use environment variables for configuration.
104+
5. **Server Management:** Kill related running servers before starting new ones. Restart servers after relevant configuration or backend changes.
105+
106+
## 📄 Documentation Maintenance
107+
108+
1. **Update Docs:** If code changes impact architecture, technical decisions, established patterns, or task status, update the relevant documentation.
109+
2. **Keep Rules Updated:** This `.cursorrules` file should be reviewed and updated periodically to reflect learned best practices and project evolution.

0 commit comments

Comments
 (0)