TL;DR – Why spend hours making manual changes when the right automation tool can do it for you in minutes? 🚀
As a manager, I’ve always looked for ways to make code maintenance more efficient—especially for repetitive tasks like writing unit tests and refactoring code. When I saw how much time my team was spending on these manual processes, I knew there had to be a better way.
That’s what led me to create Torii Genie, an AI-powered tool designed to automate code maintenance tasks. It started as an idea after an AI hackathon at Torii but quickly became a game-changer in our efforts to improve our project’s quality metrics.
You might be wondering why we didn’t just use Cursor, Bolt, or Aider. Keep reading to find out 😇
In this article, I’ll share the challenges we faced, how I built Torii Genie, and the impact it had on our project—plus how AI can help other teams streamline their development process.
This is our Torii Genie:
We aimed to improve the code quality metrics of a project, focusing on key aspects such as test coverage and TypeScript adoption. These metrics are crucial for ensuring reliability, maintainability, and scalability. Higher coverage helps catch issues early, reduces bugs, increases development velocity by giving developers confidence to make changes, and fosters better collaboration.
At the time, our project had 62% test coverage and 33% TypeScript coverage—leaving significant room for improvement. Traditionally, developers had to manually write tests or convert JavaScript code to TypeScript, which was time-consuming and tedious.
I was frustrated that we were investing a significant amount of time and effort, yet the needle wasn’t moving much.
During an AI hackathon at Torii, I was inspired to create an AI-powered solution to tackle these challenges. That’s how Torii Genie was born—an intelligent bot designed to assist with code refactoring by applying a GPT-based prompt across multiple code files simultaneously.
Torii Genie is a modular system that allows developers to easily add different bots for various tasks through configuration. Users can define the AI model they want to use and specify the bot’s tasks:
{
"model": { // configure AI model
"name": "openai",
"type": "gpt-4o"
},
"geniesConfig": {
"HOW_TO_CONFIG": { // configure a bot
"description": "Refactoring task details for clarity and readability",
"prompt": "string | file path - User prompt for detailed instructions",
"instructions": "string | file path - System instructions for AI guidance",
"handlerPath": "file path - Path to AI output handler",
}
}
}
Each bot consists of a user prompt, system instructions, and a handler function that processes AI-generated output and applies the refactoring.