SLOPSHOPPER

skill-map

Pane showing which skills are loaded into the main conversation, how big they are, and where in the context window they landed

panebandguardcommandprompttimer
v0.3.1no licenseupdated 2026-10-22vuon9/cc-mods/plugins/skill-map
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · skill-map
│ ┃ Skills ✕ › fix the failing auth test and add an audit log call │ ┃ █████████████████████████░░░░░░░░░░░░░░░░░░░ │ ┃ ■ <2 ■ 2-6 ■ 6k+ ⏺ Read(src/auth.ts) │ ┃ ⎿ Read 6 lines │ ┃ No skills yet. ⏺ Update(src/auth.ts) │ ⎿ Added 2 lines, removed 1 line │ ⏺ Bash(bun test) │ ⎿ 3 pass, 1 fail │ │ ● Done. refresh now rejects expired claims and logs an audit event. │ │ ✻ Worked for 42s · done 4:20 PM │ │ › /skill-map │ ⎿ skill-map: Skill map opened. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · Skills
█████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░ 49% ■ <2 ■ 2-6 ■ 6k+ No skills yet.
README

skill-map

skill-map pane with six skills, one reloaded and three greyed out after a compaction

<sub>Drawn by the mod from sample data.</sub>

A side pane listing every skill loaded into the main conversation, each with its size, reload count, context positions and turn. When a line can't hold all of that, the details move to the line under the name:

■ vmode [+1]               ■ vmode [+1] 2.3k 4→61% t1
  2.3k 4→61% t1            ■ apple-design 5.6k 9% t3
■ apple-design
  5.6k 9% t3
  • The square's color is the skill's size: green under 2k tokens, amber 2k to 6k, red 6k and up. Tokens are estimated as characters / 4.
  • [+1] counts loads that added the skill's text again. Typing /name twice does that. Claude Code skips a repeat Skill tool load by itself, so those don't count.
  • 4→61% is how full the context window was at the first and the latest load. t1 is the turn of the latest load.
  • After a compaction, a skill whose text was summarized away turns grey and crossed out.
  • The bar on top is the context window, filled to current usage, with a marker where each skill landed.

/skill-map opens or closes the pane. /skill-map reset clears it. The pane opens by itself on the first skill load. In fullscreen it is a sidebar only: it docks beside the transcript from 110 columns, and on a narrower terminal it waits, undrawn, until the terminal is wide enough. On the main screen, which has no dock, it sits above the prompt at 17 columns. Docked, it opens 17 columns wide (about 145px), puts the details under each name and cuts long names with …; drag the dock wider and each skill fits on one line. On the terminal the pane leaves its rightmost column empty, so text doesn't run into the dock's edge. A width you drag to is kept in ~/.claude.json as pluginPanes.dockColumns and wins over the 17.

The pane's ✕, or /skill-map minimize, minimizes it to a [+] skills 8 · 29% chip on the row above the prompt; click the chip to bring the pane back. While minimized, new skill loads update the chip instead of reopening the pane. /skill-map still closes it for good. Mods that draw on that row take turns in the order they load, and the first one wins the row, so load skill-map before them (CLAUDE_CODE_PLUGIN_DIRS=~/.claude/mods/skill-map:~/.claude/mods/token-weather) or its chip won't show.

Only the main conversation counts. Skills a subagent loads stay in the subagent's context and are left out.

Install

claude plugin marketplace add vuon9/cc-mods
claude plugin install skill-map@cc-mods

Update with claude plugin update skill-map.

Limits

  • Skill loads are spotted by the line Base directory for this skill: ... that Claude Code puts at the top of each one. If a release rewords it, the pane stops picking skills up.
  • Reading a SKILL.md counts only as a whole file: the Read tool without a line range, or a plain cat. head, grep and piped reads don't.
  • Built and tested on Claude Code 2.1.288 to 2.1.292.

Develop

From the repo root:

claude --plugin-dir plugins/skill-map
claude plugin test plugins/skill-map
Source 2 files
hooks/register.tsx 245 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register, SessionMessage } from 'claude-code'
3
4import type { SkillLoad } from '../types'
5
6const PANE = 'skill-map'
7// The dock adds 2 cells, so 19 at a ~7.6px cell stays under a 150px cap.
8const COLUMNS = 17
9// Fullscreen docks a pane beside the transcript from this width.
10const DOCK_FROM = 110
11const loads = atom({ plugin: 'skill-map', key: 'loads' } as const, [])
12const used = atom({ plugin: 'skill-map', key: 'used' } as const, 0)
13const turn = atom({ plugin: 'skill-map', key: 'turn' } as const, 0)
14const minimized = atom({ plugin: 'skill-map', key: 'minimized' } as const, false)
15
16const SMALL_MAX = 2000
17const MEDIUM_MAX = 6000
18const TIER_COLOR = { small: '#4caf50', medium: '#e0a030', large: '#e05050' }
19
20type Tier = keyof typeof TIER_COLOR
21
22const tierOf = (tokens: number): Tier =>
23  tokens < SMALL_MAX ? 'small' : tokens < MEDIUM_MAX ? 'medium' : 'large'
24
25const estimate = (text: string) => Math.ceil(text.length / 4)
26const kilo = (tokens: number) => `${(tokens / 1000).toFixed(1)}k`
27
28const stats = (one: SkillLoad) =>
29  `${kilo(one.tokens)} ${one.reloads > 0 ? `${one.firstPercent}→${one.lastPercent}%` : `${one.lastPercent}%`} t${one.turn}`
30
31const reloadTag = (one: SkillLoad) => (one.reloads > 0 ? ` [+${one.reloads}]` : '')
32
33const blockText = (block: { type: string; [field: string]: unknown }): string => {
34  if (block.type === 'text') return String(block.text)
35  if (block.type !== 'tool_result') return ''
36  if (typeof block.content === 'string') return block.content
37  return Array.isArray(block.content) ? block.content.map(blockText).join('\n') : ''
38}
39
40// Only whole-file reads count: `head`, `wc`, `grep` or a piped `cat` would log a skill that never entered context.
41const WHOLE_CAT = /(?:^|[;&]\s*)cat\s+(['"]?)(\S+\/SKILL\.md)\1\s*(?:$|[;&])/
42
43const skillFile = (e: { tool: string; [field: string]: unknown }): string | undefined => {
44  if (e.tool === 'Read' && e.offset === undefined && e.limit === undefined && String(e.file_path).endsWith('/SKILL.md')) {
45    return String(e.file_path)
46  }
47  if (e.tool === 'Bash') return WHOLE_CAT.exec(String(e.command))?.[2]
48  return undefined
49}
50
51// Every skill load, typed or through the Skill tool, lands as a meta row with this header; skill.prompt does not fire for typed skills on every build.
52const SKILL_ROW = /^Base directory for this skill: (.+)\n/
53
54const KEPT_SKILL = /^(?:Base directory for this skill: .*\/([^/\n]+)|name: ([\w:-]+))$/gm
55
56export const skillsIn = (messages: readonly SessionMessage[]) =>
57  new Set(
58    messages
59      .flatMap(one => [one.text, ...(one.toolResults ?? []).map(result => result.text)])
60      .flatMap(text => [...text.matchAll(KEPT_SKILL)].map(match => match[1] ?? match[2])),
61  )
62
63export const skillOfRow = (text: string) => {
64  const dir = SKILL_ROW.exec(text)?.[1]
65  return dir === undefined ? undefined : { skill: dir.split('/').at(-1) ?? dir, tokens: estimate(text) }
66}
67
68async function isPaneUp($: EngineInterface) {
69  return (await $.ui.panes()).some(pane => pane.id === PANE)
70}
71
72const open = ($: EngineInterface) => $.ui.open({ id: PANE, title: 'Skills', columns: COLUMNS })
73
74async function expand($: EngineInterface) {
75  await update($, minimized, () => false)
76  await open($)
77}
78
79async function record($: EngineInterface, skill: string, tokens: number) {
80  const { context } = await $.session.usage()
81  const percent = context.percent ?? 0
82  const now = await read($, turn)
83  await update($, loads, list => {
84    const old = list.find(one => one.skill === skill)
85    const entry: SkillLoad = {
86      skill,
87      tokens,
88      firstPercent: old?.firstPercent ?? percent,
89      lastPercent: percent,
90      turn: now,
91      reloads: old === undefined ? 0 : old.reloads + 1,
92      isCompacted: false,
93    }
94    return old === undefined ? [...list, entry] : list.map(one => (one === old ? entry : one))
95  })
96  if (!(await read($, minimized)) && !(await isPaneUp($))) void open($)
97}
98
99export const register: Register = on => {
100  on('session.start', async ($, e, next) => {
101    await $.command.register({
102      name: 'skill-map',
103      description: 'Toggle the pane of skills loaded into this conversation; `/skill-map minimize` folds it above the prompt, `/skill-map reset` clears it',
104    })
105    return next(e)
106  })
107
108  on('command.run', { command: 'skill-map' }, async ($, e) => {
109    if (e.args.trim() === 'reset') {
110      await update($, loads, () => [])
111      return { text: 'Skill map cleared.' }
112    }
113    if (e.args.trim() === 'minimize') {
114      await update($, minimized, () => true)
115      await $.ui.close({ id: PANE })
116      return { text: 'Skill map minimized to [+] above the prompt.' }
117    }
118    const wasOpen = await isPaneUp($)
119    await update($, minimized, () => false)
120    if (wasOpen) await $.ui.close({ id: PANE })
121    else await open($)
122    if (wasOpen) return { text: 'Skill map closed.' }
123    const isNarrow = e.presentation.isFullscreen && e.presentation.columns < DOCK_FROM
124    return { text: isNarrow ? `Skill map shows beside the transcript once the terminal is ${DOCK_FROM} columns wide.` : 'Skill map opened.' }
125  })
126
127  // The ✕ is the engine's; a person's close minimizes to the band, `/skill-map` closes for good.
128  on('ui.close', { id: PANE }, async ($, e, next) => {
129    const result = await next(e)
130    if (e.origin.kind === 'person') await update($, minimized, () => true)
131    return result
132  })
133
134  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
135    if (e.props.hasSurvey || !(await read($, minimized))) return next(e)
136    const { Box, Button, Text } = $.ui.resolve(e)
137    const list = await read($, loads)
138    const fill = await read($, used)
139    return (
140      <Box>
141        {await next(e)}
142        <Box marginLeft={2}>
143          <Button plain key="skill-map-expand" onPress={() => expand($)}>
144            [+] <Text dimColor>skills {list.length} · {fill}%</Text>
145          </Button>
146        </Box>
147      </Box>
148    )
149  })
150
151  on('prompt.submit', async ($, e, next) => {
152    await update($, turn, n => n + 1)
153    return next(e)
154  }).catch(($, e, next) => next(e))
155
156  on('session.measure', async ($, e, next) => {
157    await update($, used, () => e.context.percent ?? 0)
158    return next(e)
159  })
160
161  on('session.append', async ($, e, next) => {
162    if (e.agentId !== undefined) return next(e)
163    const loaded = e.message.isMeta ? skillOfRow(e.message.content.map(blockText).join('\n')) : undefined
164    if (loaded !== undefined) await record($, loaded.skill, loaded.tokens)
165    return next(e)
166  }).catch(($, e, next) => next(e))
167
168  on('session.compact', async ($, e, next) => {
169    const result = await next(e)
170    if (e.agentId !== undefined || e.trigger === 'precompute' || result.skip !== undefined) return result
171    const kept = skillsIn(result.messages)
172    await update($, loads, list => list.map(one => ({ ...one, isCompacted: !kept.has(one.skill) })))
173    return result
174  }).catch(($, e, next) => next(e))
175
176  on('tool.call', async ($, e, next) => {
177    const path = e.agentId === undefined ? skillFile(e) : undefined
178    if (path === undefined) return next(e)
179    const ran = await next(e)
180    if (ran.deny === undefined && !ran.isError && ran.text) {
181      await record($, path.split('/').at(-2) ?? path, estimate(ran.text))
182    }
183    return ran
184  }).catch(($, e, next) => next(e))
185
186  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
187    const { Box, Text } = $.ui.resolve(e)
188    // A sidebar only: seated inline over a narrow fullscreen terminal, reopen it from a timer. That open is
189    // unasked, so the engine holds the pane undrawn until the terminal is wide enough to dock it again.
190    if (e.props.placement === 'inline' && e.viewport?.isFullscreen === true) {
191      $.clock.after(0, () => void $.ui.close({ id: PANE }).then(() => open($)))
192      return <Box />
193    }
194    const list = await read($, loads)
195    const fill = await read($, used)
196    // Docked, fill the dock so dragging it wider shows long names whole; inline spans the terminal, so stay narrow.
197    const width = e.props.placement === 'dock' ? e.props.bodyColumns : Math.min(COLUMNS, e.viewport?.columns ?? COLUMNS)
198    // The terminal draws text right up to the dock's edge; one cell keeps it off.
199    const padding = e.surface === 'terminal' ? 1 : 0
200    const inner = width - padding
201    const barWidth = inner - 5
202    const cells = Array.from({ length: barWidth }, (_, i) => {
203      const at = list.findLast(one => Math.min(barWidth - 1, Math.floor((one.lastPercent / 100) * barWidth)) === i)
204      if (at !== undefined) return { glyph: '▮', color: TIER_COLOR[tierOf(at.tokens)] }
205      return { glyph: i < Math.round((fill / 100) * barWidth) ? '█' : '░', color: undefined }
206    })
207
208    return (
209      <Box flexDirection="column" width={width} paddingRight={padding}>
210        <Text>
211          {cells.map(cell => (
212            <Text color={cell.color} dimColor={cell.color === undefined}>
213              {cell.glyph}
214            </Text>
215          ))}
216          <Text dimColor> {fill}%</Text>
217        </Text>
218        <Text dimColor>
219          <Text color={TIER_COLOR.small}>■ </Text>&lt;2 <Text color={TIER_COLOR.medium}>■ </Text>2-6{' '}
220          <Text color={TIER_COLOR.large}>■ </Text>6k+
221        </Text>
222        <Text> </Text>
223        {list.length === 0 && <Text dimColor>No skills yet.</Text>}
224        {list.map(one => {
225          const isOneLine = `■ ${one.skill}${reloadTag(one)} ${stats(one)}`.length <= inner
226          return (
227            <Box key={`skill-${one.skill}`} flexDirection={isOneLine ? 'row' : 'column'} width={inner}>
228              <Box flexGrow={1} flexShrink={1}>
229                <Text dimColor={one.isCompacted} strikethrough={one.isCompacted} wrap="truncate-end">
230                  <Text color={TIER_COLOR[tierOf(one.tokens)]}>■ </Text>
231                  {one.skill}
232                  {one.reloads > 0 && <Text bold>{reloadTag(one)}</Text>}
233                </Text>
234              </Box>
235              <Box flexShrink={0} paddingLeft={isOneLine ? 0 : 1}>
236                <Text dimColor> {stats(one)}</Text>
237              </Box>
238            </Box>
239          )
240        })}
241      </Box>
242    )
243  })
244}
245
types/index.d.ts 16 lines
1export type SkillLoad = {
2  skill: string
3  tokens: number
4  firstPercent: number
5  lastPercent: number
6  turn: number
7  reloads: number
8  isCompacted: boolean
9}
10
11declare module 'claude-code' {
12  interface PluginState {
13    'skill-map': { loads: SkillLoad[]; used: number; turn: number; minimized: boolean }
14  }
15}
16