Level 4 — Agent Architect

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

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

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

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.
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.

Resources:

code.claude.com/docs  ·  github.com/anthropics/claude-code  ·  /help inside any session

reveal tip   hide tip   next slide   prev slide   F fullscreen