AI agents go beyond answering questions — they autonomously use tools to complete multi-step tasks: reading files, writing code, running commands, and searching the web.
An AI agent is a model combined with tools and a loop: the model decides which tool to call, calls it, gets the result, and decides the next step — repeating until the task is done.
# Agent execution loop: User: "Add a search feature to the products page" Agent: 1. [Read] src/pages/ProductsPage.vue → understands current structure 2. [Read] src/api/products.ts → sees existing API calls 3. [Read] src/stores/products.ts → sees the Pinia store 4. [Edit] src/api/products.ts → adds searchProducts() function 5. [Edit] src/stores/products.ts → adds searchQuery state + action 6. [Edit] src/pages/ProductsPage.vue → adds search input + wires it up 7. [Bash] npm run type-check → verifies no TS errors 8. Done — reports what it changed
Claude Code is a full agentic CLI. It runs in your project directory with access to your full file system and terminal.
# Start Claude Code in your project: cd my-project claude # What it can do autonomously: - Read any file in the project - Edit files (with your approval by default) - Create new files - Run bash commands (npm, git, php artisan, etc.) - Search the web (with web search tool) - Search the codebase for symbols and patterns # Example agentic tasks: "Find all API calls that don't handle loading state and fix them" "Write tests for every function in src/utils/formatters.ts" "Refactor the auth flow to use refresh tokens"
| Tool | What it does | Example use |
|---|---|---|
| Read | Read a file from the filesystem | Read component before editing it |
| Write | Create or overwrite a file | Scaffold a new composable file |
| Edit | Apply targeted edits to a file | Add a prop to an existing component |
| Bash | Run a shell command | Run tests, git commands, artisan |
| Grep | Search file contents with regex | Find all usages of a deprecated function |
| Glob | Find files matching a pattern | List all *.vue files in src/ |
| WebFetch | Fetch a URL | Read API documentation |
| WebSearch | Search the web | Look up a package or error message |
| Mode | Behaviour | When to use |
|---|---|---|
| Interactive (chat) | Single response per message; you stay in control | Questions, quick edits, reviews |
| Agentic (auto) | Multi-step autonomous loop; executes tools until done | Larger features, refactors, test generation |
# Claude Code permission modes:
--dangerously-skip-permissions # Full auto, no approvals (risky)
Default # Asks approval for file writes + bash
--print # Print-only, no tool calls (safe)
# Control auto-approve in settings.json:
{
"permissions": {
"allow": ["Read", "Glob", "Grep"], # always allow reads
"deny": ["Bash(rm:*)"] # never allow rm commands
}
}
MCP is an open standard that lets AI connect to external tools, databases, and services in a structured way. It is the "plugin system" for AI agents.
# MCP connects Claude to:
- Databases (Postgres, MySQL, SQLite)
- File systems (remote or local)
- APIs (GitHub, Jira, Slack, Notion)
- Code tools (ESLint, test runners)
- Browsers (Puppeteer, Playwright)
# Example: connect Claude Code to your Postgres DB
# In ~/.claude/settings.json:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_URL": "postgresql://user:pass@localhost/mydb"
}
}
}
}
# Now Claude can: read schema, write queries, explain tables
claude
> "Show me all tables and describe the orders table schema"
> "Find all customers who haven't ordered in 60 days"
Autonomous agents are powerful but must be supervised. Never give AI unrestricted access to production systems.
git diff to see what the agent changedrm, drop table, git push# A well-defined agentic task has:
1. Clear goal ("implement X feature")
2. Known stopping condition ("when tests pass" / "when no TS errors")
3. Defined scope ("only touch files in src/features/cart/")
4. Success criteria ("all existing tests still pass")
# Example well-scoped agent task:
"Add email validation to the registration form.
Only edit: src/components/RegisterForm.vue
src/composables/useRegistration.ts
Stop when: no TypeScript errors and the form shows an error
message for invalid email addresses.
Do not change any other files."
# Signs an agent task is poorly scoped:
- "Improve the whole codebase"
- No clear done condition
- Touches config/env files without being asked
# Prompt given to Claude Code: "Implement a product favorites feature. When the user clicks the heart icon on any ProductCard, toggle the product as a favorite. Favorites are stored in localStorage and shown in a new FavoritesPage at /favorites. Files to create/edit: - src/composables/useFavorites.ts (new) - src/components/ProductCard.vue (add heart button) - src/pages/FavoritesPage.vue (new) - src/router/index.ts (add /favorites route) Constraints: Composition API, TypeScript, Tailwind CSS. Do not change any other files." # Agent actions taken: 1. Read ProductCard.vue (understand current structure) 2. Read router/index.ts (understand route format) 3. Write useFavorites.ts (new composable with localStorage) 4. Edit ProductCard.vue (add heart button + useFavorites) 5. Write FavoritesPage.vue (new page using useFavorites) 6. Edit router/index.ts (add /favorites route) 7. Bash: npm run type-check (verify no errors) 8. Report: "Done. 4 files changed, 0 TypeScript errors."