Foundations

Setting Up Your AI Coding Environment

Lesson 2 of 4 Estimated Time 35 min

Setting Up Your AI Coding Environment

Now that you understand the landscape of AI coding tools, let’s get your environment configured so you can start using them effectively. A well-configured setup means faster iterations, better suggestions, and fewer frustrations.

Prerequisites

Before you start, make sure you have:

  • A code editor installed (VS Code, JetBrains IDE, Vim, etc.)
  • An active internet connection (most AI tools are cloud-based)
  • A subscription or free trial to at least one AI coding tool
  • Basic familiarity with your editor’s extension/plugin system

GitHub Copilot Setup

GitHub Copilot is the most accessible starting point. Here’s how to set it up:

Step 1: Get a Subscription

Visit github.com/features/copilot and:

  1. Click “Start a free trial”
  2. Follow the GitHub login/signup flow
  3. Choose your billing preference (monthly or yearly)

Note: GitHub offers free Copilot to verified students and open-source maintainers.

Step 2: Install the Extension

For VS Code:

  1. Open the Extensions sidebar (Ctrl+Shift+X)
  2. Search for “GitHub Copilot”
  3. Click “Install” on the official extension by GitHub
  4. Restart VS Code

For JetBrains IDEs (IntelliJ, PyCharm, WebStorm):

  1. Go to Settings → Plugins
  2. Search for “GitHub Copilot”
  3. Click “Install” and restart your IDE

For Vim/Neovim:

  1. Install via your plugin manager:
    " vim-plug
    Plug 'github/copilot.vim'
  2. Run :PlugInstall and restart

Step 3: Authenticate

When you first use Copilot, it will prompt you to authenticate:

  1. Accept the GitHub authentication flow
  2. A browser window opens asking for authorization
  3. Click “Authorize github”
  4. You’ll see a device code — copy it
  5. Return to your editor and paste the code when prompted

You’re now authenticated!

Step 4: Configure Copilot Settings

In VS Code, open Settings and search for “Copilot”:

Essential settings:

{
  "github.copilot.enable": {
    "*": true,
    "plaintext": false,
    "markdown": true
  },
  "editor.inlineSuggest.enabled": true,
  "editor.inlineSuggest.suppressSuggestions": false,
  "github.copilot.advanced": {
    "length": 500,
    "temperature": 0.1
  }
}

What these do:

  • enable: Toggle Copilot for different file types
  • inlineSuggest.enabled: Show suggestions inline as you type
  • length: Max length of suggestions (500 chars is reasonable)
  • temperature: Lower values = more conservative suggestions

Step 5: Key Bindings

Customize how you trigger Copilot:

{
  "key": "ctrl+;",
  "command": "github.copilot.generateCodePalette"
},
{
  "key": "alt+/",
  "command": "github.copilot.openSymbolFromReferences"
}

Default key bindings:

  • Tab: Accept suggestion
  • Escape: Reject suggestion
  • Ctrl+Enter: Show alternative suggestions
  • Alt+[ or Alt+]: Cycle through suggestions

Cursor Setup

Cursor is a VS Code fork with AI baked in. Setup is simpler than adding extensions.

Step 1: Install Cursor

  1. Download from cursor.com
  2. Install like any other application
  3. Open Cursor (it’s a full editor, not an extension)

Step 2: Sign In

  1. Click your profile icon (top right)
  2. Choose “Sign in with GitHub” or “Sign in with Google”
  3. Complete the authentication
  4. You’ll get a subscription prompt

Step 3: Configure Model and Behavior

Open Settings (Ctrl+,):

Models tab:

Primary model: GPT-4 (or Claude 3.5 Sonnet)
Tab completion model: gpt-4
Chat model: Same as primary

Features tab:

Enable codebase indexing: ON
Enable plagiarism detection: ON (recommended)
Auto-save before chat: ON

Keybindings:

Cmd+K (Mac) or Ctrl+K (Windows): Open chat
Cmd+Shift+L: Open long context
Cmd+I: Open inline edit

Claude Code Setup (Web-Based)

Claude Code is available through Claude.com without installation.

Step 1: Create Account

  1. Go to claude.ai
  2. Sign up with email or Google/Apple account
  3. Verify your email address

Step 2: Enable Claude Code

  1. In the chat interface, look for the “Claude Code” button
  2. Click to enable it for your chat
  3. Grant file access permissions when prompted

Step 3: Using with Local Projects

To work on your local code:

Option A: Drag and drop files

1. Select files/folders in your file manager
2. Drag into the Claude.ai chat
3. Claude can now read and understand them

Option B: Copy-paste code

Select code → Ctrl+C → paste into chat
Claude can reference it and generate related code

Option C: Upload as archive

Zip your project → Upload to chat
Claude has full project context

VS Code General Optimization

Regardless of which AI tool you use, optimize VS Code for faster feedback:

Performance Settings

{
  "editor.fontLigatures": true,
  "editor.wordWrap": "on",
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "files.watcherExclude": {
    "**/node_modules": true,
    "**/dist": true,
    "**/.git": true
  },
  "[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.formatOnSave": true
  }
}

Beyond your AI tool, install these for better development:

ExtensionPurpose
PrettierAuto-formatting
ESLintJavaScript linting
PythonPython language support
GitLensGit integration
Rest ClientTest API requests
Thunder ClientAPI testing UI

IDE-Specific Optimizations

PyCharm (Python Development)

  1. Go to Settings → Languages & Frameworks → Python → AI Assistant
  2. Choose your AI tool (Copilot, Cody, or built-in)
  3. Enable inline suggestions:
    • Editor → Inlay Hints → Code Vision → Enable

WebStorm (JavaScript/TypeScript)

  1. Settings → Languages & Frameworks → TypeScript
  2. Enable TypeScript language service for better completions
  3. Install Prettier for consistent formatting
  4. Add this to Run Configurations:
    {
      "node": true,
      "browser": true,
      "es2021": true
    }

Vim/Neovim Advanced Setup

For Copilot in Vim:

" init.vim
Plug 'github/copilot.vim'

" Key mappings
imap <silent><script><expr> <C-g> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true

For better Copilot experience in Vim, add Copilot-compatible commands:

" Use Ctrl+] to cycle through suggestions
imap <C-]> <Plug>(copilot-next)
imap <C-[> <Plug>(copilot-previous)

Project-Level Configuration

Create a .cursorrules or .clinerules file in your project root to give AI tools context about your project:

.cursorrules Example

# Project Guidelines

## Code Style
- Use TypeScript strictly (no `any` types)
- Follow Prettier config (see .prettierrc)
- Use arrow functions for anonymous functions
- Maximum line length: 80 characters

## Architecture
- Use React hooks, not class components
- Store in Redux with immer middleware
- API calls through services/ directory
- Environment variables in .env.local

## Testing
- Jest for unit tests
- Playwright for E2E tests
- Minimum 80% coverage
- Test files co-located with source

## Git
- Branch naming: feature/*, bugfix/*, docs/*
- Commit messages: conventional commits
- Always open PRs before merging to main

## Security
- Never commit secrets (use .env)
- Validate all user input
- Sanitize HTML in templates
- Check dependencies for vulnerabilities

## Files to Ignore
- node_modules/
- .env
- Build outputs

This file guides your AI assistant’s suggestions to match your project’s standards.

Authentication and Security

Protect Your API Keys

If you’re using Copilot or other tools that interact with your code:

  1. Never commit credentials:

    echo ".env" >> .gitignore
    echo "*.key" >> .gitignore
  2. Use environment variables:

    import os
    api_key = os.getenv('API_KEY')
  3. For Copilot specifically:

    • It respects your .gitignore
    • It won’t suggest code from public .env files in your context
    • Your code is processed on Microsoft servers (review their privacy policy)

Privacy Considerations

GitHub Copilot:

  • Code is processed on Microsoft servers
  • Microsoft may use snippets to improve the model (you can opt out)
  • Disabled by default for files containing certain patterns

Cursor/Claude Code:

  • Different privacy policies (check their documentation)
  • Claude Code offers an option for local processing
  • Smaller context windows for privacy-conscious users

Keyboard Shortcuts Quick Reference

GitHub Copilot

ActionShortcut
Accept suggestionTab
Reject suggestionEscape
Show next suggestionAlt+]
Show previous suggestionAlt+[
Open Copilot paletteCtrl+Enter

Cursor

ActionShortcut
Open chatCmd+K (Mac) / Ctrl+K (Windows)
Inline editCmd+I / Ctrl+I
Accept editCmd+Y / Ctrl+Y
Reject editCmd+N / Ctrl+N

VS Code General

ActionShortcut
Open command paletteCtrl+Shift+P
Open settingsCtrl+,
Open terminal`Ctrl+“

Testing Your Setup

Once everything is installed, test your setup:

For Copilot:

  1. Create a new Python file: test.py
  2. Type: def fibonacci(
  3. Wait 2 seconds — Copilot should suggest the full function
  4. Press Tab to accept

For Cursor:

  1. Open chat with Ctrl+K
  2. Type: “Create a function to validate email addresses”
  3. Watch Cursor write the code with inline chat

For Claude Code:

  1. Go to claude.ai
  2. Enable Claude Code
  3. Type: “Write a simple web server in Python using Flask”
  4. Watch Claude generate code

If you see suggestions appearing, your setup is working!

Troubleshooting Common Issues

Copilot Not Showing Suggestions

# Check if extension is enabled
# VS Code: Extensions → GitHub Copilot → Check "Enable"

# Clear authentication
# VS Code: GitHub Copilot: Sign Out (from command palette)
# Then sign in again

Slow Suggestions

Check your internet connection and:

{
  "github.copilot.advanced.length": 300,
  "github.copilot.advanced.temperature": 0
}

Lower values mean faster, more predictable suggestions.

Extension Not Installing

# Try manual installation
code --install-extension GitHub.Copilot

Next Steps

Now that your environment is set up:

  1. Create a test project to practice with your chosen tool
  2. Write code with AI for 1 hour to build muscle memory
  3. Read through your AI tool’s documentation specific to your editor
  4. Join communities (GitHub Copilot discussions, Cursor Discord, etc.)

The best way to learn is by doing, so don’t spend too long optimizing settings — get coding!

Exercises

  1. Setup Verification: Complete the setup for your chosen tool and get one suggestion working. Screenshot the suggestion and verify the shortcut keys work as expected.

  2. Configuration Audit: Check your current VS Code settings. Write down:

    • What format/linter do you use?
    • What’s your line length preference?
    • Create a .cursorrules file for your current project
  3. Keyboard Muscle Memory: Practice the three acceptance/rejection shortcuts 10 times without looking them up. Time yourself.

  4. Team Documentation: If you work in a team, create a setup guide for your preferred AI tool specific to your project. Include:

    • Installation steps
    • Configuration file contents
    • Common troubleshooting
    • Which files should be ignored by AI