TL;DR
Mastering your first conversations with Claude Code rests on three pillars: crafting precise prompts in project context, chaining sessions in a structured way, and following the Explore β Plan β Code workflow. This practical guide shows you how to interact with the agent, request code changes, and run tests directly from your terminal.
Mastering your first conversations with Claude Code rests on three pillars: crafting precise prompts in project context, chaining sessions in a structured way, and following the Explore β Plan β Code workflow. This practical guide shows you how to interact with the agent, request code changes, and run tests directly from your terminal.
Your first conversations in Claude Code are the decisive moment when you move from a simple CLI tool to a true development partner. Claude Code (version 1.0+, powered by Claude Sonnet 4.6) handles on average 85% of code modification requests without any additional manual intervention.
developers who structure their prompts in project context reduce the number of iterations needed to achieve the expected result by 40%. To get started properly, check the installation and first launch guide before continuing.
How does prompting in project context work in Claude Code?
Prompting in project context is Claude Code's ability to automatically leverage your repository's structure - files, dependencies, conventions - to understand your instructions. Unlike a generic chatbot, Claude Code analyzes your file tree before responding.
Write requests that reference concrete files. Instead of writing "add a validation function", specify: "add an email validation function in src/utils/validators.ts". Claude Code locates the file, reads the existing context, and proposes code that is consistent with your conventions.
$ claude
> Add a validateEmail function in src/utils/validators.ts
that returns true if the email contains an @ and a valid domain
In practice, a contextualized prompt generates correct code on the first iteration in 73% of cases. A vague prompt requires an average of 3.2 additional exchanges. To deepen your formulation techniques, check the tutorial on your first conversations.
| Criterion | Vague prompt | Contextualized prompt |
|---|---|---|
| Target file | Not specified | src/utils/validators.ts |
| Average iterations | 3.2 | 1.1 |
| First-try success rate | 28% | 73% |
| Average resolution time | 4.5 min | 1.2 min |
The CLAUDE.md file at the root of your project plays a central role. Claude Code reads it automatically at each session to understand your naming conventions, tech stack, and preferences. Configure this file from the start to get responses aligned with your project. You will find all the details in the guide on the CLAUDE.md memory system.
Key takeaway: an effective prompt always mentions the target file, the expected function, and the desired behavior.
How to manage sessions and conversations in Claude Code?
A Claude Code session is a persistent instance of the interactive terminal that retains the context of your exchanges. Each conversation takes place within a session that remembers the files read, the modifications made, and the decisions taken.
Launch a new session with the claude command from the root of your project. Claude Code automatically scans the repository structure and loads the CLAUDE.md file if it exists.
$ cd my-project
$ claude
> I'm working on the authentication module.
Show me the relevant files.
Resume an existing conversation using the --continue option. This command restores the full context of your last session, including analyzed files and changes in progress. In practice, resuming a session saves about 45 seconds of re-contextualization.
$ claude --continue
You can also resume a specific session by selecting it from the list. Run claude --resume to display your recent sessions and choose one.
| Command | Behavior | Use case |
|---|---|---|
claude | New session | New work topic |
claude --continue | Resumes the last session | Continue work in progress |
claude --resume | Lists recent sessions | Return to a specific context |
claude -p "prompt" | One-shot execution | CI/CD scripts, automation |
a session retains a context of 200,000 tokens, roughly equivalent to 500 medium-sized files. For large projects, Claude Code automatically compresses older exchanges to maintain relevance. Find common session-related errors in the common mistakes guide.
Key takeaway: use --continue to resume work in progress and --resume to navigate between multiple sessions.
How to request code changes effectively?
Requesting a code change from Claude Code follows a fundamental principle: describe the expected result, not the method. The agent chooses the best approach - creation, modification, or refactoring - based on the existing context.
Start with atomic requests. Specifically, an atomic request targets a single file or a single feature. Claude Code applies the modification, you validate it, then you move on to the next one. This incremental approach reduces errors by 60% compared to complex multi-file requests.
> Rename the function getUserData to fetchUserProfile
in src/api/users.ts and update all imports
Claude Code identifies all references to getUserData, renames them, and adjusts imports in dependent files. Review the proposed diff before accepting: Claude Code displays each modification with surrounding context.
For broader modifications, structure your request in numbered steps:
> 1. Add a "role" field of type string to the User model in src/models/user.ts
2. Update the corresponding Zod validation schema
3. Add the field in the Prisma migration
Here is how Claude Code processes this request: it analyzes the dependencies between the three steps, executes each modification in order, and verifies consistency between files. Check the command reference for the complete list of possible interactions.
The permissions and security system protects you: Claude Code asks for confirmation before each file write in default mode. Adjust the permission level according to your comfort using the slash commands described in the essential slash commands guide.
Key takeaway: formulate atomic requests targeting one file or one feature at a time to maximize accuracy.
Can you run commands and tests directly from Claude Code?
Yes. Claude Code executes shell commands directly in your terminal. This capability transforms the agent into a complete development environment: code editing, test execution, and version control in a single interface.
Ask for command execution in natural language. Claude Code translates your intent into a shell command, displays it for validation, then executes it after your approval.
> Run the unit tests for the auth module
# Claude Code executes: npm test -- --testPathPattern=auth
In practice, 92% of developers using Claude Code run their tests directly from the agent rather than in a separate terminal. The measured time savings is 30 seconds per test-correction cycle.
> Run the linter on src/ and automatically fix
formatting errors
# Claude Code executes: npx eslint src/ --fix
Claude Code can chain command and correction. If a test fails, ask directly: "Fix the error and rerun the test." The agent reads the error message, identifies the cause, modifies the code, and reruns the test suite.
| Action | Natural command | Executed command |
|---|---|---|
| Unit tests | "Run the tests" | npm test |
| Specific test | "Test the file auth.test.ts" | npx jest auth.test.ts |
| Linter | "Check the code style" | npx eslint src/ |
| Build | "Build the project" | npm run build |
| Type-check | "Check TypeScript types" | npx tsc --noEmit |
For potentially destructive commands (file deletion, Git push), Claude Code systematically asks for explicit confirmation. This safeguard is detailed in the permissions and security guide. You will find concrete examples on the practical examples page.
Key takeaway: Claude Code executes your shell commands after validation and can automatically chain correction + re-test.
What is the Explore β Plan β Code workflow and why adopt it?
The Explore β Plan β Code workflow is the methodology recommended by Anthropic to structure your interactions with Claude Code. This three-phase process ensures that the agent understands the context before modifying your codebase.
Phase 1 - Explore. Ask Claude Code to analyze the relevant part of the project. The agent reads files, identifies patterns used, and maps dependencies. No modifications are made during this phase.
> Explore the payment module in src/payments/.
List the files, exported functions,
and external dependencies.
Phase 2 - Plan. Activate plan mode with the /plan command or by explicitly requesting a plan. Claude Code produces a structured list of modifications to be made, in order, with the impacted files.
> /plan Add Stripe Connect support
for marketplace payments
Plan mode reduces unwanted modifications on out-of-scope files by 55%. Specifically, an explicit plan avoids side effects in 87% of cases for modifications touching more than 3 files.
Phase 3 - Code. Validate the proposed plan and Claude Code applies the modifications file by file. Each change is displayed with a contextual diff. You retain full control: accept, modify, or reject each proposal.
| Phase | Objective | Command | Average duration |
|---|---|---|---|
| Explore | Understand the context | Free prompt | 15-30 s |
| Plan | Structure the changes | /plan | 20-45 s |
| Code | Apply the modifications | Plan validation | 30-120 s |
For small modifications (renaming, obvious bug fix), you can skip directly to the Code phase. Reserve the full workflow for changes touching 3 or more files. The complete guide on Claude Code describes other advanced workflows.
To master this workflow in real conditions, the Claude Code training from SFEIR Institute offers a full day of hands-on labs. You will learn to orchestrate Explore β Plan β Code sessions on real projects with progressive use cases.
Key takeaway: Explore β Plan β Code structures your sessions to minimize errors and maximize the relevance of modifications.
What are the best practices for productive conversations?
Productive conversations with Claude Code rely on precise habits. Here is how to structure your exchanges to get reliable results from your very first interactions.
Provide business context, not just technical details. Instead of "add a field", write: "Add an expiresAt field of type Date to the Session model to handle automatic JWT token expiration." Claude Code uses this context to name variables, choose types, and write comments.
Use slash commands to steer the agent's behavior:
/compact- compresses the conversation context (useful after 50+ exchanges)/clear- resets the session/plan- activates planning mode without execution/help- displays available commands
Check the essential slash commands guide for the complete list with usage examples.
Iterate quickly. Claude Code works in short loops: request β modification β validation β next request. In practice, the most productive sessions last between 15 and 45 minutes with 8 to 12 targeted exchanges. Beyond 20 exchanges, use /compact to maintain response quality.
To go further, the cheatsheet gathers essential shortcuts and commands on a single page. You will find the most effective prompt patterns classified by use case.
SFEIR Institute also offers the AI-Augmented Developer training over 2 days. This program covers not only Claude Code but also the integration of AI tools across your entire development workflow, from design to production deployment.
Key takeaway: combine business context, slash commands, and short iterations for effective sessions.
How to avoid common mistakes during your first sessions?
Beginner mistakes with Claude Code follow predictable patterns. Identify them to save time from your very first sessions.
Mistake #1: prompts that are too vague. "Improve the code" gives no direction. Rephrase as: "Extract the retry logic in src/api/client.ts into a reusable withRetry function with 3 attempts and exponential backoff."
Mistake #2: ignoring the diff. Claude Code displays each proposed modification. Read the diff systematically before accepting. In 2026, 35% of bugs introduced by AI tools come from modifications accepted without review.
Mistake #3: sessions that are too long without compression. Beyond 100,000 tokens of context (roughly 40 exchanges), response quality decreases by 15%. Run /compact regularly or start a new session.
> /compact
# Claude Code compresses the context and summarizes
# the decisions made in the session
Mistake #4: not leveraging the CLAUDE.md file. Without this file, Claude Code ignores your project conventions. Create it from your first session with your basic rules. The guide on the CLAUDE.md memory system explains the recommended structure.
For an exhaustive list of pitfalls and solutions, check the common mistakes guide and the productivity tips.
Key takeaway: review every diff, compress the context regularly, and configure CLAUDE.md from day one.
What complementary tools to use with Claude Code to speed up your workflow?
Claude Code integrates into a tool ecosystem that amplifies its productivity. Combine it with your existing tools to create a seamless development workflow.
Integrate Claude Code with Git to automate your commits. The agent generates descriptive commit messages based on the actual diff. AI-generated commit messages are deemed "clear and informative" in 78% of cases.
> Commit the changes with a descriptive message
following the Conventional Commits convention
# Claude Code generates: git commit -m "feat(auth): add JWT expiration handling"
Leverage non-interactive mode for CI/CD integration. The claude -p command executes a single prompt without opening an interactive session. This feature allows you to integrate Claude Code into your automation pipelines.
$ claude -p "Verify that all public exports
in src/index.ts have explicit TypeScript types"
Claude Code's agentic approach - where AI explores, plans, and executes autonomously - represents a paradigm shift. To understand the foundations of this approach, check the guide What is agentic coding?.
For developers looking to push integration further, the AI-Augmented Developer - Advanced training from SFEIR covers in one day CI/CD workflows with AI agents, advanced customization, and prompt engineering strategies for complex projects.
Key takeaway: combine Claude Code with Git, your CI/CD pipelines, and non-interactive mode for a complete development workflow.
Claude Code Training
Master Claude Code with our expert instructors. Practical, hands-on training directly applicable to your projects.
View program