@balanza/pi-codetour 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +5 -1
- package/skills/codetour/SKILL.md +96 -0
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ pi install npm:@balanza/pi-codetour
|
|
|
40
40
|
Or load it directly during development:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
pi --extension
|
|
43
|
+
pi --extension /path/to/pi-codetour/index.ts
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Then just ask the agent to explain part of the codebase. When it wants to show
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balanza/pi-codetour",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A pi extension that guides you through a codebase by driving an editor in a terminal split.",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"pi": {
|
|
12
12
|
"extensions": [
|
|
13
13
|
"./index.ts"
|
|
14
|
+
],
|
|
15
|
+
"skills": [
|
|
16
|
+
"./skills"
|
|
14
17
|
]
|
|
15
18
|
},
|
|
16
19
|
"repository": {
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
"files": [
|
|
25
28
|
"index.ts",
|
|
26
29
|
"src",
|
|
30
|
+
"skills",
|
|
27
31
|
"README.md",
|
|
28
32
|
"LICENSE"
|
|
29
33
|
],
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codetour
|
|
3
|
+
description: Compose an effective guided code tour with the `code_tour` tool — an ordered set of stops (file + line + explanation) rendered beside the chat in an editor pane. Use when the user asks for an onboarding walkthrough, a PR review narration, a trace of a workflow or call chain, a bug investigation, a blast-radius/impact analysis, or "where does X live / how does X work" in a codebase.
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Composing a code tour
|
|
9
|
+
|
|
10
|
+
The `code_tour` tool shows the user an ordered list of **stops** next to the
|
|
11
|
+
chat and drives an editor to each `file:line` as they move through it. The user
|
|
12
|
+
can already see the code. Your job is the narrative they can't see: why this
|
|
13
|
+
spot matters to *their* question, and why the stops are in this order.
|
|
14
|
+
|
|
15
|
+
A tour is not a file listing with prose attached. It is a **path through the
|
|
16
|
+
code that answers one question** — that question is the `title`.
|
|
17
|
+
|
|
18
|
+
## The backbone (applies to every tour)
|
|
19
|
+
|
|
20
|
+
1. **Nail the question first.** Derive the one question the tour answers from the
|
|
21
|
+
user's request and make it the `title`. If the request is genuinely
|
|
22
|
+
ambiguous (which subsystem? which workflow? forward or reverse?), ask before
|
|
23
|
+
building.
|
|
24
|
+
2. **Gather context before choosing stops.** Trace the *real* code — grep for
|
|
25
|
+
callers, read the handlers, follow where the data actually goes. Don't infer
|
|
26
|
+
structure from folder names. Pull the *why* from outside the repo when it
|
|
27
|
+
matters and the tools exist (see below).
|
|
28
|
+
3. **Verify every anchor.** Open each file and land `line` on the spot that
|
|
29
|
+
actually shows the thing — prefer a signature, a decision, or a call site
|
|
30
|
+
over an arbitrary body line. Stale `file:line` is the main way a tour fails.
|
|
31
|
+
4. **Order as a narrative, not as file order.** The sequence should read like an
|
|
32
|
+
explanation, each stop following from the last.
|
|
33
|
+
5. **Make each `detail` earn its place.** Tie the location back to the question —
|
|
34
|
+
"why this matters here" — rather than restating what the code literally does.
|
|
35
|
+
6. **Right-size and stay flexible.** A focused answer is usually a handful of
|
|
36
|
+
stops; a broad one is more. There is no required count, shape, or ordering —
|
|
37
|
+
these recipes are starting points to blend, not rules to obey. The initial
|
|
38
|
+
request wins.
|
|
39
|
+
|
|
40
|
+
## Use the tools and skills around you
|
|
41
|
+
|
|
42
|
+
Compose the tour with whatever helps you understand the code and its intent:
|
|
43
|
+
|
|
44
|
+
- **Local investigation** — grep / find-references / reading files to trace the
|
|
45
|
+
actual call edges, callers, and data flow.
|
|
46
|
+
- **History and intent, if available** — `git log` / `git blame`, GitHub
|
|
47
|
+
(PRs, linked issues), Notion / Linear (design docs, tickets) via their MCP
|
|
48
|
+
tools. The code says *what*; these say *why*. Use them when they're present;
|
|
49
|
+
skip gracefully when they're not.
|
|
50
|
+
- **Project skills, if present** — if the repository ships its own skills (e.g.
|
|
51
|
+
architecture guides, domain glossaries, review checklists), read and follow
|
|
52
|
+
them. They encode local conventions a generic tour would miss.
|
|
53
|
+
|
|
54
|
+
## Recipes
|
|
55
|
+
|
|
56
|
+
These are seeds to mix and match. Most real requests blend two or three. Pick
|
|
57
|
+
the flavor that fits the question, then adapt.
|
|
58
|
+
|
|
59
|
+
### Overview / onboarding — "help me get oriented"
|
|
60
|
+
Map the whole, breadth-first. Start at the real entry points (bin/`main`,
|
|
61
|
+
routes, the public surface in `index`, build config), then the core domain
|
|
62
|
+
model, then one representative end-to-end path, then the extension points.
|
|
63
|
+
Aim for a working mental model; resist diving deep on any single branch. A good
|
|
64
|
+
place to lean on a README or architecture doc.
|
|
65
|
+
|
|
66
|
+
### PR review — "explain how these changes serve the intent"
|
|
67
|
+
Seed from the diff. **Order stops by intent, not by file**: open on the stop
|
|
68
|
+
that states the goal, then the load-bearing change, then the supporting changes,
|
|
69
|
+
then tests as evidence. Each `detail` answers "how does this hunk serve the
|
|
70
|
+
stated intent?" Pull the PR description and linked issue so you can name that
|
|
71
|
+
intent — and call out any change that *doesn't* obviously map to it.
|
|
72
|
+
|
|
73
|
+
### Workflow — "trace this from one end to the other"
|
|
74
|
+
Seed from an entry point and the end state. Follow the forward call chain across
|
|
75
|
+
module boundaries; each stop is one hop — a call site or its handler — and the
|
|
76
|
+
`detail` says what gets transformed here and what's passed on. Confirm each next
|
|
77
|
+
hop by reading the code, not by guessing from names.
|
|
78
|
+
|
|
79
|
+
### Bug — "walk the chain, but focus on what breaks"
|
|
80
|
+
Same spine as a workflow, but every stop earns its place by its relation to the
|
|
81
|
+
fault: where bad input enters, where an assumption is made, where it actually
|
|
82
|
+
breaks, and where a fix would go. Seed from a symptom, a repro, or a stack
|
|
83
|
+
trace. The `detail` emphasizes invariants and where they're violated.
|
|
84
|
+
|
|
85
|
+
### Blast radius — "what else does changing X affect"
|
|
86
|
+
The reverse direction. Seed from the symbol or signature that would change, then
|
|
87
|
+
walk its dependents: callers, shared types, serialization or API boundaries,
|
|
88
|
+
config and feature flags, and the tests that pin current behavior. Each `detail`
|
|
89
|
+
says what breaks here if X changes, and how. This leans hardest on
|
|
90
|
+
find-references / grep.
|
|
91
|
+
|
|
92
|
+
### Concept — "where does X live / how does X work"
|
|
93
|
+
A cross-cutting concern (auth, caching, logging, a specific feature) rather than
|
|
94
|
+
a whole system. Blend breadth and depth: locate where the concept is defined,
|
|
95
|
+
then the few places it's wired in or enforced, then one path that exercises it.
|
|
96
|
+
The `detail` connects each scattered location back to the single concept.
|