Table of Contents:
- How to get started with installation https://www.youtube.com/watch?v=0dSKt4DgnyA
- Best Practices
- For Prompt engineering inline
- For Copilot Chat https://www.youtube.com/watch?v=whhq0-5ibac
- Putting it into Practice in the Amplify Repo for Documentation
- Readmes
- Functions
- Tests
- Workflows
https://www.youtube.com/watch?v=0dSKt4DgnyA
-
Prerequisites: Ensure you have Visual Studio Code (VSCode) installed on your system. You can download it from https://code.visualstudio.com/.
-
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/.
-
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.
-
Authentication: After installation, you will be prompted to sign in with your GitHub account. Follow the on-screen instructions to authenticate.
-
License Activation: If you have a GitHub Copilot subscription or a trial, you will need to activate your license.
-
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.
- 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)
- 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.
-
- Start Simple Begin with simple prompts and gradually increase complexity. This helps you understand how GitHub Copilot responds to different input.
- Debugging and Refinement Review and refine the generated code or chat responses carefully. Debugging may still be necessary.
- 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
- 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
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
- Amplify readme: https://github.com/ProgramEquity/amplify
- Improve readability
- How would I get started with codespaces
- API Wikis: https://github.com/ProgramEquity/amplify/wiki
- Be sure to have the API files open as well https://github.com/ProgramEquity/amplify/tree/main/server/routes/api
- highlight entire page and ask how do we use this API that is different than Public API
- Which functions are using this API
- Which test codes are we currently using
- 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
- 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
- Files are here: https://github.com/ProgramEquity/amplify/tree/main/.github/workflows
- Create a wiki of all workflows by typing into chat "explain this to me and what endpoints are important"
- Bonus: generate a mermaid.live graphic of all workflows
- Bonus: Make issues by asking to refactor for efficiency
- 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.