Okay, so I'm in a brand-new project and now I wanna
write some code with help of Agency here.
Specifically, what I wanna build in this section here
AI-powered utility tool which can take
some blog post file in Markdown format as
input and produce an optimized tweet, a
post for the X platform based on that.
To do that, I'll start by initializing a new Python
this folder and I'm doing that using the UV tool, which is
a modern Python project manager. You can, of course, create a Python project
in any way you want if you want to follow along.
And with that created, I got a main.py file in
Python code. As you see, I'm already starting with some code here.
Now, as mentioned, I wanna build a program here that
loads a Markdown file, reads a Markdown file, and then uses AI
to generate a post. So let's say those Markdown files should
inputs folder. And in there, I'll add a
post.md file, a simple Markdown file, and in there
I'll store some dummy Markdown post, which I actually took from my
website, maximilianschwarzmuller.com.
In there, I got this article, "AI-powered development:
in the end it's the Markdown for this post which is stored in there.
You'll find that attached in case you wanna follow along, but of course,
need to. So, I want to read
all files that can be found in this inputs folder and
then I wanna generate posts based on those files with help of AI.
Now using Agency mode, we could of course tell
Cursor generate an app that reads
Markdown files and uses AI to produce X
posts. But that would be a horrible
instruction. Let's instead embrace the features Cursor
Agents offer us to increase our chances of getting a good
result. So how do you efficiently use Cursor
Agents? Well, general instructions like this one
here are not something you should do.
Instead, you wanna be as specific as possible
complex tasks into multiple smaller tasks.
When working with Cursor Agents, being
precise and having clear instructions is
the most important thing. You wanna be as
precise as possible. So instead of having a very generic
instruction like this one, you instead might wanna write an
like this one here. And just to be very clear,
more complex programs or if you're working on programs or
applications where you wanna add in individual features, it's a good
idea to break complex tasks up into multiple smaller
tasks. Here, I actually have the entire task
of building this utility program in one instruction, but still
I added some structure here to make this easier to
digest. I'm explaining what we're building,
technology we're using, and then I have this step-by-step
list here to make it very clear what should happen at which point and how
data will flow through this application.
I'm adding lots of meaningful context here because
that is probably the most important skill when working with
AI in general, being a good prompt and context
engineer. Which simply means that you need to be good at
providing the right information to the AI model to increase
your chances of getting the model to produce the right output.
Because all these models are just token generators.
That is what they are. But you can of course increase
the likelihood of the right tokens being generated to
get some output you want by providing the right context,
the right information to the model.
And in the end, prompt and context engineering therefore simply
down to having a clear instruction that's not too
complex, hence you might wanna split complex tasks
smaller tasks, and then providing the right
additional information, the right context to
help the model fulfill that instruction or complete
that instruction. And it's the same with coding and Cursor
Agents. Now, here I actually have just the
context. I don't have any instruction yet.
I'll instead add it here after this instruction, which is what I typically
like to do but which is not a hard rule.
It's just important that you do have a clear instruction
that's required. So here we go, and actually now I am
splitting this overall task up into multiple smaller tasks
because my first instruction here is that as a first step, I want the
AI to add the logic for finding and loading those Markdown
files, and that I don't want it to parse the
want it to convert it to HTML or anything like that.
It should just read it as plaintext.
Again, I'm trying to be as specific as possible
all the required context. Then you should choose an
appropriate model, whichever model you like,
and then you can choose a mode, which is what we'll do
next.