Use Checkpoints for Exploration
Quick iterations, trying different approaches, temporary experiments
Checkpoints in Cursor are like Git commits for your AI-assisted development—but faster and more fluid. They enable fearless experimentation, allowing you to try bold refactoring approaches knowing you can instantly revert if things go wrong.
Unlike Git, which requires explicit commits, Cursor automatically creates lightweight snapshots of your code at key moments. Think of it as having an intelligent “undo” system that understands the semantic boundaries of your changes.
Cursor creates checkpoints automatically when:
You can also create checkpoints manually:
// In chat, simply ask:"Create a checkpoint before we start the refactoring"
// Or use the checkpoint button in the UI// Located in the chat input area when viewing previous messages
When trying multiple approaches to solve a problem:
Create Base Checkpoint
"Create a checkpoint - we're going to try three differentapproaches to optimize this algorithm"
Try Approach 1
"Implement the optimization using memoization"
Checkpoint and Reset
"Create checkpoint. Now restore to the base and try approach 2"
Try Approach 2
"Implement the optimization using dynamic programming"
Compare and Choose Review both implementations, choose the best, restore to it
For large-scale refactoring, use checkpoints as milestones:
Use checkpoints as insurance for risky operations:
// Before a complex database migration"Create checkpoint: pre-migration state"
// Before upgrading major dependencies"Checkpoint before upgrading to React 19"
// Before applying automated fixes"Checkpoint, then fix all ESLint errors automatically"
When building a feature with multiple interdependent parts:
Use checkpoints to explore parallel implementation paths:
// Checkpoint: base"Implement user management as REST API"
// Work progresses...// Checkpoint: REST implementation complete
// Restore to: base"Implement user management as GraphQL API"
// Work progresses...// Checkpoint: GraphQL implementation complete
// Compare both implementations"Show me the differences between the RESTand GraphQL implementations"
// Make decision and proceed with chosen path
Add meaningful descriptions to your checkpoints:
// Good checkpoint practices"Checkpoint: Auth system working - all tests passing""Checkpoint: Pre-optimization baseline (current: 250ms response)""Checkpoint: Feature complete, needs code review"
// Avoid vague checkpoints"Checkpoint" // Too generic"Save" // Not descriptive
Use Checkpoints for Exploration
Quick iterations, trying different approaches, temporary experiments
Use Git for Milestones
Completed features, stable states, team collaboration
Start with a clean Git state
git status # Ensure clean working directory
Use checkpoints during development
Consolidate into Git commits
# After reaching a good state via checkpointsgit add -Agit commit -m "feat: implement user authentication"
Clean checkpoint history
A senior developer used checkpoints to isolate a performance bug:
// Checkpoint 1: Baseline (bug present)"Checkpoint: Performance bug baseline - page loads in 3s"
// Checkpoint 2: Added logging"Add performance logging to all database queries"// Discovered N+1 query issue
// Checkpoint 3: First fix attempt"Implement eager loading for user.posts relationship"// Reduced to 1.5s, but not enough
// Checkpoint 4: Optimized query"Rewrite the query to use a single JOIN"// Success! 200ms load time
// Final: Clean up logging and commit"Remove debug logging, keep the optimized query"
Migrating from REST to GraphQL while maintaining backward compatibility:
// Checkpoint: REST API stable"Create GraphQL resolvers that call existing REST controllers"
// This allows both APIs to work simultaneously// Checkpoint: Dual API support
// Checkpoint: Begin controller migration"Move business logic from REST controllers to service layer"
// Both APIs now use the same service layer// Checkpoint: Shared business logic
// Checkpoint: Add deprecation warnings"Add deprecation headers to REST endpoints"
// Monitor usage and plan sunset// Checkpoint: REST deprecated
Upgrading a large application from Next.js 13 to 14:
// Strategic checkpoint placementcheckpoints = [ "Pre-upgrade: All tests passing", "Dependencies updated", "App directory migration started", "Pages converted to app router", "Middleware updated", "Build successful", "Tests updated and passing", "Performance benchmarks complete"]
// Each checkpoint represents a stable, revertable state
Good practices:
Efficiently moving between checkpoints:
// View checkpoint history"Show me all checkpoints from this session"
// Restore specific checkpoint"Restore to checkpoint: 'Auth system working'"
// Compare checkpoints"What changed between 'REST API' and 'GraphQL API' checkpoints?"
When working with a team:
Operation | Time | Disk Usage |
---|---|---|
Create checkpoint | under 100ms | ~Size of changed files |
Restore checkpoint | under 500ms | No additional |
List checkpoints | under 50ms | No additional |
Auto-cleanup | Background | Frees space |
For large codebases:
Selective Checkpointing
// Instead of checkpointing entire project"Create checkpoint for src/auth/* only"
Checkpoint Before Heavy Operations
// Before operations that touch many files"Checkpoint, then update all import statements"
Regular Git Commits
Checkpoint Not Available
Issue: Can’t restore to an old checkpoint Solution: Checkpoints expire. Use Git for permanent history
Restore Conflicts
Issue: Restoration fails due to conflicts Solution: Commit current changes first, then restore
Performance Degradation
Issue: Checkpoints slowing down Cursor Solution: Restart Cursor to trigger cleanup
Use checkpoints during code review implementation:
Use checkpoints liberally during development - They’re cheap and fast
Create semantic boundaries - Checkpoint at meaningful points, not randomly
Combine with Git intelligently - Checkpoints for exploration, Git for preservation
Leverage for learning - Try multiple approaches to find the best solution
Clean up regularly - Let Cursor manage checkpoint lifecycle automatically
Now that you’ve mastered checkpoints:
Remember: Checkpoints make you fearless. Use them to explore boldly, fail fast, and find optimal solutions without risk. The best developers aren’t afraid to experiment—they just know how to do it safely.