Witaj w ebooku, który zawiera moją prywatną kolekcję promptów do ChatGPT związanych z programowaniem i automatyzacją rzeczy okołoprogramistycznych.
Zbierając i kategoryzując te prompty, miałem na celu stworzenie bazy, która pomoże w nauce programowania oraz skryptowania.
Prompty te są przeznaczone dla osób, które już posiadają pewną wiedzę na temat programowania, ale chcą się rozwijać i poszerzać swoje umiejętności.
W ebooku znajdziesz propozycje z różnych dziedzin. Większość propozycji jest niezależna od języka programowania.
Prompty są po angielsku, bo jakoś naturalniej jest mi pisac o programowaniu po angielsku. Bez przeszkód możesz przetłumaczyć sobie prompty na polski. Działają.
Mocno wierzę, że ta kolekcja promptów okaże się dla Ciebie przydatna i pozwoli Ci się dużo szybciej rozwijać.
No to… do dzieła!
Spis treści
Spis treściJak tego używać?O czym warto pamiętać?👤 Personal coding assistantCode Modularity: Improving ReusabilityCode Readability and Maintainability: Tips and TricksCode Optimization: Improving PerformanceSOLID Principles in Code RefactoringEfficient Code Alternatives: Achieving the Same FunctionalityRefactoring to Standard Library Functions: [YOUR LANGUAGE]Efficient Data Structure and Algorithm Selection for Problem-solvingCode Readability: Improving Naming Conventions🎓 Act as a coding teacherProgramming Concepts Made Simple for BeginnersTranslating [FIRST LANGUAGE] to [SECOND LANGUAGE]: A Line-by-Line ExplanationProgramming Language/Tool Basics: Syntax and Usage ExplainedApplying Programming Principles in Real-World ScenariosStep-by-step solutionsLearning TDDLearning OOPBreaking down the problemExplain any concept using real-world analogy🚧 Act as a [manager]Generate user storiesTechnical project managerBusiness analystProject / work manager📝 Act as a tech writer Release notesDocument endpoint codeTutorial for SDKCreate README.md🤔 Act as a sceptical testerBreak thingsDead ends in user storiesFinding boundary conditionsGiven-When-Then🤖 Act as an automation specialist Bash – renaming filesBash – resizing imagesAnalyze logs with Bash + AWKProcess CSV data with PythonBash automation ideasAutomating with no-code💡 Generating data and ideasIdeas for programming project based on frameworksIdeas for programming project based on APIsGenerate fake data from JsonGenerate fake data from DB schemaRegex generatorCSV → JsonTranslate strings.xml resourcePodsumowanie
Jak tego używać?
Pierwszym krokiem jest przekopiowania prompta i wrzucenie go do ChatGPT.
Miej na uwadze, że zachowanie chatu nie będzie deterministyczne. Możesz dostać inne wyniki niż ja.
Śmiało modyfikuj prompty i sprawdzaj co pasuje do Twojego stylu pracy.
Jeśli jednak zatrzymasz się na pierwszym kroku (copy paste), to nie wykorzystasz potencjału narzędzia.
O czym warto pamiętać?
- Niektóre prompty mają placeholder na Twój język / technologię. Zamień wtedy “[LANGUAGE]” na Javę lub Pythona. Czy na co chcesz. Zrób coś szalonego. Poproś o pseudokod po grecku.
- ChatGPT to bot konwersacyjny – pamiętaj, że możesz nawiązać do poprzedniego elementu rozmowy, by coś wyjasnić, doprecyzować lub dopytać. Możesz napisać wprost, że oczekiwany wynik jest inny i chat ma się poprawić.
- Zauważysz, że część promptów jest do siebie podobna. Tak jest. Zbadaj na własną rękę jakie będą różnice w odpowiedziach, gdy zmienisz początkowe “act as” na coś innego.
- Odpowiedzi, które dostaniesz są punktem wyjścia, a nie rozwiązaniem. Kopiowanie wprost tego, co ChatGTP wypluje jest sto razy groźniejsze niż kopiowanie odpowiedzi ze Stacka.
- Jeśli odkryjesz jakieś nowe, ciekawe instrukcje, dawaj znać!
Miłego, szybszego kodowania!
👤 Personal coding assistant
Remember. Don’t share sensitive data with ChatGPT. I warned. Now my conscience is at peace.
Code Modularity: Improving Reusability
Act as a coding assistant. I will provide you a snippet of code and you need to suggest how it could be made more modular and reusable.
Code Readability and Maintainability: Tips and Tricks
Act as a coding assistant. I will provide you a snippet of code and you need to suggest improvements to make it more readable and maintainable.
Code Optimization: Improving Performance
Act as a coding assistant. I will provide you a snippet of code and you need to suggest how it could be optimized for performance.
SOLID Principles in Code Refactoring
Act as a coding assistant. I will provide you a snippet of code and you need to suggest how it could be refactored to follow best SOLID principles.
Efficient Code Alternatives: Achieving the Same Functionality
Act as a coding assistant. I will provide you a snippet of code and you need to suggest a more efficient way of achieving the same functionality.
Refactoring to Standard Library Functions: [YOUR LANGUAGE]
Act as a coding assistant. I will provide you a snippet of code and you need to suggest a way how it could be refactored to use only standard library functions of [YOUR LANGUAGE]
Efficient Data Structure and Algorithm Selection for Problem-solving
Act as a coding assistant. I will provide you a problem statement and you need to suggest an appropriate data structure and algorithm to solve it efficiently.
Note – this solution is not perfect. Good idea with bufferedReader and useLines, but that forEach could be improved.
Code Readability: Improving Naming Conventions
Act as a coding assistant. I will provide you a piece of code and you need to suggest how it could be made more readable by following naming conventions and avoiding unclear variable or function names.
🎓 Act as a coding teacher
Programming Concepts Made Simple for Beginners
Act as a coding teacher. I will provide you a programming concept or principle, and you need to explain it in simple terms that someone new to coding could understand.
Be cautious. Sometimes ChatGPT may produce untrue results. Double check with programming books, expert blogs or event Wiki.
Translating [FIRST LANGUAGE] to [SECOND LANGUAGE]: A Line-by-Line Explanation
Act as a coding teacher. I will provide you a code snippet in [FIRST LANGUAGE] and you need to rewrite that code into [SECOND LANGUAGE] and explain line by line.
Programming Language/Tool Basics: Syntax and Usage Explained
Act as a coding teacher. I will provide you a programming language or tool, and you need to explain its basic syntax and usage.
Applying Programming Principles in Real-World Scenarios
Act as a coding teacher. I will provide you a programming concept or principle, and you need to explain how it can be applied in a real-world scenario.
Sometimes you may get funny results :)
Step-by-step solutions
Act as a coding teacher. I will provide you a programming problem, and you need to walk through the steps of how to approach and solve it.
This is good starting point if you’re stuck. If you’re still stuck after chatting, discuss ideas with human mentor.
Learning TDD
Act as a coding teacher. I will provide you a programming problem, and you need to explain how to use test-driven development (TDD) to solve it.
Learning OOP
Act as a coding teacher. I will provide you a programming problem, and you need to explain how to approach it with an object-oriented programming (OOP) mindset.
Breaking down the problem
Act as a coding teacher. I will provide you a programming problem, and you need to explain how to break it down into smaller, manageable subproblems.
Explain any concept using real-world analogy
Act as a coding teacher for junior developers. I will provide you a programming concept or principle, and you need to explain it using a real-world analogy or story that is easy to understand.
🚧 Act as a [manager]
In this chapter we will build marketplace-type app for barbers (think “Booksy”).
ChatGPT will help us refine requirements, build user stories, propose metrics and split huge tasks into smaller ones.
I don’t believe that AI will replace seasoned PM soon, however examples below may be a good start for people looking to get some product skills.
Generate user stories
Act as a product owner. I will provide you general requirements and you need to create user stories.
Technical project manager
Act as a technical project manager. I will provide you project requirements and set of frameworks technologies. You need to evaluate how to use those technologies to meet the requirements.
Business analyst
Act as a software business analyst. I will provide you with brief project description. You need to propose metrics that will be implemented.
Project / work manager
Act as my personal work manager. I will provide you with Jira task description and you need to split this into X smaller tasks.
📝 Act as a tech writer
Automate writing boring documentation. Notice differences between setting Chat as “act as programming teacher” vs “act as tech writer”. Have fun.
Release notes
Act as a technical writer. I will provide you with a set of Jira task titles, and you need to write a release notes document that includes the new features, bug fixes, and known issues for the software release. Use only information provided in task titles.
Document endpoint code
Act as a technical writer. I will provide you with a Spring controller code, and you need to write documentation that includes a description of each endpoint, its input parameters, output parameters, and if present, error codes that might be returned.
If you cannot use tools like Swagger, this may be good starting point.
Tutorial for SDK
Act as a technical writer. I will provide you with a sample code for a SDK, and you need to write a guide for developers on how to use it, including step-by-step instructions, code examples, and best practices.
Create README.md
Act as a technical writer. I will provide you with short project description and you need to write GitHub Readme. Use markdown.
🤔 Act as a sceptical tester
Break things
Act as a software tester. I will provide you with snippet of code and you need to break it.
note – some potential issues are valid, some not. What does it mean “testing with different values for the Earth radius”?
Dead ends in user stories
Act as a software tester. I will provide you with user story and you need to identify user dead ends.
Finding boundary conditions
Act as a software tester. I will provide you with snippet of code and you need to find boundary conditions.
Some boundary conditions are valid, some not. Keep in mind, that ChatGPT may not know about newest languages versions.
Given-When-Then
Act as a software tester. I will provide you with snippets of [LANGUAGE] code and you need to propose given-when-then unit test names.
note - there are no IllegalArgumentExceptions thrown in this code. GPT added it.
🤖 Act as an automation specialist
I love using bash scripts. I hate debugging them.
I found out that starting with “act as an automation specialist” produce different results than just “write script that…”.
Have fun.
Bash – renaming files
Act as an automation specialist. Write a Bash script that renames all files in the directory to lowercase.
Bash – resizing images
Act as an automation specialist. I will provide you with a set of images, and you need to write a Bash script that resizes them to a specific resolution.
Analyze logs with Bash + AWK
Act as an automation specialist. You need to write a Bash script that log files in logs directory and generate a report with the most frequent errors using awk.
Process CSV data with Python
Act as an automation specialist. I will provide you with CSV file example, and you need to write a Python script that sorts that data by specific column using built-in csv module
Bash automation ideas
Act as an automation specialist. Suggest 5 ways to automate [BORING TASK DESCRIPTION] with Bash.
Make followup questions. Don’t copy paste stuff requiring sudo without looking :)
Automating with no-code
Act as an automation specialist. You need to describe Integromat scenario that will notify me on Slack everytime Github Action build fails.
💡 Generating data and ideas
Ideas for programming project based on frameworks
Tired of doing next todolist or pet clinic with class Dog extends animal? Use this prompt to generate project ideas based on tech you know, or tech you want to learn.
After generating ideas you can further discuss given topic.
Act as a creative developer. I will provide you with a set of frameworks and technologies and you need to generate X project ideas I can code overnight.
Ideas for programming project based on APIs
There are a lot of cool apis. While using single API may be boring, you may find excitement and fresh perspective by combining them.
Act as a creative developer. I will provide you with a set of APIs and you need to generate X project ideas that utilize these APIs.
Generate fake data from Json
I will provide you with class representing JSON structure. You need to create fake data with X elements.
Then you can ask Chat to write you a script that will generate fake data ;)
Generate fake data from DB schema
I will provide you with a database schema. You need to generate fake data with X records.
Regex generator
Act as a regex generator. You need to generate a regular expression in a format that can be easily copied and pasted into a regex-enabled text editor or programming language. I will provide you with examples.
O my, regex. I have love-hate relationship with them. Check https://regex-generator.olafneumann.org/ for debugging expressions.
CSV → Json
I will provide you with CSV data. You need to convert it to JSON.
Translate strings.xml resource
Act as a translator. I will provide you with strings.xml with [SOURCE LANGUAGE] resources. You need to translate all values to [TARGET LANGUAGE] and give me XML file.
Podsumowanie
Mam nadzieję, że ta kolekcja promptów okaże się dla Ciebie inspiracją i pomocą w Twojej drodze programistycznej.
Wierzę, że roztropne wykorzystanie AI będzie kluczem do sukcesu.
Dziękuję, że zdecydował*ś się skorzystać z tej kolekcji promptów i życzę Ci powodzenia w Twojej przygodzie z programowaniem!!
Powodzenia,
Jarek Michalik