s/agents-development
Getting Started
Revision {n}
Title diff
Previous revision
Selected revision
1
1
Getting Started
Body diff
Previous revision
Selected revision
1
# Getting Started with Agent Coding1
2
3
## What is agent coding?4
5
Agent coding is a paradigm where an AI agent operates as an autonomous collaborator in your development workflow. Unlike autocomplete (Copilot-style) or chat-based coding (ChatGPT), an agent:6
7
- **Reads** your codebase, docs, configs, and git history8
- **Plans** a sequence of steps to accomplish a task9
- **Executes** — writes files, runs commands, installs packages, runs tests10
- **Iterates** — reads error output, fixes issues, re-runs until the task is done11
12
You describe *what* you want. The agent figures out *how*.13
14
## The mental model shift15
16
| Traditional coding | Agent coding |17
| --- | --- |18
| You write code line by line | You describe intent, agent writes code |19
| You debug by reading stack traces | Agent reads traces and fixes itself |20
| You context-switch between files | Agent holds entire codebase in context |21
| You run commands manually | Agent runs commands and reacts to output |22
| Quality depends on your typing speed | Quality depends on your instructions |23
24
The key insight: **your job shifts from writing code to writing constraints**. The better you define what "correct" looks like — through rules, tests, examples, and guardrails — the better the agent performs.25
26
## Your first session (10 minutes)27
28
### 1. Install Claude Code29
30
```bash31
npm install -g @anthropic-ai/claude-code32
```33
34
Requires Node.js 18+. Authenticate with your Anthropic API key or Claude Pro/Max subscription.35
36
### 2. Navigate to a project37
38
```bash39
cd your-project40
claude41
```42
43
Claude Code starts in interactive mode, reads your project structure, and is ready to go.44
45
### 3. Give it a real task46
47
Don't start with "write hello world". Start with something you'd actually do today:48
49
```50
fix the failing test in pkg/auth/token_test.go51
```52
53
```54
add a /healthz endpoint that checks database connectivity55
```56
57
```58
refactor the UserService to use the repository pattern, keep all tests passing59
```60
61
### 4. Observe the loop62
63
Watch how the agent:64
65
1. Reads relevant files66
2. Proposes a plan67
3. Edits code68
4. Runs tests or build69
5. Fixes any issues70
6. Reports what it did71
72
This read → plan → execute → verify loop is the core of agent coding.73
74
## When agents work well75
76
- **Boilerplate-heavy tasks** — CRUD endpoints, migrations, config files77
- **Refactoring with clear rules** — rename across codebase, extract interfaces78
- **Bug fixes with reproducible errors** — failing tests, stack traces79
- **Greenfield features with good specs** — "add X following the pattern in Y"80
- **Code review and analysis** — "find all SQL injection risks in this codebase"81
82
## When agents struggle83
84
- **Ambiguous requirements** — "make the UX better" gives bad results85
- **Novel algorithms** — agents remix known patterns, they don't invent86
- **Large-scale architecture decisions** — they optimize locally, not globally87
- **Performance tuning** — they lack runtime profiling context88
- **Tasks requiring visual judgment** — UI polish, design decisions89
90
## Key concepts to learn next91
92
| Concept | Why it matters | Page |93
| --- | --- | --- |94
| [CLAUDE.md](http://CLAUDE.md) | Define project rules the agent follows | [CLAUDE.md](http://CLAUDE.md)[ & Agent Rules](https://claude.ai/chat/claude-md-agent-rules.md) |95
| Hooks | Programmatic guardrails that enforce policy | [Hooks & Policy-as-Code](https://claude.ai/chat/hooks-policy-as-code.md) |96
| MCP | Connect agents to external tools and APIs | [MCP](https://claude.ai/chat/mcp.md) |97
| Headless mode | Run agents in CI/CD without human interaction | [Multi-Agent Patterns](https://claude.ai/chat/multi-agent-patterns.md) |98
99
## Common mistakes beginners make100
101
**1. Being too vague** Bad: "improve this code" Good: "extract the database logic from handlers into a repository layer, add interfaces, update tests"102
103
**2. Not providing context** Bad: "add authentication" Good: "add JWT authentication using the existing User model in pkg/models/user.go, follow the middleware pattern from pkg/middleware/logging.go"104
105
**3. Not verifying output** Agent code compiles ≠ agent code is correct. Always review diffs, run tests, check edge cases.106
107
**4. Fighting the agent** If the agent keeps going in the wrong direction, don't keep correcting — stop, write a clearer [CLAUDE.md](http://CLAUDE.md), add constraints, and restart.108
109
**5. Skipping the [CLAUDE.md](http://CLAUDE.md)** A project without a [CLAUDE.md](http://CLAUDE.md) is like a new hire with no onboarding doc. The agent will guess — and guess wrong.110
111
---112
113
Next: [Tools Landscape →](https://claude.ai/chat/tools-landscape.md)