How To UPGRADE Your Cursor AI Code Outputs β
Let's learn how to use Cursor AIπ
2024-09-11
Transcript β
[00:00] if you want these rules check them in the description down below let's see them in action let's find out how we can start using cursor AI in a more effective manner when we code with it by the end of today's video we're going to unlock together a very special tool found within cursor AI this tool is kind of hidden so it's good we're doing this video together because this is going to allow for better code outputs better structuring you know better everything when it comes to application development when using cursor AI sound good let's jump in so if you know me you already know when I talk about coding of AI a very important part is custom instructions if you don't know what custom instructions are what it allows us to to do is give a ton of context to
[00:32] our artificial intelligence models before we even ask for code I've created videos discussing this topic for this exact type of workflow in chat gbt but let's also add this kind of workflow within cursor AI to do so all we need to do is come up here to our little nav bar here go and hover over cursor hit settings and go to cursor settings click once we're in cursor settings here we're going to scroll down and there we go it's rules for AI this is pretty cool this is going to allow us to basically be like hey don't give us some crazy code outputs follow some directions and
[01:03] give me some good code therefore let's create some instructions together and from this video you'll be able to create your own instructions sound good I'm going to go and paste mine over so first major thing that you need to identify is that this type of rules for AI is going to be a global type of setting EG if you have multiple projects within curs your AI this will apply to it number two if you don't want to actually use the rules that you create maybe in a very specific project you want to use them you scroll down here simply hit this little bulling here or the slider turn it off it's it's not using them let's go and walk through these rules I've created explain why and then show it in a real life demo so
[01:35] first things first when using rules for AI we're going to identify what kind of Stack we're using when I reference stack I mean like what are we using language wise what are we using framework wise what are we just using to build out this app so in this context I plan on wrapping up a series I did earlier this year when I was creating an entire landing page for my business so I plan on wrapping that up in cursor AI so you can go Ahad and check that out if you want to but in this context we'll use JavaScript react Firebase and python think of the first sentence as the ultimate context I've identified web
[02:05] development I've identified these specific languages that I care about you do the same next I'm going over code style and structure a lot of this is just for good practice for example I have described this in the past so this is very important when describing variable names or when outputting variable names in code sometimes it can be too General it can be like is button clicked button is clicked like what is what is the button what are we clicking therefore something like this solves for it descriptive variable names use verbs or clear naming conventions to represent state or actions EG is authenticated fetch user data also I'm realizing that
[02:36] some of y'all might actually want my rules so what I'm going to do is actually copy my entire rule book here paste it into a Google doc check it out in the description down below you can paste it yourself if you want to use my rules and if you found value up to this point leave a like it's free is it free Corbin it's free my specific use case when it comes to using rules for AI is very specific to structuring and naming as when I code with AI I think the biggest hinder that I've noticed is very much not personalization for specific actions and functions which can get very confusing when you're dealing with multiple files therefore using rules AI
[03:07] we can follow best practices here's another example components what is a component let's say we have a parent child type of component here so let's say we have a homepage. JS which will render most of the homepage of that website and then the components within it which we'll call child is going to be like the footer the CTA the above the fold section if you want more clarity on that go a and check out that video right there show you in 10 minutes on how to properly structure an entire cursor AI repository or folder or files whatever you want to call it so in this context use pasal case for react component file
[03:39] names such as user profile nav bar you know you can see right here U capitalize nav bar capitalized if you want these rules check them in the description down below let's see them in action coming over to our code here I'm going to go and highlight this section here going hit command K and this is where it's going to be referencing our rules right now I have a button and this button does nothing right here says button let's find out so the rule I'm going to ask here or the request is going to be okay when I click the button have it turn blue and say we have found out about rules in cursor AI what I expect to see
[04:09] here if I didn't have the rules was the variable state would be is button clicked set is button clicked like it's going to be General but because I set the rules here I expect to see some specification within that variable let's find out submit edit there we go is blue set is blue notice how that is very specific to to the event of a click incurring with that button now to be clear the handle click that probably could be a little bit more specific to maybe a handle click on this specific
[04:39] button but that's kind of the idea here obviously I could just go in here and be like handle blue click if I chose to do so and then that solves that situation but the idea is that these rules are supposed to expediate specific things that you have issues with with bad code outputs that does today's video if you want to see a ton of other videos on cursor AI how to deploy an application with a live website link how to code correctly with cursor AI you can check out a bunch of other videos on my channel here but without further Ado I'll see you in the next video these videos are random but they were chosen for you so are they good are they not so
[05:12] good I'll see you in the next video