doc: improve README with prompting examples
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Glenn Y. Rolland 2024-01-04 17:04:20 +01:00
parent a1ff045da3
commit ff2c660d90

View file

@ -172,6 +172,82 @@ Then you can type a shorter command like:
__Note:__ the command `ctrlc` in previous command is an alias to `xclip __Note:__ the command `ctrlc` in previous command is an alias to `xclip
-selection clipboard -i` -selection clipboard -i`
### Prompting efficiently with CodePreloader
The goal is to maximize the effectiveness of your interactions with large
language models (LLMs) using CodePreloader for software development tasks.
1. **Preload Your Project:** Before starting a new task, ensure you preload your project. This prepares the LLM with the necessary context, making it ready to assist you effectively.
**2. Utilize Structure Separators:** Use "@@" as a delimiter to clearly separate and introduce new content. This could be for final requests, additional files, or other relevant data.
**3. State Your Goals Clearly:** Begin by explicitly informing the LLM of your objectives. A clear and concise explanation of what you aim to achieve helps the model understand your needs better.
**4. Reference Preloaded Files:** If necessary, refer to preloaded files by using "@@ File ...". This directs the LLM's attention to specific parts of your project.
**5. Direct Focus Using Specific Phrasing:** Encourage the LLM to "focus" or "concentrate" on particular elements of the preloaded context, like files, classes, methods, etc. These specific terms have been observed to enhance the model's attention to the relevant details.
**6. Approach the Task in Stages:** Divide your request into multiple stages for clarity and precision:
* **a. First Request**: Ask the LLM to analyze the content based on your instructions and explain the approach it would take for the changes requested. At this stage, request the LLM to refrain from writing code.
* **b. Second Request**: Instruct the LLM to focus on both the content and its previous analysis. Request a proposed fixed version of the specific file, class, or method based on the prior analysis. The more detailed your request, the better the outcome. Ask for changes to be made one at a time.
* **c. Third and Subsequent Requests**: Follow the same pattern as the second request but apply it to different parts of the project that require changes.
#### Example: improving a README.md
First request:
> @@ REQUEST (ANALYZE)
>
> We want to improve the README.md file as for an open-source project following the best practices.
>
> Please focus on the code provided in the « @@ File ... » sections and analyze the existing « @@ File "README.md" », then take in account the content of class Config which analyzes the command line.
>
> In this analysis of the existing « @@ File "README.md" », please provide me with a list of things that you appreciate, a list of things to amplify, a list of things to adjust.
Second request:
> @@ REQUEST (WRITE)
>
> We want to improve the README.md file as for an open-source project following the best practices.
>
> Please focus on the code provided in the « @@ File ... » sections and analyze the existing « @@ File "README.md" », then take in account the content of class Config which analyzes the command line.
>
> Please concentrate on the detail of your analysis in your previous message and write a new improved/fixed version of « @@ File "README.md"
#### Example: writing a new feature
First request:
> @@ REQUEST (ANALYZE)
>
> I would like to change CLI parameters structure add add two subcommands:
> * init : which will create an example .code_preloader.yml file (with comments)
> * pack : which will create the packed version of the current directory for LLM prompting
>
> Most of current options (except --version and --help) must become options of the pack subcommand.
>
> I already started some changes to achieve this goal, but it is not finished, and I need your help and expert advises.
>
> Can you please tell me :
> * where the changes should occur (which file? which class? which method?)
> * what kind of changes must be made there?
>
> Please do not write code yet, simply explain.
Second request:
> @@ REQUEST (WRITE)
>
> I would like to change CLI parameters structure add add two subcommands:
> * init : which will create an example .code_preloader.yml file (with comments)
> * pack : which will create the packed version of the current directory for LLM prompting
>
> Most of current options (except --version and --help) must become options of the pack subcommand.
>
> Please concentrate on the detail of your analysis in your previous message and write a new improved/fixed version of « @@ File "README.md". Please keep in mind the separation of concerns and the single responsibility principle.
>
> Please provide me a new version of « File ... » which include the requested change?
## Contributing ## Contributing
Contributions are what make the open-source community such an amazing place to Contributions are what make the open-source community such an amazing place to