Skip to content
AIupick

Coding

Understand and fix a small piece of code

Ask a coding tool to explain code first, make one small change at a time, and test everything yourself.

Tool types that fit: Coding

Step by step

Worked example: A Python function that crashes on an empty list

  1. 1
    Never paste passwords, API keys or private customer data.

    For example

    The function is in a file that also holds an API key. Copy only the function, never the key.

  2. 2
    Describe what the code should do and the exact error or behaviour you see.

    For example

    What you type

    This Python function should return the average of a list of numbers: def average(numbers):    return sum(numbers) / len(numbers) average([2, 4, 6]) works, but average([]) stops with:ZeroDivisionError: division by zeroFor an empty list it should return None.
  3. 3
    Ask for an explanation of the code before asking for changes.

    For example

    What you type

    First explain what each part of the function does and why the empty list fails. Do not change the code yet.

    Sample answer, written by us. Your tool's answer will differ.

    sum(numbers) adds the numbers up and len(numbers) counts them. For an empty list both are 0, and Python cannot divide by zero, so it raises ZeroDivisionError.
  4. 4
    Apply one small change at a time.

    For example

    What you type

    Now suggest the smallest change that returns None for an empty list.

    Sample answer, written by us. Your tool's answer will differ.

    def average(numbers):    if not numbers:        return None    return sum(numbers) / len(numbers)
  5. 5
    Run the code and its tests yourself, and read every changed line.

    For example

    Run both cases yourself: average([2, 4, 6]) should give 4.0, and average([]) should give None. Read the two new lines: they only handle the empty list and change nothing else.

Template to copy

Here is some [language] code:
[code]
It should [expected behaviour], but instead [actual behaviour or error message].
First explain what the code does, step by step.
Then suggest the smallest change that could fix it, and explain why.
Tell me how I can test the fix.

Asking AI to flag uncertainty does not make its answer correct. Keep checking the parts that matter.

Check the result

  • You understand what the change does.
  • The code runs and the tests pass on your machine.
  • No secrets were shared with the tool.
  • The change did not break other parts of the code.
  • You read every line that changed.

Tools you could try

Listed by name, not ranked. You can only compare tools of the same type side by side.

  • Amazon Q Developer is AWS's AI assistant for software development in code editors, the command line and the AWS console; a beginner might try its free tier for code suggestions and questions about AWS.

    CodingKnown for:Amazon Q in the AWS Management ConsoleJava upgrade transformationDiagnose with Amazon Q

    Cheapest paid: Pro Tier $19.00 / month

    Verified free plan
  • Cursor is an AI code editor and coding agent from Anysphere that runs as a desktop app, a command-line tool and cloud agents; a beginner might try it to get code suggestions while typing or to ask an agent to explain and change a project.

    CodingKnown for:TabCloud AgentsBugbot

    Cheapest paid: Plus $8.00 / month

    Verified free plan
  • GitHub Copilot is GitHub's AI coding assistant for code editors, the command line, GitHub.com, GitHub Mobile and a desktop app; a beginner might try it for code suggestions while typing and for asking questions about a repository.

    CodingKnown for:Copilot cloud agentCopilot code reviewThird-party coding agents (Claude and Codex)

    Cheapest paid: Copilot Pro $10.00 / month

    Verified free plan
  • JetBrains AI Assistant is a plugin that adds AI chat, code completion and coding agents to JetBrains IDEs; a beginner might try it for code suggestions and questions about a project in IntelliJ IDEA or PyCharm.

    CodingKnown for:JetBrains Air in IDEsJunieClaude Agent and Codex in AI Chat

    Cheapest paid: AI Pro $10.00 / month

    Verified free plan
  • Tabnine is an AI coding assistant for code editors and the terminal, now owned by Tricentis, whose current documentation describes enterprise plans; a beginner could use it for code completions and chat about a codebase if their organization provides access.

    CodingKnown for:Private installation (on-premises or VPC)Context EngineProvenance and Attribution

    Paid plans not yet confirmed

    Free plan: not yet confirmed
Esc
↑ ↓ to moveEnter to open