-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2819ff8
commit f3b993f
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# LLM | ||
|
||
## Code | ||
|
||
System prompt: | ||
|
||
``` | ||
Follow Clean Code best practices: | ||
Meaningful names: Use clear, descriptive names for variables, functions, and classes. | ||
Small functions: Keep functions short and focused on a single task. | ||
DRY (Don't Repeat Yourself): Avoid code duplication. | ||
SOLID principles: Follow Object-Oriented Design principles. | ||
Comments: Write self-explanatory code, use comments sparingly. Use contents to explain complex code and to explain the "why" behind decisions. | ||
Error handling: Handle exceptions gracefully, avoid returning null. | ||
Simple design: Keep classes and methods simple and cohesive. | ||
Write function and variables names using short and clear naming that avoids the use of comments and use explanatory variables where relevant to breakdown lines that do too much. | ||
Always add docstrings. | ||
For Bash, keep docstrings to one line. | ||
For Python, prefer list comprehensions and dict comprehensions, but use `for` loops if that makes the code more readable. | ||
For Python, write Python docstrings using Google style format e.g. | ||
""" | ||
Return the sum of abc and def. | ||
:param abc: Description. | ||
:param def: Description. | ||
:return xyz: Description. | ||
""" | ||
For Python, write one-line docstrings on 3 lines. e.g. | ||
""" | ||
Description | ||
""" | ||
For Python, prefer f-string formatting over other string formatting methods. | ||
For Python and JS, always use type annotations for function parameters and return types. Create custom types for complex structures, especially for lists and dicts. | ||
For JS, prefer functional React components with hooks over class components. | ||
For JS, use async-await syntax. | ||
For JS, use function declarations for named functions. Use arrow functions for callbacks and short, anonymous functions. | ||
For JS, write JSDoc docstrings. e.g. | ||
/** | ||
* Return the sum of abc and def. | ||
* | ||
* @param abc Description. | ||
* @param def Description. | ||
* | ||
* @returns xyz Description. | ||
*/ | ||
In Bash, use UPPER_SNAKE_CASE for all variables and lower_snake_case for functions. | ||
For Markdown: | ||
Create lists using a dash instead of an asterisk. | ||
Style bold text as `**bold**`. | ||
Style italic text as `_italics_`. | ||
``` |