Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

My #1 workflow change recently is adding comments *everywhere* in my code with Cursor. Want a major codegen performance boost? Then document your codebase to drastically help the AI that’s working on it. It’s super easy - prompt below.

149,284 Aufrufe • vor 1 Jahr •via X (Twitter)

11 Kommentare

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

USE THE FOLLOWING PROMPT IN A FILE — You are tasked with adding comments to a piece of code to make it more understandable for AI systems or human developers. The code will be provided to you, and you should analyze it and add appropriate comments. To add comments to this code, follow these steps: 1. Analyze the code to understand its structure and functionality. 2. Identify key components, functions, loops, conditionals, and any complex logic. 3. Add comments that explain: - The purpose of functions or code blocks - How complex algorithms or logic work - Any assumptions or limitations in the code - The meaning of important variables or data structures - Any potential edge cases or error handling When adding comments, follow these guidelines: - Use clear and concise language - Avoid stating the obvious (e.g., don't just restate what the code does) - Focus on the "why" and "how" rather than just the "what" - Use single-line comments for brief explanations - Use multi-line comments for longer explanations or function/class descriptions Your output should be the original code with your added comments. Make sure to preserve the original code's formatting and structure. Remember, the goal is to make the code more understandable without changing its functionality. Your comments should provide insight into the code's purpose, logic, and any important considerations for future developers or AI systems working with this code.

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

Now every time you make a request, you're including an instructional manual with it. It gives the model fewer opportunities to make mistakes. Sometimes people overthink this stuff… If the instructions would be useful for a human, they’re useful to an AI too!

Profilbild von Sully
Sullyvor 1 Jahr

Someone needs to make "comments for ai" only your ide hides it or something then u can go wild

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

This is a brilliant idea.

Profilbild von AI Machine Dream
AI Machine Dreamvor 1 Jahr

Good tip. For Cursor I tell it: “Include semantic inline (//) comments to explain the "why" of functionality.” at the end of my Cursor rules. It is a balance of increased tokens vs increased understanding by yourself and the LLM.

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

I’ve been trying to do a similar thing but at the top (briefly mentioned in video). I don’t feel like I quite have the right workflow down just yet, but I agree this is a great thing to do!

Profilbild von ndx.eth 🐉 @ ETH Denver
ndx.eth 🐉 @ ETH Denvervor 1 Jahr

“Comments lie” is a thing… I wonder what would happen if the developer changes code without changing the comments? Who would the model trust? You might end up debugging both code and comments.

Profilbild von Z🦨
Z🦨vor 1 Jahr

love the idea of a prompts folder, will be using this.

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

It’s the best. So many options!

Profilbild von BOOTOSHI 👑
BOOTOSHI 👑vor 1 Jahr

thanks for posting this !! context is EVERYTHING when it comes to an AI, a sense of clearer direction is usually all that's needed for a drastic performance increase

Profilbild von Mckay Wrigley
Mckay Wrigleyvor 1 Jahr

Context is king 👑

Ähnliche Videos