Tips for Agent (It's very powerful!)

  1. Add this .cursorrules to the root of your directory.

Cursor Operation Rules

Edit Handling

  1. Single-Pass Editing
  • Make all necessary changes in a single pass
  • Group related edits together
  • Avoid multiple iterations over the same file
  • Use clear edit markers and comments
  1. Edit Format
// Format for edit blocks:
````language:path/to/file
// ... existing code ...
{{ edited_code }}
// ... existing code ...

Tool Usage Guidelines

  1. File Operations
  • Verify file exists before attempting operations
  • Check file permissions
  • Use absolute paths when possible
  • Handle file not found scenarios
  1. Search Operations
  • Use specific search terms
  • Verify search results before acting
  • Handle empty search results gracefully
  • Cache search results when appropriate
  1. Code Analysis
  • Verify syntax before making changes
  • Check for dependencies
  • Validate type safety
  • Ensure consistent formatting

Error Prevention

  1. Pre-Edit Checks
  • Verify file context
  • Validate syntax
  • Check dependencies
  • Confirm file permissions
  1. Post-Edit Validation
  • Verify syntax after changes
  • Check for introduced errors
  • Validate type safety
  • Ensure formatting consistency

Performance Optimization

  1. Operation Batching
  • Group related operations
  • Minimize file reads/writes
  • Cache frequently accessed data
  • Use bulk operations when possible
  1. Resource Management
  • Release resources promptly
  • Clean up temporary files
  • Manage memory efficiently
  • Handle large files appropriately

Best Practices

  1. Documentation
  • Comment all significant changes
  • Explain edit rationale
  • Mark skipped sections clearly
  • Include context when necessary
  1. Error Handling
  • Provide clear error messages
  • Include recovery steps
  • Handle edge cases
  • Maintain system stability
  1. Version Control
  • Respect source control
  • Handle conflicts gracefully
  • Preserve file history
  • Support rollback capability

Operational Constraints

  1. File Limits
  • Max file size: 10MB
  • Max line count: 10,000
  • Max edit size: 1,000 lines
  • Max search depth: 5 directories
  1. Performance Targets
  • Edit response: < 100ms
  • Search response: < 200ms
  • File operations: < 50ms
  • Validation: < 150ms
  1. Use NOTEPADS to start but not during your project since they are 1-way edit only (you to Cursor). Tips:
  • Ensure your project is well structured and has logical sections of what your codebase/application does.
  • Assuming most of you are using AI regularly already, ask Claude or Gemini (large context) to contextualize and provide a MECE (mutually exclusive, collectively exhaustive) set of context notes grouped by functionality type.
  • Ask Claude to make a Build Checklist and a Build Tracker to start the project and create a working directory with the notes to transition your notepads to the new files. Then delete your Notebooks (optional but I like to free up the context and remove redundancies right away to maintain version control on the latest project status)
  1. Ask Claude to use tools. Type to it like you would to an intern or to yourself. Tell it about your project and ask it to look up context.
    cursordev
1 Like