|
| 1 | +# Cursor Rules - Context7 Required |
| 2 | + |
| 3 | +## MANDATORY: Always Use Context7 |
| 4 | + |
| 5 | +**CRITICAL RULE**: Before answering any question, implementing any feature, or solving any problem, you MUST use Context7 to look up relevant documentation and best practices. |
| 6 | + |
| 7 | +### When to Use Context7 |
| 8 | + |
| 9 | +1. **Before implementing any feature**: Always search Context7 for library documentation, examples, and best practices |
| 10 | +2. **When encountering errors**: Use Context7 to find solutions and troubleshooting guides |
| 11 | +3. **When using external libraries**: Always fetch library documentation via Context7 before using APIs |
| 12 | +4. **When optimizing code**: Search Context7 for performance best practices and patterns |
| 13 | +5. **When designing architecture**: Consult Context7 for design patterns and architectural guidance |
| 14 | + |
| 15 | +### How to Use Context7 |
| 16 | + |
| 17 | +1. **Resolve library ID first**: Use `mcp_context7_resolve-library-id` to find the correct library identifier |
| 18 | +2. **Fetch documentation**: Use `mcp_context7_get-library-docs` with the resolved library ID |
| 19 | +3. **Apply best practices**: Use the documentation to inform your implementation |
| 20 | +4. **Cite sources**: Reference the Context7 documentation when explaining your approach |
| 21 | + |
| 22 | +### Example Workflow |
| 23 | + |
| 24 | +``` |
| 25 | +User asks: "How do I implement X?" |
| 26 | +1. Use Context7 to resolve library ID for relevant library |
| 27 | +2. Fetch documentation with specific topic |
| 28 | +3. Review examples and best practices |
| 29 | +4. Implement solution based on Context7 documentation |
| 30 | +5. Explain approach referencing Context7 sources |
| 31 | +``` |
| 32 | + |
| 33 | +### Prohibited Behavior |
| 34 | + |
| 35 | +- ❌ DO NOT implement features without consulting Context7 first |
| 36 | +- ❌ DO NOT guess API usage - always look it up via Context7 |
| 37 | +- ❌ DO NOT skip Context7 even for "simple" questions |
| 38 | +- ❌ DO NOT use outdated patterns - always check Context7 for current best practices |
| 39 | + |
| 40 | +### Exception |
| 41 | + |
| 42 | +The ONLY exception is when Context7 is explicitly unavailable or the user explicitly requests to skip it. Otherwise, Context7 usage is MANDATORY. |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Project-Specific Rules |
| 47 | + |
| 48 | +### Technology Stack |
| 49 | +- **Framework**: Dioxus 0.7.1 |
| 50 | +- **Language**: Rust |
| 51 | +- **Styling**: Tailwind CSS |
| 52 | +- **Platform**: Web (WASM) |
| 53 | + |
| 54 | +### Code Style |
| 55 | +- Use Rust naming conventions (snake_case for functions, PascalCase for types) |
| 56 | +- Prefer explicit types over type inference when it improves readability |
| 57 | +- Use `use_signal`, `use_memo`, `use_effect` hooks appropriately |
| 58 | +- Keep components focused and single-purpose |
| 59 | +- Organize code into separate component files |
| 60 | + |
| 61 | +### Component Organization |
| 62 | +- Components should be in `src/components/` directory |
| 63 | +- Each component should be in its own file |
| 64 | +- Use `mod.rs` to re-export components |
| 65 | +- Pass signals and event handlers as props |
| 66 | + |
| 67 | +### Best Practices |
| 68 | +- Always handle async operations with `spawn` and proper error handling |
| 69 | +- Use debouncing for expensive operations |
| 70 | +- Cache expensive computations (like scrypt key derivation) |
| 71 | +- Provide visual feedback for loading states |
| 72 | +- Ensure accessibility with proper ARIA labels and keyboard navigation |
| 73 | + |
0 commit comments