Improving your code craft with generative AI - Liam Hampton, Microsoft

Learn essential tips for working effectively with AI coding tools like GitHub Copilot, from context setting to prompt engineering, testing and workflow integration.

Key takeaways
  • Context is crucial when working with generative AI - provide clear directives and as much relevant information as possible to get better results

  • Prompt engineering is an essential skill - being direct, specific and minimizing iterations leads to higher quality code suggestions

  • Verify all AI-generated code - AI tools like Copilot are assistants, not replacements for developers, and generated code must be tested and validated

  • Copilot works best with commonly used languages and patterns - more popular languages tend to get better suggestions due to larger training datasets

  • Workspace awareness matters - having relevant files and context open in your IDE helps Copilot provide more accurate suggestions

  • Zero-shot, one-shot and few-shot prompts offer different levels of context - iterate through these approaches to get better results

  • AI tools process data ephemerally - they don’t retain or train on your code, maintaining security and privacy

  • Garbage in = garbage out - low quality prompts will result in low quality suggestions

  • Copilot can assist with many development tasks beyond code completion - including commit messages, PR summaries, and code explanations

  • The goal is to enhance developer productivity - AI tools should integrate into your workflow to accelerate development, not replace core engineering skills