
Many developers start Claude Code the same way:
Take a look at this project.
Take a look at this project.
Claude Code reads files, analyzes the project, and suggests next steps. That feels useful immediately. The problem appears when the task moves from reading to doing: editing files, running commands, reacting to errors, and continuing without a clearly defined boundary.
Claude Code is powerful because it can work inside a real project. That also means it needs project rules, permission boundaries, verification steps, and cost controls.
This guide walks through a practical setup:
- where Claude Code fits in a development workflow
- how to install it and start with a read-only task
- why you should create
CLAUDE.md - which tasks are safe to delegate
- how to connect Claude Code through ClaudeAPI
- how to choose models and control cost
If your team also uses Cursor, Cline, Dify, Open WebUI, or internal scripts, treat this as the Claude Code layer of the larger toolchain. Claude Code works inside the project. ClaudeAPI can centralize model access, keys, usage, and billing.
Where Claude Code fits
Claude Code is best for project-level development work. Official documentation describes it as an agentic coding tool that can read your codebase, edit files, run commands, and integrate with development tools.
It is useful for tasks such as:
- reading an unfamiliar project and explaining the structure
- identifying entry files and important modules
- diagnosing errors from logs or test output
- writing or improving README files
- adding API documentation
- adding tests to legacy code
- planning a small feature implementation
- cleaning up local duplicated logic
- running tests after you approve a change
High-risk work should stay behind human confirmation:
- production configuration
- secrets and API keys
- payment logic
- permission logic
- database migrations
- production deploys
- bulk file deletion
- automatic Git commits or pushes
A practical default:
Reading, drafting, and adding tests can be delegated.
Deleting, deploying, migrating data, changing permissions, or committing code requires confirmation.
Reading, drafting, and adding tests can be delegated.
Deleting, deploying, migrating data, changing permissions, or committing code requires confirmation.
The faster an agent can work, the more important it is to define the brakes before it starts.
Install Claude Code and start with read-only work
Use the official Claude Code documentation for the current installation method. The native installer is now the recommended path in the official docs.
macOS, Linux, or WSL:
curl -fsSL https://claude.ai/install.sh | bash
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
After installation, enter a low-risk project:
cd your-project
claude
cd your-project
claude
First launch usually requires login or API key configuration, depending on your environment. Check the official quickstart before rolling this out to a team.
Do not start with a code change. Start with a read-only task:
Do not modify any files yet.
Read the project structure and tell me:
1. What is the main technology stack?
2. Where are the entry files?
3. What local startup command is likely?
4. Which 5 files should I read first?
5. If I ask you to improve the README, what information do you need to confirm first?
Do not modify any files yet.
Read the project structure and tell me:
1. What is the main technology stack?
2. Where are the entry files?
3. What local startup command is likely?
4. Which 5 files should I read first?
5. If I ask you to improve the README, what information do you need to confirm first?
This tests two things:
- whether Claude Code can understand the repository
- whether it respects a no-edit boundary
Confirm that it can read before you let it write.
Add CLAUDE.md to the project
Claude Code supports CLAUDE.md files as persistent project instructions. The official documentation notes that Claude reads these files at the start of a session and uses them as context. They are guidance, not hard enforcement. For enforced tool restrictions, use settings, permission rules, hooks, or managed policy.
For a project, place the file at:
./CLAUDE.md
./CLAUDE.md
or:
./.claude/CLAUDE.md
./.claude/CLAUDE.md
Here is a starter version you can copy.
# Project collaboration rules
## Project context
This is an active business project. Your job is to help read, analyze, modify, and verify code.
## Default workflow
1. After receiving a task, read the relevant files first and then propose a plan.
2. If multiple files may change, list the files and explain why each one is needed.
3. Make one coherent change at a time. Do not perform broad refactors without approval.
4. After editing, explain what changed, why it changed, and whether follow-up confirmation is needed.
5. Run tests when possible. If tests cannot run, explain why.
## Forbidden actions without explicit confirmation
1. Do not delete files.
2. Do not modify production configuration, secrets, payment logic, permission logic, or database migration scripts.
3. Do not create Git commits automatically.
4. Do not deploy automatically.
5. Do not perform large-scale refactors without explaining the impact first.
## Code style
1. Preserve the existing project style.
2. Do not introduce a new framework just to modernize the code.
3. Do not over-engineer simple logic.
4. When adding a function, component, or script, explain the naming choice.
## Output format
Before editing, output:
- My understanding of the task
- Files I plan to change
- Risks
- Questions that need confirmation
After editing, output:
- Changes made
- Verification performed
- Remaining risks
- Suggested next steps
# Project collaboration rules
## Project context
This is an active business project. Your job is to help read, analyze, modify, and verify code.
## Default workflow
1. After receiving a task, read the relevant files first and then propose a plan.
2. If multiple files may change, list the files and explain why each one is needed.
3. Make one coherent change at a time. Do not perform broad refactors without approval.
4. After editing, explain what changed, why it changed, and whether follow-up confirmation is needed.
5. Run tests when possible. If tests cannot run, explain why.
## Forbidden actions without explicit confirmation
1. Do not delete files.
2. Do not modify production configuration, secrets, payment logic, permission logic, or database migration scripts.
3. Do not create Git commits automatically.
4. Do not deploy automatically.
5. Do not perform large-scale refactors without explaining the impact first.
## Code style
1. Preserve the existing project style.
2. Do not introduce a new framework just to modernize the code.
3. Do not over-engineer simple logic.
4. When adding a function, component, or script, explain the naming choice.
## Output format
Before editing, output:
- My understanding of the task
- Files I plan to change
- Risks
- Questions that need confirmation
After editing, output:
- Changes made
- Verification performed
- Remaining risks
- Suggested next steps

This file turns implicit team expectations into project assets. New teammates can read it. Claude Code can load it. Reviewers can update it when the agent repeatedly makes the same mistake.
Keep it specific and concise. The official docs recommend using CLAUDE.md for facts Claude should carry into every session: build commands, conventions, project layout, and always-do rules.
First real task: README and tests
Do not make the first task a new feature. Use a low-risk task that still exercises the workflow.
README and tests are good starting points because they require Claude Code to understand the project, edit files, run commands, and report failures without touching core business logic.
Start with analysis only:
Read the project first. Do not modify files.
Goal: make this project easier for a new developer to understand.
Output:
1. Project structure summary
2. Local startup command
3. Key module explanation
4. Missing README sections
5. The 3 tests you recommend adding first
Analysis only. Do not edit files.
Read the project first. Do not modify files.
Goal: make this project easier for a new developer to understand.
Output:
1. Project structure summary
2. Local startup command
3. Key module explanation
4. Missing README sections
5. The 3 tests you recommend adding first
Analysis only. Do not edit files.
Then allow a limited README change:
Based on the analysis, make the first change.
Rules:
1. You may only modify README.md.
2. Do not edit business code.
3. README should include project overview, installation, startup, common commands, directory structure, and contribution notes.
4. After editing, summarize what you added.
Based on the analysis, make the first change.
Rules:
1. You may only modify README.md.
2. Do not edit business code.
3. README should include project overview, installation, startup, common commands, directory structure, and contribution notes.
4. After editing, summarize what you added.
Then add a small test scope:
Now add tests.
Rules:
1. You may only modify the tests/ directory.
2. If tests/ does not exist, you may create it.
3. Do not edit business code.
4. Add the 2 easiest tests to verify.
5. After editing, run the test command.
6. If tests fail, explain the failure first and ask whether to continue fixing it.
Now add tests.
Rules:
1. You may only modify the tests/ directory.
2. If tests/ does not exist, you may create it.
3. Do not edit business code.
4. Add the 2 easiest tests to verify.
5. After editing, run the test command.
6. If tests fail, explain the failure first and ask whether to continue fixing it.

This is a useful first team acceptance task. If Claude Code cannot produce a clear README, small tests, and a verification report, do not give it core business code yet. If it performs well, expand gradually to bug fixes, local refactors, and feature work.
Write executable prompts, not vague wishes
Many Claude Code tasks go wrong because the prompt contains a wish but no boundary.
This is vague:
Optimize this project.
Optimize this project.
Claude Code has to guess what “optimize” means: performance, structure, docs, build speed, dependencies, naming, tests, or architecture.
Use a bounded prompt instead:
Read only src/api/ and src/services/.
Find duplicated request-handling logic.
Requirements:
1. Do not modify files yet.
2. Output the locations of duplicated logic.
3. Rank them by small impact range, clear benefit, and easy testability.
4. Suggest the first refactor step.
5. Wait for my confirmation before editing.
Read only src/api/ and src/services/.
Find duplicated request-handling logic.
Requirements:
1. Do not modify files yet.
2. Output the locations of duplicated logic.
3. Rank them by small impact range, clear benefit, and easy testability.
4. Suggest the first refactor step.
5. Wait for my confirmation before editing.
For debugging, do not only paste an error and say “fix it.” Use:
Below is the error from running npm test.
Please:
1. Identify likely causes.
2. Find the related files.
3. Propose the smallest safe fix.
4. Do not expand the refactor scope.
5. After editing, rerun the same test command.
Error:
...
Below is the error from running npm test.
Please:
1. Identify likely causes.
2. Find the related files.
3. Propose the smallest safe fix.
4. Do not expand the refactor scope.
5. After editing, rerun the same test command.
Error:
...
A reliable Claude Code prompt usually includes:
- task objective
- directories or files it may read
- whether editing is allowed
- allowed modification scope
- verification method
If you do not provide these, Claude Code will infer them. Sometimes the inference is right. Sometimes the rework starts there.
Connect Claude Code through ClaudeAPI
For individual exploration, Claude Code’s default authentication path is enough.
For team usage, centralize API keys, model selection, call records, and billing. When each developer configures their own key, short-term setup is easy but long-term operations become harder:
- You cannot tell which project consumed the most.
- You cannot tell who used expensive models.
- Leaked keys are harder to scope.
- Different tools use different configurations.
- Finance, invoices, and reimbursement become fragmented.
ClaudeAPI can act as a model access layer for Claude Code, Dify, Open WebUI, n8n, internal scripts, and other tools.
ClaudeAPI console:
Common endpoints:
Anthropic-compatible base_url:
https://gw.claudeapi.com
OpenAI-compatible base_url:
https://gw.claudeapi.com/v1
Anthropic-compatible base_url:
https://gw.claudeapi.com
OpenAI-compatible base_url:
https://gw.claudeapi.com/v1
Claude Code’s official gateway documentation shows that requests can be routed through a gateway with environment variables such as ANTHROPIC_BASE_URL. If your Claude Code version and deployment mode support an Anthropic-compatible gateway, configure:
export ANTHROPIC_BASE_URL="https://gw.claudeapi.com"
export ANTHROPIC_API_KEY="YOUR_CLAUDEAPI_KEY"
export ANTHROPIC_BASE_URL="https://gw.claudeapi.com"
export ANTHROPIC_API_KEY="YOUR_CLAUDEAPI_KEY"
On Windows PowerShell:
$env:ANTHROPIC_BASE_URL = "https://gw.claudeapi.com"
$env:ANTHROPIC_API_KEY = "YOUR_CLAUDEAPI_KEY"
$env:ANTHROPIC_BASE_URL = "https://gw.claudeapi.com"
$env:ANTHROPIC_API_KEY = "YOUR_CLAUDEAPI_KEY"
Then verify:
claude /status
claude /status
and run a short request from a low-risk project.
For tools using an OpenAI-compatible protocol, use:
https://gw.claudeapi.com/v1
https://gw.claudeapi.com/v1
Keep the two URL styles separate:
Claude Code / Anthropic-compatible base URL:
https://gw.claudeapi.com
OpenAI-compatible tools:
https://gw.claudeapi.com/v1
Claude Code / Anthropic-compatible base URL:
https://gw.claudeapi.com
OpenAI-compatible tools:
https://gw.claudeapi.com/v1
Before rollout, confirm:
- your Claude Code version supports the authentication route you plan to use
- your tool supports a custom base URL
- the ClaudeAPI key is created and active
- the selected model is enabled in the ClaudeAPI console
An internal team card can reduce configuration drift:
Service: ClaudeAPI
Console: https://console.claudeapi.com
Anthropic-compatible base_url: https://gw.claudeapi.com
OpenAI-compatible base_url: https://gw.claudeapi.com/v1
Key policy: create keys per project, not per personal habit
Model policy: Sonnet for daily work, Opus/Fable for complex work, Haiku for lightweight tasks
Cost review: weekly review by project, member, model, and task type
Service: ClaudeAPI
Console: https://console.claudeapi.com
Anthropic-compatible base_url: https://gw.claudeapi.com
OpenAI-compatible base_url: https://gw.claudeapi.com/v1
Key policy: create keys per project, not per personal habit
Model policy: Sonnet for daily work, Opus/Fable for complex work, Haiku for lightweight tasks
Cost review: weekly review by project, member, model, and task type
Put this card in the team wiki, internal docs, or project README. Reuse it when configuring Claude Code, Cline, Dify, Open WebUI, n8n, or internal agents.
Model selection: start with Sonnet
Claude Code cost is mainly driven by input context and output length.
Code projects grow context quickly: repository files, logs, test output, historical conversation, and requirements all consume tokens.
For day-to-day development, route by task:
| Model | Good fit |
|---|---|
claude-sonnet-5 |
Daily code changes, tests, scripts, documentation |
claude-opus-4-8 |
Complex reasoning, long-context analysis, cross-module debugging |
claude-fable-5 |
Very complex workflows and high-value flagship tasks |
claude-haiku-4-5-20251001 |
Lightweight extraction, classification, batch cleanup |
The source draft lists the following ClaudeAPI example prices from the console:
claude-sonnet-5
Input $1.600 / M tokens
Output $8.000 / M tokens
claude-opus-4-8
Input $4.000 / M tokens
Output $20.000 / M tokens
claude-fable-5
Input $8.000 / M tokens
Output $40.000 / M tokens
claude-haiku-4-5-20251001
Input $0.800 / M tokens
Output $4.000 / M tokens
claude-sonnet-5
Input $1.600 / M tokens
Output $8.000 / M tokens
claude-opus-4-8
Input $4.000 / M tokens
Output $20.000 / M tokens
claude-fable-5
Input $8.000 / M tokens
Output $40.000 / M tokens
claude-haiku-4-5-20251001
Input $0.800 / M tokens
Output $4.000 / M tokens
Prices and model availability can change. Use the ClaudeAPI console as the final source before setting a team budget.
The safer default is:
Use Sonnet for routine development.
Escalate to Opus or Fable for architecture, long debugging chains, and high-value complex tasks.
Use Haiku or scripts for lightweight batch work.
Use Sonnet for routine development.
Escalate to Opus or Fable for architecture, long debugging chains, and high-value complex tasks.
Use Haiku or scripts for lightweight batch work.
Do not use a flagship model for every task. Documentation cleanup, formatting, extraction, and simple classification often do not need it.

Five habits that control Claude Code cost
1. Give only relevant directories
Do not start by asking Claude Code to scan the entire repository.
Read only src/auth/, src/api/user/, and tests/auth/.
Do not scan unrelated directories.
Read only src/auth/, src/api/user/, and tests/auth/.
Do not scan unrelated directories.
Smaller scope improves focus and reduces cost.
2. Ask for a plan before edits
First propose a modification plan. Do not edit files until I confirm.
First propose a modification plan. Do not edit files until I confirm.
This prevents broad, unnecessary changes and reduces rework.
3. Split large tasks
Avoid:
Refactor the entire payment module.
Refactor the entire payment module.
Use:
First read the payment module and identify one function that is the safest first refactor candidate.
Only output a recommendation. Do not edit files.
First read the payment module and identify one function that is the safest first refactor candidate.
Only output a recommendation. Do not edit files.
Small steps are easier to review and easier to stop.
4. Summarize at phase boundaries
Long sessions become expensive.
At the end of a phase, ask for a compact handoff:
Summarize the current task in under 300 words.
Include changed files, unresolved issues, and the recommended next step.
Summarize the current task in under 300 words.
Include changed files, unresolved issues, and the recommended next step.
Continue the next phase from the summary instead of carrying every prior turn.
5. Put repeated rules in CLAUDE.md
Do not retype “do not commit,” “do not edit production config,” or “show the plan before editing” every time.
Put stable rules in CLAUDE.md. That makes team behavior more consistent and reduces accidental scope expansion.
FAQ
What is Claude Code?
Claude Code is Anthropic’s agentic coding tool. It can read codebases, edit files, run commands, and work across terminal, IDE, desktop, web, and other surfaces depending on your setup.
Beginners can use it, but should start with low-risk tasks: reading a project, improving README files, adding small tests, and explaining errors.
How is Claude Code different from Cursor or Cline?
Cursor and Cline are editor-centered AI coding tools. Claude Code is more like a coding agent that can work inside a project from the terminal and other Claude Code surfaces.
Teams often use them together: Cursor or Cline for interactive editing, Claude Code for longer project tasks such as repo analysis, test generation, bug fixing, and handoff summaries.
Why write CLAUDE.md?
CLAUDE.md gives Claude Code project-specific instructions: coding style, build commands, test commands, files to avoid, review expectations, and workflow rules.
It is not an enforcement layer. For hard restrictions, use permission rules, settings, hooks, managed policy, or a sandboxed environment.
Can Claude Code connect to ClaudeAPI?
If your Claude Code version and deployment mode support a custom Anthropic-compatible gateway, configure the base URL as:
https://gw.claudeapi.com
https://gw.claudeapi.com
For OpenAI-compatible tools, use:
https://gw.claudeapi.com/v1
https://gw.claudeapi.com/v1
Check current Claude Code documentation and your tool’s actual configuration options before production rollout.
Is Claude Code expensive?
It depends on context size, output length, model choice, tool calls, and retries. Claude Code often consumes more tokens than a short chat because it may read files, logs, test output, and conversation history.
Control cost by narrowing scope, asking for plans first, splitting large tasks, summarizing long sessions, and routing models by task value.
Should Claude Code modify code automatically?
It can, but define boundaries first:
- Start with read-only analysis.
- Ask for a plan.
- Confirm file scope.
- Make a small change.
- Run tests.
- Review the diff.
- Decide whether to continue.
Do not let it independently modify secrets, payment logic, permissions, migrations, production config, or deployment state.
Why should teams centralize API keys and billing?
Separate personal keys make debugging and budgeting harder. Centralized access through ClaudeAPI helps teams see usage by project, tool, model, and task type; rotate keys; and reduce billing fragmentation.
What should the first Claude Code task be?
Start with one of these:
- analyze project structure
- identify entry files and startup commands
- improve README
- add one or two low-risk tests
These tasks verify that Claude Code understands the project without touching critical business logic.
What should I do when Claude Code makes a mistake?
Stop expansion first:
Do not continue editing.
Explain:
1. Which command failed.
2. What the likely cause is.
3. Which files you plan to inspect.
4. The smallest next fix you recommend.
Do not continue editing.
Explain:
1. Which command failed.
2. What the likely cause is.
3. Which files you plan to inspect.
4. The smallest next fix you recommend.
If the failure is API-related, check model ID, base URL, API key, quota, rate limits, and request format.
What is the relationship between ClaudeAPI and Claude / Anthropic?
ClaudeAPI is an independent third-party API service. Claude, Claude Code, and Anthropic are names owned by their respective rights holders. ClaudeAPI provides API access, model calling, usage management, and related technical services; it does not imply official affiliation, agency, resale partnership, or endorsement by Anthropic.
Start with a controlled rollout
If you want Claude Code in your development workflow, start small:
- Install Claude Code using the official quickstart.
- Run a read-only project analysis.
- Add a concise
CLAUDE.md. - Use README and tests as the first write task.
- Configure ClaudeAPI only after confirming your tool supports the required gateway mode.
- Use Sonnet for daily work and escalate only when needed.
- Review cost and mistakes weekly.
Claude Code is most reliable when it operates inside a clear engineering process: project context, written rules, permission controls, scoped tasks, verification, and usage review.
Sources
- Anthropic Claude Code Docs: Overview
- Anthropic Claude Code Docs: Quickstart
- Anthropic Claude Code Docs: How Claude remembers your project
- Anthropic Claude Code Docs: Configure permissions
- Anthropic Claude Code Docs: Settings
- Anthropic Claude Code Docs: Environment variables
- Anthropic Claude Code Docs: Connect Claude Code to an LLM gateway
- ClaudeAPI: Claude Code / Cline / Cursor configuration guide
Disclosure
ClaudeAPI is an independent third-party API service and is not affiliated with Anthropic.



