---
title: "Fix your first bug in Autohand Code Desktop"
description: "Use a dependency-free Node.js practice project to reproduce a quantity bug, let an agent fix it, review the diff, and verify it in the app."
slug: "tutorials/desktop-first-task"
---

This exercise gives you a small project with one failing test, so you can try the whole Desktop loop in a few minutes. You need [Autohand Code Desktop installed](/working-with-autohand-code/code/desktop/installation) and signed in, Git, Node.js 22 or newer, and npm. The project has no dependencies to install.

## Prepare the practice project

1. [Download the practice project](/tutorials/desktop-first-task.zip).
2. Extract the ZIP and keep the `desktop-first-task` folder somewhere you can find it.
3. Open a terminal in that folder and make it a Git repository:

```bash
cd "/path/to/desktop-first-task"
git init -b main
git add .
git commit -m "Add practice project"
```

Replace the path with your extracted folder. These commands also work in PowerShell. If Git cannot commit because your name and email are not set, configure them as you normally would and commit again.

If you installed the `ad` command during setup, you can now run `ad .` to open the folder in Desktop.

## Reproduce the failure

```bash
npm test
```

The price-times-quantity test fails: the code returns **7** where the expected total is **19**. The empty-basket test passes.

The starting implementation ignores quantity:

```javascript title="total.js"
export function total(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}
```

## Open the project and ask for the fix

1. In Desktop, choose **Add project**, keep **Folder**, select the `desktop-first-task` folder, and choose **Create project**.
2. Choose **New thread**. Check the composer shows the project, **Local**, and the `main` branch, and that **Temporary** is off.
3. Pick a model you can use, and a mode that asks first: **Ask** for Autohand, or **Ask for approval** for other agents.

<img className="ah-shot-light" src="/images/desktop/app/newthread-light.webp" alt="New thread composer with the project, Local, branch selector, and Temporary above the prompt, and Ask for approval and a model below it." width="2880" height="1800" />
<img className="ah-shot-dark" src="/images/desktop/app/newthread-dark.webp" alt="New thread composer with the project, Local, branch selector, and Temporary above the prompt, and Ask for approval and a model below it." width="2880" height="1800" />

A new thread ready to send: project, Local, and branch above the prompt; permission mode and model below it.

Send:

```text
Fix the failing quantity calculation in this repository. Run npm test first,
inspect total.js and total.test.js, then make the smallest correct fix and
add a regression test for a zero quantity. Run npm test again. Only edit
this project. Do not commit, push, or install dependencies. Explain the bug
and report the test result.
```

When an approval appears, read what it covers and choose **Approve once**.

## Review and verify

When the turn ends, choose **Review** on the **Edited N files** card. You should see `total.js` multiplying price by quantity, and a new test showing that a zero-quantity line adds nothing. Open **Environment > Changes** to see the whole working tree, or the **Git** panel to see each file's diff.

Then open the right-hand panel, choose **Terminal**, and run:

```bash
npm test
git diff --check
git diff
```

Expected result: **3 tests passed, 0 failed**, with source changes only in `total.js` and `total.test.js`. The agent may also create local `.autohand` files; check those separately before committing. Test names and formatting can differ, so check the behavior rather than the exact output.

## Iterate in the same thread

Ask for one more case and keep the fix:

```text
Keep the fix. Add a regression test for a single item with quantity one,
and rerun npm test. Do not change the public function or add dependencies.
```

Read the new test and run the suite yourself. You should now see **4 tests passed, 0 failed**.

## Try it in a worktree

To see isolation in action, start a second thread on the same project and choose **New worktree** in the **Work in** menu. Ask for a different change, such as a README section. The worktree gets its own branch and files, so the two threads do not touch each other's work. Find and remove it later in **Settings > Worktrees**.

## Clean up

This is a practice folder. Archive its threads when you are done. Removing the project from Desktop and deleting the folder are separate actions, so keep the files if you want the result.

Next, try [real development workflows](/working-with-autohand-code/code/desktop/workflows), [review and delivery](/working-with-autohand-code/code/desktop/review-and-delivery), or [the tour](/working-with-autohand-code/code/desktop/tour).

<AcademyCta course="autohand-desktop-101" title="Autohand Desktop 101" blurb="Install the preview, take a task from prompt to commit, and run agents in parallel worktrees." />
