Skip to content
OPQAI.
Sourced intermediate / 💻 Coding

Use GitHub Copilot for Code Generation in Established Codebases

Job to be done: Integrate LLM assistance into an established codebase for a small engineering team

🇳🇬 Ways to use this in Nigeria

Ideas to get you started, adapt to your situation.

  • 9-5 employee

    As a software engineer, use Copilot to automatically generate comprehensive unit tests for a new API endpoint in your company's backend service, ensuring code quality and faster deployment.

  • Entrepreneur

    As a solo founder, use Copilot to automatically generate the code for integrating a new payment method (e.g., Paystack) into your e-commerce platform, freeing you to focus on product features.

  • Student

    For your final year project's web app, use Copilot to automatically generate the basic structure and tests for a new user login module, speeding up development and learning best practices.

What you’ll get

You’ll learn how to leverage GitHub Copilot to automatically generate code suggestions and pull requests for issues within an established codebase. This approach helps small teams accelerate development by offloading routine coding tasks to an AI assistant.

Tools you need

  • GitHub (freemium) - For version control, issue tracking, and CI/CD.
  • GitHub Copilot (paid) - An AI pair programmer that suggests code and entire functions in real-time, right inside your editor.

Steps

  1. Ensure GitHub is set up - Verify your project is hosted on GitHub and you have access to the repository. This workflow assumes you are using GitHub for source control.
  2. Install GitHub Copilot - If you haven’t already, install the GitHub Copilot extension in your code editor (e.g., VS Code, JetBrains IDEs). Follow the extension’s prompts to authenticate with your GitHub account.
  3. Create a GitHub Issue - Navigate to your GitHub repository and create a new issue that describes a task or bug you want to address. Be as specific as possible in the issue description.
  4. Assign the Issue to Copilot - In the issue details on GitHub, find the ‘Assignees’ section. Assign the issue to ‘Copilot’. This is a convention described in the source material to trigger Copilot’s automated PR generation.
  5. Observe Copilot’s Action - GitHub Copilot, when assigned an issue in this manner, will automatically attempt to generate code to address the issue. It will then open a pull request (PR) with the proposed changes.
  6. Review the Pull Request - Once Copilot has created the PR, navigate to the ‘Pull requests’ tab in your GitHub repository. You should see a new PR with code changes suggested by Copilot.
  7. Examine the Code Changes - Carefully review the code changes within the PR. Check for correctness, adherence to your project’s coding standards, and potential bugs. The source mentions that complex typing might still require manual intervention.
  8. Approve or Discard - Based on your review, you can either approve the PR and merge the changes, or discard it if the suggestions are not suitable. The source notes that there is no stigma around creating many PRs, and unused ones are frequently deleted.

Original source

This workflow is inspired by a discussion on Hacker News titled ‘Ask HN: How are you LLM-coding in an established code base?’ by user adam_gyroscope. The author shares their startup’s practices for integrating LLMs into their development process, focusing on tools like GitHub Enterprise and Copilot for issue resolution.

Notes & variations

  • Free Tier Alternative: While GitHub Copilot is a paid tool, GitHub itself offers robust free-tier features for version control and issue tracking, which are essential prerequisites.
  • Common Pitfall: Relying solely on Copilot’s output without thorough code review can lead to introducing bugs or non-compliant code. Always review AI-generated code.
  • Tip for Better Results: Ensure your GitHub issues are very clearly and precisely described. The more context and specific requirements you provide in the issue, the better Copilot will be able to generate relevant code.

Keep going

More Coding workflows