|
| 1 | +# Gemini Guidelines |
| 2 | + |
| 3 | +## Development Workflow |
| 4 | + |
| 5 | +- **Plan First:** Before implementing, draft a plan in `docs/<feature_name>.md`. |
| 6 | +- **Iterate:** Implement changes step-by-step. Avoid large, sweeping modifications. |
| 7 | +- **Preserve Code:** When removing code, comment it out with a `DEPRECATED` notice instead of deleting it outright. |
| 8 | + |
| 9 | +## Core Principles |
| 10 | + |
| 11 | +- **Simplicity & Readability:** Write simple, straightforward, and easy-to-understand code. |
| 12 | +- **Performance:** Consider performance without sacrificing readability. |
| 13 | +- **Maintainability & Testability:** Write code that is easy to update and test. |
| 14 | +- **Reusability:** Create reusable components and functions. |
| 15 | +- **Minimalism:** Less code is less debt. Keep the footprint small. |
| 16 | +- **Clarification & Specificity:** Ask for more details and provide open-ended suggestions if the request is ambiguous. |
| 17 | + |
| 18 | +## Best Practices |
| 19 | + |
| 20 | +- **Vanilla JavaScript First:** Avoid introducing new frameworks (e.g., React, Vue) or large libraries (e.g., jQuery). |
| 21 | +- **Leverage Alpine.js:** Use the existing `mainApp` data object for UI logic and state. |
| 22 | +- **Global Scope Awareness:** All JavaScript is loaded via `<script>` tags; be mindful of the global scope. |
| 23 | +- **Functional Style:** Prefer functional, immutable, and stateless approaches where they improve clarity. |
| 24 | +- **Early Returns:** Use early returns to avoid nested conditions. |
| 25 | +- **Descriptive Naming:** Use clear names for variables and functions (e.g., `handle` prefix for handlers). |
| 26 | +- **Constants:** Use constants instead of functions where possible. |
| 27 | +- **DRY (Don't Repeat Yourself):** Avoid code duplication. |
| 28 | +- **Minimal Changes:** Only modify code relevant to the current task. |
| 29 | +- **TODOs:** Mark issues in existing code with a `TODO:` prefix. |
| 30 | +- **Clean Logic:** Keep core logic clean and push implementation details to the edges. |
| 31 | + |
| 32 | +## Formatting |
| 33 | + |
| 34 | +- **Indentation:** Use tabs. |
| 35 | +- **Semicolons:** Always use semicolons. |
| 36 | +- **Braces:** Use One True Brace Style (1TBS). |
| 37 | + |
| 38 | +## Naming Conventions |
| 39 | + |
| 40 | +- **camelCase:** For variables and functions (e.g., `noteEditorVisible`, `fetchNotes`). |
| 41 | +- **UPPER_SNAKE_CASE:** For constants and globals (e.g., `DB_NAME`, `NOTE_STORE`). |
| 42 | +- **\_prefix:** Consider for internal/private functions (e.g., `_doSomethingInternal`). |
0 commit comments