Generating Readme Files and Code Comments
Learn how to generate readme files and code comments. Discover the benefits of using Google's Bard and how to write code comments and explainer prompts.
Pratham
DevRel @HyperspaceAI • Prev @Rapid_API • Partners @iteration_x @10Web_io @StockImgAI @JamDotDev @CohesiveAI @refine_dev @chatlingai @Inboxproio @Docus_ai
-
Writing code in the AI era is much easier.
— Pratham (@Prathkum) June 3, 2023
I tried Google's Bard with a few different prompts, and it worked great (any developer should check): pic.twitter.com/gTibJ7hZhS -
1. Generate Readme Files
— Pratham (@Prathkum) June 3, 2023
Prompt:
"Generate documentation for the code below. You should include detailed instructions to allow a developer to run it on a local machine, explain what the code does, and list vulnerabilities that exist in this code. {enter code}" pic.twitter.com/dO76Jg1xsa -
2. Write code comments
— Pratham (@Prathkum) June 3, 2023
Prompt:
"Regenerate the code snippet below, but please include comments to each line of code {enter code}" pic.twitter.com/29b72TyXla -
3. Code explainer
— Pratham (@Prathkum) June 3, 2023
Prompt:
"What will the following code snippet do {enter code}" pic.twitter.com/LUUfvydq2U -
4. Find bugs
— Pratham (@Prathkum) June 3, 2023
Prompt:
Find the bug in the following code {code} pic.twitter.com/TZ51j4KO4p -
5. Write code tests
— Pratham (@Prathkum) June 3, 2023
Prompt: "Write test cases for the main edge cases that could happen to the below code snippet. First outline the test cases you'll write. Second, write the test cases in javascript using the Jest framework. {enter code}" pic.twitter.com/EvmEGdk4DP -
6. Convert your code to specific code guidelines
— Pratham (@Prathkum) June 3, 2023
Prompt:
"Rewrite the code below following the Google style guidelines for javascript. {enter code}" pic.twitter.com/QCMKfFAD62 -
7. Code translator
— Pratham (@Prathkum) June 3, 2023
Prompt:
"Translate this code from JavaScript to Python {Enter code}" pic.twitter.com/xMnQyTKeYS