Mazda CX5
Як зробити цифрову копію себе. Ось відео —>

A Ukrainian developer suggested building prompts as a software architecture. How not to overload LLM with instructions?

Ukrainian developer and Data Warehouse Lead Olena Kuznetsova shared her approach to working with large language models. Instead of one large prompt with instructions, she creates a kind of architecture from separate blocks, in which rules, context, automations, and AI agent roles are stored separately and loaded as needed.

3 comments
A Ukrainian developer suggested building prompts as a software architecture. How not to overload LLM with instructions?

Ukrainian developer and Data Warehouse Lead Olena Kuznetsova shared her approach to working with large language models. Instead of one large prompt with instructions, she creates a kind of architecture from separate blocks, in which rules, context, automations, and AI agent roles are stored separately and loaded as needed.

The developer talks about this on LinkedIn.

According to her, she first began to separate out obvious groups of instructions. For example, the rules for writing SQL queries can be put into a separate file and loaded only when the model works with SQL. Over time, the developer formed a more complex system of several types of blocks.

“Instead of soldering a lot of instructions into an agent or skill for all occasions, I first started dividing them into obvious vectors: “here are the rules for writing SQL queries, let's put them in a separate file and load them dynamically,” explains Kuznetsova.

Its "prompt architecture" includes:

  • Rules are direct instructions to the model: what it should do and what it should not do.
  • Project context — information about the project structure, the operation of its modules, and data storage locations.
  • The context of the task is a description of what needs to be done and why. Usually this role is fulfilled by a detailed task in Jira, but for large tasks, the developer creates a separate prompt.
  • Automations are skills for specific repetitive actions. For example, creating documentation for a new table and publishing it in an internal knowledge base.
  • Orchestrators are instructions that determine which AI agents to call and how to organize their work together. In particular, she uses orchestrators to find poor quality AI-generated code where the model itself is not always able to spot the problem.
  • Agents are ready-made work scenarios with decision-making rules and loading of the necessary instructions and skills.
  • Scope is the model's behavior rules. They determine how strictly it should follow instructions, whether it can take initiative, whether it should check its work, and how thoroughly it should explain its actions to the user.
  • Voices are the tone and “personality” of an agent. A noticeable change in response style may indicate that the model has lost some context or is not working as expected.

Among her own modes, the developer mentions scope-beer — literally “developer under beer.” She turns it on when she is not sure of her own decisions and wants the agent to check her more carefully and “lead her by the hand.”

According to Kuzentsova, prompts in such a system increasingly resemble SOLID — principles that divide a program into separate components with clear functions.

“It’s incredibly exciting: building the perfect tool that understands what I mean when I say, ‘Okay, just do it nicely,’” says the developer.

In the comments, Kuznetsova was asked how exactly she dynamically loads additional instructions, since there is no separate button or special mechanism for this in Claude. According to her, it is enough to write the condition in plain text and indicate to the agent the path to the required file: for example, "If you work with module X, read claude/shared/prompt.md"

You can also explain the models in which situations you need to run additional agents. Claude sometimes finds and calls skills independently based on their description, but this does not always work. Therefore, the developer advises to directly name the desired tool in the prompt if necessary.

Previously, dev.ua wrote about the study of configuration files for coding AI agents. It showed that an excessive number of constantly loaded instructions can overload the model context. The researchers advised to put rarely needed rules and skills into separate files that the agent will load only when needed.

Slack launches dedicated channels for teamwork with AI agents. How does it work?
Slack launches dedicated channels for teamwork with AI agents. How does it work?
On the topic
Slack launches dedicated channels for teamwork with AI agents. How does it work?
Life hack from Andrey Karpaty on how to get better answers from AI: just chat with it for 10 minutes
Life hack from Andrey Karpaty, how to get better answers from AI: just chat with it for 10 minutes
On the topic
Life hack from Andrey Karpaty, how to get better answers from AI: just chat with it for 10 minutes
Read the country's main IT news in our Telegram
Read the country's main IT news in our Telegram
On the topic
Read the country's main IT news in our Telegram

Have important news to share? Message our Telegram bot

Key events and useful links in our Telegram channel

Discussion
0

Відстали на декілька років - від такого давно всі відмовились, бо все, що не завантажене в контекст напряму - не гарантується, що дійсно буде вичитане в разі потреби. Тому воно рандомно щось то підтягує то ні. Наразі найкращий підхід - це максимально зменшити кількість інструкцій, залишити лише реально необхідні. А інші рознести по сабагентам і скілам і воркфлоу, які в промптах явно просити викликати, інакше знлву ж таки - ніхто не гарнатує їх виклик, навіть якщо в CLAUDE.md написати "викликай /code-review для рев'ю". Більше того, Anthropic нещодавно оновив claude code видаливши 80% інструкцій, бо по замірам модель, яка сама в рантаймі все шукає, працює краще, ніж коли їй накидали інструкцій, які для різних задач підходять завжди лише частково.

0

Відстали на декілька років - від такого давно всі відмовились, бо все, що не завантажене в контекст напряму - не гарантується, що дійсно буде вичитане в разі потреби. Тому воно рандомно щось то підтягує то ні. Наразі найкращий підхід - це максимально зменшити кількість інструкцій, залишити лише реально необхідні. А інші рознести по сабагентам і скілам і воркфлоу, які в промптах явно просити викликати, інакше знлву ж таки - ніхто не гарнатує їх виклик, навіть якщо в CLAUDE.md написати "викликай /code-review для рев'ю". Більше того, Anthropic нещодавно оновив claude code видаливши 80% інструкцій, бо по замірам модель, яка сама в рантаймі все шукає, працює краще, ніж коли їй накидали інструкцій, які для різних задач підходять завжди лише частково.

0

Відстали на декілька років - від такого давно всі відмовились, бо все, що не завантажене в контекст напряму - не гарантується, що дійсно буде вичитане в разі потреби. Тому воно рандомно щось то підтягує то ні. Наразі найкращий підхід - це максимально зменшити кількість інструкцій, залишити лише реально необхідні. А інші рознести по сабагентам і скілам і воркфлоу, які в промптах явно просити викликати, інакше знлву ж таки - ніхто не гарнатує їх виклик, навіть якщо в CLAUDE.md написати "викликай /code-review для рев'ю". Більше того, Anthropic нещодавно оновив claude code видаливши 80% інструкцій, бо по замірам модель, яка сама в рантаймі все шукає, працює краще, ніж коли їй накидали інструкцій, які для різних задач підходять завжди лише частково.