While digging through a messy codebase, I stumbled upon an amazing little trick using AI agents in my IDE that instantly brought clarity. It was too cool not to share—plus, now I’ll have a handy reference to myself later.
AI Agents in your IDE: Cursor and GitHub Copilot
I’ve tested this out using Cursor and the newly released GitHub Copilot Agent, both yielding fantastic results. If you haven’t explored Agent mode in your IDE, you’re seriously missing out. Instead of painstakingly editing functions individually, agents seamlessly navigate across multiple files, connecting dots and effortlessly applying broader changes. It’s mind-blowing.
Here’s one practical example I stumbled upon:
Creating Diagrams with Code Agents
Visualizing your code is one of the fastest ways to understand how it actually works. Diagrams turn logic into something tangible—great for onboarding, debugging, or just sanity-checking your own work.
Here’s the prompt I gave my IDE agent for a python script I created for ingesting data:
create a UML sequence diagram in mermaid of this script. Include all scripts it refers to. Include external API calls. Consider each of the flags. Include enough detail to help a new developer understand the flow exactly. Clearly define the participants and include function names when appropriate. Exclude markdown.
Here’s what the agent generated:
sequenceDiagram
participant CLI as Command Line
participant Pipeline as IngestionPipeline
participant Photos as GooglePhotosIngester
participant Vision as VisionAnalyzer
participant DB as DynamoDB
participant S3 as AWS S3
participant Google as Google Photos API
participant OpenAI as OpenAI Vision API
participant TokenTracker as TokenTracker
Note over CLI: User runs script with flags
Note over CLI: --full: Clear DB and reprocess all
Note over CLI: --incomplete: Only process missing data
CLI->>Pipeline: main() with args
activate Pipeline
alt full_ingestion flag is True
Pipeline->>DB: clear_database()
Pipeline->>S3: clear_s3_panels()
end
alt incomplete_only flag is True
Pipeline->>DB: get_incomplete_comic_ids()
Note over Pipeline: Get IDs of comics missing analysis
else
Pipeline->>DB: get_existing_comic_ids()
Note over Pipeline: Get IDs of already processed comics
end
Pipeline->>Photos: fetch_album_images(album_id)
activate Photos
Photos->>Photos: authenticate()
Note over Photos: Load credentials from file
Photos->>Google: OAuth authentication
Google-->>Photos: Authentication token
Photos->>Google: albums().list()
Google-->>Photos: List of available albums
Photos->>Google: albums().get(albumId)
Google-->>Photos: Album details
loop For each page of images
Photos->>Google: mediaItems().search(albumId)
Google-->>Photos: Media items in album
Photos->>Photos: Create Comic objects
end
Photos-->>Pipeline: List of Comic objects
deactivate Photos
Pipeline->>Pipeline: Filter comics to process
Note over Pipeline: Based on existing/incomplete IDs
loop For each comic to process
Pipeline->>Pipeline: process_comic(comic)
activate Pipeline
Pipeline->>Pipeline: download_image(image_url)
Note over Pipeline: Download image as bytes
Pipeline->>Vision: enrich_comic(comic)
activate Vision
Vision->>OpenAI: analyze_image(image_url)
Note over Vision: Send image to OpenAI Vision API
OpenAI-->>Vision: Analysis results
Vision->>TokenTracker: add_usage(usage)
Vision->>Vision: Filter "unknown" values
Vision-->>Pipeline: Enriched Comic object
deactivate Vision
Pipeline->>Pipeline: _generate_image_name(comic)
Note over Pipeline: Create unique filename from properties
Pipeline->>S3: _save_to_s3(image_data, filename)
S3-->>Pipeline: S3 URL
Pipeline->>DB: save_comic(enriched_comic)
Note over DB: Save to DynamoDB
Pipeline-->>Pipeline: Processed Comic
deactivate Pipeline
end
Pipeline->>TokenTracker: log_summary()
Note over TokenTracker: Log token usage statistics
Pipeline-->>CLI: Ingestion complete
deactivate Pipeline
Pretty neat, huh? Sure, at a glance it’s a bit overwhelming. But pop this into MermaidChart or Miro and voilà, you get a crystal-clear diagram!

I love this.
- It understands my runtime arguments, throughout
- Adds notes to what’s going on in a few key places
- Leverages class and function names, easy to find in the code
- I know where external calls are being made
- How much looping am I really doing?
Why is this awesome?
This workflow is gold in two scenarios:
Quickly onboarding onto new codebases
Instantly grasp an understanding of the project, saving time and mental cycles. Or in my case, refresh my memory of what I was doing in here…
Double-checking your work
Review complex code efficiently to ensure they’re running exactly as intended. This was my reason for the above diagram. It simplified reviewing a long, intricate script.
Be More Creative with AI!
AI-powered coding assistants are fantastic at tasks like these. This quick tip saves me tons of time and energy—so give it a try and experiment!
What creative ways are you engaging with AI? Have you asked your agent to do something unexpected or clever? Drop your examples in the comments—I’d love to hear how others are pushing boundaries!
Subscribe to my blog and get posts like this in your inbox. Share your email below, or follow me on Threads, LinkedIn, or BlueSky.
