Jump to content

Claude Code

From Sinfronteras

Claude Code (Anthropic’s coding-focused CLI/tooling)

Claude https://claude.ai is an AI assistant made by Anthropic (like ChatGPT). You can chat, write, analyze, code, and build interactive tools together.

Claude Code is an Agentic Coding Assistant. A developer tool where Claude works inside your terminal or IDE, autonomously reading and editing your actual codebase, running commands, and completing multi-step coding tasks hands-free. So, Claude Code is about delegating tasks to an AI agent. It goes further by orchestrating multiple tasks across a set of AI agents that can work in parallel.

A key tip for working with Claude Code is to provide clear context. This means pointing it to relevant files, clearly describing the functionality and features you want, and making sure you extend its capabilities using tools like MCP servers and others in the ecosystem.

Claude Code is extensible: You can add additional tools by connecting MCP servers, which allow customization for your particular project.


Resources:

Claude Code in Action: https://anthropic.skilljar.com/claude-code-in-action



Claude Code can help with every step of a project:

1. Discover 2. Design 3. Build 4. Deploy 5. Support & Scale
Explore codebase and history Plan project Implement code Automate CI/CD Debug errors
Search documentation Develop tech specs Write and execute tests Configure environments Large-scale refactor
Onboard & Setup Define architecture Create commits and PRs Manage deployments Monitor usage & performance



Claude Code tools:
A set of built-in tools that help it understand and modify your codebase. For example:



Installation

https://code.claude.com/docs/en/overview

The curl method is Anthropic's new preferred way. It's simpler, has no dependencies, and keeps itself up to date. The npm method still works but it'll be deprecated.

curl -fsSL https://claude.ai/install.sh | bash



Codebase Exploration

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L2_notes.md

Here are some questions you can ask Claude Code to explore a codebase:

  • Give me an overview of this codebase
  • What are the key data models?
  • Explain how the documents are processed
  • What is the format of the document expected by the document_processor?
  • How are the course chunks loaded to the database?
  • Trace the process of handling user's query from frontend to backend
  • Draw a diagram that illustrates this flow
  • Explain how the text is transformed into chunks? What is the size of each chunk?
  • Describe the api endpoints
  • How can I run the application?



How to structure an instruction

Instructions need to be structured clearly so Claude Code understands what we’re asking it to do.

In this section, there are some examples of request https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L3_notes.md

For instance:

The chat interface displays query responses with source citations. I need to modify it so each source becomes a clickable link that opens the corresponding lesson video in a new tab:
- When courses are processed into chunks in @backend/document_processor.py, the link of each lesson is stored in the course_catalog collection
- Modify _format_results in @backend/search_tools.py so that the lesson links are also returned
- The links should be embedded invisibly (no visible URL text)


Claude Code Commands

https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/zzhtb/adding-features

  • Managing Project Memory:
  • /init: Claude Code scans your codebase and creates CLAUDE.md file inside your project directory.
  • CLAUDE.md guides Claude through your codebase, pointing out important commands, architecture and coding style. It's automatically included in the context each time you launch Claude Code.
  • Here's an example of a CLAUDE.md file generated by init for the RAG chatbot example.
  • #: Use # to quickly add a memory. Useful when you see Claude Code repeats an error.
  • Example 1: since the project is a uv project, we added these to CLAUDE.md file using #:
  • # use uv to run python files or add any dependencies
  • Example 2: you can inform Claude Code about the database schema, in this case since you have a vector database, you can inform Claude Code about the collections stored in the vector database:
  • # The vector database has two collections:
  • course_catalog:
  • stores course titles for name resolution
  • metadata for each course: title, instructor, course_link, lesson_count, lessons_json (list of lessons: lesson_number, lesson_title, lesson_link)
  • course_content:
  • stores text chunks for semantic search
  • metadata for each chunk: course_title, lesson_number, chunk_index


  • Managing the Context of Claude Code:
  • /clear: clears current conversation history
  • /compact: summarizes current conversation history
  • ESC: interrupt Claude to redirect or correct it
  • ESC ESC: rewind the conversation to an earlier point in time


  • claude --resume: is a Claude Code CLI flag that lets you resume a previous conversation session. When run, it shows a list of recent sessions you can pick from and continue where you left off.


  • You can use regular bash command within Claude Code, but you need to start the command with ! (for example: !pwd).
  • You can type exit to quit Claude Code.


  • File mentions: let you pull a specific file into the context of your conversation using the @. For example @path/to/file.ts


  • Planning mode is a way to ask Claude to think through a task before doing anything — so you can review and approve the approach before any code is written or files are changed.
You can trigger it in different ways:
  • By entering Planning mode before asking any question using:
  • Using the /plan command
  • Using the Shift Tab shortcut, which switches between Claude Code's input modes:
  1. Normal mode (default)
  2. Auto-accept edits (Claude makes changes without asking)
  3. Plan mode (read-only, no edits)
So you need to press it twice (Shift Tab Shift Tab) to go directly into Planning mode.
  • Or just by asking me like "enter plan mode" or "switch to plan mode"
  • You can also asking Claude to plan first in any question (but I’d suggest switching to Planning mode first):
For example: "Plan how you would add authentication to this app"


  • /mcp: Manage MCP connection & check available MCP servers with their provided tools



Custom commands

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L5_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/oo58a/adding-multiple-features-simultaneously

To create a custom command implement-feature, we need to create the file:

.claude/commands/implement-feature.md

You will be implementing a new feature in this codebase

$ARGUMENTS

IMPORTANT: Only do this for front-end features.
Once this feature is built, make sure to write the changes you made to file called frontend-changes.md
Do not ask for permissions to modify this file, assume you can always do it. 
  • The $ARGUMENTS variable is used to pass arguments to the custom command.
  • Launch Claude Code again. You can now use the command like any other built-in command: /implement-feature
  • If you want something to be applied to every single instance of Claude Code you create, use your CLAUDE.md file; but if you have specific commands that you only use for certain conversations, then custom commands are a nice way to handle that.



Effort levels / Extended Thinking

https://platform.claude.com/docs/en/build-with-claude/effort

I found the documentation regarding effort levels and extended thinking is not very clear.

We can check and set the effort level with the effort command. Available levels are:
low, medium, high, xhigh, and max.

Apparently, the thinking mode can also be controlled using keywords in the request:
think, (think hard or megathink), and ultrathink.

It seems that the ultrathink keyword is equivalent to the max effort level.

It also appears that the newest Claude models use "adaptive thinking", meaning the model adjusts how much it thinks based on the complexity of the request. Again, the documentation is not very clear, but it seems that even when using xhigh, the model may still adjust the effort level depending on the task complexity.



CLAUDE.md

It's essentially a way to give Claude Code a "memory". When Claude Code starts or operates in a directory, it automatically reads any CLAUDE.md file it finds and uses that content as part of its context. This allows you to give Claude standing instructions without having to repeat them in every conversation.

Common uses include:

  • Project overview and architecture notes
  • Coding conventions and style guidelines
  • Commands to run tests, build, or lint the project
  • Important context about dependencies or environment setup
  • Things Claude should always remember or avoid doing


Three common CLAUDE.md files

  • CLAUDE.md
  • Generated with /init
  • Commit to source control
  • Shared with other engineers
  • Location: project directory or subdirectories (for folder-specific context)
  • CLAUDE.local.md
  • Not shared with other engineers. It's typically added to .gitignore
  • Contains personal instructions and customizations for Claude
  • Location: project directory or subdirectories (for folder-specific context)
  • ~/.claude/CLAUDE.md
  • Used with all projects on your machine
  • Contains instructions that you want Claude to follow on all projects
  • Location: .claude folder stored in your home directory



Create custom subagents

https://code.claude.com/docs/en/sub-agents



Adding Features with MCP servers

https://code.claude.com/docs/en/mcp

MCP (Model Context Protocol) servers are a standardized way to extend Claude's capabilities by connecting it to external tools, data sources, and services. Think of them as plugins. They let Claude interact with things beyond its built-in abilities, like reading your files, querying databases, calling APIs, or controlling apps.

How it works: MCP is an open protocol that Anthropic developed. An MCP server exposes a set of "tools" that Claude can call during a conversation. Claude discovers what tools are available, and can invoke them as needed to complete tasks.


Examples of what MCP servers can do:

  • File systems: read/write files on your machine
  • Databases: query PostgreSQL, SQLite, etc.
  • Version control: interact with GitHub (open PRs, read issues, etc.)
  • Web browsing: fetch pages, search the web
  • Productivity tools: connect to Slack, Notion, Jira, Asana
  • Dev tools: run terminal commands, interact with Docker, etc.


In the context of Claude Code specifically: You can add MCP servers to extend what Claude Code can do in your sessions. For example:

bashclaude mcp add github -- npx -y @modelcontextprotocol/server-github



Installing the Playwright MCP server

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L3_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/zzhtb/adding-features

Playwright is an MCP server that provides browser automation capabilities using Playwright. It lets AI assistants control a web browser automatically:

  • it opens websites
  • clicks buttons
  • fills forms
  • reads page content
  • takes screenshots
  • runs browser tests


To install Playwright MCP:

  • Exit Claude Code
  • In the terminal, type:
claude mcp add --scope user playwright -- npx -y @playwright/mcp@latest
  • Open Claude Code again and verify you are connected to the MCP server using /mcp command


Then we can make a request to Claude code this way:

Using the playwright MCP server, visit 127.0.0.1:8000 and view the '+ New Chat' button. I want that button to look the same as the other links below for Courses and Try Asking. Make sure this is left aligned and that the border is removed.



Run multiple Claude sessions in parallel using Git worktrees

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L5_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/oo58a/adding-multiple-features-simultaneously

How we can work in parallel with Claude Code: We're going to use Git to make sure we don't overwrite existing files when we have multiple instances of Claude Code operating on the same project. Git worktrees allow us to create isolated copies of the codebase, work independently, and then merge the changes together at the end.

Git worktrees allow you to check out multiple branches from the same repository into separate directories. Each worktree represents a copy of your working directory with isolated files but shares the same Git history.

Workflow:

  • Make sure first that you've added and committed any previous changes to the codebase.
  • Create the folder .trees:
  • For each feature you want to implement, create a worktree:
git worktree add .trees/ui_feature
git worktree add .trees/testing_feature
git worktree add .trees/quality_feature
To confirm that we've created all the necessary worktrees, we can use the command git branch -a
  • From each worktree, open an integrated terminal, launch Claude code in each terminal, and ask it to implement each feature.
  • For each worktree, add and commit the changes in each worktree.
  • Close claude terminals.
  • In the main terminal: ask Claude Code to git merge the worktrees and resolve any merge conflicts. We can give Claude an instruction like:
Use the git merge command to merge all the worktrees in the .trees folder and fix any conflicts
  • Remove the .trees folder and the underlying worktrees and once you're done push this code to github


Run multiple Claude sessions in parallel using Git worktrees. See the video lesson



GitHub Integration & Hooks

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L6_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/nngi6/exploring-github-integration-%26-hooks
https://code.claude.com/docs/en/github-actions

GitHub Integration:
In this lessson, we'll learn how to use Claude Code outside of the terminal with Github integrations.

With a simple @claude mention in any PR (pull request) or issue, Claude can analyze your code, create pull requests, implement features, and fix bugs - all while following your project’s standards.

In Github, a pull request (PR) is basically a way to say: "I made some changes to the code. Please review them before adding them to the main project".

Here's a simple example:

  • Imagine you have a website and you want to add a dark mode feature. Instead of changing the main code directly, you create a separate copy/branch and work there. After finishing, you open a pull request.
  • The PR shows: What files changed. What code was added or removed. Comments and discussions about the changes.
  • Then other developers can: Review the code, suggest improvements, approve it and merge it into the main project

Claude Code can creates a complete PR. So, it can write the code changes for you and opens the request automatically so you can review and merge it.


Let's start installing the Claude code integration library (follow the procedure on the video lesson):

/install-github-app



Hooks:
Claude Code hooks are shell commands that you can define and can be executed at various points in Claude Code’s lifecycle (before tool execution, after tool execution, when subagent finishes a task, when claude finishes responding).

We showed a quick example on hooks in this lesson. If you'd like to learn more about hooks and see more examples, you are encouraged to check out:

"Hooks" in Anthropic's Claude Code In action.
Documentation: Hooks guide and hooks reference.



Course 1

Built in direct partnership with Anthropic and taught by their Head of Technical Education. I think it was released in 2025-08
https://www.deeplearning.ai/short-courses/claude-code-a-highly-agentic-coding-assistant
Reading notes: https://github.com/https-deeplearning-ai/sc-claude-code-files

The course covers best practices and tips on how to use agentic coding with Claude Code. You'll learn these tips through 3 examples:

  • (1) Codebase for the RAG chatbot (Lessons 2-6):
  • Here's the repo of the starting codebase used in lesson 2.
Lessons 3-6 add features to the starting codebase.
  • Here'sthe state of the codebase after lesson 5.
Feel free to fork the starting codebase and follow the lessons' activities.
  • (2) E-commerce data analysis (Lesson 7):
Here are the lesson's files. It includes the data, the starting and refactored notebooks, and the dashboard file. Feel free to fork this repo, and try lesson 7 tasks using the starting notebook and the data folder.
  • (3) Figma design mockup (Lesson 8):
Here's the link to the Figma mockup design (which you can open with Figma Desktop App).
In lesson 8, you will build a Next.js app based on this mockup. Here's the link to the repo of the app we got during filming.



Testing, Error Debugging and Code Refactoring

https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/33kzc/testing%2C-error-debugging-and-code-refactoring
https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L4_notes.md


Here is the request:

The RAG chatbot returns 'query failed' for any content-related questions. I need you to:
1. Write tests to evaluate the outputs of the execute method of the CourseSearchTool in @backend/search_tools.py
2. Write tests to evaluate if @backend/ai_generator.py correctly calls for the CourseSearchTool
3. Write tests to evaluate how the RAG system is handling the content-query related questions.

Save the tests in a tests folder within @backend. Run those tests against the current system to identify which components are failing. Propose fixes based on what the tests reveal is broken.

Think hard


We can also use several agents in the same request. We only need to specify this on the request:

....
....

Use two parallel subagents to brainstorm possible plans. Do not implement any code.

In the above request, Claude Code will give us two different approaches to tackle the task.



Refactoring a Jupyter Notebook & Creating a Dashboard

The files used in this lesson are at https://github.com/https-deeplearning-ai/sc-claude-code-files/tree/main/lesson7_files
https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L7_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/33kzr/refactoring-a-jupyter-notebook-%26-creating-a-dashboard

Claude Code includes tools for reading and editing Jupyter notebooks.

Refactoring Prompt:

The @EDA.ipynb contains exploratory data analysis on e-commerce data in @ecommerce_data, focusing on sales metrics for 2023. Keep the same analysis and graphs, and improve the structure and documentation of the notebook.

Review the existing notebook and identify:
- What business metrics are currently calculated
- What visualizations are created
- What data transformations are performed
- Any code quality issues or inefficiencies
  
**Refactoring Requirements**

1. Notebook Structure & Documentation
    - Add proper documentation and markdown cells with clear header and a brief explanation for the section
    - Organize into logical sections:
        - Introduction & Business Objectives
        - Data Loading & Configuration
        - Data Preparation & Transformation
        - Business Metrics Calculation (revenue, product, geographic, customer experience analysis)
        - Summary of observations
    - Add table of contents at the beginning
    - Include data dictionary explaining key columns and business terms
   
2. Code Quality Improvements
   - Create reusable functions with docstrings
   - Implement consistent naming and formatting
   - Create separate Python files:
 	- business_metrics.py containing business metric calculations only
	- data_loader.py loading, processing and cleaning the data  
        
3. Enhanced Visualizations
    - Improve all plots with:
        - Clear and descriptive titles 
        - Proper axis labels with units
        - Legends where needed
        - Appropriate chart types for the data
        - Include date range in plot titles or captions
        - use consistent color business-oriented color schemes
          
4. Configurable Analysis Framework
The notebook shows the computation of metrics for a specific date range (entire year of 2023 compared to 2022). Refactor the code so that the data is first filtered according to configurable month and year & implement general-purpose metric calculations. 
       

**Deliverables Expected**
- Refactored Jupyter notebook (EDA_Refactored.ipynb) with all improvements
- Business metrics module (business_metrics.py) with documented functions
- Requirements file (requirements.txt) listing all dependencies
- README section explaining how to use the refactored analysis

**Success Criteria**
- Easy-to read code & notebook (do not use icons in the printing statements or markdown cells)
- Configurable analysis that works for any date range
- Reusable code that can be applied to future datasets
- Maintainable structure that other analysts can easily understand and extend
- Maintain all existing analyses while improving the quality, structure, and usability of the notebook.
- Do not assume any business thresholds.



Creating Web App based on a Figma Mockup

https://github.com/https-deeplearning-ai/sc-claude-code-files/blob/main/reading_notes/L8_notes.md
https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant/lesson/vvq28/creating-web-app-based-on-a-figma-mockup