Claude Code Mastery

From Zero to Agent Architect — A practical guide for the engineering team

Node.js / Express / Lambda Vue 3 React Native QA

Use to reveal tips • to go back • next slide • previous slide

OVERVIEW

What We'll Cover

Four levels, from first install to fully autonomous agents.

Level 1 — Foundations

Install, invoke, navigate, first prompts, basic config

Level 2 — Daily Workflow

Cost-effective usage, Git / PR flow, CLAUDE.md, tech-stack tips

Level 3 — Customisation

Slash commands, hooks, MCP servers, skills, plugins

Level 4 — Agent Architect

Sub-agents, multi-agent orchestration, SDK, CI/CD, scheduled tasks

Level 1

Foundations

Getting everyone on the same page — install, invoke, and understand the basics.

Level 1 — Foundations

Installation — Three Paths

Three team members are on older macOS that may not support the native installer. Here are all options.

Native Installer (recommended): Fastest, no dependencies, auto-updates. Works on macOS 13+ (Ventura and later).
curl -fsSL https://claude.ai/install.sh | sh
Homebrew: Good alternative if you prefer package managers. Also requires relatively modern macOS.
brew install --cask claude-code
npm (for older macOS): Works on macOS 10.15+ (Catalina). Requires Node.js 18+. Use nvm to manage Node versions without system conflicts.
nvm install 20 && npm install -g @anthropic-ai/claude-code
VS Code Integration: Install the "Claude Code" extension from the VS Code marketplace. It embeds the agent directly in your editor with a dedicated panel. Works regardless of macOS version.
Verify: Run claude --version to confirm. Then claude to start your first session. You'll be prompted to authenticate via your Anthropic account.
Level 1 — Foundations

Ways to Invoke Claude Code

Different invocation methods for different situations.

Interactive REPL: Just type claude in your terminal. Opens a chat session where you converse back and forth. Best for exploratory work.
One-shot prompt: claude -p "explain the auth middleware in src/middleware/auth.js" — sends a single prompt, prints the answer, and exits. Great for quick questions.
Pipe input: cat error.log | claude -p "what caused this crash?" — pipe any text into Claude for analysis. Perfect for logs, diffs, and outputs.
Resume a session: claude --resume picks up your last conversation. claude --resume SESSION_ID resumes a specific one. Use claude -n "feature-x" to name sessions for easy recall.
Non-interactive (CI/scripts): claude -p "run all tests and report failures" --allowedTools Bash,Read — use in scripts and CI pipelines with explicit tool permissions.
VS Code: Open the Claude panel (Cmd+Shift+P → Claude Code). Same power, inline in your editor. Selections can be sent directly to Claude.
With context flags: claude --add-dir ../shared-lib adds sibling directories as context. claude --system-prompt "You are a Vue expert" sets a custom system prompt.
Level 1 — Foundations

Essential Slash Commands

Commands you'll use every day inside a Claude Code session.

/help — Lists all available slash commands including your custom ones. Your first friend.
/clear — Wipes the conversation context. Use when switching tasks to save tokens.
/compact — Summarises the conversation so far to free up context window. Can pass custom instructions like /compact focus on the API changes.
/cost — Shows token usage and cost for the current session. Keep an eye on this!
/effort — Set model effort level: /effort low for fast, /effort high for thorough analysis.
/model — Switch between Sonnet (fast, cheap) and Opus (deep, thorough) mid-session.
/init — Generates a starter CLAUDE.md file by analysing your project. Run this once per project.
/permissions — View and manage what tools Claude can use. Control file writes, bash commands, etc.
Level 1 — Foundations

Understanding the Permission System

Claude asks before it acts. Here's how to control that flow.

Ask/Allow/Deny: Every tool action (file write, bash command, etc.) goes through a permission gate. You approve, deny, or set rules.
Trust levels: Run /permissions to see the current trust matrix. You can allow tools globally, per-project, or per-session.
Allowlist patterns: claude --allowedTools "Bash(npm run *)" "Edit" "Read" — allow specific bash patterns. Keeps Claude productive without blanket trust.
Dangerously Skip Permissions: claude --dangerously-skip-permissions exists for CI only. Never use in interactive development — it bypasses all safety prompts.
Settings files: Permissions persist in .claude/settings.json (project) and ~/.claude/settings.json (global). Check these into git (project-level) for team consistency.
Level 1 — Foundations

Plan Mode — Think Before Coding

Have Claude design the approach before writing a single line.

Activate: Press Shift+Tab to toggle Plan Mode. Claude will read, analyse, and propose a plan without making changes.
When to use: Multi-file refactors, new features, architecture decisions, debugging complex issues. Anything where "measure twice, cut once" applies.
Iterate on the plan: Review Claude's plan, ask questions, adjust scope. Once satisfied, switch back to normal mode and say "execute the plan."
Cost benefit: Planning in Sonnet, executing in Sonnet = cheap. Planning in Sonnet, complex execution in Opus = optimal. Avoids expensive false starts.
Team tip: For PRs with significant scope, paste the plan into the PR description. It documents intent and helps reviewers.
Level 2

Daily Workflow

Cost-effective usage, Git mastery, CLAUDE.md, and tech-stack–specific workflows.

Level 2 — Daily Workflow

Saving Your Usage Limit — The DOs

10 practices that will stretch your token budget dramatically.

1. Be specific upfront: "Add a GET /users/:id/orders endpoint to src/routes/users.ts that returns paginated results using the existing OrderService" beats "add an endpoint for orders."
2. Use /clear between tasks: Switching from a bug fix to a feature? Clear the context. Old context bloats every subsequent message.
3. Use /compact when context grows: /compact keep the API schema and test results — tells Claude what matters. Reduces context by 50-70%.
4. Default to Sonnet: Sonnet handles ~80% of tasks. Use /model opus only for deep architectural analysis, complex debugging, or large refactors.
5. Reference files, don't paste them: Say "read src/services/auth.js and fix the token refresh bug" instead of pasting 200 lines into the chat.
6. Use Plan Mode for big tasks: Shift+Tab → plan → review → execute. Avoids costly trial-and-error on complex changes.
7. Set /effort appropriately: /effort low for simple renames, formatting. /effort high for security reviews, architecture. Match effort to task complexity.
8. One-shot for quick questions: claude -p "what does the --strict flag do in tsc?" — no session overhead, instant answer, minimal tokens.
9. Use CLAUDE.md effectively: Project conventions in CLAUDE.md = Claude stops asking "which style guide?" every session. Saves rounds of clarification.
10. Scope your requests: "Fix the null check in processOrder() at line 42" is cheaper than "there's a bug somewhere in the order processing."
Level 2 — Daily Workflow

Saving Your Usage Limit — The DON'Ts

10 anti-patterns that silently burn through your allocation.

1. Don't have marathon sessions: After 30+ exchanges, Claude carries massive context overhead. Start fresh sessions for new tasks.
2. Don't paste entire files: "Here's my 500-line component, fix it" forces Claude to process everything. Point to the file and describe the issue instead.
3. Don't be vague: "Make the app better" or "fix the tests" gives Claude no anchor. It will explore broadly, read many files, and burn tokens figuring out what you mean.
4. Don't use Opus for boilerplate: CRUD endpoints, simple tests, config files — Sonnet handles these perfectly. Opus costs ~5x more per token.
5. Don't skip /init: Without a CLAUDE.md, Claude re-discovers your project structure every session. That discovery phase is pure token waste.
6. Don't ask Claude to "read everything": "Read the entire src/ directory and tell me about it" can consume your whole context window. Be selective.
7. Don't repeat instructions: If you tell Claude the same coding convention every session, put it in CLAUDE.md instead. Every repetition costs tokens.
8. Don't ignore auto-compact warnings: When Claude warns about context limits, proactively /compact with guidance. Auto-compact may drop important context.
9. Don't chain unrelated tasks: "Fix the login bug, then refactor the database layer, then write docs for the API" — each topic inflates context for the others. Separate sessions.
10. Don't add pleasantries: "Hi Claude, I hope you're doing well! Could you please kindly..." — every token counts. Be direct: "Add input validation to the signup form."
Level 2 — Daily Workflow

Git with Claude — Daily Commands

Let Claude handle your routine git operations via the gh CLI.

Status check: "what's the git status? any uncommitted changes?" — Claude runs git status, git diff --stat and summarises.
Smart commit: "commit my changes with a good message following conventional commits" — Claude analyses the diff, writes a semantic commit message, and runs git commit.
Branch management: "create a branch feat/user-orders from main and push it" — Claude handles checkout, branch creation, and push in one go.
Interactive rebase help: "squash the last 3 commits into one with a clean message" — Claude handles the rebase non-interactively, preserving your changes.
Cherry-pick & backport: "cherry-pick commit abc123 onto the release/2.1 branch" — Claude switches branches, cherry-picks, handles conflicts, and pushes.
Stash management: "stash my current work, pull latest main, then pop the stash" — Claude handles the full flow and alerts you about conflicts.
Level 2 — Daily Workflow

Git with Claude — PR Workflow

From opening a PR to reviewing a colleague's code.

Open a PR: "create a PR to main with a description of what changed and a test plan" — Claude runs gh pr create with a well-structured title, summary, and test plan.
Review a peer's PR: "review PR #142 — focus on security and error handling" — Claude uses gh pr diff 142, reads the changes, and provides inline-style feedback.
Address review comments: "read the review comments on PR #142 and fix them" — Claude fetches comments via gh api, makes fixes, commits, and pushes.
PR status dashboard: "show me all open PRs assigned to me and their CI status" — Claude runs gh pr list --assignee @me and gh pr checks.
Merge when ready: "squash-merge PR #142 after checks pass" — Claude monitors checks with gh pr checks --watch and merges with gh pr merge --squash.
GitHub Actions helper: "why is the CI failing on PR #142?" — Claude runs gh run view, reads the logs, identifies the failure, and suggests a fix.
Level 2 — Daily Workflow

CLAUDE.md — Project Level

Your team's shared "instruction manual" for Claude, checked into git at the project root.

What it is: A markdown file at your project root that Claude reads at the start of every session. Think of it as .editorconfig but for AI behaviour.
Example 1 — Build commands:
# Build & Test
- Build: `npm run build`
- Test all: `npm test`
- Test single: `npm test -- --grep "test name"`
- Lint: `npm run lint`
Example 2 — Code style:
# Code Style
- Use TypeScript strict mode
- Prefer async/await over .then() chains
- Use Zod for request validation, not manual checks
- Error responses follow RFC 7807 (Problem Details)
Example 3 — Architecture rules:
# Architecture
- Routes go in src/routes/, services in src/services/
- Every route must have a corresponding OpenAPI spec in api/
- Lambda handlers are in src/handlers/ — use claudia.js conventions
- Never import from src/handlers/ in src/services/
Example 4 — Git conventions:
# Git
- Use Conventional Commits: feat|fix|chore|docs|refactor(scope): message
- Always squash-merge PRs to main
- Branch naming: feat/*, fix/*, chore/*
Example 5 — Testing rules:
# Testing
- Use Vitest for unit tests, Supertest for API integration tests
- Every new endpoint needs at least: happy path, 400, 401, 404 tests
- Mock external services using msw (Mock Service Worker)
- Test files live next to source: foo.ts → foo.test.ts
Keep it lean: ~100-150 lines max. For each line, ask: "Would Claude make a mistake without this?" If not, cut it. Every unnecessary line dilutes the ones that matter.
Level 2 — Daily Workflow

CLAUDE.md — Global Level

Personal preferences at ~/.claude/CLAUDE.md — applies to every project.

What it is: Your personal CLAUDE.md at ~/.claude/CLAUDE.md. Applies across all projects. Great for coding style preferences, language, and personal workflow.
Example 1 — Personal preferences:
# Personal Preferences
- I prefer concise explanations — skip the preamble
- Always show the file path before code changes
- When writing commit messages, include the ticket number from the branch name
Example 2 — Editor integration:
# Environment
- I use VSCode with Prettier (format on save)
- After editing a file, no need to run formatters — it happens automatically
- My terminal is iTerm2 with Zsh
Example 3 — Communication style:
# Communication
- When unsure, ask before making changes
- If a change touches more than 5 files, show me the plan first
- Explain trade-offs when suggesting architectural decisions
Example 4 — Default tools:
# Tools
- Use gh CLI for all GitHub operations
- Prefer npx over global installs
- Use jq for JSON processing in bash
Example 5 — Security rules:
# Security
- Never commit .env files or secrets
- Always check for hardcoded credentials before committing
- Flag any use of eval() or unsanitised user input
Hierarchy: Global CLAUDE.md → Parent directory → Project root → Child directories. More specific files override more general ones. Child CLAUDE.md files are loaded on demand.
Level 2 — Daily Workflow

Stack-Specific: Node.js + Express + Claudia.js

Prompts and CLAUDE.md tips for the backend team.

OpenAPI-first development: "Read api/openapi.yaml and generate the Express route + Zod validation for the POST /orders endpoint" — Claude generates code that matches your spec exactly.
Lambda handler scaffolding: "Create a new Lambda handler in src/handlers/ for the user-notifications service following the existing pattern in src/handlers/orders.js"
Claudia.js deployment checks: Add to CLAUDE.md: Deploy with: claudia update --handler src/lambda.handler. Claude will use the right command.
API testing helper: "Write Supertest integration tests for all endpoints in src/routes/orders.ts, covering 200, 400, 401, and 404 responses"
CLAUDE.md snippet for backend:
# Backend Stack
- Runtime: Node.js 20 on AWS Lambda via Claudia.js
- Framework: Express with OpenAPI 3.1 specs in api/
- Validation: Zod schemas auto-generated from OpenAPI
- Deploy: `npx claudia update` (never `claudia create` on existing)
Debugging Lambda locally: "Help me debug this Lambda timeout — read the CloudWatch log snippet I pasted and suggest fixes"
Level 2 — Daily Workflow

Stack-Specific: Vue 3

Prompts and tips for the frontend team.

Component generation: "Create a Vue 3 Composition API component for a paginated data table in src/components/DataTable.vue using <script setup> with TypeScript"
Composable extraction: "Extract the filter logic from OrderList.vue into a composable at src/composables/useOrderFilters.ts"
Pinia store scaffolding: "Create a Pinia store for the notification system with actions to fetch, mark-read, and dismiss"
CLAUDE.md snippet for frontend:
# Frontend Stack
- Framework: Vue 3 with Composition API (<script setup>)
- State: Pinia stores in src/stores/
- Styling: Tailwind CSS — no custom CSS unless absolutely necessary
- Testing: Vitest + Vue Test Utils
- Always use TypeScript, never plain JS in .vue files
Migration helper: "Refactor src/components/LegacyForm.vue from Options API to Composition API with <script setup>, preserving all functionality"
Level 2 — Daily Workflow

Stack-Specific: React Native

Prompts and tips for the mobile team.

Screen scaffolding: "Create a new screen at src/screens/OrderDetailScreen.tsx with React Navigation params for orderId, fetching data with React Query"
Platform-specific code: "Add haptic feedback on iOS and vibration on Android when the user completes a purchase — use Platform.select"
Native module debugging: "Read the Metro bundler error log and explain why the native module 'react-native-camera' isn't linking properly"
CLAUDE.md snippet for mobile:
# Mobile Stack
- Framework: React Native 0.74+ with TypeScript
- Navigation: React Navigation v6
- State: Zustand for local, React Query for server state
- Testing: Jest + React Native Testing Library
- Always handle both iOS and Android edge cases
Performance profiling: "Analyse why the FlatList in src/screens/Feed.tsx is re-rendering excessively and add memoisation where needed"
Level 2 — Daily Workflow

Stack-Specific: QA

Claude can be a powerful testing partner.

Test generation: "Read the PR diff for #156 and generate test cases covering all changed logic, edge cases, and error paths"
E2E test writing: "Write a Playwright E2E test for the user login flow: valid creds → dashboard, invalid → error message, expired session → redirect"
Bug reproduction: "Here's the bug report: [paste]. Read the relevant code and write a failing test that reproduces this issue."
Test coverage analysis: "Run the test suite, analyse the coverage report, and identify the 5 most critical untested code paths"
API contract testing: "Compare the OpenAPI spec in api/openapi.yaml with the actual API responses and flag any mismatches"
Level 3

Customisation

Slash commands, hooks, MCP servers, skills, and plugins — making Claude Code truly yours.

Level 3 — Customisation

Custom Slash Commands

Reusable prompt templates that your whole team shares.

How they work: Create a markdown file at .claude/commands/name.md (project-shared) or ~/.claude/commands/name.md (personal). The filename becomes the /name command.
Example — /review-security:
# .claude/commands/review-security.md
Perform a security review of the current changes:
1. Check for SQL injection, XSS, CSRF vulnerabilities
2. Verify all user inputs are validated with Zod
3. Ensure no secrets are hardcoded
4. Check auth middleware is applied to protected routes
Focus on: $ARGUMENTS
Example — /new-endpoint:
# .claude/commands/new-endpoint.md
Create a new API endpoint following our conventions:
1. Add the OpenAPI spec to api/openapi.yaml
2. Generate the route in src/routes/
3. Create the service in src/services/
4. Write tests covering 200, 400, 401, 404
Endpoint: $ARGUMENTS
$ARGUMENTS placeholder: Whatever you type after the command becomes $ARGUMENTS. E.g., /review-security the auth middleware.
Frontmatter for control:
---
allowed-tools: Read, Grep, Glob
model: opus
---
Deep analysis prompt here...
Team sharing: Commit .claude/commands/ to your repo. Everyone gets the same commands. Personal variants go in ~/.claude/commands/.
Level 3 — Customisation

Hooks — Deterministic Automation

Unlike CLAUDE.md (advisory), hooks are guaranteed to run. Use them for things that must happen every time.

What are hooks? Shell commands triggered by Claude Code lifecycle events. Configured in .claude/settings.json. They run your scripts at specific points.
Hook events: SessionStart (session begins), PreToolUse (before a tool runs), PostToolUse (after a tool completes), Stop (agent finishes), Notification, PostCompact.
Example — Auto-lint on save:
// .claude/settings.json
{ "hooks": { "PostToolUse": [
  { "matcher": "Write|Edit",
    "hooks": [{ "type": "command",
      "command": "npx eslint --fix $CLAUDE_FILE_PATH",
      "timeout": 15 }] }
] } }
Example — Block dangerous commands:
// PreToolUse hook: exit code 2 = BLOCK the action
{ "matcher": "Bash",
  "hooks": [{ "type": "command",
    "command": "echo $CLAUDE_TOOL_INPUT | grep -qE 'rm -rf|drop table' && exit 2 || exit 0" }] }
Example — Auto-test after code changes:
{ "matcher": "Write|Edit",
  "hooks": [{ "type": "command",
    "command": "npm test -- --related $CLAUDE_FILE_PATH",
    "timeout": 60 }] }
PreToolUse exit codes: 0 = allow, 2 = block the action (Claude gets notified why). Any other code = error.
Rule of thumb: If it must happen 100% of the time → hook. If it's guidance Claude should follow → CLAUDE.md. Hooks are deterministic; CLAUDE.md is advisory.
Level 3 — Customisation

MCP Servers — Extending Claude's Reach

Model Context Protocol servers give Claude access to external tools and data sources.

What are MCP servers? External processes that expose tools to Claude via a standard protocol. Think "plugins for Claude's tool system." Each server provides new capabilities.
Configuration: Add to .claude/settings.json or ~/.claude/settings.json:
{
  "mcpServers": {
    "browser": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-browser"]
    },
    "postgres": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-postgres", "postgresql://..."]
    }
  }
}
Popular MCP servers: Database access (Postgres, MySQL), browser automation, Slack integration, Jira/Linear, filesystem watchers, Docker management, AWS services.
Useful for your stack: AWS MCP server for Lambda logs & metrics. Postgres MCP for direct database queries during debugging. Browser MCP for E2E verification.
Each server exposes tools: After configuring, Claude sees new tools. E.g., with a Postgres MCP: "Query the users table for accounts created this week" — Claude calls the database tool directly.
Build your own: MCP servers are simple JSON-RPC over stdio. Build one for your internal APIs: deploy status, feature flags, monitoring dashboards. The SDK has TypeScript and Python templates.
Level 3 — Customisation

Skills — Reusable Knowledge Packs

More powerful than slash commands: skills bundle prompts, scripts, and resources together.

Skills vs Commands: Commands = simple prompt templates. Skills = rich packages with a SKILL.md, helper scripts, reference files, and configuration. Use skills when the task needs more than a prompt.
Structure:
.claude/skills/
  deploy-checker/
    SKILL.md         # Main instructions
    scripts/
      check-deploy.sh  # Helper script
    reference/
      deploy-checklist.md  # Reference doc
SKILL.md frontmatter:
---
description: "Verify deployment readiness for Lambda services"
allowed-tools: Bash, Read, Grep
model: sonnet
---
# Deploy Checker
Before deploying, verify:
1. All tests pass (npm test)
2. No TODO/FIXME in changed files
3. OpenAPI spec is up to date
...
Invoke: Skills appear as slash commands: /deploy-checker. They can also be triggered by Claude automatically when their description matches the task.
Sharing skills: Commit .claude/skills/ to your repo for team skills. Use ~/.claude/skills/ for personal ones. Skills can also be distributed via plugins.
Idea for your team: Create skills for: api-scaffold (new endpoint from OpenAPI), lambda-debug (analyse CloudWatch logs), rn-screen (new React Native screen), vue-component (new Vue component with tests).
Level 3 — Customisation

Plugins — All-in-One Packages

Plugins bundle skills, commands, hooks, and MCP configs into a single installable package.

What's in a plugin? A plugin can include: slash commands, skills, hooks, MCP server configurations, and settings — all bundled together. Install once, get everything.
Install a plugin:
/plugin install anthropic/code-review
/plugin install anthropic/memory
Built-in plugins worth knowing: code-review — automated PR review with specialised agents. memory — persistent facts across sessions. todo — task tracking.
Create a team plugin: Bundle your team's commands, skills, and hooks into a plugin. Distribute via a GitHub repo. New team members run one install command and get the full setup.
Plugin structure:
my-team-plugin/
  plugin.json           # Plugin manifest
  commands/             # Slash commands
  skills/               # Skills with SKILL.md
  hooks/                # Hook scripts
  settings.json         # MCP servers + permissions
Level 4

Agent Architect

Sub-agents, multi-agent orchestration, the Claude Code SDK, CI/CD automation, and scheduled tasks.

Level 4 — Agent Architect

Sub-Agents — Divide and Conquer

Specialised AI agents that Claude delegates specific tasks to, each with its own context and tools.

What are sub-agents? Independent Claude instances with custom system prompts, scoped tool access, and their own context windows. The main agent delegates tasks, sub-agents execute and return results.
Create a sub-agent:
# .claude/agents/security-reviewer.md
---
description: "Reviews code changes for security vulnerabilities"
allowed-tools: Read, Grep, Glob
model: opus
---
You are a security reviewer. Analyse the given code for:
- Injection vulnerabilities (SQL, NoSQL, command, XSS)
- Authentication/authorization flaws
- Sensitive data exposure
- Insecure dependencies
How delegation works: When you ask Claude to "review this for security," it matches the description to the sub-agent and delegates. The sub-agent gets its own isolated context and reports back.
Team sub-agent ideas: api-designer (OpenAPI expert), test-writer (generates comprehensive test suites), perf-analyser (profiles and optimises), doc-writer (API docs from code).
Sub-agents vs Skills: Skills augment Claude's knowledge. Sub-agents are independent executors with separate contexts. Use skills for "how to do X." Use sub-agents for "go do X and come back with results."
Cost advantage: Sub-agents have focused contexts (only what they need). A security review sub-agent doesn't carry your whole conversation history — just the code to review. This saves tokens.
Level 4 — Agent Architect

Multi-Agent Orchestration

Multiple agents working together on complex tasks.

Sequential pipeline: Claude delegates to agents in sequence: code-writertest-writersecurity-reviewerdoc-writer. Each agent receives the previous agent's output.
Parallel execution: Claude can dispatch multiple sub-agents simultaneously. E.g., while test-writer creates tests, doc-writer generates docs — both from the same code change.
Example: Full feature pipeline:
"Implement the user notifications feature:
1. Read the spec in docs/notifications-spec.md
2. Implement the backend endpoints
3. Write comprehensive tests
4. Review for security issues
5. Update the OpenAPI spec
6. Create the PR with a full description"
Claude orchestrates multiple sub-agents for each step.
Agent teams (advanced): Unlike sub-agents (report to main), agent teams run in their own context windows with direct communication. Use for truly independent workstreams like "backend + frontend + tests in parallel."
When not to use: Simple tasks don't need multi-agent. A single focused prompt beats orchestration overhead for straightforward changes. Reserve this for complex, multi-concern tasks.
Level 4 — Agent Architect

Claude Code SDK — Programmatic Access

Run Claude Code from your own scripts, CI pipelines, and applications.

What is it? The @anthropic-ai/claude-code npm package lets you invoke Claude Code programmatically from Node.js. Full agent capabilities in your scripts.
Basic usage:
import { claude } from "@anthropic-ai/claude-code";

const result = await claude({
  prompt: "Run tests and fix any failures",
  workingDirectory: "./my-project",
  allowedTools: ["Bash", "Read", "Write", "Edit"],
  model: "sonnet"
});
Use cases for your team: PR review bots, automated code migration scripts, nightly audit agents, deployment verification, documentation generation pipelines.
GitHub Actions integration:
# .github/workflows/claude-review.yml
- name: Claude Code Review
  uses: anthropics/claude-code-action@v1
  with:
    prompt: "Review this PR for bugs, security, and style"
    allowed_tools: "Read,Grep,Glob"
Streaming results: The SDK supports streaming for real-time feedback. Build internal dashboards that show Claude's progress on long-running tasks.
Level 4 — Agent Architect

CI/CD Integration

Put Claude to work in your deployment pipeline.

Automated PR reviews: Use claude-code-action in GitHub Actions. Every PR gets automatic code review comments — security checks, style issues, potential bugs.
Pre-merge verification:
claude -p "Verify this branch is ready to merge:
  1. All tests pass
  2. No TODO/FIXME markers
  3. OpenAPI spec matches implementation
  4. No console.log statements in production code"
  --allowedTools Bash,Read,Grep
Post-deploy smoke tests: After Claudia.js deploys your Lambda, have Claude verify the endpoints are responding correctly by hitting health checks and sample endpoints.
Changelog generation: claude -p "Generate a changelog from the commits since the last tag, grouped by feat/fix/chore" — automate your release notes.
Dependency auditing: Schedule weekly: claude -p "Run npm audit, analyse the vulnerabilities, and create a PR fixing any that can be auto-patched"
Security note: In CI, use --allowedTools to restrict what Claude can do. Never use --dangerously-skip-permissions on shared runners without careful scoping.
Level 4 — Agent Architect

Scheduled Tasks & Autonomous Agents

Set it and forget it — Claude working on a schedule.

Scheduled tasks: Use cron-style scheduling to run Claude tasks automatically. Daily test runs, weekly security audits, nightly dependency checks.
Examples:
# Every morning at 9am — pull latest, run tests, report failures
claude -p "Pull main, run full test suite, and if anything fails, create a GitHub issue with the details"

# Weekly on Monday — dependency audit
claude -p "Run npm audit and create a PR fixing critical vulnerabilities"

# Nightly — code quality report
claude -p "Analyse code quality metrics and post a summary to #engineering Slack"
Background agents: Long-running agents that monitor and respond. E.g., watch for new issues with a specific label and auto-triage them with code analysis.
Self-healing pipelines: "Monitor the CI pipeline. If a test fails on main, analyse the failure, create a fix, and open a PR." — Claude as your on-call bot.
Your team's starter kit: Start with: 1) Nightly test runner, 2) Weekly dependency audit, 3) Automated PR review on open. Build from there as you trust the output.
Level 4 — Agent Architect

Advanced Prompting Patterns

Level up how you communicate with Claude for better, faster results.

Constraint-first prompts: Lead with constraints: "Using only the existing OrderService methods, no new dependencies, and keeping backward compatibility — add bulk order creation to POST /orders"
Example-driven specification: "Add input validation. Here's the pattern from our user endpoint: [paste 5-line example]. Apply the same pattern to the /orders endpoint."
Negative examples: "Don't use try/catch for flow control — we use Result types. Don't import from /handlers/ in /services/. Don't use any from TypeScript."
Chain-of-thought for debugging: "Walk through the request lifecycle for POST /orders step by step. At each stage, check if the data could be null or malformed."
Role assignment: "Act as a senior backend engineer reviewing a junior's PR. Be thorough but constructive. Focus on security, performance, and maintainability."
Iterative refinement: Start broad, then narrow: "Outline the approach" → "Implement step 2" → "Add error handling to the catch block on line 45." Each step is focused and cheap.
Level 4 — Agent Architect

Team Rollout Strategy

How to get the whole team productive with Claude Code.

Week 1–2 (Everyone): Install Claude Code, run /init on each project. Learn: interactive mode, one-shot, /clear, /compact, /cost. The 2 experienced members pair with newcomers.
Week 3–4 (Daily habits): Adopt Claude for commits and PRs. Write the team CLAUDE.md together. Each sub-team adds their stack-specific section. Start tracking token usage.
Month 2 (Customise): Create 3–5 shared slash commands for repeated workflows. Set up 2–3 essential hooks (lint-on-save, test-after-edit). Install useful MCP servers.
Month 3 (Automate): Build team skills and sub-agents. Integrate Claude into CI/CD. Set up scheduled tasks. Create a team plugin for easy onboarding.
Ongoing: Monthly retro on Claude usage. Share prompts that worked well. Update CLAUDE.md as conventions evolve. Measure time saved.
Success metrics: Track: time-to-PR, review turnaround, test coverage trends, production bugs. If Claude is helping, these all improve.
QUICK REFERENCE

Cheatsheet — Keep This Handy

The most useful commands and shortcuts at a glance.

Install: Native: curl -fsSL https://claude.ai/install.sh | sh · Brew: brew install --cask claude-code · npm: npm i -g @anthropic-ai/claude-code
Invoke: Interactive: claude · One-shot: claude -p "..." · Pipe: cat file | claude -p "..." · Resume: claude --resume
Session control: /clear (reset) · /compact (summarise) · /cost (tokens) · /model (switch) · /effort (depth) · Shift+Tab (plan mode)
Git shortcuts: "commit with a good message" · "create a PR" · "review PR #N" · "fix the review comments on PR #N" · "why is CI failing?"
Config files: ~/.claude/CLAUDE.md (global) · ./CLAUDE.md (project) · .claude/settings.json (permissions/hooks) · .claude/commands/ · .claude/skills/
Custom commands: Create: .claude/commands/name.md · Use: /name arguments · Share: commit to repo
Hooks: SessionStart · PreToolUse · PostToolUse · Stop · Notification · PostCompact
Sub-agents: Create at .claude/agents/name.md · Automatic delegation by description match · Scoped tools and model per agent
RESOURCES

References & Learning Resources

Official docs, free courses, video tutorials, and community guides to deepen your Claude Code skills.

Official Docs — Start Here: code.claude.com/docs — The complete official documentation: overview, quickstart, how it works, configuration, hooks, skills, agents, CLI reference, and more.
Quickstart Guide: code.claude.com/docs/en/quickstart — Up and running in minutes. The official first-steps walkthrough.
Best Practices (Official): code.claude.com/docs/en/best-practices — Anthropic's own guide on effective prompting, context management, and scaling workflows.
Common Workflows (Tutorials): code.claude.com/docs/en/tutorials — Step-by-step walkthroughs: exploring codebases, fixing bugs, refactoring, writing tests, creating PRs, and managing sessions.
Hooks Reference: code.claude.com/docs/en/hooks — Full reference for SessionStart, PreToolUse, PostToolUse, Stop, Notification, PostCompact events and handler types.
CLI Reference: code.claude.com/docs/en/cli-reference — Every flag, environment variable, and invocation mode documented.
Free Course — Claude Code 101: anthropic.skilljar.com/claude-code-101 — Official free Anthropic Academy course. From installation to advanced customisation, with certificate on completion.
Free Course — Claude Code in Action: anthropic.skilljar.com/claude-code-in-action — Deeper official course: building, configuring, and sharing Skills. Also free with certificate.
Video — Anthropic's YouTube Channel: youtube.com/@anthropic-ai — Official Anthropic channel with product demos, workflow walkthroughs, and feature deep-dives.
Video — Anthropic Workflows: Even Anthropic Engineers Use This Claude Code Workflow — Real-world workflow patterns from the team that built Claude Code.
GitHub — Source & Community: github.com/anthropics/claude-code — Source, issue tracker, plugins, and community discussions. Also see awesome-claude-code for curated skills, hooks, and plugins.
Community — Best Practices Repo: shanraisshan/claude-code-best-practice — 20k+ stars. 84 compiled best practices covering prompting, CLAUDE.md, skills, and debugging. A great second opinion alongside official docs.

Start Small, Grow Fast

Level 1 today. Level 4 by the end of the quarter.
The best prompt is the one you don't have to type again.

code.claude.com/docs  ·  anthropic.skilljar.com  ·  github.com/anthropics/claude-code

reveal tip   hide tip   next slide   prev slide   F fullscreen