Your First Conversation with Claude Code
Your First Conversation with Claude Code
You have Claude Code installed. Now it is time to actually use it. In this lesson, you will open Claude Code, learn how the conversation interface works, run your first prompts, and walk through a practical hands-on example.
By the end of this lesson, you will be comfortable having productive conversations with Claude Code and will understand the key commands that control the experience.
What You'll Learn
- How to start Claude Code in a project directory
- The conversation interface and how to type prompts
- How to read Claude Code's output and understand what it is doing
- Essential commands: /help, /clear, /exit, and Escape
- How multi-turn conversations work
- A practical example: creating and modifying a file from scratch
Starting Claude Code
Claude Code is designed to be launched from the root directory of a project. This gives it the full context of your codebase.
Open your terminal and navigate to a project:
cd ~/projects/my-project
claude
If you do not have a project handy, create a simple one to practice with:
mkdir ~/projects/claude-practice
cd ~/projects/claude-practice
npm init -y
claude
When Claude Code starts, you will see a welcome message and a prompt cursor. The interface is simple: you type your message and press Enter to send it.
The Conversation Interface
The Claude Code interface is a text-based conversation in your terminal. There is no GUI, no buttons, and no menus. You type naturally in plain English (or any language), and Claude Code responds with a mix of text explanations and actions.
How to Type a Prompt
Simply type what you want at the prompt and press Enter:
> What files are in this project?
Claude Code will then process your request. For this prompt, it would scan your directory and list the files it finds.
Multi-Line Input
For longer prompts, you can use Shift+Enter or backslash (\) at the end of a line to continue on the next line without sending the message. This is useful when you want to write detailed instructions:
> I need you to create a utility function that:\
1. Takes an array of objects\
2. Groups them by a specified key\
3. Returns a Map with the grouped results
Understanding the Response
When Claude Code responds, you will see different types of output:
Thinking -- Claude Code sometimes shows its reasoning process. This helps you understand how it is approaching your request.
Tool calls -- When Claude Code reads a file, writes code, or runs a command, it shows you what tool it is using and what it is doing. For example:
Reading file: package.json
Writing file: src/utils/groupBy.ts
Running command: npm test
Text explanations -- Claude Code explains what it did, why it made certain choices, and what you might want to do next.
Code blocks -- When showing you code it wrote or found, Claude Code formats it with syntax highlighting in your terminal.
The Approval Flow
When Claude Code wants to take an action that modifies your project (writing a file, running a command), it asks for your approval first. You will see something like:
Claude wants to write to src/utils/groupBy.ts
Do you want to proceed? (y/n)
Type y to approve or n to reject. This keeps you in control of every change. We will cover the permission model in detail in the next lesson.
Your First Prompt
Let us start with the most useful first prompt you can give Claude Code: asking it to explain your project.
> Explain this project. What does it do, what tech stack does it use, and how is it organized?
Watch what happens. Claude Code will:
- Read
package.jsonto understand your dependencies and scripts - Scan the directory structure to see how files are organized
- Read key files like README.md, configuration files, and main entry points
- Synthesize a summary that explains the project
This is a great way to onboard onto any codebase -- even one you wrote yourself months ago and have since forgotten the details of.
Other Great First Prompts
Here are some useful exploratory prompts to try:
> What are the main dependencies of this project and what do they do?
> Show me the entry point of this application and trace the main execution flow.
> Are there any potential issues or code smells you can spot?
> What test coverage does this project have?
Each of these prompts causes Claude Code to actively explore your codebase, reading multiple files and synthesizing its findings.
Essential Commands
Claude Code has several built-in commands that start with a forward slash (/). These control the tool itself rather than asking Claude to do something.
/help
Shows all available commands and their descriptions:
> /help
This is the command to remember when you forget the others.
/clear
Clears the current conversation history and starts fresh:
> /clear
Use this when you want to change topics completely or when the conversation has gotten long and you want to start with a clean context. Claude Code maintains conversation context across turns, so clearing is useful when previous context is no longer relevant.
/exit
Exits Claude Code and returns you to your regular terminal:
> /exit
You can also exit by pressing Ctrl+C twice or Ctrl+D.
Escape Key
Press Escape to cancel a response that Claude Code is currently generating. This is useful when:
- Claude Code is taking a long time and you want to rephrase your prompt
- You realize you asked the wrong question
- Claude Code is going down the wrong path
After pressing Escape, you can type a new prompt immediately.
/cost
Shows you how many tokens you have used in the current session and the associated cost:
> /cost
This is helpful for monitoring your API usage if you are on an API key plan.
/compact
Compresses the conversation history to use fewer tokens while retaining the key context:
> /compact
Use this when you have had a long conversation and want to keep going without hitting context limits. Claude Code will summarize the conversation so far and continue from that summary.
Multi-Turn Conversations
One of Claude Code's strengths is multi-turn conversation. Unlike single-prompt interactions, you can build on previous context across multiple messages.
How Context Carries Forward
When you have a conversation with Claude Code, it remembers everything from previous turns. This means you can start broad and narrow down:
> What testing framework does this project use?
# Claude Code reads package.json, finds Jest configuration, and explains the setup.
> Show me an example of a well-written test in this project.
# Claude Code searches for test files and shows you one, explaining the patterns used.
> Write a new test for the userService module following the same patterns.
# Claude Code uses knowledge from the previous turns to write a test that
# matches your project's conventions.
Each prompt builds on the previous ones. Claude Code does not need you to repeat context -- it remembers what it read and discussed.
When to Clear Context
While persistent context is powerful, sometimes it gets in the way:
- Switching tasks: If you were debugging a bug and now want to add a new feature, use
/clearto reset. - Long sessions: After many turns, the conversation can accumulate a lot of context. Use
/compactto compress it or/clearto start fresh. - Correcting course: If Claude Code has gone down a wrong path and keeps referencing incorrect assumptions, clearing and starting over can be faster than trying to correct it.
Refining Responses
You can ask Claude Code to adjust its output:
> Create a function to validate email addresses.
# Claude Code creates a function with regex validation.
> That's good, but also add validation for disposable email domains.
# Claude Code modifies the function to include disposable domain checking.
> Actually, let's extract the domain list to a separate config file.
# Claude Code creates a config file and updates the function to import from it.
This iterative refinement is where Claude Code shines. Each turn builds on the last, and Claude Code keeps all the changes consistent.
Practical Example: Creating and Modifying a File
Let us walk through a complete practical example. We will ask Claude Code to create a simple file and then modify it in subsequent turns.
Step 1: Create a Project Directory
If you have not already, create a practice project:
mkdir ~/projects/claude-practice
cd ~/projects/claude-practice
npm init -y
claude
Step 2: Ask Claude Code to Create a File
> Create a file called src/greet.js that exports a function called greet.
> The function should take a name parameter and return "Hello, {name}!".
Claude Code will:
- Create the
srcdirectory if it does not exist - Create
src/greet.jswith the function - Show you the file it created
You will see output similar to:
Creating directory: src/
Writing file: src/greet.js
And the file content will look something like:
function greet(name) {
return `Hello, ${name}!`;
}
module.exports = { greet };
Step 3: Modify the File
Now ask Claude Code to enhance the function:
> Update the greet function to also accept an optional greeting parameter
> that defaults to "Hello". So greet("Alice", "Hi") returns "Hi, Alice!".
Claude Code will read the existing file, understand the current implementation, and modify it. It does not rewrite the entire file -- it makes targeted edits.
Step 4: Add Error Handling
> Add input validation. If name is not a string or is empty, throw a
> TypeError with a descriptive message.
Claude Code will edit the file again, adding validation logic before the return statement.
Step 5: Create a Test
> Create a test file for this function. Use basic Node.js assert module
> since we don't have a test framework installed.
Claude Code will create a test file (likely src/greet.test.js or test/greet.test.js) that imports the function and tests various cases including the error handling.
Step 6: Run the Test
> Run the test file.
Claude Code will execute:
node src/greet.test.js
And show you whether the tests pass. If any fail, you can ask Claude Code to fix them:
> Fix the failing test.
What You Just Did
In six conversational turns, you:
- Created a source file with a function
- Added a parameter with a default value
- Added input validation with error handling
- Created a test file
- Ran the tests
- (Potentially) fixed any issues
All without leaving your terminal. All without copying and pasting a single line of code. Claude Code handled the file creation, editing, and command execution while you directed the work at a high level.
Tips for Effective Conversations
Be Specific
The more specific your prompt, the better the result:
# Less effective:
> Make a utility function.
# More effective:
> Create a utility function in src/utils/debounce.ts that implements
> a debounce with TypeScript generics. It should accept any function
> type and preserve the parameter types.
Provide Context When Helpful
If you have preferences or constraints, state them:
> Add error handling to the API route in src/app/api/users/route.ts.
> Use the existing ApiError class from src/lib/errors.ts for consistency.
Ask Claude Code to Verify Its Work
After Claude Code makes changes, ask it to verify:
> Run the linter to check for any issues.
> Run the tests to make sure nothing broke.
Use Conversation History Strategically
Build up context incrementally:
> First, let me understand the auth system. How does authentication work
> in this project?
# Read Claude Code's explanation, then:
> Now add a middleware that checks for admin role before allowing access
> to the /admin routes.
The first prompt gives Claude Code (and you) context that makes the second prompt more effective.
Summary
You have now had your first real conversation with Claude Code. You know how to start it, type prompts, read its output, use essential commands, and leverage multi-turn conversations to build up complex changes incrementally.
The key insight is that Claude Code is a conversation, not a single prompt. You can iterate, refine, and build on previous context. Start broad, get specific, and let Claude Code handle the mechanical work while you direct the creative and architectural decisions.
In the next lesson, you will learn about the permission model -- how Claude Code asks for approval, how you can configure what it is allowed to do, and best practices for staying safe while working fast.
Key Takeaways
- Start Claude Code by typing
claudein your project's root directory - The interface is conversational: type naturally and press Enter to send
- Claude Code shows its work: you can see which files it reads, what it writes, and which commands it runs
- Essential commands:
/helpfor guidance,/clearto reset context,/exitto quit, Escape to cancel - Multi-turn conversations let you build on previous context and refine results iteratively
- Use
/compactto compress long conversations without losing key context - Be specific in your prompts and ask Claude Code to verify its work by running tests or linters
Cuestionario
Discussion
Sign in to join the discussion.

