Code Monkey home page Code Monkey logo

copilot-101's Introduction

copilot-documentation Hack Pod

Table of Contents:

How to get started with Installation

https://www.youtube.com/watch?v=0dSKt4DgnyA

  1. Prerequisites: Ensure you have Visual Studio Code (VSCode) installed on your system. You can download it from https://code.visualstudio.com/.

  2. GitHub Account: You will need a GitHub account to access GitHub Copilot. If you don't have one, you can create an account at https://github.com/.

  3. VSCode Extension Installation: Open VSCode. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS). Search for "GitHub Copilot" in the search bar. Click the "Install" button to install the extension.

  4. Authentication: After installation, you will be prompted to sign in with your GitHub account. Follow the on-screen instructions to authenticate.

  5. License Activation: If you have a GitHub Copilot subscription or a trial, you will need to activate your license.

  6. Using GitHub Copilot: GitHub Copilot will now be available to assist you while coding. You can start typing code, and it will provide context-aware suggestions and completions.

Best Practices

Screenshot 2023-10-06 at 8 53 32 AM
  1. Context Awareness Provide context in your prompts to guide the model. Open up each file that is a dependency for the task at hand (Copilot can only draw context from open files in IDE not the entire codebase)
  2. Clarity and PrecisionWhen creating prompts or chat messages, be clear and precise in your instructions such as variable names or files or even the format you'd like the code. Mention the programming language, expected input, or the desired outcome.
    1. Start Simple Begin with simple prompts and gradually increase complexity. This helps you understand how GitHub Copilot responds to different input.
  3. Debugging and Refinement Review and refine the generated code or chat responses carefully. Debugging may still be necessary.

Copilot inline prompt engineering

  • Use cases: auto complete code, documentation when using a readme
  • Ctrl + return will create a large segment of code
  • Having specificity in variable name will help create a pattern

Copilot Chat

  • Use cases: documentation anywhere (including comments and explanations like ChatGPT), creating unit and API tests, refactoring code for a different language or complexity.
  • highlighting segments of code will help target your prompts
  • Different prompts create different results when refactoring
    • Robust creates more validation
    • Readable creates comments
    • Faster creates more efficiency from an O notation compute

Putting it into Practice in the Amplify Repo for Documentation via Chat prompts:

Check out the project board here, depending on what you choose..here are some helpful prompts for

  • Prompt engineering for readme/wiki for an API
  • Functions
  • Tests
  • Workflows

Readme:

Functions:

  • Files are here: https://github.com/ProgramEquity/amplify/tree/main/server/routes/api
  • To add comments: "Make this function more readable and concise"
  • To create documentation in the discussion:
    • Ensure server files of database are open: "Which data models does this function consume"
    • What dependencies does this function use
    • Bonus if you want to create issues for further work on the project: How would I refactor this to be more robust

Tests:

  • Files are here
  • highlight code snippet and type into chat "Explain this test to me"
  • general question and possible addition to wiki "why do we use jest framework", "what are advantages of jest over chai"
  • Bonus if you want to create issues for further work on the project: highlight code snippet and type into chat "how would I mock data for this" and "mock an array of data for this test". Make an issue out of the output.
  • Bonus if you want to create issues for further work on the project: type in //add more post validation tests or //add in test for codes that aren't used yet

Workflows:

Troubleshooting

  • Reinstall the Copilot extension.
  • Ensure you are signed into GitHub, either via CodeSpace or the web interface.
  • If necessary, sign out of GitHub and then sign back in.
  • Copilot will prompt you to allow access.
  • Once access is granted, you can start using Copilot for enhanced coding assistance.

copilot-101's People

Contributors

manishapriya94 avatar dunridge avatar rcmtcristian avatar wiinci avatar

Watchers

 avatar Param Siddharth avatar

Forkers

wiinci

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.