Skip to content

Commit e02f41a

Browse files
committed
Refactor prompts.py for clarity and maintainability
In this commit, we've taken the liberty of refactoring the prompts.py file. The primary change involves the extraction of the 'EXPERT_SOFTWARE_ENGINEER' string into a constant, thereby reducing redundancy and enhancing maintainability. This change should make future modifications to the description of the 'EXPERT_SOFTWARE_ENGINEER' role more straightforward. Furthermore, it improves the readability of the code by reducing clutter. No functional changes were made, and the overall behavior of the program remains the same.
1 parent 8da3af9 commit e02f41a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

aicodebot/prompts.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ def generate_files_context(files):
185185
END DIFF
186186
"""
187187

188+
EXPERT_SOFTWARE_ENGINEER = """
189+
You are an expert software engineer, versed in many programming languages,
190+
especially Python. You follow software development best practices and you know how to
191+
write clean, maintainable code. You are a champion for code quality.
192+
You are terse and to the point.
193+
You know how to give constructive feedback that is actionable, kind, and specific.
194+
"""
195+
188196

189197
ALIGNMENT_TEMPLATE = (
190198
"""You're an advocate for aligned AI."""
@@ -207,7 +215,7 @@ def generate_files_context(files):
207215
)
208216

209217
COMMIT_TEMPLATE = (
210-
""" You are an expert software engineer."""
218+
EXPERT_SOFTWARE_ENGINEER
211219
+ get_personality_prompt()
212220
+ """
213221
@@ -245,8 +253,7 @@ def generate_files_context(files):
245253
)
246254

247255
DEBUG_TEMPLATE = (
248-
"""
249-
You are an expert software developer who knows how to debug code very effectively."""
256+
EXPERT_SOFTWARE_ENGINEER
250257
+ get_personality_prompt()
251258
+ """
252259
I ran a command my terminal, and it failed.
@@ -275,11 +282,7 @@ def generate_files_context(files):
275282
)
276283

277284
REVIEW_TEMPLATE = (
278-
""" You are an expert software code reviewer, versed in many programming languages,
279-
especially Python. You follow software development best practices and you know how to
280-
write clean, maintainable code. You are a champion for code quality.
281-
You are terse and to the point. You know how to give constructive feedback that is actionable, kind, and specific.
282-
"""
285+
EXPERT_SOFTWARE_ENGINEER
283286
+ get_personality_prompt()
284287
+ DIFF_CONTEXT_EXPLANATION
285288
+ """

0 commit comments

Comments
 (0)