skills/hike/SKILL.md
Display a rich explanation of the current conversation. Only use when explicitly called.
npx skillsauth add code-hike/hike hikeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write a narrative explaining what happened in this coding session.
Build a clear picture of what changed and why. Use whatever sources are available — pick the ones that fill in the gaps:
git diff, git status, git log. Essential when the conversation is thin or absent.By the end of this phase you should know:
Discard dead ends. Only the final state matters.
Look at all the files changed and think about the best order to present them. This is a teaching order, not the chronological order of the session.
<Walk> blocks when it helps — if a file has many changes or changes that serve different purposes, explain each group in a separate <Walk> placed where it fits in the narrative. Don't force everything into one block just because it's the same file.The goal is that at every point in the narrative, the reader already has the context they need for what comes next. If a file change depends on understanding another file's change, the dependency comes first.
The goal is to split each file's diff into multiple small steps that make the changes easy to follow. The UI animates transitions between steps, so the reader only needs to notice what changed — not re-read the whole block.
Go through the ordered files one at a time. For each file, think about how to break the diff into steps.
<Walk> blocks.<Walk> blocks instead.print:hidden, show className="... print:hidden" — don't include the full "fixed bottom-0 left-0 right-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur ..." string). Omit the className prop entirely when no class is relevant.!callout to every step. Callouts guide the reader's attention and help them parse the step faster. Carefully pick the most important line in the step to place the callout — it should point to the key change.!callout per step. If a step needs more than one callout, it's probably better to split into more steps.!mark-start and !mark-end. The callout target can be inside the range — that's fine. Marks are mandatory whenever a step mixes context code with new/changed code — they're the only way the reader knows what changed. Skip marks only when most lines in the step would be marked (marks add no signal in that case).!tooltip — supplementary info shown on demand.Each group of related changes gets one <Walk> block with a filename attribute (a file may have multiple <Walk> blocks if its changes are unrelated — see Phase 2). Inside it, each step is a code fence with "!!" in the metastring. Tooltip content goes in ## !id headings after the steps.
<Walk filename="app/api/mtime/route.ts">
```ts !!
// !tooltip[/force-dynamic/m] dynamic
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
const fileName = request.nextUrl.searchParams.get("file");
const filePath = getFilePath(fileName);
// !callout[/statSync/m] Read modified time from file system
const stat = fs.statSync(filePath);
return NextResponse.json({ mtime: stat.mtimeMs });
}
```
```ts !!
// !tooltip[/force-dynamic/m] dynamic
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
const fileName = request.nextUrl.searchParams.get("file");
// !mark-start
if (!fileName) {
// !callout[/NextResponse/m] Handle missing file
return NextResponse.json({ error: "Missing file" }, { status: 400 });
}
// !mark-end
const filePath = getFilePath(fileName);
const stat = fs.statSync(filePath);
return NextResponse.json({ mtime: stat.mtimeMs });
}
```
## !dynamic
Next.js caches route handlers by default; `force-dynamic` ensures every poll gets a fresh stat.
</Walk>
Annotation reference:
!callout[/regex/m] message — explains intent at a regex match. The m flag searches forward through the step to find the match.!tooltip[/regex/m] id — on-demand detail at a regex match.!mark-start / !mark-end — highlights all lines between the two markers (visual emphasis, no message).!diff - — marks the next line as removed (struck-through / red). Use when highlighting a deletion is important for the explanation.// !callout[/regex/m]{/* !callout[/regex/m] */}Every snippet must show all enclosing scopes up to the top-level declaration. Never show floating lines.
Bad — shows the inner function but not where it lives:
function handleDelete() {
// ...
}
Good — full nesting visible:
function UserCard() {
function handleDelete() {
// ...
}
// ...
}
Bad — floating JSX, no enclosing component:
<button onClick={handleDelete}>
<Trash2 className="size-4" />
</button>
Good — component scope visible:
function UserCard() {
return (
<div>
<button onClick={handleDelete}>
<Trash2 className="size-4" />
</button>
</div>
);
}
Use !mark-start before the first changed line and !mark-end after the last changed line to bracket contiguous ranges. For non-contiguous changes, use separate pairs.
Bad — no marks, changed lines buried in context:
export async function GET(request: NextRequest) {
const fileName = request.nextUrl.searchParams.get("file");
const filePath = getFilePath(fileName);
if (!fileName) {
return NextResponse.json({ error: "Missing param" }, { status: 400 });
}
const normalized = path.normalize(filePath);
// !callout[/startsWith/m] Prevent path traversal
if (!normalized.startsWith(BASE_DIR)) {
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
}
const stat = fs.statSync(filePath);
return NextResponse.json({ mtime: stat.mtimeMs });
}
Good — contiguous changed lines bracketed with !mark-start/!mark-end:
export async function GET(request: NextRequest) {
const fileName = request.nextUrl.searchParams.get("file");
const filePath = getFilePath(fileName);
// !mark-start
if (!fileName) {
return NextResponse.json({ error: "Missing param" }, { status: 400 });
}
const normalized = path.normalize(filePath);
// !callout[/startsWith/m] Prevent path traversal
if (!normalized.startsWith(BASE_DIR)) {
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
}
// !mark-end
const stat = fs.statSync(filePath);
return NextResponse.json({ mtime: stat.mtimeMs });
}
When trimming unimportant code, always use valid syntax. Use comments (// ...) to collapse lines. Never use bare ... as code — it's not valid in most languages and breaks JSX/TSX parsing.
Bad — bare ... is not valid syntax:
<text x={x} ...>x</text>
function foo(...) { }
Good — just omit unimportant props, no placeholder needed:
<text x={x}>x</text>
For function args or other expressions, use a comment:
function foo(/* ... */) {}
When collapsing multiple lines inside a block, use a single-line comment:
function UserCard() {
// ...
}
Annotation comments must use the comment syntax of the surrounding context AND appear in a valid position for that syntax.
Bad — // comments inside JSX:
function UserCard() {
// !mark-start
const name = "Alice";
return (
<div>
// !mark-end
<button onClick={handleClick}>Save</button>
</div>
);
}
Good — // in JS context, {/* */} in JSX context:
function UserCard() {
// !mark-start
const name = "Alice";
return (
<div>
{/* !mark-end */}
<button onClick={handleClick}>Save</button>
</div>
);
}
Bad — {/* */} between JSX element attributes (not a valid position):
<iframe
{/* !callout[/print:hidden/m] Hidden on print */}
className="... print:hidden"
/>
Good — annotation on its own line before the element:
{
/* !callout[/print:hidden/m] Hidden on print */
}
<iframe className="... print:hidden" />;
Note: {/* */} annotations are only valid as JSX children (inside an element's opening/closing tags), never between attributes, and never as bare expressions in ternary branches like condition ? ( {/* !mark-start */} <div>...</div> ) : .... Place them inside the nearest enclosing element instead.
After building all steps for a file, re-read each step and verify:
!callout? If not, add one.!mark-start/!mark-end? If not, add them. Only skip marks with good reason (e.g., most lines in the step are changed).!callout, !mark-start, !mark-end, !tooltip, !diff) using the correct comment syntax for their context (// in JS/TS, {/* */} in JSX) AND placed in valid positions? (No {/* */} between element attributes or as bare ternary expressions.)... as expressions, props, or arguments — use comments to collapse code instead.Fix any violations before moving to the next file.
<Walk>Now assemble the full MDX file. The <Walk> blocks are the backbone — the prose exists to connect and contextualize them.
Start with the problem statement: One sentence. What's broken or missing, where it shows up, why the change is needed. This comes before any code.
Then alternate between <Walk> and prose transitions:
<Walk> blocks (different files), add a short prose transition if the connection isn't obvious. State the intent ("now wire the limiter into the route") not the implementation details the reader is about to see.```mermaid) — but only if multiple actors or branches make prose hard to follow. For linear flows, prose is better.Prose style: Short sentences. Front-load the key point. Bold sparingly for scanning. Inline code as symbol. End with a colon when directly introducing a code block. Don't repeat what's visible in the snippet.
Comment syntax for annotations: TS/JS → // !callout[/regex/m], JSX → {/* !callout[/regex/m] */}. Annotations (!mark-start/!mark-end, !callout, !diff, !tooltip) only work inside <Walk>-managed code blocks. Outside them, use standard fenced code blocks with short prose.
Close with completeness: The final steps should show the complete working mechanism.
Add frontmatter at the top of the file. Get the current timestamp by running date +%Y-%m-%dT%H:%M:%S:
---
title: "Human-readable session title"
date: "YYYY-MM-DDTHH:MM:SS"
version: "<version from this skill's frontmatter>"
---
Check for missing context. Re-read the map and the narrative side by side. If there's any important information from the map that didn't make it into the narrative — a key decision, a tradeoff, a non-obvious reason for a change — find the right place and way to include it.
Important: do this as you work, not after. During Phases 1–4, whenever you're thinking through a decision — ordering files, splitting steps, deciding what to cut — write those thoughts down immediately in a scratch area. Don't wait until the end to reconstruct your reasoning; that produces rationalization, not the real process. Log when you transition between phases (e.g., "--- moving to Phase 3 ---") so the decision trail is easy to follow.
After the hike file is complete, append all of those raw notes to the end of the file inside a fenced code block so raw content doesn't break MDX parsing:
## Thought Process
````md
(raw notes here)
````
This should be unedited stream-of-consciousness — the messy real-time reasoning, not a clean retrospective. Include false starts, uncertainties, things you almost did differently. The goal is to preserve the actual decision trail so the author can later understand what really happened during generation.
Before writing, check for secrets. Scan the full output for API keys, tokens, passwords, credentials, or private URLs. Redact or omit any that appear.
Write to .hike/<descriptive-slug>.mdx. Derive the slug from session content (e.g., add-dark-mode-toggle.mdx, fix-auth-redirect-loop.mdx, refactor-api-client.mdx). Create .hike/ if it doesn't exist. If the file already exists, append -2, -3, etc. (e.g., add-dark-mode-toggle-2.mdx).
Skip this step in non-interactive mode (Claude Code's -p/--print flag) — there's no browser to open.
Otherwise, run npx @code-hike/hike@^<version> <filename> in the background to open a browser preview. <version> is the version from this skill's frontmatter, prefixed with ^ for compatible versions. Use run_in_background: true so the user can review at their own pace without blocking the conversation. Run the command in the user's current working directory (not inside .hike/).
npx @code-hike/hike@^<version> <slug>.mdx
testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".
testing
Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).
testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".
testing
Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).