در حال بارگذاری ...

Commands vs. Skills0:08

So if a clogged command is sort of like an alias or even a trigger for a prompt that we often write, then a clogged skill is more like a field guide. It's our way of saying to the ai, this is how we do things in these parts. You better follow these guidelines. All right, let me show you an example. So check this out. We're once again in the demo app for the telegram bot that we built a few episodes ago and have a look, we have an issue here within help command.

for the telegram bot that we built a few episodes ago and have a look, we have an issue here within help command. We accidentally introduced a D test test and worse, we pushed it up to GitHub and we distribute it and tagged it for our users. We gotta fix this issue right away, but this time, rather than doing it by hand, let's have AI take care of the entire process. Alright, here's how, let's switch to full screen and I will bring up the terminal

Installing GitHub CLI0:56

Alright, here's how, let's switch to full screen and I will bring up the terminal and yeah, if we wanna interact with GitHub, of course the first thing we should do is install the GitHub CLI. So we can do that using Homebrew. I could say brew install gh, but I already have that installed on my machine. So if I were to expand this and run gh, you'll see all

So if I were to expand this and run gh, you'll see all of the various commands we can run. And yeah, if you're doing that for the first time, there will be a quick setup so that you can authenticate takes 20 seconds. Okay, so I already have a GitHub repository, um, for this project. So why don't we create an issue? We're gonna simulate a user complaining about our project.

Creating and Viewing Issues1:30

So why don't we create an issue? We're gonna simulate a user complaining about our project. Let's clear this and say GitHub issue create, let's say help Telegram command not working, and let's launch them trying to use the bot and the help command, but nothing happens. Alright, good enough. That simulates an issue. So we will submit it and now we have an issue right here. We can review all of our issues using DCLI by saying GH issue list.

We can review all of our issues using DCLI by saying GH issue list. Alright? And sure enough, we have exactly one issue at the moment. Next, uh, we could say GitHub issue show, and I can provide, uh, as you'll see right here, I'm sorry, GitHub issue view. And we need to provide the, um, the issue number that we are reviewing, right? So in this case, I believe it was issue number three.

Defining the Fix Skill2:24

that we are reviewing, right? So in this case, I believe it was issue number three. All right, so GitHub issue view three, and yeah, now from the CLI, we can review all of the details for this issue that needs to be fixed. Okay, so now let's create a Claude skill to take care of the entire process. We can create a Claude skill once again within the Claude directory. And this time I'm gonna add a folder called skills.

the Claude directory. And this time I'm gonna add a folder called skills. And the only difference from commands is each skill could potentially consist of multiple files. So with that in mind, let's add a directory and we should add this directory. And why don't we call it fix issue. And then within here we can add our markdown file. Now, let's name it skill.md. That's the common conviction that we should follow.

Now, let's name it skill.md. That's the common conviction that we should follow. All right, so let's close this and switch to two up. And yeah, as before, we're not gonna write this all out by hand, but we would add our YML front matter. And it's very important that our description is clear and gives clues to the AI about when it should reach for this skill. Remember, it's a field guide, it's a guideline, and we wanna make sure that AI thinks to review this skill

Remember, it's a field guide, it's a guideline, and we wanna make sure that AI thinks to review this skill and follow this skill whenever we reference certain keywords and suggestions. Okay? So we might say, review a GitHub issue, solve the issue and submit a PR fix. Yeah, something like that. Okay, so now if we were to open up the terminal, or don't forget, we can reference any of our commands or skills directly from the JetBrains AI as well as long

we can reference any of our commands or skills directly from the JetBrains AI as well as long as we're using the cloud agent. Okay? Anyhow, let's boot up Claude. And let's list all of our skills and expand and sure enough, we can see exactly one project skill at the moment for fixed issue. And at the moment it doesn't do anything. Okay? So yeah, let's just think about it. Um, if we were to do this by hand,

So yeah, let's just think about it. Um, if we were to do this by hand, the old school way, what would you do? Well, you would review the issue, of course, you'd look at it, uh, you'd analyze it. Uh, then you would, uh, check out a branch perhaps, and maybe one team has a convention for the name, uh, of the branch you create. And then other teams don't care at all, right? This is why we create the field guide so

And then other teams don't care at all, right? This is why we create the field guide so that we can mold the AI according to how your team behaves. So maybe your team's convention is you create a new branch, uh, and you call it fix slash issue dash, and then the number of the issue up on GitHub, okay? Now that you have a branch, you solve the issue. Uh, maybe you have a mandate that tests or regression tests must be written as part of the fix, and then you need to of course, uh, commit to your changes.

or regression tests must be written as part of the fix, and then you need to of course, uh, commit to your changes. Maybe there is a specific con uh, convention for how you commit those changes, right? Uh, maybe the commit message should be fixed issue number, whatever the issue is. Again, uh, maybe you have to provide a description with the commit message. Maybe you don't. Anyways, and then finally, you need to submit a pr

Maybe you don't. Anyways, and then finally, you need to submit a pr and the PR needs to list that it closes the issue, it needs to summarize the fixes and stuff like that. So just take whatever those steps are for your team and document them. And if you want, you can be really sloppy. Just do a quick bulleted list and then of course you can reach for AI to expand upon this and suggest things, uh, that you might've forgotten.

and then of course you can reach for AI to expand upon this and suggest things, uh, that you might've forgotten. So with that in mind, here's what we might reach for. I'm gonna paste this in here. Alright? Yes. Just too much to write by hand. Alright, so here's how we're fixing GitHub issues. Uh, follow this approach. This is our field guide. This is our guideline. First, we need context. So fetch the issue details. And as we've learned, we can say GitHub issue

So fetch the issue details. And as we've learned, we can say GitHub issue view, and then the number. All right? Have a look, take a look at it like we just discussed. Next, I want you to create a branch. So we're gonna create a branch using this convention. Get check out a branch called fix issue four or five, I think it's three in this case. Next, I want you to follow all of our existing guidelines

or five, I think it's three in this case. Next, I want you to follow all of our existing guidelines and code standards. I want you to write tests. Uh, and this is a key line that I find in my own projects. You cannot consider this work as complete until my test suite passes. Now, of course, we wanna make sure the test suite passed before this issue. Uh, otherwise it's gonna be fixing

before this issue. Uh, otherwise it's gonna be fixing a lot of unrelated things. But yeah, this is a key component. Uh, as often you, maybe you've seen this in the past, AI will provide a fix and then you run the test suite and you think, well, did you fix it? Because none of the tests are passing. This is all broken. You didn't do what you said you did. So yeah, this is key. Keep running this until the issue is solved.

You didn't do what you said you did. So yeah, this is key. Keep running this until the issue is solved. Next, we're gonna run the format command. And this is the Claude command that we learned about in, um, maybe the previous episode. That will simply, uh, we'll simply, uh, as just a, um, an AI shortcut or trigger that runs composer, run format, and then peach p stand and test again. So really, if we want, in this case, we could probably remove that

So really, if we want, in this case, we could probably remove that because format includes the test suite, even though we probably should change that name to something like finalize. Honestly, uh, that better represents what it does. Nonetheless, I'm gonna keep both. Okay, so now we're gonna commit, uh, this is our convention. This is our team's convention for commit messages that resolve issues.

This is our team's convention for commit messages that resolve issues. Next, we are gonna create the pr. And here is a suggestion for how we would create it. So, uh, this looks complicated, but really we just have a summary, like a template for, for what the description should look like. And you can submit a PR using the GitHub, uh, utility by saying pr, create, give it a title, give it a body, and then you can push that up.

by saying pr, create, give it a title, give it a body, and then you can push that up. Alright? So we give it some details, and then the final output is how do you respond to me when I, um, when I'm chatting with you, well, gimme a summary, tell me what was changed, and then give me a link to the pr. This is it, and you can tweak this if you want. We can go back to AI and ask it to, uh, optimize or, uh, suggest anything.

We can go back to AI and ask it to, uh, optimize or, uh, suggest anything. This will do the trick nicely. All right, so now let's try this out. And I'm just gonna warn you, if you've never seen this before, it's pretty wild. And in fact, at the end of the video I'll tease you on how we might take this even further. Alright? So actually, I know you're excited to try this out, but one last thing,

Ensuring Skill Gets Used8:36

Alright? So actually, I know you're excited to try this out, but one last thing, I wanna stress this before we try it out. If we open up our skill, this is a field guide, it's a handbook for ai, but what you may find is that sometimes it just doesn't read the field guide. So we wanna nudge it in the right direction as much as we can. So here's how at least initially, uh,

direction as much as we can. So here's how at least initially, uh, Claude does not load all of these skills into the context. Instead, it'll just have like the name and the description only. So it doesn't have any of this unless it basically opens up that, that field guide. So that means it's really important that the description describes what the skill does as well as when it should be reached for.

that the description describes what the skill does as well as when it should be reached for. So in our case, we have what it does down, it reviews GitHub issue, it solves it and submits a PR fix. But next, when should it reach for it? Well, maybe even if it's a little redundant, let's say reach for this skill whenever I ask you to fix a GitHub issue, and that should be good. Next, if you want, you can even be a little more explicit. This is fix a GitHub issue or Git issue. Okay?

Next, if you want, you can even be a little more explicit. This is fix a GitHub issue or Git issue. Okay? But now let's say you run it and I I, I would imagine it's going to read the skill. Um, but let's say it just doesn't for some reason. Okay? In that case, let's nudge it a little more in the right direction. And here's how, if we scroll down, you'll see I have a clo.md file, but actually this is being populated by Laravel Boost,

you'll see I have a clo.md file, but actually this is being populated by Laravel Boost, which we have installed, and you can find it here. So Laravel Boost dynamically generates this guideline, uh, clause at MD file. So I could append here if I want, but the next time I run Boost, um, install it will clear it out. So instead, what we can do is we can create our own guidelines that will be appended, uh, by boost.

So instead, what we can do is we can create our own guidelines that will be appended, uh, by boost. Here's how I'm gonna create a new directory called.ai. Then within here, let's add another directory for guidelines, and we can add as many markdown files as we want. So why don't we call this Skills md? And yeah, we're just gonna follow the same convention that Claude's using. So we have, um, a heading and then a description. Okay?

convention that Claude's using. So we have, um, a heading and then a description. Okay? Skills, and I'll paste this in and yeah, let's use, uh, tap completion here. Okay. When asked to fix a GitHub issue, immediately use the fix issue Claude skill instead of manually running commands. Okay? So once again, we're being a little redundant here, but we are, we're nudging Claude in the proper direction. And, and hopefully this will do the trick for us.

but we are, we're nudging Claude in the proper direction. And, and hopefully this will do the trick for us. Okay, so bring up the terminal because we have added a new boost guideline, I can say PBRs send Boost and install. Remember though, if you are not using Laravel Boost, then you can simply, uh, append to your own Claude dot mnd file directly. So now let's give it a shot. Finally, let's boot up Claude. Have a look at GitHub issue number three, make a fix

Running Skill to Fix11:27

So now let's give it a shot. Finally, let's boot up Claude. Have a look at GitHub issue number three, make a fix and submit a PR bingo GitHub PR Create Proceed. All right, let's have a look at the summary. It's solved the issue. The problem was that, of course, there was a D statement in there. It fixed it by removing it entirely. And now here is a link to the pr. Here's the pr.

It fixed it by removing it entirely. And now here is a link to the pr. Here's the pr. All right, let's take a look at the files changed. Of course, we just removed that single line, so now I can of course merge the pull request. And now AI has solved our problem. Come on, it's ridiculous.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟