Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/camsong/chatgpt-engineer-prompts

Awesome ChatGPT prompts for engineers😇
https://github.com/camsong/chatgpt-engineer-prompts

Last synced: 24 days ago
JSON representation

Awesome ChatGPT prompts for engineers😇

Awesome Lists containing this project

README

        

# chatgpt-engineer-prompts 👩‍💻🧑‍💻

image

Practical Prompts for Engineers

## ChatGPT Usage Tips:

1. The ability to record the context, when a question does not get the desired answer, you can continue to pursue the question
2. Support mixed Chinese and English, you can flexibly switch between Chinese and English expressions in a question

## Table of Contents

1. [Code Generation](#code-generation)
1. [Code Explanation](#code-explanation)
1. [Code Optimization](#code-optimization)
1. [Code Conversion](#code-conversion-js-to-typescript)
1. [Specify the return format](#specify-the-return-format)
1. [Regular Expression](#regular-expressions)
1. [Generate SQL](#generate-sql)
1. [Communication](#communication)

## Code Generation

```
Use HTML and CSS to achieve a left-center-right three-column layout, with a fixed width of 100px on the left and right, and the middle to fill the remaining space
```

image
image

```
Use React to generate a login form with a username, password, and confirmation password.
```

image

## Code Explanation

```
Explain this code:
export const useDeepMemo = (memoFn: () => V, key: K): V => {
const ref = useRef<{ key: K; value: V }>().

if (!ref.current || !isEqual(key, ref.current.key)) {
ref.current = { key, value: memoFn() }.
}

return ref.current.value.
}.
```

image

## Code Optimization

```
Optimize the following code:
function bottom(layout: Layout): number {
let max = 0.
let bottomY.
for (let i = 0, len = layout.length; i < len; i += 1) {
bottomY = layout[i].y + layout[i].h.
if (bottomY > max) {
max = bottomY.
}
}
return max.
}
```

image

Support for follow-up questions:

```
Why is it so optimized?
```

image

## Code conversion: JS to TypeScript

```
Converting this code to TypeScript:
const useWrapperCallback = (callback, wrapperFunction) => {
const wrapperRef = useRef({
currentCall: callback.
returnCall: wrapperFunction(function (.. .args) {
return wrapperRef.current?.currentCall(. .args).
}).
}).

wrapperRef.current.currentCall = useMemo(() => callback, [callback]).
return wrapperRef.
}
```

image

## Specify the return format

Return JSON

```
Generate 3 test users' information in json object array format, including name, phone, email
```

image

Return XML

```
Generate 2 test users' information and return it in xml format, including name, phone, email
```

image

## Regular expressions

```
Write a JS regular expression that checks the strength of the password must contain a combination of upper and lower case letters and numbers, no special characters, and be between 8 and 10 in length.
```

image

Can also interpret regular expressions
```
What is the meaning of this regular expression?
^[A-Z]:\\{1,2}[^/:\*\? <>\|]+\. (jpg|gif|png|bmp)$
```

image

## Generate SQL
```
There is a salary table emp_salary, containing employee number emp_id, department name dep_name, salary salary, query each employee's salary and the average salary of his department
```
The following results are generated and the window function is also proficient in use:
```
SELECT
emp_id.
dep_name.
salary.
AVG(salary) OVER (PARTITION BY dep_name) AS avg_salary
FROM
emp_salary.
```

! [image](https://user-images.githubusercontent.com/948896/223762204-ef3296bf-bb72-4b5c-a908-fd7d5be2e0b4.png)

You can also follow up to generate test data and view the results of sample runs at

! [image](https://user-images.githubusercontent.com/948896/223762643-fb17106b-6c54-4f36-9a66-6ca1ecf11ca6.png)

## Communication

```
Explain to a 6 year old why it is important to focus on the quality of the code
```
image

```
Explain to bosses who don't understand technology why they need to do code refactoring frequently
```
image

## WIP

New prompts is coming, stay tuned.