AI-assisted programming for responsible people

Hands up if you've heard of cursor, or even both hands up if you've used it.

All right.

Good stuff.

Well, I will try and make this comprehensible, even if you've never heard of it, and you don't even really do that much programming.

And I'll also try and make sure there's something for you, even if you've used it a bunch, and perhaps could learn a few tricks.

All right, so I won't suspend much about me other than to say that I've been mixing between AI, managing teams, and building things back and forth for a long time.

1And it turns out that actually managing people ends up being one of the most useful skills when it comes to managing AIs.

And we'll talk more about what I mean by that in a moment.

So we'll race through how to get things set up and focus straight on a demo.

And I'll talk through some of those patterns.

Okay, so in terms of the cursor setup, cursor is an IDE.

What that means is it's a sort of, it's like Microsoft Word for programmers and you can get it from cursor.com, download, blah-de-blah.

Let's assume that you have downloaded it.

There's a settings cog in the top right.

And I would suggest a few things.

Probably want to turn on privacy mode, especially if you're using it for work.

And in the models, you want Claude 5 Sonnet from 2024 in October.

That's the magic model.

That's the model I trust more than most developers that I've worked with.

It's pretty well behaved and friendly and smart.

What more can you ask for from an AI?

And then pick a reasoning model.

I haven't got a strong view about those yet.

In terms of the features, basically turn them all on.

And there's one in particular called YOLO Mode, which has

the main quality that it enables the AI to run stuff, to do stuff, to actually type commands.

And of course, with great power comes great responsibility.

Sometimes it drops all the tables in my database.

Sometimes it just randomly deletes code that I really didn't want it to delete.

But for the most part, it hasn't yet deleted chunks of my hard disk or emailed my most private thoughts to perfect strangers.

For the most part, it's pretty well behaved.

So turn on all the features.

I even suggest you turn on the beta ones, except the bug finder, because apparently that can be very expensive sometimes.

Okay.

So let's start.

Let's get cracking.

So up here is where we create the...

That's where we interact with the AI.

And so let's write a function that adds two numbers together.

OK, and hopefully it can do this without too much trouble.

And so just as with a normal chat, you blah, blah, blah.

And then the key thing is that it's actually going to start to check the code that we already have and actually write code itself.

So it's created a file called mathutils.py.

That sounds sensible.

okey-doke, yeah, that sounds good, and that looks about right to me, and you can even say, okay, do a bunch more stuff.

1You can even say things like run the unix command to list the files in this directory.

So this is what I was saying before.

You can actually get it to run files rather than just edit them.

Okay, so that's running files.

Cool, so let's get cracking.

Let's do something a little bit more exciting.

Yep.

And we're going to start a new conversation up here.

Make sure we've got Claude 3.5 Sonnet set.

Oh, and by the way, make sure you've got it in agent mode.

That's where all the good stuff happens.

All right.

So I'll use voice to save on typing.

We're going to write a simple vector search app.

And let's start with a planning doc.

OK, and so the key thing here that I've done is I've said I want it to write a document.

I want it to plan.

I want it to think through.

And this is the difference between, OK, write me a function that adds two numbers together.

Yeah, it can do that.

As soon as you want to do something that's going to take hours or days, something like a meaty proper thing,

You've got to plan it out.

You've got to break it down.

You've got to treat it like a project broken down into stages with multiple parts.

And you've got to make sure you're aligned with the AI.

So imagine if you're working with a brand new colleague who doesn't know anything about what you're doing.

Well, of course, you're going to want to have a conversation about the goals.

And they're going to be like, well, should I use this?

Or should I do that?

And is this important?

You've got to have all of those conversations.

All right, so, and in a minute I'll show you a little bit how I've cheated here, but I'll open the curtains so you can cheat too.

So, it said, before I create the planning document, I'd like to ask you a few questions.

So, vector search is basically a fancy word for, I want to be able to type in a query, and it will find me text files that are similar, right?

So, like a mini search engine.

That's what vector search means, and it's using modern AI techniques.

Okay, so what kind of data would you like to search through and hopefully you can see those questions there?

And so one of the things I've told it to do when writing planning documents is to ask me some questions first So that what it comes up with is what I intended.

All right, so just text and you use the open AI one and It's gonna be very small scale data and we'll say command line only as in we're not going to build a website to begin with that we could do that and

If anybody wants, and there's time.

Nope.

And keep it simple.

All right, great.

And so normally, I'd spend a lot longer giving answers, because if I was writing something for work that really mattered, I'd want to be very precise about exactly what kinds of things matter.

You guys, I just want to get racing through it and get to the good stuff.

OK.

And so, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.

And off it goes.

Now, I promised there was a bit of magic, and I was going to show you what that magic is.

So this repository that we're working with doesn't really have much in it, but it does have one important thing.

So you can give cursor the program.

You can give it kind of rules.

And so I've written a rule.

I've said, this is the rule for writing planning documents.

So whenever you're writing a planning document, I want you to do the following things.

I want you to create it with a particular file name.

I want them to be concise.

Only include stuff that you've explicitly agreed with me, OK?

If you're starting it from scratch, then I want you to ask me some questions.

So that's why I ask questions rather than just getting cracking.

And update it regularly, blah, blah, blah.

And I've given it a document structure, the goal, the context, principles, key decisions, actions, yada, yada.

Okay, so in fact, we can see if we go up here.

Great, it's created a planning document for us.

Here it is.

Goal and context.

Okay, so it looks familiar, right?

I told it command line, I told it to use open AI.

It's using simple stuff, small data sets.

And now, look, it's come up with its own to-do list.

Okay, well, I'm just going to be like, what?

and cross my fingers that that all looks right, because there's not enough time.

That all looks good.

Start with creating a mini data set for us to use, three or four documents to start with, and start with a test.

Let's go.

And like I say, normally, I'd probably spend a bit longer.

I'd spend a lot more time looking at this planning document.

Because you think of a planning document as kind of like a contract that you've agreed with the AI.

And so long as you keep reminding it, because sometimes it forgets, keep reminding it to have a look at your planning document, then probably most of the time, it'll actually do what it said it would do in that.

And if your planning document is thoughtful, then you'll end up with good stuff.

So if you're a programmer, this is all going to make sense.

It's going to install the following packages, and then it's going to write some simple functions.

Okay.

So now we can have a look at what it's been up to while I've been yammering.

So it's made that directory for the test data.

Okay.

And then it's created these files.

So this one, Python is a high-level programming language.

Machine learning is a subset of artificial intelligence.

Vector search.

Okay.

These are quite boring, actually.

I might ask it to create some more interesting data in a minute.

And it's updated the packages that it's going to install.

And then it started writing the code.

OK.

Now here's the bit that I want to focus on.

I don't know if you've ever heard of unit tests.

But they're basically like, OK, I am going to run this test.

I'm going to check that things are working the way I expect.

So a test usually is constructed in the following way.

If I give you the following input, then you should give me the following output.

So our test here is saying, OK, if I give you the following, oh, this is all too complicated.

So you know what I might do?

Can you simplify the test, please?

Let's just have a single or one or two that are very easy to read.

OK, let's do that.

And this is one of the key things.

When you're managing a team, the thing I found scariest was there were all these people and they were all industriously writing code, and I couldn't possibly look at all of it.

So the only thing you can do as a manager to feel confident that what they're coming up with is right is to have a really long conversation and be aligned about the overall goals, about what good looks like.

Think about the evaluation.

Think about the tests.

Think about the edge cases.

And if you do that, then you can be fairly confident that anything that

fits all of those evaluation criteria is probably right.

That's why I'm really stressing this point about focusing on the tests.

So now, if we have a look, it's written a much simpler test.

And I can look at that, and I can understand it.

And it's basically just checking, yeah, all of this should work.

OK, great.

And so now, this is where the fun stuff says, OK, I'm going to run the tests for you.

Let's run the test.

Yay, they passed.

Okay, great.

So now add a command line interface and add two or three more random docs about different topics.

Okay, so what I'm asking it is to give it a command line interface so I can type in it and so I can actually try it out.

And so while it's doing that, I'm just going to show you one or two things.

URL there, makingdatamistakes.com slash mindstone 2025.

I've included this presentation, GitHub repository, my favorite tips and tricks, a deep dive on how to use cursor, and a whole bunch of other stuff.

So feel free to grab from there, including links to the voice mode and a bunch of other stuff.

Okay.

And so that's still going.

There's a couple of things that I want to talk through with you.

The first is this idea of conversation modes.

So I've given you a hint of it.

The first one is this information gathering mode, where I say things to me like, ask me questions, help me think through the options and trade-offs for my particular goal, make a proposal, don't make changes.

So you get aligned.

OK, great.

Then once that happens, I say, OK, now update the planning doc.

And you saw that planning doc.

So what we'll ask it to do in a moment is to update it.

And you'll see that it's ticked off most of the items.

And we can see what's next.

And we can agree.

I often ask it to write the tests first.

And it's incredibly satisfying to say, OK, let's write all the tests.

OK, complicated function, all these edge cases.

It writes all the tests.

I'm like, yup, that looks good.

Now write the code that makes those unit tests, those automated tests pass.

And you can literally go off and make a cup of tea, because it sometimes takes a few minutes.

And you can watch it.

It's like, OK, I'm running the tests.

Oh, no.

Most of them fail.

OK, updated the code.

Oh, some of them pass.

OK, great, great.

Updated the code some more.

All the tests pass.

Great, good.

My cup of tea is ready.

And this is literally how I program nowadays.

It's kind of funny.

And then write the code, run the tests in a loop.

And then finally, help me debug this.

Here's the information.

You figure it out.

And often what I'll say is, go and gather some more information.

Check the database.

Inspect the code.

Have a look at the blah, blah, blah.

See if you can figure out what's going on.

Gather the information you might need.

Be a detective.

OK.

So in the meantime, let's see if it's finished.

It's still going.

Crikey.

All right.

And as you can see, our tests are not all passing yet.

That's a bit disappointing.

But it has added some more exciting documents.

We've got some on chess and coffee and gardening.

OK.

And then, all right.

And so if we have a look, I'm also going to say,

update the README with instructions on how to use this and then update the planning document with our progress so far.

And by the way, I don't know if Josh is about to tell you about Super Whisper.

Are you gonna mention it?

Yes.

Okay, then I won't say it anymore.

I'll leave that as a hanging.

And so we can have a look in the README that it's about to dock, and we can also try and run our brand new program that has been written for us.

Okay.

Okay, so here's our README.

This is how to install it, and this is how to use it.

Blah, blah, blah, blah, blah.

So let's try it.

Okay, and so it's giving me these instructions for all the things that I have to do in order to add documents to the database, which is a little bit boring of it.

And then finally I can,

Yeah, you know what this is.

So what I'll probably do is say, can you simplify the interface to add all the documents in the directory?

And then just give me one command that I can run to search over them.

OK.

And so this is an example where I think we didn't do a good enough job upfront in setting out the requirements and saying, I want it to be really, really easy to use.

And if we'd done that, maybe we'd have agreed, this is the interface that I want you to use.

Whereas in this case, I just said, hey, go hog wild.

And we can have a look at our planning document and see if it's updated that.

Yeah, my goodness, it's written way too much code.

So that's one of the dangers.

So I'll often say to it, hey, keep the changes minimal.

Keep this simple.

Do one thing at a time.

Because otherwise, it just kind of writes a bunch of stuff.

One of the nice things about this is if at any point you don't like what it's doing, you can always just skip back up to a previous bit of the conversation.

You click there, and it basically rewinds the state to where it was at that point in the conversation.

So I'll often write something.

It'll start writing code.

I'm like, oh, no, no, that's not right.

go back to that bit of the conversation, be like, okay, let me change my instructions to be a bit clearer.

Okay, try it again.

Ah, yeah, now, here we go.

And so there's a real sense in like, it'd be quite nice in some ways if you could be in the middle of a conversation and just hit undo because you realize you said something really stupid or unclear.

And that's a little bit how this is like.

Okay.

So... Okay.

So...

Ah, yeah, there we go, so it's run the... And so you can see that it's actually run the code itself, and then I will just say run an example for us.

I'm gonna just wait for it to finish coding that.

This is definitely an example where probably what we should have said right up front is keep it really simple, keep it minimal.

Let's try that.

All right.

I promised I would finish on time, so I will do that.

The things I want to just stress are that the key thing here is about context.

So you want to be able to give the LLM the right context.

That means highlighting the relevant files and functions.

Ask me questions before you start coding.

Start new conversations often, because the longer the conversations, the dumber it gets.

And then keep the planning documents up to date so that you can reference them.

So for example,

So I think it's actually deleted my OpenAI key, which is one of the other lessons that I was going to say, which is always make sure that everything is

Reversible, okay, oh my goodness.

So I had a .env file and it's replaced it with, okay, Mind Stone, yup, create secret key.

I'm gonna have to remember to delete this afterwards because it's in front of everybody.

Okay, there we go, let's try that.

Okay, don't overwrite .env.

Try running it again.

Okay, let's see.

And then the final things that I wanted to leave you with were just to say the presentation and everything else is available here, including screenshots for how to set the various...

bits and bobs up in settings, and I would love to hear from you.

I sometimes train teams on how to use Cursor and other more advanced stuff, and I always love talking about this, so I hope that you'll come up and see me afterwards.

Feel free to ask any questions, and thank you.

Does anyone have any questions, then?

Q&A Session

So obviously for this talk, you had to pick a really simple example.

Can you just give a quick summary?

What's the most complex thing you've achieved using this?

Oh, great question.

So I built this.

Basically didn't write any code myself so it's a language learning vocab learning app where you can upload a photograph of a book you're reading and it will automatically transcribe it and

then create a dictionary based on the words that you're learning, and then audio flashcards.

So there I'm learning Greek.

It's automatically found the words that it thinks that I'm going to struggle with.

It's automatically created this dictionary.

It built all this.

It will speak it to me if I want to practice the audio.

And so obviously, yeah, so I wrote some code, but really very little.

And I'm pretty sure it would have taken me two or three times longer in total if I was to try and build it by hand.

I'd be happy to talk about some of the complexities to trying to work within a larger code base, because it's one thing to build from a green field.

It's a whole other to build within a larger structure.

Any other questions?

So right now, the pricing is, it makes no sense.

Cursor charge 20 bucks a month, flat fee, and so long as you stick with the models like Claude, they don't charge you any extra.

After a while, it gets a bit slower, but I mean, I don't know if you get paid to program, but if you do, I would say that the, I mean, this is probably worth thousands of dollars a month to me.

And you sometimes have to pay them a bit more to use the fancy models, but even then it's pretty affordable.

Yes.

Thank you.

Finished reading?