Claude code AI agent 101

This article collects basic knowledge you need to know about the Claude code AI coding agent


1) Install / Update

In the terminal app, use the command below to install the tool. 

npm install -g @anthropic-ai/claude-code

This requires npm. If you don't have it, you can get it via nvm.

2) Running

You should run the tool at the root of your project directory.

cd /path/to/app/root && claude

3) Billing

You can choose a subscription package or pay per use via API token. After Claude is started, run the /login command below:

/login

4) Select Model

This step is optional. Claude Code uses a default model; at the time of this article, it is Sonnet 4. If you intend to use a different model, run the /model command below:

/model

5) Providing Memory

It is possible to provide instructions (memory) to the tool. After Claude is started, run the /init command below:

/init

This creates a CLAUDE.md file where you can place information such as coding guidelines. A sample is shown below:

# Testing Guideline
1. Run all tests before making any changes to ensure there are no existing failures.
2. After completing your modifications, re-run the tests. If any tests fail, you must fix your code.
3. If the existing test cases do not cover the code you changed, you must add test coverage for these changes.
4. Finally, verify that all your changes comply with the linter formatting requirements.

6) Tool setting

Claude allows you to whitelist or blacklist certain actions. For example, you can have the tool create a directory without asking you. However, you do not want it to read certain files that contain sensitive information. A sample is shown below:

vi ./.claude/settings.local.json
{
  "permissions": {
    "allow": [
      "Bash(mkdir:*)",
    ],
    "deny": [
      "Read(.env)"
    ]
  }
}

7) Referencing a file/directory

You can use the @ symbol. Example:

> Review @js/application.js for mistakes

8) Referencing an image

You can drag and drop the image into the terminal window.

9) Cost

You can check the cost of the current session by using the / command below:

> /cost 
  ⎿ Total cost:            $0.0687
    Total duration (API):  39.2s
    Total duration (wall): 1m 55.2s
    Total code changes:    0 lines added, 0 lines removed
    Usage by model:
        claude-3-5-haiku:  7.7k input, 309 output, 0 cache read, 0 cache write
           claude-sonnet:  165 input, 620 output, 31.3k cache read, 17.2k cache write

Tips to save cost: https://docs.anthropic.com/en/docs/claude-code/costs#reduce-token-usage

10) Development Partner Program

In the Anthropic console, you can enroll in the Partner program to get a better token rate.

Once enrolled, the label below is displayed when you use the tool.

11) Resume from a previous session

You can use the -r option to start Claude code and pick the session you want to resume.

claude -r

12) Report bugs

Report bugs to Anthropic by using the / command below:

/bug

Enjoy coding with Claude :)


AI Summary AI Summary
gpt-4.1-2025-04-14 2025-07-20 17:49:30
This article serves as a beginner's guide to the Claude code AI agent, covering installation, usage, billing options, model selection, memory settings, permissions, file and image referencing, cost tracking, development partner benefits, session management, and bug reporting. It provides tips for efficient and secure use.
Chrome On-device AI 2025-07-26 21:34:29
Writing

Share Share this Post