📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

5 Ways I Use Coding & Background Agents Every Day to Boost Productivity

James Montemagno21:25

Transcription

Today, I want to break down five different ways that I'm using coding agents, or background tasks, or background agents, or whatever you want to call them. Things that are doing asynchronous work for you. I want to break down my tips and tricks and setup guides that enable these asynchronous agents to do their best work. So, let's get into it.

[Music]

Okay, so let's first define what I mean when I say coding agent. Sometimes coding agents are often talked about or referred to as background task or background agents. These are essentially things that are happening asynchronously. They could be asynchronous on your machine, but most often they're happening in the cloud.

Now, many of you are probably used to using like chat and agent mode inside of code editors like VS Code or Visual Studio or other IDEs out there. Now, when I'm inside of chat or agent mode and I'm typing in what I want the feature to be, or the bug fix, or debugging things, or getting information in chat, things are streaming back and edits are being applied synchronously inside of my code editor. That is not this.

When we talk about coding agents, they are agents that are working and writing and doing work for you somewhere else, and there's many of them happening at the same time. So, for example, I use the GitHub Copilot coding agent, and that allows me to assign work from many places, including VS Code or Visual Studio or other IDEs, and even github.com, to the coding agent to go do stuff for me. There's a bunch of them out there.

So, I love working with coding agents because it allows me to have any idea at any time, assign it to it, and let it rip. You can do it on multiple branches. You can do it, um, multiple features at the same time. And that's great because when I'm working and I'm going deep on my code on my local machine, I want to be working with the agent mode locally. But I want to have other things happening all at the same time, or perhaps before I go to bed, give it a task to do and wake up and I have something there. And that really, to me, is the difference between a coding agent and things like chat and agent mode.

So, let's get into my very first way that I use these coding agents.

Okay, let's go ahead and ease into this and talk about a way that anybody can start using coding agents today, which is just assigning issues to a specific coding agent. Now, I'm going to be using the GitHub Copilot coding agent, uh, here on my feedback flow application. And if we go into issues, we can see that I have a bunch of different issues here, and some of them actually already assigned to Copilot, and pull requests have been opened.

So, if I take a look at a recent issue that I just created, uh, we can see that I have some information on it using these skeleton loadings. And if I go into assignees, I can assign it to myself or to Copilot. Now, it's there because I enabled that inside of my GitHub Copilot settings. And under coding agent, we can see that I have all repository set. So, what that means, I can come in here, assign it to Copilot, or I could also do it directly from VS Code.

So, over here, I can take a look at the GitHub extension. And if I go ahead and, let's say, refresh this here, we should have that new issue that we just created. And I can just simply assign it to Copilot. So, when I do that, it's basically doing the same thing that I would do if I did it through github.com, but it's all integrated directly into the IDE, which is really, really nice.

So, now we can see the assignee is Copilot. If I hit that gear, I see the same assignees there as well, which is great. So, if I scroll down, we can see that there's this little Copilot eyes over here that Copilot has reacted, that it saw this issue, and it's actually created a pull request for me that I can tap on and I can load it directly here inside of VS Code.

So, this is going to say that it wants to merge changes into main from this Copilot feature fix branch that it created automatically for me, and and it's assigned this, uh, to me, uh, right here, uh, and to Copilot itself. So, what it's going to be doing now is it says, "Hey, thanks for assigning me the issue." It's going to start to work. And it outlines the original issue. If I scroll down, we can actually view the session over here. And this is an asynchronous coding agent session that has automatically got it started over here for me.

So, we can see that it's starting MCP servers, it's checking out the code, it's installing dependencies, and it's starting different things for me automatically, which is really nice. is going to like start to go and start implementing these skeleton loading screens, which is really cool. Now, I can view it all from here. But the place that I actually use almost the most, to be honest with you, is this new chat sessions over here.

If you don't have that, you can go into your settings and just type in chat sessions. And then you'll see this agent sessions view location and just change it from disabled to view. And that will give you this little icon over here that'll show you all of your local chat sessions, which are here from the, uh, agent mode. But then it'll also show you all the coding agent sessions that are active.

Now, this is really neat because you can actually chat with the GitHub coding, uh, agent in real time. So, you can watch its work, you can stop it, you can reply to it, you can see if it's going down the wrong path, basically. Or once it's completed, you could go ahead and have it make changes for you as well. So, I actually had another issue and I actually assigned it to it. So, let's go ahead and take a look at that session.

And we can see that it added 350 lines of code and removed 26. So, I'm going to go and scroll up to the top here. And this is basically the same exact issue. And we can see it checked out the code. It was reading different files and it did a bunch of things for me. And then it said it implemented the heavy sessions. It started checking things off. Started editing files. It was using Playwright to navigate around, uh, and then, you know, at some point it started to actually do visualization change things automatically.

And now what we can see is that I can tap on any of these and actually get that code diff right inside of VS Code, which is really, really cool. So, we have that tier comparison skeleton that it created for us right there. We have another one, uh, which is the admin analytics, uh, one that was created for us as well. So, we get to see all of those there.

Now, this view is very similar to the view that you would see if you went over to that pull request here. Here's that one that was finished. And if you scroll down, it's going to be the same thing that we saw inside of VS Code. And you could also say view session. That would allow you to go through and see that session. It was nearly 18 minutes. And we're going to see all those things that were being shown inside of VS Code. And you could tap on these. is you can get more information of exactly what it was doing along the way to actually finish that work for us. But I love being able to see what's happening directly inside of VS Code, see all of my working coding sessions. We can see it's starting to work right here and it has this checklist automatically for me.

So, that is the first way that you can easily start using coding agents.

Okay, let's get into the second way that I love using coding agents, which is just assigning it work randomly from a bunch of various places. So, here is my content feeds. So, this allows me to like grab things from YouTube or Reddit or Hacker News and then analyze them basically using feedback flow. Now, this is cool, but actually, if you notice when I click on Hacker News, it should just like load automatically.

So, I can come back to my repo and I can click over here on the agents panel, and this will show me my repo and then any other branch I want it to work off of. And then I could just give it a task to do. So, I could say on the content feed page, when the user clicks Hacker News, load it automatically. Just do it. And then I could hit go.

Since I'm often working inside of VS Code, it'd be great to actually delegate directly to the coding agent from there. And you can totally do that. So, if you're inside of chat, and we'll talk about this a little bit more in another feature I like to use, you can just type in anything you want and then click on this delegate to coding agent button there. That's nice when we actually have a bunch of context.

But the place that I actually like to do this from the most and would recommend is go over to that chat sessions and over here under the GitHub Copilot coding agent, just hit plus. This will start a new chat session that will be forwarded to the coding agent. Press it in here, which we want to send, and just go. What's great here is that this will immediately start and run that coding agent session, uh, for exactly what I want. And we can see that the title's been updated here. And we can see that it's been added over here for me as well.

Now, this is going to spin up that coding agent. It's going to start that pull request in motion for me. And then I'll start to get notifications here. So, while we see this working, we got just got to give it a few seconds to spin up that background agent. And there it is. The pull request has been created for me. It has all this information there.

Now, I'll also point out that I'm on main, so it's going to be using main, uh, for it to work off of, and it'll create a branch off of that. But if I was on another branch, it would create a branch off of that branch. I'll talk about that a little bit more. You can always just click see more here, which will then take you to that pull request. We can see that it wants to merge in these changes. I could check it out. I could refresh this. I could view the session. That'll give me everything directly inside of VS Code, which is absolutely delightful.

Okay, let's talk about the third way I use the coding agent, which is sort of to continue the work that I'm working on inside of a branch and even inside of a chat experience. So, here I'm on this feature branch, which I've been working on sort of, uh, I would say, reorganizing my MCP servers, and that has a bunch of work in it, but I wanted to add some new tools.

So, I went to the top up here in ask mode originally. Just kind of got information about my MCP servers, how they're constructed, how to go adding this new method onto it, what I would need to update. So, again, it's looking through a bunch of stuff and give me a plan. It's, uh, suggesting some code changes for me, and then I go ahead and I implement it here, which is great. So, if I tap on this here, we can see that, yeah, it refactored a bunch of code, which is kind of awesome, and that's really nice.

But I still need to update documentation, the website documentation, the README, a bunch of other things. Uh, so here I can just simply say, yeah, let's go ahead and update the documentation, also the docs on the website, and then I'm going to go ahead and hit this little delegate to coding agent. This is going to, of course, analyze that chat history that we saw previously before. And it pops up this window. You might have saw it before, too.

And what it's asking me is says, "Hey, your chat context will be used to continue the work. Do you want to include the changes or ignore the changes?" So, there's two ways that I could have done this. I could have committed the code and then, you know, have it work off of this branch. And that's how that works. If I'm in VS Code and I just say go work on something, if I'm on a branch, it'll work off of that branch. But in this case, I want to actually include the changes inside of this.

Okay. So, what's fascinating here is that it just went off and it created a new branch but brought the changes over with it and then delegated that task off to it. So, that is actually kind of amazing in some way that those sort of pending changes were pushed for a remote branch that it can then go work off of in general. And now this chat is spinning up for me here. And we can see that it has implementation of documentation. And then I can see all the, the different information in this pull request that is coming in and the session sort of in real time. And now it's working. Right.

So, this is cool because I'm on a branch of a branch, and it brought over my changes into that branch that I was just working on. So, I can continue that stream. If I didn't finish my work for the day, I can say, "Yeah, go ahead and go finish this off for me."

Okay. And now that we've talked about sort of creating issues assigned to Copilot, creating new sessions, assigning to-dos, you know, working off existing sessions and actually using different branches. What about actually interacting with these coding agents?

So, here is a pretty big PR that I did to unify this, you kind of commenting threading system. It was a big refactoring, as you can see here. And the first thing that we'll notice is it gives a great overview. Uh, and then I have this immediately set up to launch into staging. So, we can see the staging being set up here. So, I can go and test it. And the first thing that you'll notice here is that I'm just testing the PR, or I'm reviewing the PR. And what I do is just add a comment. So, I say, "@Copilot, this is the error I'm getting." And then I also say, "Can you also fix up any warnings, the API service run null references that were coming up as well?"

So, it gets to work, has a new session, and then it comments back that, hey, it fixed these errors for me, just like if I was working with a colleague down here. It stages. It comes again. Whoa. And I'm like, "Wow, it's working. However, these things aren't working." Right? So, here's some things that you need to happen. It goes back, fixes everything for us, and then in this case, I go, "Wow, this is amazing, but I actually just want some changes to the UI that I didn't think about originally."

So, I just work with Copilot to do that. And at the end of the day, it gives us a nice breakdown, and I'm actually able to deploy it off. So, that's the type of sort of work with, uh, Copilot that I do. Now, I will also say at this, you can also just pull down this branch and start committing code to it and then work back and forth. And I also really like to put these little PR merged, uh, things as well when these GitHub actions go off. It makes me feel pretty good about it, uh, too. So, so I really like seeing these things all happen and that communication back and forth, uh, with Copilot.

Okay, another way that I work with coding agents actually code reviews. So, inside of VS Code or Visual Studio or other IDEs, you can actually have code reviews take place right inside of there. I actually prefer just kind of go to GitHub and do asynchronous code reviews. And all I have to do now is just go into my reviewers and assign it to Copilot.

Now, when I do that, basically what's going to happen is Copilot's going to spin up a full review session for me, uh, that will enable me to kind of just iterate with it back and forth inside of it. So, it's going to go off. It's going to do a, a code review of this and then give me recommendations based off the changes in this pull request. And again, you can do this actually before you commit code inside of VS Code, or in this case, after the pull request has been created. And this is just a great way to get direct feedback and recommendations, uh, for what your code has been committed in that pull request.

So, let's go ahead and see what it gives us.

Okay, so that was actually really fast. So, we got the pull request overview. It gives us a nice, uh, information of what this pull request is about, uh, which is cool. And then it also reviewed 16 out of 30 change files, generated two comments. So, we can actually see everything that gave us, you know, show a summary per file of everything that it looked at. Then we can see here that actually, you know, here it's recommending like using console.write line for logging in production. Library is not recommended. Consider using ILogger dependency for proper logging. If I scroll down, same thing here. So, it hasn't found like too many problems in this, but yeah, I actually probably wouldn't have caught that at all and probably probably do want to use like a, a console logger here or a vi logger, for example, which is really, really nice.

Now, at this point, I could just like assign it off to Copilot and do its thing. But even with that just little thing, and again, this is kind of a small pull request, it's able to identify some immediate actions in place that I could go ahead and actually solve up.

Okay, I want to talk about one more coding agent that's actually been with us for a long time, which is sort of making sure our dependencies are secure and up to date, and that's Dependabot. It's been with us sort of forever, and, you know, you should enable it on your repos. If you go into your repo and go into settings, scroll down to advanced security, and down here there's a bunch of things that you can enable, like dependency graph on it. You can enable dependency alerts for Dependabot security updates, group security updates, and also you can allow Dependabot's, uh, here to create pull requests automatically to keep those dependencies up to date when new versions are available. And you can define custom rules, for example, here for Dependabot rules, and also how often you want things to run.

So, here you can also open up your, uh, Dependabot, and here I'm specifying the .NET SDK, the directory, and the schedule. And when you do that, you go into your network and you can see dependency graph and you can see all of the dependencies in the graph and the ecosystem. Here you can look at the dependents that are coming, and I have none in this one case. And then actually Dependabot here, and it's actually looking at the .NET SDK that have specified and looking at recent job updates and it's understanding what's going on here and updating different version numbers, numbers as well, which is cool.

What this looks like in reality, seeing that I just enabled this, is if I go over to like the .NET Aspire repo and just look for Dependabot, we can see that here last week it added a bump to npm and yarn group across three directories and updates. If I tap on that here, we can see that, yeah, it changed a bunch of files that were inside of here in the package lock lock files, normal packages, and this is just amazing that it's doing for you automatically. Same thing, uh, true over here. If you go back to closed, you can see that these are all of the different, uh, pull requests that Dependabot has been opening on this repo as part of that.

So, when I think about this advanced security and I think about how dependent can just work asynchronously, that's another great agent that's just sitting there waiting for you to use.

All right, a little bit of bonus here. Let's talk about how I manage all of these agents, how I get insight into them, and also talk about tips and tricks for it setting up the environment that you want and following best practices in your repo.

One, I use a lot of GitHub Copilot. So, I can go to github.com/copilot. There's an agents here, and this will actually allow me to delegate tasks to any of my repos at any time. So, I don't even need to go to each individual repo. I can just simply, you know, select it from a drop-down list here and select the branch I wanted to work off of, uh, and then I can see all my open and closed things and things that are working, you know, currently, basically, which is really nice.

Now, once these agents are running, or hopefully before they're running, you can help them create the best environment for them, um, by giving them a little bit of context. If I go into my GitHub folder, we have things in here like chat modes and prompts, and then I have that dependy, but I also have workflows. You think of workflows as CI/CD, building and publishing your applications, but also you can help Copilot sort of get the environment set up that you need when it's working with the coding agent.

So, there's a copilot setup steps.yaml. These are custom steps that you can use for it to set up the environment, basically. And you saw this, it was the first thing it was doing was checking on the code. It was installing .NET and installing dependencies. So, here, for example, I just give it a workflow dispatch. I'm running out of Ubuntu latest. I'm reading contents here, giving the permission, check out the code, getting the actions, install .NET 9, installing dependencies, and installing the Aspire CLI because that's what I use here.

If you're doing down Maui work, I have one set up as well. Over in my Blazer Scorekeeper application, I actually have a workflow specifically for Copilot setup steps, or I actually set up and I install the specific Maui workload here, which is cool. So, you can take a look at that repo too. So, you can define what things you're using for your environment, which is really great.

Now, for it to follow best practices, it's sort of the exact same as working with the, uh, agent mode inside of VS Code or Visual Studio, which is Copilot instructions. Copilot instructions are the grounding, the rooting, if you will, for best practices, how your application is structured inside of here. So, making sure that you have great commands of how it runs it, the architecture, the stack, uh, the integrations, the CSS best practices, how you want your application to be built, and the practices that you want it to follow.

And then, of course, there's not just Copilot instructions. It also works with agents.md. If you're using multiple coding agents out there, you can also use an agents.md file to specify some of that information and use that together inside of it. So, you can do agents.md, or if you're just sort of using the, uh, GitHub Copilot coding agent and agent mode, you can use Copilot instructions, and this will find the generic one or the ones specific, uh, per like programming language, however you want to specify it as well. But these are super duper important for enabling the coding agent and agent mode inside of VS Code and VS and other IDEs to actually follow the best practices, just like your teammate would or you would as well.

Well, there you have it. Those are just some ways that I'm using the GitHub Copilot coding agent every single day to do work for me. Honestly, since this thing was released, I have used it nonstop. And as the integrations into VS and VS Code have gotten better and better, I've been really using that as a hub to do a whole bunch of work all at once locally on my machine and asynchronously with these coding agents.

Well, how are you using coding agents? So, which ones are you using? Have you found different tips and tricks? Let me know in the comments below. I would love to know what you're using, if it's similar to how I'm using it, or I would love some info on how you're using these coding agents as well.

If you're new here, I'm James. I put up videos all the time on .NET development, agentic development, and a whole lot more. So, if you like this video, give it a thumbs up, subscribe, and, uh, ring that notification bell so you get notified every time I put out a video here. That's going to do it for this one. So, until next time, thanks for watching.

[Music]