AI Guide for Developers
- For developers, AI is a tool that cuts down repetitive work like understanding code, finding the cause of bugs, writing tests and docs, and review.
- Tools that work directly with your code include Claude Code and Cursor, while a chat AI is enough for questions and design discussions.
- Code that AI produces should go in only after you’ve read it, run it, and tested it.
- Before you start, decide what you will and won’t enter: secret keys, customer data, and internal code.
Who this is for
Section titled “Who this is for”This guide suits web, app, and server developers, people with side projects, and people who want to introduce AI tools to their team.
- You need to get up to speed on a codebase you’ve never seen before.
- You have a lot of repetitive testing, documentation, and review work.
- You need a standard for how far to trust the code AI gives you.
Top 5 ways AI helps
Section titled “Top 5 ways AI helps”1. Understand code you’ve never seen
Section titled “1. Understand code you’ve never seen”Asking it to explain the file structure and what each function does shortens onboarding time. For work that involves reading an entire repository, coding tools like Claude Code and Cursor are a good fit (Understand and fix existing code with Cursor).
I want to understand the structure of this repository. Explain the role of the main directories, the entry points, and the order in which data flows. Then tell me, in order, which files I should read first to modify [feature name]. Mark anything you’re not sure about as a guess.
2. Narrow down the cause of a bug
Section titled “2. Narrow down the cause of a bug”Give it the error message and how to reproduce it, and you can get candidate causes ranked by priority. Remove secret keys and personal information before pasting.
I’m getting the error below. My environment is [language/framework/version], and the steps to reproduce are [reproduction steps]. Give me 3 possible causes in order of likelihood, and for each one, tell me how to check it, with the command or log location. Don’t fix it right away; let’s confirm the cause first.
[Error message and related code]
3. Write test code and documentation
Section titled “3. Write test code and documentation”You can quickly draft unit tests for existing functions, edge cases, a README, and comments. Also check that the generated tests can actually fail.
Write unit tests for the function below using [test framework]. Separate normal cases, boundary values, and invalid-input cases, and add a one-line comment for each test saying what it verifies. Don’t change the implementation.
[Function code]
4. Assist with code review
Section titled “4. Assist with code review”You can get another check on bugs, error handling, and readability issues that are easy to miss in a PR’s changes. Use it as a first pass rather than a replacement for human review.
Review the changes below. Look for problems in this order: potential bugs, missing error handling, security issues, performance issues, readability. Give each item a severity (high/medium/low) and a suggested fix. If there are no problems, say so. Don’t nitpick just to have something to say.
[diff]
5. Automate repetitive work and build agents
Section titled “5. Automate repetitive work and build agents”Repetitive work like scheduled checks or deployment assistance can be handed off to skills, routines, and CI. The concepts are covered in Delegate recurring tasks to agents, and how to build one yourself with the API is covered in Build a work bot with tool use.
I want to automate [task name], which I repeat every week. My current manual process is [process]. Break it into steps that can be automated, and mark the approval points where a person must confirm. Also suggest how to roll back if it fails.
A day in the life
Section titled “A day in the life”- MorningHave AI explain the related code and decide the order to read it→ Understand the scope of changes
- Late morningGet a plan first, then request implementation in small pieces→ Small changes you can verify
- AfternoonWrite tests and run them yourself; if they fail, narrow down the cause→ Passing tests
- Before leavingDo a first review of the diff with AI, then draft the PR description→ Ready for human review
This is a simplified flow. See the official help page for the actual screens.
Recommended learning path
Section titled “Recommended learning path”- The first 30 minutes: Cover how AI basically works and where its limits are.
- Asking good questions: The habit of giving context works just as well for code questions.
- Protecting personal and company information: Set standards for how far you’ll enter code and secret keys.
- Claude Code overview: Learn the installation and basic concepts.
- Getting started with Claude Code: Practice plan mode and the approval flow.
- Claude Code core features: Refine how you work with CLAUDE.md, hooks, subagents, and more.
- Hand off GitHub work with cloud sessions: Try delegating repository work remotely.
- Understand and fix existing code with Cursor: Compare working inside an editor.
- Getting started with the Claude API: Get an API key and make your first call to prepare to build things yourself.
- Manage output quality with evals: Check the quality of what you’ve built with numbers.
To go deeper, the Developer Deep Dives section has topics like the Agent SDK, MCP servers, and headless mode and CI.
More: new tutorials that suit developers
Section titled “More: new tutorials that suit developers”- Getting started with GitHub Copilot: Learn autocomplete, chat, and agent use in VS Code.
- Build your first web app with Claude Code, no coding required: An easy hands-on tutorial that’s good for guiding non-developer colleagues.
- Estimate Costs Before You Send with the Token Counting API: Measure a request’s input tokens with the free count_tokens endpoint and estimate the cost.
- Stream Claude API Responses in Real Time: Turn on streaming and read the server-sent event flow.
- Process Large Jobs with the Message Batches API: Send many Messages requests as one asynchronous batch.
- Use Adaptive Thinking and Effort in the Claude API: Turn on thinking in the Messages API and set effort.
- Tune Claude Code Settings and Permissions Safely: Write allow, ask and deny rules and protect sensitive files like .env.
- Connect MCP Servers to Claude Code: Add MCP servers with claude mcp add and stay safe with third-party servers.
- Review Code with AI Before You Merge: Get an AI first pass on a pull request while a human stays in charge of the merge.
- How to Check an AI Agent’s Work Before You Trust It: A results-review checklist for work an AI agent says it has finished.
- Send Images and PDFs to the Claude API: Put images and PDFs into Messages API requests, with the size and page limits.
- Debug Errors with AI and Prove the Fix: Share an error message safely, let Claude Code find the cause, apply a small fix and confirm it with a test you run yourself.
- Commit, Branch and Open PRs with Claude Code: Let Claude Code draft commit messages, work on a branch and write a pull request, while you check the diff and decide when anything is pushed.
- Cut Cost and Latency with Prompt Caching: Place cache breakpoints, compare automatic and explicit caching, and learn cache lifetimes, minimum lengths, invalidation and the usage fields.
- Shape how Claude responds: output styles and personalization: Control Claude’s tone, length and format with output styles, account Instructions, project instructions and skills.
Copy-ready prompts for developers
Section titled “Copy-ready prompts for developers”Replace the [square-bracket] parts with your own details, then paste the prompt into your AI chat. Don’t paste personal or confidential information; the basics are in Using AI while protecting personal and company information. Always check the results yourself before you use them.
Understand and debug
Section titled “Understand and debug”Explain what the code below does, at the level of a developer new to this codebase. Give: purpose in 2 sentences, the main flow step by step, inputs and outputs, side effects, and anything that looks risky or surprising. Language and framework: [language, framework].
[Paste the code, with secrets and customer data removed]
Tip: Put the relevant code in the prompt, as in Debugging with AI.
I have a bug. Expected behavior: [expected]. Actual behavior: [actual]. Steps to reproduce: [steps]. Environment: [versions, OS]. Error message: [paste]. Relevant code: [paste]. List the 3 most likely causes ranked by probability, and for each give a quick check I can run to confirm or rule it out. Do not suggest a fix until I report back.
Tip: The full method is in Debugging with AI.
Here is a stack trace from [language/framework]: [paste]. Explain in plain words where the failure starts, which frames are my code and which are libraries, and what to inspect first. If you are unsure, say what extra information would help.
Tip: Never paste keys or tokens, per Protect personal and company information.
Tests, docs, and SQL
Section titled “Tests, docs, and SQL”Write unit tests for the function below using [test framework]. Cover the normal case, boundaries, empty or null input, and invalid input. Name each test so it reads as a sentence. Before writing, list the edge cases you plan to cover so I can add or remove some.
[Paste the function]
Tip: Review generated tests carefully; see Reviewing agent work.
Write a README for the module below. Sections: what it does, install, quick start with a minimal example, configuration options in a table, and common errors. Use only what the code shows; mark anything you had to guess with TODO.
[Paste the code or file list]
Tip: More patterns are in Write docs with AI.
Write a [PostgreSQL / MySQL] query for this: [goal in plain words]. Tables: [table names with columns and types]. Explain each clause, mention performance concerns such as missing indexes, and give a small sample result so I can check the logic. Do not modify data.
Tip: See SQL with AI, and test on a copy first.
Review and refactoring
Section titled “Review and refactoring”Review this diff as a careful senior engineer. Check correctness, error handling, security issues, naming, and test coverage. Group comments as must fix, should fix, and nitpick. For each, point to the line and explain the risk briefly. Context for the change: [what the PR is for].
[Paste the diff]
Tip: See Code review with AI, and keep human review as the final gate.
I want to refactor the code below to [goal, e.g., remove duplication, separate I/O from logic]. Propose a plan of small steps where each step keeps all existing tests passing. Do not change behavior. Show the first step only, then wait.
[Paste the code]
Tip: Work step by step as in Refactoring with AI.
Write a commit message and a pull request description for the diff below. Commit: imperative subject under 50 characters, body explaining why. PR: summary, what changed, how to test, and risks. Do not claim anything the diff does not show.
[Paste the diff]
Tip: Git workflows with an AI agent are in Git with Claude Code.
What to watch out for
Section titled “What to watch out for”- Verification: AI can confidently write functions that don’t exist or outdated usage. Confirm by running and testing (how to fact-check).
- Permissions: For tools that run and modify code directly, keep approval units small, and have a person confirm hard-to-undo actions like deletion, deployment, and payments (Using agents safely).
- Licensing: Generated code can resemble existing open-source code. Review it according to your organization’s licensing policy.
- Understand it before you merge it: Don’t merge code you don’t understand. The person who has to fix it later is ultimately you.
Next steps
Section titled “Next steps”- Guide for marketers and content managers, Guide for office, planning, and admin roles: Knowing how the roles you collaborate with use AI makes communication easier.
- Guide for solo business owners and small shops: Helpful for developers who build small tools for others.
- Collection of role guides: Browse other roles.
- Ready-to-use prompt collection: Find more phrases to copy and use.