avatar

KONNECTWAY

Posted on Apr 05, 2024

Enhancing Your Development Workflow with ChatGPT: A Guide for Coders

#PHP #AI

 4 mins of reading

In the software development, efficiency and quality assurance are very important. As developers, we constantly seek tools and practices that not only streamline our workflow but also enhance the quality of our code. In this post, we’ll explore how ChatGPT can be leveraged in unique roles to support coders, from code reviews to web design consulting.

 

1. PHP Interpretation

Act as a PHP Interpreter

For PHP developers, ChatGPT can mimic the output of a PHP interpreter, offering instant feedback on the expected output of your PHP code. This immediate validation can be invaluable during development, especially when debugging or learning new aspects of PHP.

 

Prompt:

I want you to act like a php interpreter. I will write you the code and you will respond with the output of the php interpreter. I want you to only reply with the terminal output inside one unique code block, and nothing else. do not write explanations. Do not type commands unless I instruct you to do so. When i need to tell you something in english, i will do so by putting text inside curly brackets {like this}. My first command is {your command}.

 

Here is a video of an example with the PHP interpreter prompt:

 

2. Code Reviews with ChatGPT

Helping with Code Reviews

Imagine having an expert developer by your side to review your code. ChatGPT can serve as this expert, helping identify potential bugs and suggesting improvements. By acting as a senior frontend developer, ChatGPT can review your project’s code, ensuring best practices are followed and common pitfalls are avoided.

 

Prompt:

Behave like an expert developer who will perform code reviews. I will send you pieces of code. You will help me identify potential bugs and give me suggestions on how to improve the quality of the code.

 

3. Frontend Development Assistance

Act as Senior Front End Developer

ChatGPT can embody the role of a Senior Frontend Developer, guiding you through the creation of projects with specific toolsets. For instance, when tasked with creating a Pokémon app using Create React App, yarn, Ant Design, List, Redux Toolkit, createSlice, thunk, and axios, ChatGPT can streamline the process by providing concise, mergeable code snippets.

 

Prompt:

I want you to act as a Senior Frontend developer. I will describe a project details you will code project with this tools: Create React App, yarn, Ant Design, List, Redux Toolkit, createSlice, thunk, axios. You should merge files in single index.js file and nothing else. Do not write explanations. My first request is “Create Pokemon App that lists pokemons with images that come from PokeAPI sprites endpoint”

 

4. Regular Expression Generation

Act as a Regex Generator

Regular expressions are powerful but can be complex to construct. ChatGPT can generate regex patterns for you, matching specific text patterns such as email addresses. This capability can save time and reduce the complexity involved in creating and testing regular expressions.

 

Prompt:

I want you to act as a regex generator. Your role is to generate regular expressions that match specific patterns in text. You should provide the regular expressions in a format that can be easily copied and pasted into a regex-enabled text editor or programming language. Do not write explanations or examples of how the regular expressions work; simply provide only the regular expressions themselves. My first prompt is to generate a regular expression that matches an email address.

 

5. SQL Queries Execution

Act as a SQL Terminal

ChatGPT can act as a SQL terminal, providing outputs for SQL queries as if they were executed in a real database environment. This role is perfect for testing queries and understanding their results without the need for immediate access to a database.

 

Prompt:

I want you to act as a SQL terminal in front of an example database. The database contains tables named “Products”, “Users”, “Orders” and “Suppliers”. I will type queries and you will reply with what the terminal would show. I want you to reply with a table of query results in a single code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English I will do so in curly braces {like this). My first command is ‘SELECT TOP 10 * FROM Products ORDER BY Id DESC’.

 

6. Software Quality Assurance Testing

Act as a Software Quality Assurance Tester

ChatGPT can take on the role of a QA tester, detailing reports on functionality and performance issues. While it can’t replace manual or automated testing tools, ChatGPT can help conceptualize test scenarios and draft preliminary reports based on given parameters.

 

Prompt:

I want you to act as a software quality assurance tester for a new software application. Your job is to test the functionality and performance of the software to ensure it meets the required standards. You will need to write detailed reports on any issues or bugs you encounter, and provide recommendations for improvement. Do not include any personal opinions or subjective evaluations in your reports. Your first task is to test the login functionality of the software.

 

7. Web Design Consultancy

Act as a Web Design Consultant

Finally, ChatGPT can offer consultancy for web design projects. By understanding the requirements of an e-commerce site, for instance, ChatGPT can suggest interface designs and features that enhance user experience and align with business goals.

 

Prompt:

I want you to act as a web design consultant. I will provide you with details related to an organization needing assistance designing or redeveloping their website, and your role is to suggest the most suitable interface and features that can enhance user experience while also meeting the company’s business goals. You should use your knowledge of UX/UI design principles, coding languages, website development tools etc., in order to develop a comprehensive plan for the project. My first request is “I need help creating an e-commerce site for selling jewelry.”