AI agents have mastered boilerplate generation, short algorithms, and unit tests—speeding up routine and repetitive tasks.
But I tend to focus on code analysis and improvement suggestions. They’re especially helpful when writing performance-critical code or conducting intense code reviews.
Prompts I Use for Code Analysis
I usually ask the AI agent to analyze my code for:
- Performance issues
- High memory and CPU usage
- Memory leaks
- Poor scalability
- Unbounded collections
- Connection exhaustion
- Unnecessary allocations
- Deadlocks
- Starvation
- Inefficient loops and LINQ queries
- Inefficient serialization/deserialization
- Redundant computations
- Blocking calls
- Inefficient I/O operations
- Improper resource disposal
- Parallelization overhead
- Inefficient exception handling
- Unhandled exceptions
- Unhandled edge cases
- Algorithmic overcomplexity
- Inefficient object lifetimes
- Excessive thread creation and contention
- Overuse of locks or synchronization primitives
Prompts I Use for Improvement Suggestions
I also ask it to explore potential improvements such as:
- Performance optimizations
- Memory usage optimizations
- Concurrent or parallel execution
- Simultaneous async calls
- LINQ optimization or replacement with loops
- Resource reuse
- Read-only, frozen, or concurrent collections
- Lazy evaluation
- Weak references
- Pooling of connections, arrays, objects, etc.
And what are your favorite prompts?
Top comments (0)