AI chat for developers

Use ChatG as a second pair of eyes: explain unfamiliar code, narrow down bugs, write tests and docs, and map a new language onto one you already know.

4 min readUpdated

A developer working on a laptop at a home desk with plants

For developers, an AI chat is a fast rubber duck that talks back: it reads unfamiliar code, suggests where a bug might hide, drafts tests and writes the documentation nobody wants to write. It does not replace reading the code or running it. ChatG is free with a daily allowance of messages, renders code in highlighted blocks with a copy button, and keeps your history in your own browser. Here are the workflows that pay off most, each with a prompt you can open in the chat.

Understand and fix code

Paste only the code that matters, and include versions, error messages and what you already tried.

Explain unfamiliar code

Inherited a module with no comments? Ask for an explanation plus the edge cases it misses.

Explain what this [language] function does, line by line where it matters. Then list any edge cases it doesn't handle and any performance concerns: [paste code]

Try this prompt in the chat or use the Code Assistant.

Debug an error with ranked hypotheses

Asking for ranked causes and a way to confirm each one turns a guess into a short investigation.

I'm getting this error in my [language or framework] project: [paste error message and stack trace]. Here's the relevant code: [paste code]. Explain the likely cause, rank the possible fixes from most to least likely, and tell me what to log to confirm.

Open this prompt in the chat.

Write unit tests

Tests are a good fit for AI drafts because you can run them immediately and see what fails.

Write unit tests for the function below using [test framework]. Cover the normal case, edge cases (empty input, very large input, invalid types) and one failure case. Use descriptive test names: [paste function]

Try this prompt in the chat.

Get a second review on a diff

Before you ask a colleague, let the chat catch the obvious problems so the human review can focus on design.

Review this code change like a senior [language] developer. Point out bugs, security issues and readability problems, ordered by severity. Suggest concrete changes, and say which comments are optional: [paste diff]

Open this prompt in the chat.

Write queries, docs and new skills

The chat is also handy for the small tasks around coding that break your focus.

Write a SQL query from a schema

Share the table definitions, not the data, and ask for an explanation you can verify.

Write a [SQL dialect] query that returns [describe result] from these tables: [table schemas]. Explain each clause briefly and mention any index that would help.

Try this prompt in the chat.

Draft documentation

Give the audience and the structure, and you get a README section you only need to correct.

Write a README section for [project name] that explains installation, configuration via [config method] and a minimal usage example. Audience: developers who know [language] but not this project. Use Markdown headings and code blocks.

Open this prompt in the chat.

Learn a new language by mapping it to one you know

Side-by-side examples help you skip the beginner material and go straight to the differences.

I know [language I know] well and I'm learning [new language]. Show me how these concepts map: [list concepts, e.g. error handling, async code, packages]. Use short side-by-side code examples and point out traps for someone coming from [language I know].

Start learning in the chat, or choose the Coder assistant for a longer session.

Plan a refactor in safe steps

Large refactors fail when the code is broken for days. Ask for a plan where every step leaves it working.

I want to refactor [component or module] to [goal, e.g. remove a shared global state object]. Here's the current structure: [describe or paste]. Propose a step-by-step plan where the code still works after each step, and say which tests I should add first.

Open this prompt in the chat.

Tips for better results

  • State versions and constraints. Language version, framework, runtime and "no new dependencies" all change the right answer.
  • Give a minimal example. A small snippet that reproduces the problem beats a whole file, and keeps unrelated code out of the chat.
  • Ask for the reasoning. "Explain why this fixes it" makes wrong answers easier to spot.
  • Feed back the result. Paste the new error after trying a fix; the next suggestion is usually much better.

What to avoid

  • Pasting secrets. Remove API keys, passwords, tokens, connection strings, customer data and anything from a .env file. Messages are sent to an AI processing service to generate answers.
  • Breaking your employer's rules. Many companies limit which code may be shared with outside AI services. Check before pasting proprietary code.
  • Running code you haven't read. Generated code can look right and still delete the wrong files or skip validation. Read it, run it somewhere safe and keep your tests green.
  • Installing packages you haven't checked. AI can suggest libraries, functions or options that don't exist or are outdated. Confirm names and APIs in the official documentation before installing anything.
  • Ignoring licenses. If a snippet looks copied from a known project, find the source and check its license.

Ready when you are

Open the chat and ask your first question. It's free, and there is nothing to install.

Start chatting