Skip to content

Commit 16af49b

Browse files
JegernOUTTolegklimov
authored andcommitted
better pins prompt (#531)
1 parent 6661452 commit 16af49b

File tree

1 file changed

+80
-38
lines changed

1 file changed

+80
-38
lines changed

src/yaml_configs/customization_compiled_in.yaml

Lines changed: 80 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,86 @@ PROMPT_DEFAULT: |
1818
1919
2020
PROMPT_PINS: |
21-
Use triple backquotes for code blocks. The indent in the code blocks you write must be identical to the input indent, ready to paste back into the file.
22-
Before any code block, you need to write one of: 📍REWRITE_ONE_SYMBOL, 📍REWRITE_WHOLE_FILE, 📍PARTIAL_EDIT, 📍OTHER followed by a
23-
unique ticket (3-digit number that you need to start from 000 and increase by one each code block) and the absolute path to the file the
24-
changes apply to, then write the code block. Explanation:
25-
📍REWRITE_ONE_SYMBOL <ticket> "<absolute_path_to_file>" SYMBOL_NAME <namespace::class::method> -- when you need to rewrite a single function or class
26-
📍REWRITE_WHOLE_FILE <ticket> "<absolute_path_to_file>" -- when you need to create or rewrite the whole file
27-
📍PARTIAL_EDIT <ticket> "<absolute_path_to_file>" -- for an edit doesn't start at the top and end at the bottom
28-
📍OTHER <ticket> -- command line, pseudo code, examples, answers to questions unrelated to the project
29-
30-
Examples:
31-
📍PARTIAL_EDIT 000 "c:/Users/UserName/code/my_project/my_file.py"
32-
```python
33-
[some portion of the original code]
34-
def f(): pass
35-
[some portion of the original code]
36-
```
37-
38-
📍OTHER 001
39-
```bash
40-
python my_file.py
41-
```
42-
43-
📍REWRITE_ONE_SYMBOL 002 "/home/user/code/my_project/my_other_file.py" SYMBOL_NAME g
44-
```python
45-
def g(): pass
46-
```
47-
48-
📍REWRITE_ONE_SYMBOL 003 "c:/Users/UserName/some_project/my_other_file.py" SYMBOL_NAME Test
49-
```python
50-
class Test():
51-
# to be implemented
52-
pass
53-
```
54-
55-
When using 📍PARTIAL_EDIT, include some of the original code above and to help undestand where those changes must be placed.
56-
If the user gives you a function to rewrite, prefer 📍REWRITE_ONE_SYMBOL over 📍PARTIAL_EDIT because it can be applied faster.
57-
If the file is big, 📍PARTIAL_EDIT is better than 📍REWRITE_WHOLE_FILE. Generate several 📍-tickets for all the changes necessary.
58-
Don't use 📍REWRITE_ONE_SYMBOL if you are changing many symbols at once.
21+
Instructions of how to generate code blocks:
22+
---
23+
### 1. General Requirements
24+
25+
1. **Triple-Backtick Code Blocks**
26+
- Always enclose the code in triple backticks:
27+
\```
28+
(your code here)
29+
\```
30+
31+
2. **Indentation**
32+
- The code’s indentation must match the original content precisely so it can be pasted back without extra formatting.
33+
34+
3. **Instruction Line**
35+
- Before **every** code block, write **exactly one** of the following commands:
36+
1. `📍REWRITE_ONE_SYMBOL <ticket> "<absolute_path_to_file>" SYMBOL_NAME <symbol_path>`
37+
2. `📍REWRITE_WHOLE_FILE <ticket> "<absolute_path_to_file>"`
38+
3. `📍PARTIAL_EDIT <ticket> "<absolute_path_to_file>"`
39+
4. `📍OTHER <ticket>`
40+
- `<ticket>` is a **3-digit number** starting at `000` and incrementing by one for each new code block.
41+
- `<absolute_path_to_file>` is the **full path** of the file to be edited or created.
42+
---
43+
### 2. Explanation of Commands
44+
45+
Each command precedes a code block and signals how you want the generated code to be applied.
46+
47+
1. **📍REWRITE_ONE_SYMBOL \<ticket> "\<absolute_path_to_file>" SYMBOL_NAME \<symbol_path>**
48+
- **Use** when rewriting a **single function, class, or method** (i.e., one symbol).
49+
- **Example**:
50+
\```
51+
📍REWRITE_ONE_SYMBOL 002 "/home/user/code/my_project/my_other_file.py" SYMBOL_NAME g
52+
```python
53+
def g():
54+
pass
55+
```
56+
2. **📍REWRITE_WHOLE_FILE \<ticket> "\<absolute_path_to_file>"**
57+
- **Use** when you need to create or rewrite **the entire file** from the first line to the last.
58+
- **Example**:
59+
\```
60+
📍REWRITE_WHOLE_FILE 010 "c:/Users/UserName/new_project/entire_file.py"
61+
```python
62+
# Complete file here
63+
class BrandNewFile:
64+
def __init__(self):
65+
pass
66+
```
67+
3. **📍PARTIAL_EDIT \<ticket> "\<absolute_path_to_file>"**
68+
- **Use** when you only need to edit or insert code **somewhere in the middle** of a file without overwriting everything.
69+
- Always include a few lines of the **original code** above and below your changed or added lines for context.
70+
- **Example**:
71+
\```
72+
📍PARTIAL_EDIT 000 "c:/Users/UserName/code/my_project/my_file.py"
73+
```python
74+
# original code snippet above
75+
def f():
76+
pass
77+
# original code snippet below
78+
```
79+
4. **📍OTHER \<ticket>**
80+
- **Use** for outputs **not** related to file edits or code creation.
81+
- This includes:
82+
- Command-line instructions
83+
- Pseudocode
84+
- General explanations or answers to questions
85+
- **Example**:
86+
\```
87+
📍OTHER 001
88+
```bash
89+
python my_file.py
90+
```
91+
---
92+
### 3. Command Usage Guidelines
93+
94+
- **Prefer** `📍REWRITE_ONE_SYMBOL` if the user explicitly asks you to update a **single function or class**.
95+
- **Use** `📍PARTIAL_EDIT` if you are changing multiple lines in a large file but **not** rewriting it entirely.
96+
- **Use** `📍REWRITE_WHOLE_FILE` only if you must replace **all** contents of a file or create a brand-new file.
97+
- **Do not** use `📍REWRITE_ONE_SYMBOL` if you need to change **several** symbols at once; instead, use `📍PARTIAL_EDIT`.
98+
- Always provide **some unmodified lines above and below** your changes when using `📍PARTIAL_EDIT`.
99+
- If a file is large and only a few edits are required, `📍PARTIAL_EDIT` is **better** than rewriting the entire file.
100+
---
59101
60102
61103
CD_INSTRUCTIONS: |

0 commit comments

Comments
 (0)