- Prompt for generating controllers.
- Prompt for service file code generation.
- Prompt for generating db repository functions
- Prompt for generate smaller utils
- Use copilot as a search engine
- Generate Unit test
- Writing regular expressions
- Writing sql queries
- Writing Commands
To generate a large code like controller with its request body, use @workspace agent. Explain about the controller with appropriate info to get desired result. You can also attach existing controller and request body to copy your style.
Example:
@workspace Create a controller to send otp for aadhar verification. Request body of this request takes aadharNumber, name, consent(boolean). It should be a post request with path '/v1/loan-applications/:loanApplicationId/aadhaar/send-otp'. Also add swagger documentation for controller and request body. Refer files #file:pan-verification.controller.ts #file:pan-verification.request.ts.
Generating a controller file with Copilot makes sense as most of the controller files remain same. But in a service business logic is verify specific to the API so it is not a good idea to generate a, entire service file with Copilot. Make use of Copilot autocomplete and write some small functions of this service logic using Copilot.
@workspace Create a video-kyc DB entity with below columns id: auto increment id status: initiated, successful, failed customerId, validTill, agentId: string, auditorId: string, details: JSON
One customer can have many video-kyc. Refer files #file:customer.entity.ts
@workspace Create a function to get all the repayments with status as DRAFTED and update them with status cancelled. This fucntion should take transaction as a params and call db using this given transaciton. #file:repayment.entity.ts #file:repayment.types.ts #file:repayments.enum.ts
@workspace Create a function which take status and date as input and return the repayments with the given status and scheduledAt as the given date b/w 00 hours to 23 hours #file:repayment.entity.ts #file:repayment.types.ts #file:repayments.enum.ts
Using @workspace agent is not required here as the context is going to be a single file in which we are writing the utility function. We should attach additional context using #file.
Give me commands to push the changes to the remote repository
Refer Test cases generation
Working with regular expressions can be challenging and confusing at times. However, GitHub Copilot can help in simplifying the process of writing regular expressions. it is crucial to adjust and test the generated regular expressions according to your specific requirements and the programming language you are utilizing.
GitHub Copilot understands the syntax and context of SQL code. You should keep related entity files open and write a prompt with context about what you want to achieve with the SQL query.
You can use GitHub Copilot for finding the command you’re looking for. You can use code comments to find the command. Also as you begin typing the initial part of the command, GitHub Copilot analyses the context and generates relevant suggestions, and completes the command for you. For instance, This feature proves particularly helpful when you’re learning or writing Git commands.