All articles
platform engineering ·

Component showcase

Every MDX component available in harnez posts — props, variants, and live examples.

componentsdesign-systemreference

Callout

Contextual callout boxes. type controls the colour: info (default), tip, warning, danger, note. label renders a distinct header row above the body.


CodeBlock

A syntax-highlighted code card with a header bar showing filename and language. Uses Shiki dual-theme so colours work in both dark and light mode.

example.ts typescript
interface Session {
  id: string;
  model: string;
  tokens: { in: number; out: number };
  checkpoints: Checkpoint[];
}

function totalTokens(session: Session): number {
  return session.tokens.in + session.tokens.out;
}
terminal bash
npx cc-session-viewer --roots ~/.claude --port 4000

MetaCard

Single metadata card or a responsive card grid. Pass label and value for one card, or items for the four-up overview used at the top of posts.

Model
claude-opus-4-7
Sessions
24
Tokens (total)
2.4M
Outcome
Shipped

MetricCard

Large-number callout for quantitative highlights. Pass value and label for a single card, or items for a responsive four-up grid.

3-5×
File reads vs. edits ratio
10×
Token cost on ambiguous tasks
60–80%
Cost reduction with cache hits
47
Tool calls in a single checkpoint

Stage

Unified stage cards for milestone sequences and additive rule stacks. Pass items and the component renders a vertical stack.

Milestone stack

Explore

Stage 1

Map the problem space. Read the existing code, understand the constraints, identify the unknowns.

Build

Stage 2

Implement a minimal version that covers the core path. Defer edge cases until the shape is right.

Validate

Stage 3

Run against real data. Measure, compare, and decide whether to ship or iterate.

Rule stack

Role + task

Stage 1

The minimal prompt: a one-line role anchoring the model, and a task defining what to extract.

<role>
You are a data extraction expert.
</role>

<task>
Extract reviewer and rating as CSV.
</task>

+ Format rules

Stage 2

Explicit format constraints prevent the model from inventing column names or wrapping output in markdown.

<format>
Return raw CSV only. No headers. No fences.
Columns: reviewer,rating
</format>

+ Edge cases

Stage 3

Explicit handling for null ratings, decimals, and boundary sentiments locks in consistent output.

<rules>
- Missing rating → empty string, not "N/A"
- Decimal ratings → preserve as-is (3.5, not 4)
- Sentiment: only "positive"/"negative"/"neutral"
</rules>

Table

Markdown tables in a bordered card with an optional caption header. Leave a blank line before and after the table inside the component.

Model comparison
ModelSpeedCostBest for
claude-haiku-4-5FastLowClassification, simple extraction
claude-sonnet-4-6BalancedMidMost coding tasks
claude-opus-4-7ThoroughHighComplex reasoning, large context

Matrix variant

Use variant="matrix" when the structure is a fixed validation grid rather than freeform markdown table content.

Final validation matrix
Check Task 1Task 2Task 3
Output format correct PASS PASS FAIL
Null ratings handled FAIL PASS PASS
No extra columns PASS WARN PASS
No markdown fences PASS PASS PASS
Decimal ratings preserved PASS PASS

TodoList

Ordered task list with optional detail and status per item. Status done shows a green checkmark, failed shows a red ×, default shows the step number.

Implementation checklist
  1. Define the content schema in Zod src/content.config.ts
  2. Create the MDX layout PostLayout.astro
  3. Wire up dynamic routing [slug].astro
  4. Add syntax highlighting Shiki dual-theme
  5. Write the first post Needs content

BeforeAfter

Side-by-side before/after comparison with named slots. beforeLabel and afterLabel default to Naive / Improved.

Without context
Fix the bug.
With context
The validateUser() function at src/auth/validate.ts:42
throws when email contains a + character. Fix it so
RFC 5321 addresses are accepted. Do not change the
function signature.

TwoCol

Two-column layout with named slots main and side. The side column is narrower and typically holds a figure, table, or supporting note.

Why prompts drift

Every iteration of a prompt is an implicit experiment. Without a fixed fixture to validate against, you can’t tell whether a change made things better or just different. The instinct is to keep the last version that felt good — but “felt good” isn’t reproducible.

A fixture anchors the experiment. It defines what correct looks like so every prompt change has a measurable outcome.

Iteration loop
StepOutput
Change prompt.system.md
Runoutput.txt
Validateresults.json
Analyzesuggestions.json

Takeaways

Highlighted insight cards with a coloured left border. tone controls the colour: accent, good, warn, purple, neutral.

accent — the default

Use for primary findings or the central argument of a section.

good — positive outcomes

Use for things that worked, improvements measured, or results worth highlighting.

warn — watch out

Use for tradeoffs, caveats, or patterns that look good but carry hidden costs.

purple — insight

Use for non-obvious observations, surprising findings, or model behaviour notes.

neutral — context

Use for background observations that support the argument without strong valence.


Timeline

Vertical log of iterations or events. status is pass, fail, model, fixture, info, or change.

v1

Baseline prompt — no format rules

Fail

Model wrapped output in markdown fences and added extra columns.

v2

Add explicit CSV format instruction

Fail

Fences gone, but model still normalised empty strings to 'N/A'.

v3

Switch to claude-opus-4-7

Model

Better instruction following. Zero-rating ambiguity resolved correctly.

v4

Lock down null handling explicitly

Pass

All 20 pages pass. Output is clean CSV with no post-processing needed.


Paged navigation for any component. Each direct child becomes one slide.


StepFlow

Horizontal numbered steps for a linear process. Each step has a label and detail.

1
Write
Author the prompt in .system.md
2
Run
Send all fixture pages through the model
3
Validate
Compare output against expected fixture
4
Analyze
Identify failure patterns
5
Refine
Update the prompt and repeat

ComparisonGrid

Multi-column comparison table with labelled rows. Columns define the headers; rows define the values per column.

Approach comparison

Format compliance

Prompt v1

0 / 20

Prompt v2

14 / 20

Prompt v3

20 / 20

Null handling

Prompt v1

Fails

Prompt v2

Partial

Prompt v3

Correct

Token cost (avg)

Prompt v1

420 out

Prompt v2

380 out

Prompt v3

310 out

Extra columns

Prompt v1

Yes

Prompt v2

No

Prompt v3

No


Iteration

A single pass/fail card for an experiment iteration. Usually rendered inside a loop or sequence. status is pass, fail, model, or fixture.

Prompt v2 — explicit null rules

Pass

Adding null → empty string to the format block eliminated all N/A substitutions. 20/20 pages pass the null check.

Prompt v1 — baseline

Fail

Model consistently substituted empty ratings with “N/A” and wrapped output in triple-backtick fences despite no instruction to do so.


Mermaid

Client-side Mermaid diagrams, re-rendered on theme change. Pass the diagram source as the code prop. Optional caption renders below the diagram.

Sequence diagram

Agent decision loop

Stage diagram

Prompt loop stages