← Blog

How to Use Anthropic Claude Code: Setup to Workflow

2026-09-13 · 5 min read · SubToAPI Team

Anthropic Claude Code is a command-line tool that lets Claude work directly inside your terminal and codebase: reading files, running commands, writing patches, and executing multi-step engineering tasks with your approval. If you're wondering how to use it, the short answer is: install it via npm, run it inside a project directory, and interact with it like a very capable pair programmer that can actually touch your files and shell.

This guide walks through installation, authentication, everyday commands, and the workflow patterns that make Claude Code genuinely useful instead of just a novelty.

What Claude Code Actually Does

Unlike a chat window where you copy-paste code back and forth, Claude Code operates with direct access to your project. It can:

It's designed for tasks like "fix this failing test," "refactor this module to use the new API," or "add error handling across these endpoints" — things that require understanding a codebase, not just generating a snippet.

Installing Claude Code

Claude Code is distributed as an npm package. You need Node.js installed, then run:

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

Once installed, navigate to a project directory and start it:

cd my-project
claude

This launches an interactive session scoped to that directory. The first time you run it, you'll be prompted to authenticate with your Anthropic account or API credentials.

Authenticating

Claude Code needs API access to function. You'll typically authenticate through your Anthropic account (if you have Claude Pro/Max with Code access) or by supplying an API key. Follow the on-screen prompt after your first claude command — it will open a browser flow or ask you to paste a key.

If you're building automation around Claude's capabilities separately from the interactive CLI — for example, scripting Claude into a CI pipeline, a backend service, or an internal tool — you don't need to script against Claude Code itself. A cleaner path is calling the Messages API directly. SubToAPI wraps your existing Claude access into a standard HTTPS API with application keys (sub_live_...), so you can send requests like:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain what this diff changes and why."}
    ]
  }'

This is useful when you want Claude's reasoning inside a script, a bot, or a build step without running an interactive terminal session. See /docs/quickstart and /docs/messages for setup details.

Basic Claude Code Usage Patterns

Once you're in a session, you interact conversationally, but with a codebase attached. A few patterns that work well:

Start with context, not commands. Instead of "write a login function," try "look at how authentication is handled in this app and add a rate limiter to the login endpoint." Claude Code will read the relevant files first.

Let it plan before it edits. For non-trivial tasks, ask it to outline its approach before making changes:

Before making any edits, explain your plan for adding pagination to the /users endpoint.

This gives you a checkpoint to correct direction before code gets touched.

Review diffs before accepting. Claude Code will typically show you proposed changes and ask for confirmation on file writes or shell commands. Don't rubber-stamp — read the diff, especially for anything touching auth, payments, or data migrations.

Use it for repetitive refactors. Tasks like "rename this pattern across 40 files" or "convert these callbacks to async/await" are where Claude Code saves the most time, because it can search, edit, and verify in one pass.

Run tests as part of the loop. Ask it to run your test suite after changes and fix failures iteratively:

Run `npm test`, and if anything fails, fix it and re-run until it passes.

Common Commands and Session Controls

Inside a Claude Code session you can typically:

Keep sessions scoped to one logical task. Long, sprawling sessions covering unrelated changes make it harder to review what happened and easier for context to drift.

When to Use Claude Code vs. the API Directly

Claude Code is built for interactive, file-system-aware development work — you sitting at a terminal, iterating on a real codebase. It's not meant for embedding into a product, a backend job, or a customer-facing feature.

For those cases, you want programmatic access to Claude's models: a chatbot, a document summarizer, an agent that calls tools, a pipeline step that classifies support tickets. That's what the Messages API is for, and SubToAPI makes it available as a standard HTTPS endpoint with streaming (/docs/streaming), tool use (/docs/tools), and usage metadata per key — useful if multiple team members or services need separate, trackable access without sharing one raw credential. Plans start at €9/month with a free trial at /signup, and full pricing is at /pricing.

Getting the Most Out of Claude Code

A few practical habits that improve results:

Questions

Do I need a paid Claude plan to use Claude Code? Yes — Claude Code requires API access or a qualifying Anthropic subscription tier. Check current eligibility on Anthropic's site before installing, since access requirements can change.

Can Claude Code push code directly to GitHub? It can run git commands including commits and pushes if you grant permission during the session, but it will typically ask for confirmation before pushing to a remote.

Is Claude Code the same as calling the Claude API? No. Claude Code is an interactive terminal tool with file-system access. The API (including via SubToAPI) is for programmatic integration into apps, scripts, and services — see /docs for details.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →