Course Game Plan0:08
All right, so before we get started, here is the game plan. So as you already know, even at this point, there's no shortage of AI tooling and agents in the wild. And to be honest, it can sometimes be a little bit overwhelming, but that's okay. We're gonna keep things super practical and super laser focused on the working PHP and Laravel developer. Let's get going. So
Choosing JetBrains AI0:27
and Laravel developer. Let's get going. So with PHP and Laravel in mind, because tooling link, PHP storm is so widely adopted in our world, we're gonna use JetBrains ai. But don't worry, all of this knowledge is portable. Uh, or in other words, 95, 96, 90 7% of what we're gonna talk about here can be applied anywhere. Alright, so let's scroll down.
what we're gonna talk about here can be applied anywhere. Alright, so let's scroll down. Of course, you're gonna have access to AI completions directly within your editor, but you also have access to super powerful agents, which we'll talk about more in the future. But you'll start with, uh, JetBrains, his own JUNI agent. But you can also reach for Claude if you prefer. Alright? And if I scroll down, here's an example of that interaction. Notice how the agent is creating a plan
And if I scroll down, here's an example of that interaction. Notice how the agent is creating a plan and sequentially working through that plan. It's very cool. We can also do updates as you see here. Now, to get us going, we're gonna use the Laravel workshop code base that Simon, Jeremy and I worked on together. So this'll give us some good material to figure out what AI is capable of. All right, let's get going. So I'm gonna start by visiting our settings
Installing AI Assistant1:32
All right, let's get going. So I'm gonna start by visiting our settings and let's come down to Plugins Marketplace. And at the time of this recording, I'm gonna look for AI assistant. Alternatively, you might search for JetBrains AI just in case they rename it. Alright, so let's install it. And that's done. Alright, so very quickly though, you'll notice that it says purchased here.
Alright, so very quickly though, you'll notice that it says purchased here. You don't have to buy it if you don't want to. Let's quickly talk about that. If I switch back to the landing page and scroll down to the plan section, yeah, you'll see there is a free plan that has unlimited code completion and local AI support, but it also includes a one month trial of their pro plan that gives you, uh, access to June and things like that.
Opening AI Chat2:09
but it also includes a one month trial of their pro plan that gives you, uh, access to June and things like that. So take a look, decide for yourself. It's not up for me to tell you which one to pick. Anyhow, I will apply that. Okay, so now I can bring up AI chat by going to tools in this one here works great. Alternatively, if you prefer, you can do it through the menu bar as you see here, this icon next. If you prefer, uh,
through the menu bar as you see here, this icon next. If you prefer, uh, to search anything, I could do it like that. Let's look for AI chat, or I'm sorry, AI assistant. And then here we go. But generally, I'm sort of a keystroke guy. So this is what I would do. I'd once again bring up settings. I'd go to key Map, I'd look for AI chat or AI assistant. And here you can see I've already added a keystroke
I'd go to key Map, I'd look for AI chat or AI assistant. And here you can see I've already added a keystroke of option C, but you can add whatever makes sense to you. So now anywhere in my code base on my machine, I can press option C to pull up the chat tab. All right, let's get going. So right away we see a bunch of icons here, we see chat versus agents. Do we use Junie or Claude? What's the difference between an agent and and chat? Again, it can all be a little bit overwhelming.
What's the difference between an agent and and chat? Again, it can all be a little bit overwhelming. And then for chat, we see all of these different models and you're just expected to know which one you need to use. Well, I'm gonna tell you the truth, even people who do this all the time aren't entirely sure which one they're supposed to pick. And that's because things are a little volatile right now and things keep changing and models improve and one surpasses the other,
Chat vs Agents3:35
and things keep changing and models improve and one surpasses the other, but two months later the other one comes back and surpasses the former. Uh, don't worry about it too much. So for now, here's what I want you to think about. You'll see a distinction between chat and agents. Chat means exactly what you think it means. Chat with ai, ask it questions. In this case, it's not gonna do any work,
Chat with ai, ask it questions. In this case, it's not gonna do any work, it's just gonna talk to you. And in many situations when you are reviewing a code base, it's helpful to just have someone to talk to, Hey, this code looks a little weird. Why do you think it was done that way? Or in our case, maybe this is our first introduction and we might say, can you give me a quick review of what this application does?
and we might say, can you give me a quick review of what this application does? This is a great example of using the chat. Now for the model, you might just stick with auto and uh, JetBrains will do its best to choose a performance and cheap option. In this case, it's recommending Gemini three, but if you know a bit more and you prefer a version of Claude or chat GPT, you could reach for those as well.
and you prefer a version of Claude or chat GPT, you could reach for those as well. Do pay attention to the little icons here because they will give you an indication in terms of cost. Alright, in our case, let's stick with auto and give this a run. So now literally what it's doing is it's collecting all the context. It can, it's looking at your files, it's gonna read the routes file.
It can, it's looking at your files, it's gonna read the routes file. It's, it's, it's going to check if you have certain guidelines in place. It'll review the controllers and what tooling is being used, stuff like that. All right, and that's done took about 20 seconds. So here's a quick review. It's a social media platform, correct? Mimics Twitter or X, correct?
It's a social media platform, correct? Mimics Twitter or X, correct? It's built with Laravel and view and inertia. Again, all correct, providing a single page application feel. All right. Next key features. It has a timeline and posts and links and follows. Users can have profiles. We support authentication. Uh, for the backend, we're using the Laravel 12 for the front end view three
Uh, for the backend, we're using the Laravel 12 for the front end view three and inertia for testing, we're using pest. Again, this is just a, a, a great introduction to a code base if you are interacting with it for the first time. Now in this case, again, I want you to notice that we're just chatting with ai. It's not actually writing specific code. So in those situations you have to decide, uh, two things.
It's not actually writing specific code. So in those situations you have to decide, uh, two things. First, do I wanna be the agent or in other words, do I wanna be fully in control every step of the way I ask it to do a thing and it does the thing and then it comes back to me? Or am I okay with it functioning as an agent where it has a bit more autonomy and these situations I can tell it what I want and it'll start making a plan
and these situations I can tell it what I want and it'll start making a plan and it'll work through that plan sequentially implementing the code. Are you okay with that or do you wanna be in complete control every step of the way? The answer to that question will determine how often you reach for maybe the chat tab versus a dedicated agent.
Agent Settings Overview6:27
how often you reach for maybe the chat tab versus a dedicated agent. Alright, so here's another example. This time I will switch to one of the agents. We'll go to Junie in this case and you'll see a handful of menu options here that can be a little confusing, but they're super important to know. So first up, even in the context of an agent, you have the ability to simply ask it questions, right?
So first up, even in the context of an agent, you have the ability to simply ask it questions, right? Or once again, it can be treated as a full autonomous agent that can get to work or Juni can figure out what you want in this case. Uh, so you do have that option. Alright, next brave mode again is what you think it is. Is it okay if Juni is a little bit brave here? Is it allowed to write terminal commands without asking for permission?
Is it allowed to write terminal commands without asking for permission? Uh, and you just have to decide for yourself. Are you okay with that? Or do you wanna be in complete control where you have to manually approve every single command? My recommendation is once, don't you leave that one deselected unless you really know what you're doing. Alright, and then finally think more.
unless you really know what you're doing. Alright, and then finally think more. Yeah, this is kind of a fun one. So as it turns out, if you ask AI to take a little more time and think a little bit harder, it will do better. Isn't that interesting? Even in a, a general web chat, if you say, think really hard about this, well, it's gonna think a little bit harder about it and it's gonna give you better output. Just keep in mind sometimes the this will take longer
and it's gonna give you better output. Just keep in mind sometimes the this will take longer and there might be a cost associated with that. So only select this for situations where it's vital that the AI takes its time to really prepare the best possible response. Okay? Now if we take a look here, it doesn't seem that AI is being referenced anywhere. And by that I mean it doesn't look like Laravel Boost is installed and I don't see any agents.md
Generating Project Guidelines8:04
And by that I mean it doesn't look like Laravel Boost is installed and I don't see any agents.md or guideline files for ai. So that might be a good first step for us. Now, I could write this out here, or you can pull in dedicated tools to convert your speech and the text and just have a Google for that. The one that I will be using here is called whisper flow. And again, you can try it out for free. So now I can hit a keystroke
And again, you can try it out for free. So now I can hit a keystroke and you'll see it allows me to begin speaking and when I let go of that keystroke, it will convert that into text. Alright, so let's do this, uh, throughout this course, perform a thorough review of this code base including its structure and patterns, and then extract that into your own guidelines.md file for future reference.
and then extract that into your own guidelines.md file for future reference. All right, so we'll give that a run and let's see what it comes up with. Alright, so almost immediately it wants to run a terminal command to scan our project for PHP view and JavaScript files. But again, it's a terminal command and it has to ask for permission because we don't have brave mode turned on.
and it has to ask for permission because we don't have brave mode turned on. So I will say, yeah, go ahead. Alright, and that's done. So yeah, in real life it took three or four minutes to complete and that mostly consisted of scanning our entire project, reviewing it, figuring things out, what are the patterns, what are the style guides we use, what are the conventions? So it created a comprehensive guidelines, file documents, the standards, the patterns, the testing, the code quality.
So it created a comprehensive guidelines, file documents, the standards, the patterns, the testing, the code quality. You get the idea. Okay? So now you'll find a new guidelines.md file or potentially you could place this directly within the uni.directory if you want this guideline to be unique and only accessible to uni. So take a look here. Uh, we have a general, um, style guide, so to speak for our project. Here's what the tool is.
so to speak for our project. Here's what the tool is. Here is the tooling that we can reach for and keep in mind you can modify this to your heart's content. So if you see a section you disagree with, change it. If you wanna make something explicit, maybe the braces should always go on the same line as the method signature rather than its own line. You can be clear about, uh, the, the rules
as the method signature rather than its own line. You can be clear about, uh, the, the rules that AI should follow when writing code on your behalf. Alright, so next it picked up on the fact that we always use strict types, which means, again, when AI creates a new class on our behalf, it's gonna know, all right, I'm gonna include that because that seems to be a convention in the code base. Next we can see type declarations, how rules might be declared, where we store our models,
Next we can see type declarations, how rules might be declared, where we store our models, how we define relationships. You get the idea if I bring up the, uh, outline here, notice it's quite comprehensive. What are the patterns for front ends? Let's take a look real quick. Well, we use view components and this is where our pages are and this is how we store layouts. Think of this literally as a guide for AI to figure out
and this is how we store layouts. Think of this literally as a guide for AI to figure out how it should go about implementing the code. We ask it to write, here are the best practices that it picked up for our code base. And once again, just to be crystal clear, you are in charge of this file, make sure it reflects what you want. Okay? But yeah, I think you get the idea. So once again, we're calling this guidelines nd but there's no hard rule at the time of this recording.
Supplying Better Context11:10
So once again, we're calling this guidelines nd but there's no hard rule at the time of this recording. You'll often see agents nd this is a markdown file specifically for agents so that they can better gather, uh, context about how to proceed with what you want. And again, it turns out context is sort of a key word. Keep it simple. Context is exactly the way you would use that term in real life. Mm-hmm. It allows the model to gather additional information in order to proceed, right?
Mm-hmm. It allows the model to gather additional information in order to proceed, right? So in this case, the context is, well when you work on my code base, this is how you should structure it. This is the style guide you should use. This is how you should prepare tests. Uh, here's another one. If you wanted to always include tests as part of any feature it implements, you can be explicit here.
If you wanted to always include tests as part of any feature it implements, you can be explicit here. On the other hand, if, if you're a cowboy and you just wanna skip that part, well you could tell it to skip the test as well though I would not recommend it. And then further in terms of context, if I bring up our tab again, let's imagine you're working on the profile feature and there's something specific you want AI to do for you. Well, you can include the profile model in the context just
and there's something specific you want AI to do for you. Well, you can include the profile model in the context just so you're crystal clear that here's what we're working with, here's the migration file. And based on that context, here's what I want you to do. So just as a general rule, the more information you give ai, the the more equipped it is to execute the task.
