┌──────────────────────────────────────────────┐ │ Layer 6: Permissions (settings.local.json) │ What the agent CAN do ├──────────────────────────────────────────────┤ │ Layer 5: Plans (.claude/plans/*.md) │ What the agent IS doing ├──────────────────────────────────────────────┤ │ Layer 4: Auto Memory (memory/MEMORY.md) │ What the agent HAS learned ├──────────────────────────────────────────────┤ │ Layer 3: Skills (*.skill.md) │ HOW to do specific things ├──────────────────────────────────────────────┤ │ Layer 2: Agent Personas (*_Agent.md) │ WHO the agent is ├──────────────────────────────────────────────┤ │ Layer 1: CLAUDE.md (project instructions) │ The rules everyone follows └──────────────────────────────────────────────┘ CODE_BLOCK: ┌──────────────────────────────────────────────┐ │ Layer 6: Permissions (settings.local.json) │ What the agent CAN do ├──────────────────────────────────────────────┤ │ Layer 5: Plans (.claude/plans/*.md) │ What the agent IS doing ├──────────────────────────────────────────────┤ │ Layer 4: Auto Memory (memory/MEMORY.md) │ What the agent HAS learned ├──────────────────────────────────────────────┤ │ Layer 3: Skills (*.skill.md) │ HOW to do specific things ├──────────────────────────────────────────────┤ │ Layer 2: Agent Personas (*_Agent.md) │ WHO the agent is ├──────────────────────────────────────────────┤ │ Layer 1: CLAUDE.md (project instructions) │ The rules everyone follows └──────────────────────────────────────────────┘ CODE_BLOCK: ┌──────────────────────────────────────────────┐ │ Layer 6: Permissions (settings.local.json) │ What the agent CAN do ├──────────────────────────────────────────────┤ │ Layer 5: Plans (.claude/plans/*.md) │ What the agent IS doing ├──────────────────────────────────────────────┤ │ Layer 4: Auto Memory (memory/MEMORY.md) │ What the agent HAS learned ├──────────────────────────────────────────────┤ │ Layer 3: Skills (*.skill.md) │ HOW to do specific things ├──────────────────────────────────────────────┤ │ Layer 2: Agent Personas (*_Agent.md) │ WHO the agent is ├──────────────────────────────────────────────┤ │ Layer 1: CLAUDE.md (project instructions) │ The rules everyone follows └──────────────────────────────────────────────┘ COMMAND_BLOCK: ## TBT Law (Inviolable) 1. Be patient — 80% planning, 20% implementation 2. Do not be overeager — never try to impress by doing unrequested work 3. Always seek approval before implementing any plan 4. Never make changes without a plan — plan first, always 5. Do not rush the user — be patient, wait for direction 6. Do not make decisions or assumptions on the user's behalf 7. If unsure, ask — never guess or assume 8. If the plan isn't working, STOP — no workarounds 9. Rushing and over-eager changes will break code or design 10. If rules are violated, admit openly — do not hide mistakes COMMAND_BLOCK: ## TBT Law (Inviolable) 1. Be patient — 80% planning, 20% implementation 2. Do not be overeager — never try to impress by doing unrequested work 3. Always seek approval before implementing any plan 4. Never make changes without a plan — plan first, always 5. Do not rush the user — be patient, wait for direction 6. Do not make decisions or assumptions on the user's behalf 7. If unsure, ask — never guess or assume 8. If the plan isn't working, STOP — no workarounds 9. Rushing and over-eager changes will break code or design 10. If rules are violated, admit openly — do not hide mistakes COMMAND_BLOCK: ## TBT Law (Inviolable) 1. Be patient — 80% planning, 20% implementation 2. Do not be overeager — never try to impress by doing unrequested work 3. Always seek approval before implementing any plan 4. Never make changes without a plan — plan first, always 5. Do not rush the user — be patient, wait for direction 6. Do not make decisions or assumptions on the user's behalf 7. If unsure, ask — never guess or assume 8. If the plan isn't working, STOP — no workarounds 9. Rushing and over-eager changes will break code or design 10. If rules are violated, admit openly — do not hide mistakes COMMAND_BLOCK: # my-saas-landing
- Project Instructions ## Project Overview **Repository**: my-saas-landing **Purpose**: Marketing landing page
- Single-page scroll site **Stack**: React 18 + TypeScript + Vite ## Cross-App Navigation | Action | Target URL | |-------------------------|-------------------------------| | "Start Free Trial" | /app/onboarding | | "Buy" pricing button | /checkout?planId={id} | ## S3 Deployment Landing page files deploy to the root of my-web-public S3 bucket... COMMAND_BLOCK: # my-saas-landing
- Project Instructions ## Project Overview **Repository**: my-saas-landing **Purpose**: Marketing landing page
- Single-page scroll site **Stack**: React 18 + TypeScript + Vite ## Cross-App Navigation | Action | Target URL | |-------------------------|-------------------------------| | "Start Free Trial" | /app/onboarding | | "Buy" pricing button | /checkout?planId={id} | ## S3 Deployment Landing page files deploy to the root of my-web-public S3 bucket... COMMAND_BLOCK: # my-saas-landing
- Project Instructions ## Project Overview **Repository**: my-saas-landing **Purpose**: Marketing landing page
- Single-page scroll site **Stack**: React 18 + TypeScript + Vite ## Cross-App Navigation | Action | Target URL | |-------------------------|-------------------------------| | "Start Free Trial" | /app/onboarding | | "Buy" pricing button | /checkout?planId={id} | ## S3 Deployment Landing page files deploy to the root of my-web-public S3 bucket... COMMAND_BLOCK: # DevOps Engineer Agent ## Identity You are a Senior DevOps Engineer specialising in AWS infrastructure... ## Core Competencies
- CI/CD pipeline design (GitHub Actions)
- Infrastructure as Code (Terraform)
- Container orchestration (ECS, ECR)
- CloudFront distribution management ## Workflow 1. Assess current infrastructure state 2. Propose changes with risk assessment 3. Implement with rollback plan 4. Verify deployment 5. Document changes ## Constraints
- Never modify production without approval
- Always use Terraform for infrastructure changes
- Follow the AWS Well-Architected Framework COMMAND_BLOCK: # DevOps Engineer Agent ## Identity You are a Senior DevOps Engineer specialising in AWS infrastructure... ## Core Competencies
- CI/CD pipeline design (GitHub Actions)
- Infrastructure as Code (Terraform)
- Container orchestration (ECS, ECR)
- CloudFront distribution management ## Workflow 1. Assess current infrastructure state 2. Propose changes with risk assessment 3. Implement with rollback plan 4. Verify deployment 5. Document changes ## Constraints
- Never modify production without approval
- Always use Terraform for infrastructure changes
- Follow the AWS Well-Architected Framework COMMAND_BLOCK: # DevOps Engineer Agent ## Identity You are a Senior DevOps Engineer specialising in AWS infrastructure... ## Core Competencies
- CI/CD pipeline design (GitHub Actions)
- Infrastructure as Code (Terraform)
- Container orchestration (ECS, ECR)
- CloudFront distribution management ## Workflow 1. Assess current infrastructure state 2. Propose changes with risk assessment 3. Implement with rollback plan 4. Verify deployment 5. Document changes ## Constraints
- Never modify production without approval
- Always use Terraform for infrastructure changes
- Follow the AWS Well-Architected Framework COMMAND_BLOCK: # DynamoDB Single Table Design ## When to Apply Apply when a service has 3+ entity types with relational access patterns. ## Partition Key Strategy
- Use composite keys: {ENTITY_TYPE}#{ENTITY_ID}
- GSI1PK for inverted lookups
- GSI2PK for cross-entity queries ## Access Patterns | Pattern | PK | SK | Index | |---------|----|----|-------| | Get user by ID | USER#123 | METADATA | Table | | Get user's sites | USER#123 | SITE# | Table | | Get site by domain | DOMAIN#example.com | METADATA | GSI1 | COMMAND_BLOCK: # DynamoDB Single Table Design ## When to Apply Apply when a service has 3+ entity types with relational access patterns. ## Partition Key Strategy
- Use composite keys: {ENTITY_TYPE}#{ENTITY_ID}
- GSI1PK for inverted lookups
- GSI2PK for cross-entity queries ## Access Patterns | Pattern | PK | SK | Index | |---------|----|----|-------| | Get user by ID | USER#123 | METADATA | Table | | Get user's sites | USER#123 | SITE# | Table | | Get site by domain | DOMAIN#example.com | METADATA | GSI1 | COMMAND_BLOCK: # DynamoDB Single Table Design ## When to Apply Apply when a service has 3+ entity types with relational access patterns. ## Partition Key Strategy
- Use composite keys: {ENTITY_TYPE}#{ENTITY_ID}
- GSI1PK for inverted lookups
- GSI2PK for cross-entity queries ## Access Patterns | Pattern | PK | SK | Index | |---------|----|----|-------| | Get user by ID | USER#123 | METADATA | Table | | Get user's sites | USER#123 | SITE# | Table | | Get site by domain | DOMAIN#example.com | METADATA | GSI1 | COMMAND_BLOCK: ~/.claude/projects/{project-path}/memory/ ├── MEMORY.md # Always loaded (first 200 lines) ├── debugging.md # Detailed debugging notes ├── patterns.md # Confirmed patterns └── architecture.md # Architectural decisions COMMAND_BLOCK: ~/.claude/projects/{project-path}/memory/ ├── MEMORY.md # Always loaded (first 200 lines) ├── debugging.md # Detailed debugging notes ├── patterns.md # Confirmed patterns └── architecture.md # Architectural decisions COMMAND_BLOCK: ~/.claude/projects/{project-path}/memory/ ├── MEMORY.md # Always loaded (first 200 lines) ├── debugging.md # Detailed debugging notes ├── patterns.md # Confirmed patterns └── architecture.md # Architectural decisions COMMAND_BLOCK: ## Confirmed Patterns
- CloudFront Function handles SPA routing for all frontends
- S3 bucket serves all frontend apps from different prefixes
- Safe sync requires --exclude flags for other app prefixes
- Browser cache causes stale content after deployments (hard refresh needed) ## AWS SSO
- Profile name: dev
- Token expires frequently — run `aws sso login --profile dev` COMMAND_BLOCK: ## Confirmed Patterns
- CloudFront Function handles SPA routing for all frontends
- S3 bucket serves all frontend apps from different prefixes
- Safe sync requires --exclude flags for other app prefixes
- Browser cache causes stale content after deployments (hard refresh needed) ## AWS SSO
- Profile name: dev
- Token expires frequently — run `aws sso login --profile dev` COMMAND_BLOCK: ## Confirmed Patterns
- CloudFront Function handles SPA routing for all frontends
- S3 bucket serves all frontend apps from different prefixes
- Safe sync requires --exclude flags for other app prefixes
- Browser cache causes stale content after deployments (hard refresh needed) ## AWS SSO
- Profile name: dev
- Token expires frequently — run `aws sso login --profile dev` COMMAND_BLOCK: ~/.claude/plans/ ├── zazzy-puzzling-cloud.md # Frontend extraction plan ├── elegant-crunching-sunbeam.md # Security hardening rollout └── zazzy-percolating-lecun.md # CDN deployment plan COMMAND_BLOCK: ~/.claude/plans/ ├── zazzy-puzzling-cloud.md # Frontend extraction plan ├── elegant-crunching-sunbeam.md # Security hardening rollout └── zazzy-percolating-lecun.md # CDN deployment plan COMMAND_BLOCK: ~/.claude/plans/ ├── zazzy-puzzling-cloud.md # Frontend extraction plan ├── elegant-crunching-sunbeam.md # Security hardening rollout └── zazzy-percolating-lecun.md # CDN deployment plan COMMAND_BLOCK: # Plan: Extract Landing Page into Standalone Repo ## Context The landing page was prototyped inside the main app... ## Step 1: Scaffold New Repo Create directory structure at /path/to/new/repo... ## Step 2: Create Fresh Files - vite.config.ts — base: '/'
- App.tsx — no router, single-page scroll ## Step 3: Modify Copied Files
- Navigation.tsx — remove router dependency
- PricingPage.tsx — use window.location.href ## Verification 1. npm run dev → all sections render 2. npm run type-check → 0 errors 3. Images and assets load correctly COMMAND_BLOCK: # Plan: Extract Landing Page into Standalone Repo ## Context The landing page was prototyped inside the main app... ## Step 1: Scaffold New Repo Create directory structure at /path/to/new/repo... ## Step 2: Create Fresh Files - vite.config.ts — base: '/'
- App.tsx — no router, single-page scroll ## Step 3: Modify Copied Files
- Navigation.tsx — remove router dependency
- PricingPage.tsx — use window.location.href ## Verification 1. npm run dev → all sections render 2. npm run type-check → 0 errors 3. Images and assets load correctly COMMAND_BLOCK: # Plan: Extract Landing Page into Standalone Repo ## Context The landing page was prototyped inside the main app... ## Step 1: Scaffold New Repo Create directory structure at /path/to/new/repo... ## Step 2: Create Fresh Files - vite.config.ts — base: '/'
- App.tsx — no router, single-page scroll ## Step 3: Modify Copied Files
- Navigation.tsx — remove router dependency
- PricingPage.tsx — use window.location.href ## Verification 1. npm run dev → all sections render 2. npm run type-check → 0 errors 3. Images and assets load correctly CODE_BLOCK: { "permissions": { "allow": [ "Bash(git add *)", "Bash(git commit *)", "Bash(aws s3 sync *)", "Bash(aws cloudfront create-invalidation *)", "Bash(terraform plan *)", "Bash(pytest *)", "Bash(npm run build *)" ] } } CODE_BLOCK: { "permissions": { "allow": [ "Bash(git add *)", "Bash(git commit *)", "Bash(aws s3 sync *)", "Bash(aws cloudfront create-invalidation *)", "Bash(terraform plan *)", "Bash(pytest *)", "Bash(npm run build *)" ] } } CODE_BLOCK: { "permissions": { "allow": [ "Bash(git add *)", "Bash(git commit *)", "Bash(aws s3 sync *)", "Bash(aws cloudfront create-invalidation *)", "Bash(terraform plan *)", "Bash(pytest *)", "Bash(npm run build *)" ] } }
- Mandatory SDET Verification — every plan must be tested after execution
- Defect Management — every bug gets logged, reproduced, fixed, and verified
- Deployment-First Verification — no fix is considered testable until deployed
- Repository Isolation — every service gets its own repo
- AWS Resource Naming Conventions — DynamoDB tables use plain names, S3 buckets include environment suffixes
- DynamoDB_Single_Table.skill.md — Single-table design patterns, GSI strategies, access patterns
- HATEOAS_Relational_Design.skill.md — API design with hypermedia links
- Development_Best_Practices.skill.md — SOLID, TDD, BDD, DDD principles
- Monolith_Anti_Pattern_Validation.skill.md — Six anti-patterns (AP-1 through AP-6) to detect
- Step_Functions_Decision_Logic.skill.md — State machine patterns
- API_Proxy_Testing.skill.md — End-to-end testing patterns
- Save: Stable patterns confirmed across multiple sessions
- Save: Key architectural decisions and important file paths
- Save: Solutions to recurring problems
- Don't save: Session-specific context or temporary state
- Don't save: Speculative conclusions from reading a single file
- I open the project. Claude Code loads CLAUDE.md (Layer 1) — the agent knows the stack, deployment targets, and global rules.
- I say "load the DevOps Engineer." The agent reads the persona file (Layer 2) — it now thinks like a DevOps engineer with CI/CD expertise.
- The agent references existing knowledge. It checks auto memory (Layer 4) for deployment patterns — it already knows the S3 bucket name, CloudFront distribution ID, and safe sync exclusions.
- It creates a plan. The plan (Layer 5) outlines: build, sync to S3, invalidate CloudFront, verify. Per TBT Law, it waits for my approval.
- I approve. The agent executes within its permissions (Layer 6) — it can run npm run build and aws s3 sync, but it asks before running destructive commands.
- SDET verification triggers. Per the CLAUDE.md mandatory rule, the SDET persona activates to verify the deployment — checking asset integrity, page load, and console errors.
- The agent saves what it learned. If it encountered a new pattern (like a CloudFront cache behaviour), it writes it to auto memory for next time.
- Claude Code Documentation — Anthropic
- CLAUDE.md Best Practices — Anthropic
- Model Context Protocol (MCP) — Specification
- Claude Code CLI — GitHub