Skip to content

Commit aef3c2d

Browse files
ofriwclaude
andcommitted
Add ThreeContextWorkflow visual component
New visualization for lesson 8 showing independent context separation pattern. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 858f974 commit aef3c2d

File tree

4 files changed

+365
-3
lines changed

4 files changed

+365
-3
lines changed

website/docs/practical-techniques/lesson-8-tests-as-guardrails.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_label: 'Lesson 8: Tests as Guardrails'
44
title: 'Lesson 8: Tests as Guardrails'
55
---
66

7+
import ThreeContextWorkflow from '@site/src/components/VisualElements/ThreeContextWorkflow';
8+
79
AI agents can refactor half your codebase in minutes. They'll rename functions, restructure modules, and update dozens of files—all while you grab coffee. This velocity is powerful, but dangerous. Small logic errors compound fast when changes happen at scale.
810

911
Tests are your constraint system. They define operational boundaries agents cannot cross. More importantly, they're living documentation that agents read to understand intent, edge cases, and the gotchas that tribal knowledge usually covers.
@@ -52,7 +54,9 @@ When tests become the optimization target, agents optimize for passing tests rat
5254

5355
Apply the same planning and execution methodology from [Lesson 7](./lesson-7-planning-execution.md) to each step—writing code, writing tests, and triaging failures. Each follows the same pattern: research requirements, plan approach, execute, verify. The critical difference: use **fresh contexts** for each step. This leverages the stateless nature from [Lessons 1](../understanding-the-tools/lesson-1-intro.md) and [2](../understanding-the-tools/lesson-2-understanding-agents.md)—the agent doesn't carry assumptions or defend prior decisions between contexts.
5456

55-
**The three-context workflow:**
57+
## The three-context workflow:
58+
59+
<ThreeContextWorkflow />
5660

5761
1. **Write code** in Context A—research existing patterns using [grounding from Lesson 5](../methodology/lesson-5-grounding.md), plan implementation, execute, verify correctness
5862
2. **Write tests** in fresh Context B—research requirements and edge cases, plan test coverage, execute (agent doesn't remember writing implementation, so tests derive independently from requirements), verify tests fail initially
@@ -177,7 +181,7 @@ When tests fail, apply the same four-phase workflow from [Lesson 3](../methodolo
177181

178182
This diagnostic prompt applies techniques from [Lesson 4](../methodology/lesson-4-prompting-101.md): [Chain-of-Thought](../methodology/lesson-4-prompting-101.md#chain-of-thought-paving-a-clear-path) sequential steps, [constraints](../methodology/lesson-4-prompting-101.md#constraints-as-guardrails) requiring evidence, and [structured format](../methodology/lesson-4-prompting-101.md#applying-structure-to-prompts). Understanding why each element exists lets you adapt this pattern for other diagnostic tasks.
179183

180-
``````markdown title="Diagnostic Prompt for Test Failures"
184+
````markdown title="Diagnostic Prompt for Test Failures"
181185
```
182186
$FAILURE_DESCRIPTION
183187
```
@@ -195,7 +199,7 @@ DETERMINE:
195199
Is this a test that needs updating or a real bug in the implementation?
196200

197201
Provide your conclusion with evidence.
198-
``````
202+
````
199203

200204
**Why this works:**
201205

website/src/components/PresentationMode/RevealSlideshow.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import styles from './RevealSlideshow.module.css';
1818
import CapabilityMatrix from '../VisualElements/CapabilityMatrix';
1919
import UShapeAttentionCurve from '../VisualElements/UShapeAttentionCurve';
2020
import WorkflowCircle from '../VisualElements/WorkflowCircle';
21+
import ThreeContextWorkflow from '../VisualElements/ThreeContextWorkflow';
2122
import GroundingComparison from '../VisualElements/GroundingComparison';
2223
import ContextWindowMeter from '../VisualElements/ContextWindowMeter';
2324
import AbstractShapesVisualization from '../VisualElements/AbstractShapesVisualization';
@@ -85,6 +86,7 @@ const VISUAL_COMPONENTS = {
8586
CapabilityMatrix,
8687
UShapeAttentionCurve,
8788
WorkflowCircle,
89+
ThreeContextWorkflow,
8890
GroundingComparison,
8991
ContextWindowMeter,
9092
AbstractShapesVisualization,
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/* Container Styles */
2+
.container {
3+
margin: 2rem 0;
4+
padding: 1.5rem 0;
5+
}
6+
7+
/* Compact mode for presentations - maximize content area */
8+
.container.compact {
9+
margin: 0 auto;
10+
padding: 0;
11+
max-width: 100%;
12+
}
13+
14+
/* SVG Sizing */
15+
.svg {
16+
width: 100%;
17+
height: auto;
18+
display: block;
19+
margin: 0 auto;
20+
}
21+
22+
/* Context Box Animations */
23+
@keyframes fadeInSlide {
24+
from {
25+
opacity: 0;
26+
transform: translateY(10px);
27+
}
28+
to {
29+
opacity: 1;
30+
transform: translateY(0);
31+
}
32+
}
33+
34+
.contextGroup {
35+
animation: fadeInSlide 0.6s ease-out forwards;
36+
opacity: 0;
37+
}
38+
39+
/* Reduce motion for accessibility */
40+
@media (prefers-reduced-motion: reduce) {
41+
.contextGroup {
42+
animation: none;
43+
opacity: 1;
44+
}
45+
}
46+
47+
/* Context Boxes */
48+
.contextBox {
49+
fill: var(--visual-bg-workflow);
50+
stroke: var(--visual-workflow);
51+
stroke-width: 3;
52+
transition: all 0.3s ease;
53+
}
54+
55+
.contextBox:hover {
56+
fill: var(--visual-bg-decision);
57+
stroke: var(--visual-decision);
58+
}
59+
60+
/* Text Styles */
61+
.contextTitle {
62+
fill: var(--ifm-color-emphasis-700);
63+
font-size: 28px;
64+
font-weight: 600;
65+
font-family: var(--ifm-font-family-base);
66+
}
67+
68+
.contextLabel {
69+
fill: var(--ifm-font-color-base);
70+
font-size: 44px;
71+
font-weight: 700;
72+
font-family: var(--ifm-font-family-base);
73+
}
74+
75+
.contextDescription {
76+
fill: var(--ifm-color-emphasis-600);
77+
font-size: 22px;
78+
font-family: var(--ifm-font-family-base);
79+
}
80+
81+
/* Arrows */
82+
.arrow {
83+
stroke: var(--visual-workflow);
84+
stroke-width: 4;
85+
fill: none;
86+
}
87+
88+
.arrowMarker {
89+
fill: var(--visual-workflow);
90+
}
91+
92+
/* Separation Barriers */
93+
.barrier {
94+
stroke: var(--visual-decision);
95+
stroke-width: 2;
96+
opacity: 0.3;
97+
}
98+
99+
/* Description Text */
100+
.description {
101+
margin-top: 1rem;
102+
padding-top: 1rem;
103+
border-top: 1px solid var(--ifm-color-emphasis-200);
104+
font-size: 0.9rem;
105+
color: var(--ifm-color-emphasis-700);
106+
text-align: center;
107+
line-height: 1.5;
108+
}
109+
110+
/* Presentation Mode Adjustments */
111+
.container.compact .svg {
112+
max-width: 100%;
113+
}
114+
115+
.container.compact .contextTitle {
116+
font-size: 32px;
117+
}
118+
119+
.container.compact .contextLabel {
120+
font-size: 52px;
121+
}
122+
123+
/* Responsive Design */
124+
@media (max-width: 768px) {
125+
.container {
126+
padding: 1rem 0;
127+
}
128+
129+
.contextTitle {
130+
font-size: 16px;
131+
}
132+
133+
.contextLabel {
134+
font-size: 24px;
135+
}
136+
137+
.contextDescription {
138+
font-size: 14px;
139+
}
140+
}
141+
142+
/* Dark mode specific adjustments for presentations */
143+
:global(.reveal) .contextBox {
144+
fill: rgba(167, 139, 250, 0.2);
145+
stroke: #a78bfa;
146+
stroke-width: 3;
147+
}
148+
149+
:global(.reveal) .arrow {
150+
stroke: #a78bfa;
151+
stroke-width: 5;
152+
}
153+
154+
:global(.reveal) .arrowMarker {
155+
fill: #a78bfa;
156+
}
157+
158+
:global(.reveal) .barrier {
159+
stroke: #c4b5fd;
160+
opacity: 0.4;
161+
}
162+
163+
:global(.reveal) .contextTitle,
164+
:global(.reveal) .contextLabel,
165+
:global(.reveal) .contextDescription {
166+
fill: #e5e7eb;
167+
}

0 commit comments

Comments
 (0)