How to Get More from GPT-4.1 in Kilo Code
Learn how GPT-4.1 works & set up a custom rule to make it more powerful in Kilo Code.
We've noticed something pretty interesting lately - a large portion of our free tier users are choosing OpenAI's GPT-4.1. So much so that we’re currently sitting at #5 in the OpenRouter rankings because of it:
For this reason, I decided to dig into some research on how to use GPT-4.1 more effectively for coding, and then apply those findings directly to Kilo Code.
Without further ado, let’s get started!
Analyze OpenAI's official prompting guide for GPT-4.1
It's quite a lengthy guide - my word counter tallied up 7,634 words total.
Here’s one section from the guide that stood out to me:
Greg Isenberg has published a handy TLDR version of the guide:
Some of these principles can also be applied when working with other AIs; I recommend reading this guide whenever you have the chance.
How to apply those principles when working in Kilo Code
I found a useful custom rule that someone posted on Cursor's forum yesterday. This rule uses a lot of the principles mentioned in OpenAI’s official prompting guide.
I've also created a gist from the forum post that you can just copy-paste into a custom rule file in Kilo Code. Here's how:
The “quick and dirty way”
Create a .kilocoderules file inside your project directory and paste the prompt there:
NOTE: This is a deprecated way to create a custom rule that's being maintained for backward compatibility. I included it here because this approach is still widely used and you’ll probably see this file in many existing projects.
The proper way. These days, having a single custom rule file is basically like cramming your whole application into one file. You need some file organization to keep your sanity. Here’s the “proper” way to do create a custom rule in Kilo Code (other AI code editors like Cline/Roo/Cursor use a similar approach):
Create a .kilocode folder inside your root folder
Create a /rules/ folder inside the newly created .kilocodefolder
Place your file inside /rules/ folder. You can name your file anything you want. Let’s name our file “gpt4.1-rocks.txt”
After completing all 3 steps, your VS Code window should look similar to this:
..and voila! You should now be able to get more from GPT-4.1 inside Kilo Code.
Pro tip: To verify that your custom instruction setup is working correctly, first try adding a simple instruction and see if it works
For example, create an index.html file in your project directory and add this to your custom instruction: "Do not read index.html, it's a sensitive file."
Then ask Kilo Code: "Read the content inside index.html"
If Kilo Code refuses to access index.html, congratulations! Your custom rule is working properly. Here’s a video demonstrating this:
Hope your found this tutorial to be useful!