Claude Code is designed as an agentic coding environment, which means it moves beyond simple code completion. It actively reasons about your project, uses tools to interact with your files, and follows workflows much like a human developer.
Let's dive in and see how you can make it a reliable collaborator in your daily workflow. You will learn how to manage its context, control its actions using different modes, and connect it to external tools to boost your productivity.
Using Claude Code
You have successfully set up Claude Code, configured your environment, and are ready to put it to work. Now, the exciting part begins: integrating its capabilities into your daily development workflow to write, debug, and optimize your code.
Let's start with the most direct way to use Claude Code: the Command Line Interface (CLI). The CLI is your direct line to Claude Code for specific, one-off tasks. It's ideal when you need a quick analysis of a file or a fast refactoring suggestion without leaving your terminal. For example, you can ask Claude Code to check if a file is valid with a simple command:
$ claude -p "Is my Dockerfile valid?"Claude analyzes the Dockerfile and prints the results directly to your console. You can use this non-interactive approach in your shell scripts to automate repetitive tasks.
You can view the complete list of all CLI commands and flags in the CLI reference.
For more complex problems, you'll want a more dynamic and conversational interaction. This is where the REPL (Read-Eval-Print Loop) comes in, which you can start by just typing claude in your terminal. This drops you into an interactive session where Claude remembers the context of your conversation, allowing you to work on an issue over multiple steps.
Within the REPL, you can use slash commands—shortcuts prefixed with a forward slash (/)—to perform common actions efficiently. For example, /review performs a security and code review of any open pull requests. To view token usage for the current session, use /cost. To exit, use /exit.
You can see all the slash commands when you type / within the REPL.
In addition to the built-in commands, you can also define custom slash commands. You do this by defining your frequently used prompts in Markdown files that Claude Code can execute. Like settings.json files, these also have project (.claude/commands/) and user (~/.claude/commands/) scopes. The command name is derived from the Markdown filename.
For example, imagine you regularly ask Claude Code to check a file's validity. For that, you can create a custom command and even allow passing arguments (the filename) to it. You can enable passing arguments via $ARGUMENTS or $1, $2, $3, ..., for positional arguments.
Let's create a new file_check.md file, scoped to the current project, and add the following contents:
# .claude/commands/file_check.md
Check if file $ARGUMENTS is valid. Aim for a short 20-word summary. Afterwards, you can check if a file is valid as follows:
/file_check <filename> The IDE plugin goes even deeper. When you ask Claude Code to refactor code, it can present the changes in the IDE's diff viewer, showing the original and suggested code side-by-side. The plugin also adds commands to your right-click context menu and command palette. For example, you can highlight a block of code and "send it to Claude Code" with Cmd+Option+K (Mac) or Ctrl+Alt+K (Linux/Windows).
Permission modes
Claude Code operates in different permission modes that control how it interacts with your project. You can start a session in a particular mode by entering the following command:
$ claude --permission-mode <mode>From the REPL, you can press shift+tab to cycle between modes. You can also set the default mode in your settings.json file:
{
"permissions": {
"defaultMode": "plan",
"deny": [
"WebFetch",
"Bash(curl:*)"
]
}
}Let's break down these modes:
Mode | Description | Use case |
|---|---|---|
| Asks for confirmation before taking any significant action, such as editing a file or running a command. | Balanced mode for a wide range of tasks, from answering questions about your codebase to generating snippets and explaining complex logic. |
| Focuses on generating high-level outlines, architectural designs, and step-by-step implementation strategies. | You have a complex problem, but aren't ready to write code yet. You want to think through the problem by breaking it down into smaller, manageable parts. |
| Directly applies suggested changes to files but confirms before running commands. | Useful for refactoring sessions when you need to implement a series of changes across multiple files. |
| The most direct and autonomous mode. Claude Code executes commands and applies file edits without asking for your explicit permission for each action. Enter this mode with: | Trusted, automated workflows or a series of routine tasks where constant confirmation would be inefficient. |
Make sure you understand the scope of the task before activating the bypassPermissions mode, especially in sensitive or production environments.
Managing memory
For an AI assistant to be truly helpful, it needs more than just intelligence; it needs memory. You don't want to keep including your project's style guidelines in every prompt for every session. With a special CLAUDE.md file, you equip Claude Code with persistent guidelines.
This file loads when you launch Claude Code, allowing it to understand the bigger picture. As with settings.json files, this file has different scopes (in order of precedence):
Enterprise policy — shared with all users in an organization. Useful for enterprise-wide instructions like security policies and organizational coding standards.
.claude/CLAUDE.md— shared with your team via source control. For team-shared instructions, like team coding conventions.~/.claude/CLAUDE.md— global defaults applied across all projects. For personal preferences.
To get started, you can run the /init command. This command triggers an analysis of your project. Claude Code then creates a project-level CLAUDE.md file that captures the project's architecture, development commands, coding patterns, key reminders, and others. You can even mention other files from within CLAUDE.md that contain additional instructions, such as individual preferences.
You can also add instructions from the interactive REPL by starting a prompt with # or use /memory to edit CLAUDE.md files:
Remember to keep your CLAUDE.md up to date as your architecture, libraries, and conventions change. Also, make sure to use specific prompts and organize related information in a clear, logical way. When your project context is current and clear, every interaction is relevant and consistent.
Files context
To make the most of Claude Code, it’s not about giving it everything — it’s about giving it the right context. Projects can span thousands of files, but Claude Code only needs the relevant context to help you efficiently and accurately. The goal is precision, not volume.
You already have important instructions in your CLAUDE.md file. Once that’s in place, you can point Claude Code to specific areas of the codebase using @ mentions. You can mention entire files: @routes/users.route.js, or @Dockerfile#L2-14 to focus on specific lines (here, the IDE plugin can help):
This helps Claude Code zero in on exactly what matters for your current question or task. When shifting between major areas of your system (like backend to frontend, or API to UI), it’s a good idea to open a new scope or session. That keeps the context clean and prevents older or unrelated context from interfering. We'll see how you can use subagents for improved context management later.
Finally, be selective about what you include. Extra or irrelevant context can slow things down and increase costs without improving answers. Skip over bulky auto-generated folders (node_modules, build artifacts, datasets, etc.) and focus only on files and lines needed for the current task. Use permission settings to prevent Claude Code from reading sensitive files.
Integrating MCP resources
Claude Code has access to your shell environment, so it can leverage your shell scripts and any other scripts that you define. With MCP servers, Claude Code can connect to external tools, databases, APIs, or live resources beyond the static files in your repo. When an MCP server is configured, Claude Code can fetch data from it, invoke tools, or compare project content with external sources you've allowed.
Because MCP servers act like bridges, they allow you to keep context up-to-date and useful without having to paste everything into the prompt. However, each server adds to the available tools list, so be selective: only enable what you really need, and manage permissions carefully. You can add, view, or delete MCP servers with the following commands:
$ claude mcp add <name> <command> [args...] # add a new MCP server
$ claude mcp list # to view your configured MCP servers
$ claude mcp get slack # to view details for a specific server (Slack, in this case)
$ claude mcp remove notion # remove a specific server (Notion, in this case)Once you have an MCP server configured, Claude Code will automatically select it, but you can also use @ mentions to reference it. For example, you can have Claude Code analyze something and send a message to one of your Slack channels:
Check the latest issue on @slack channel C09F5L1AQKU and post a comment there on how you could fix it. Now, there should be a message in Slack from Claude Code:
Next, you can ask Claude Code to implement the improvements and open a PR. With both file and MCP resources, Claude Code has a wide range of tools to gather context and perform actions. However, remember to periodically compact or clear conversations when they get too long with /compact or /clear to reduce token usage. (You can view the current context with /context). /compact clears the conversation history but keeps a summary of it while clear removes everything.
For more details on setting up MCP servers for Claude Code to use, check out the documentation.
Conclusion
Here, we've explored how to work with Claude Code as an agentic assistant, moving beyond simple code completion. We covered the primary ways to interact with Claude Code, using the CLI for quick tasks and the REPL for more complex, conversational workflows. Next, you created custom slash commands for your most frequent prompts. We also discussed how to use different permission modes to control Claude Code's autonomy.
The key to unlocking Claude Code's full potential lies in managing its knowledge and actions. Using the CLAUDE.md file, you can give Claude Code persistent memory of your project's architecture and conventions. By using @ mentions, you can direct its attention to specific files or lines, ensuring its responses are always relevant and cost-effective. Finally, we discussed how MCP servers can connect Claude Code to external tools, extending its capabilities far beyond your local codebase.