ClineCode

Learn ClineCode

Seven short lessons that make the agent more useful, and make each of your messages go further.

Lesson 1

Say what “done” looks like

The agent does best when it knows the goal, where to work, and how to tell it’s finished.

VagueFix the login.
ClearUsers with a "+" in their email can’t log in. The check is in src/auth/validate.ts. Fix it and add a test that covers name+tag@example.com.
Lesson 2

Point it at the right place

Type @ and a path to mention a file or folder. Paste error messages and stack traces as they are; don’t paraphrase them.

ExampleThe build fails with the error below. Start from @webpack.config.js.
ERROR in ./src/index.ts Module not found: Can’t resolve "./routes"
Lesson 3

Ask for a plan on bigger jobs

For anything that touches several files, ask for a plan first, read it, then tell it to go ahead. It’s cheaper to fix a plan than to undo a change.

ExampleI want to move our settings from JSON files to environment variables. Don’t change anything yet. List the files involved and the steps you’d take.
Lesson 4

Read before you approve

ClineCode shows each file edit and command before it runs and waits for you. Read the diff. If it’s not what you want, say no and explain why. That’s faster than fixing it afterwards.

Allow a kind of action for the whole session only when you’re comfortable with the agent repeating it unprompted.

Lesson 5

Have it check its own work

Ask the agent to run your tests, linter or build after a change, and to fix what breaks. It can read the output and keep going without another message from you.

ExampleAfter the change, run npm test and fix any failures you caused.
Lesson 6

Keep conversations focused

Long conversations that mix unrelated tasks get slower and less accurate.

Lesson 7

Make each message count

Free accounts get a set number of messages every 24 hours, and one message can drive a lot of work: the agent’s own steps don’t count. Put the whole request in one message instead of several small ones.

Three messagesAdd a date picker.  →  Make it start on Monday.  →  Also write a test.
One messageAdd a date picker to the booking form. Weeks start on Monday. Add a test for selecting a range across two months.

Prompts to try

Copy one into ClineCode in a project of your own.

Get oriented

A quick tour of an unfamiliar codebase.

Explain what this project does, how it is organized, and where the entry points are.

Find a bug

Start from the symptom.

The app crashes when I submit the form with an empty name. Find the cause and propose a fix before changing anything.

Add tests

Cover what exists before you change it.

Write tests for the functions in @src/utils that have none, then run them.

Next: the docs cover installing, signing in and every command.