AI-151

Using Windsurf as coding assistant and generator

(code and test generation, code refactoring, explanation and documentation)

Course Length

1 day or 2 half days

Course Overview

Windsurf is one of the most popular alternatives to Github Copilot among coding assistant applications which help programmers to generate, refactor, explain and document program codes in dozens of languages as well to generate tests for the same codes.

An important feature of Windsurf is the ability to use not only the current file but also local program libraries as well as public and private repos as context for code understanding and generation. This way Windsurf can learn the programming standards and styles of the team or the whole organization and can produce code that fits well into the existing code base and can use public or company program libraries.

Training Objectives

At the end of the training participants:

  • • understand the basic LLM and Windsurf concepts
  • • gain practical skills in prompt engineering
  • • gain practical skills in using Windsurf for code and test generation, code refactoring, explanation and documentation

Main Topics

  • • LLMs in a nutshell
  • • Introduction and main features of Windsurf
  • • Test Driven Development with Windsurf
  • • Windsurf autocompletion
  • • Windsurf Chat
  • • Prompt engineering for code generation
  • • Advanced features (Explain, Document, Refactor, Unit-test generation)
  • • Adding context

Structure

Roughly 50% lecture, 50% hands on lab exercises. The lab exercises are available either in a VS Code + Python, VSCode + C, C++ or IntelliJ + Java environment.

Target Audience

Software developers and testers as well as their technical managers who want to use Windsurf in their daily work.

Prerequisites

Basic understanding of AI concepts, experience in using the programming language where Windsurf would be used as a coding assistant, user experience with ChatGPT or similar chatbots.

Course Modules

Module 1: LLMs in a nutshell

  • Main parts and working of LLMs in a nutshell
  • Most important base LLM vendors and models
  • LLMs used in Windsurf

Module 2: Introduction and main features of Windsurf

  • Main features of Windsurf
  • VS Code or IntelliJ basics
  • Core features of Windsurf
  • Different Types of Interaction with Windsurf
  • Using different LLMs (GPT, Claude Sonnet and Windsurf's proprietary ones)
  • Test Driven Development with Windsurf
  • Lab

Module 3: Windsurf autocompletion

  • Auto completion
  • Accept suggestion, accept next word, next suggestion
  • With cycle menu
  • With shortcuts
  • Lab

Module 4: Windsurf Chat

  • Windsurf Chat: Inline commands
  • Windsurf Chat: Chat panel
  • Windsurf Chat: Tips & Tricks
  • Lab

Module 5: Prompt engineering for code generation

  • The 2 golden rules of prompt engineering
  • 10 Prompting rules of thumb
  • Be concise and give clear instructions
  • Be specific and include relevant details
  • Add positive and negative prompts
  • Define roles for the LLM
  • Define roles for the LLM's audience
  • Provide examples for the solution or response style (one-shot or few-shot prompting)
  • Add relevant context
  • Divide difficult tasks into subtasks (Prompt Chaining)
  • "Let's think step by step" (Chain of Thought)
  • Let the LLM ask questions
  • Lab

Module 6: Advanced features

  • Explain
  • Generate explanation for a code-block: With Code Lens, with Chat and linking the code block with @ in the Chat window as well as with code block selection and global menu
  • Documentation
  • Generate language specific documentation in the right format
  • Refactoring
  • Language specific refactoring options in the refactor menu
  • Unit-test generation
  • Lab

Module 7: Adding context

  • Context handling in Windsurf
  • Custom chat instructions
  • Pinned contexts
  • Local indexes
  • Setting files and directories which won't be part of the context
  • Setting up team-wide repos for context
  • Using team-wide repos
  • Lab