# 5 prompt engineering techniques to get the best out of a legacy project

> Source: <https://dev.to/marcotcdev/5-prompt-engineering-techniques-to-get-the-best-out-of-a-legacy-project-4jc6>
> Published: 2026-06-26 00:20:40+00:00

Have you ever been at a situation where you have been recently hired to maintain a legacy project, an important project at your company, but the previous team has long retired, and when you start, there is no documentation? When that happens, the old adage of "The code is the documentation" sounds true, but what happen when the code is also very old, hard to understand, and make use of libraries from when your parents were dating? In that case, using an AI Tool to help you understand how this project was created and maintained could be an option. Below are five prompt engineering techniques taken from a scientific article, with CLI based examples, to help you get the best out working with a legacy project.

A zero-shot prompt is when you make a prompt to request the model to execute a task without giving it any extra information or practical example in the input prompt. A classic example would be to ask a coding model to translate a "string.xml" file containing commonly used text strings in a natural language (for example, English) into another (for example, Spanish).

Those are the easiest prompts to create and to feed to the model, but their results can be more unpredictable, since they usually lack the constraints of larger prompts.

```
I want you to translate the contents of "string.xml"
from English into Spanish and output it to me.
Check this project files and directories, and provide
me a list containing the current node version being
used on this project and its libraries.
```

In contrast to a zero-shot prompt, a few-shot prompt is a prompt including one or more pairs of the desired input and output, so the model can infer or mimic the desired output when you input the next value. A classic example would be asking a model for predictions based on a set of constraints.

Those prompts tend to be longer and more complicated, and you must check the answer, because there is always a chance the model may infer incorrectly your desired answer.

```
I'm busy on my calendar thursday and friday nights for
this week and the next. Starting two weeks from now,
I'll be busy tuesday and wednesday nights for three weeks.
Based on my schedule, propose a day of the week in the next
four weeks for me to meet with my friends which does not
conflict with my schedule.
```

The chain-of-though prompting is where you use the model own linguistic skills to induce a correct answer. It is like guiding a child in a school homework, you provide the right questions, so the chain of thought of the model will find the answer.

```
This project has an issue with the login page. Some users are unable to login correctly despite providing their user and correct password. Let's solve this step-by-step. What is the login authentication method used here? Please explain your analysis on the answer.

<Model answer OAuth 2.0, with in depth analysis>

Ok, so the model is OAuth 2.0. Now, we need to understand what is the authorization server url, and what is the resources server url. Is the authorization server refusing valid credentials? Or is the user server not accepting a valid token? Please elaborate in depth on the two questions.

<Model elaborates on auth server and user server. Model claims auth server is valid, while user server is rejecting the token>

The authentication token is being rejected as invalid. Please analyze the code, and elaborate on possible explanations on why the token could be rejected. Could it be invalid formatting?
```

The instruction prompting is a technique where the user not only provides information, but also an explicit sequence of steps the model should follow. This step by step prompting, or instruction promping, serves to guide the model in complex logic or mathematic tasks where you don't want it to make a mistake.

The result will depend on how many steps you add and how clear you instruct the model.

```
This project is not building. Let's solve this issue
with the following steps: First, check the project code
for any hint of missing configuration files, anything
from git files, maven, gradle, or npm config. Second,
check the code version of any major language or frameworks,
be it the jdk version, or the spring version or the
angular version. Third, check the files for any syntax
errors that represent an impediment to the project build,
like missing imports, wrong method calls, missing semicolons.
Fourth, after those checks, create a summary of all the
issues you have found, and present it to me in an easy
to read manner.
```

The role prompting is a technique that may be used with other techniques to improve their overall tool output, by filtering certain probable answers. For example, if you're using an LLM to generate source code, either as vibe coder, or as ai assisted coder, you'll want answers most likely to be given by senior engineers, instead of answers given by junior engineers. It is very useful to use with CLI tools, like Claude CLI or Gemini CLI. It may also be user to help you figure out problems in your line of thought, if you assign it an adversarial role.

```
On this specific subject, I need you to behave as a senior software engineer with fullstack expertise.
I'm going to build a line of thought, and I need you to identify and report any possible mistakes I could make. Do not let any possibility of a mistake to remain unindentified.
```


