Save reusable prompts and put one into the composer as a draft.

Save reusable prompts and put one into the composer as a draft.
Use it when: Reuse a review or debugging prompt without auto-submitting it.

Screenshot of this mod's render tree in the fixture preview, with sample data. This is not a capture of the Claude Code application. How previews are made.
claude plugin marketplace add whyashthakker/awesome-claude-code-mods
claude plugin install prompt-shelf@awesome-claude-code-mods
Run /reload-plugins in an existing session, then /prompt-shelf. Use Tab and Enter to operate controls; Esc closes the pane. Terminal and Desktop Code tab supported; pane UI is unavailable in claude -p and the VS Code chat panel.
Try the source without installing:
claude --plugin-dir ./mods/prompt-shelf
Example: open /prompt-shelf and enter Review this patch for accessibility and edge cases in its input.
Stores user-entered items in this plugin’s local store, partitioned by workspace path. Each item has a separate key. No file writes or network. Fills a draft in the composer on button press; does not submit a prompt.
Module variables reset on hot reload. Workspace collections persist in Claude Code's local plugin store and reload when reopened. Deleting an item removes only that item's store key. Collections show the latest 100 items; concurrent changes to the same item use last-write-wins behavior. All display output is bounded; viewers may truncate long content to 9,000 characters. Relative file paths and Git commands use the session working directory.
Tested with Claude Code 2.1.288. Minimum documented mods version: 2.1.287. The API can change; validate against your installed version.
claude plugin validate mods/prompt-shelf --strict
claude plugin test mods/prompt-shelf
Tests cover plugin commands, pane isolation, both UI surfaces, and the behavior described in tests/register.test.ts. Drawing tests validate element trees; they do not verify pixels painted by the native apps. Validation details.
MIT licensed. No runtime packages or build step required.
hooks/register.js 64 lines1import { clean, text, code, row, frame, bar, pretty, bounded, entries, safePath } from './ui.js'
2const ID = "prompt-shelf"
3
4let prefix=''
5let items=[]
6let message=''
7async function load($) {
8 const keys=(await $.store.keys()).filter(k=>k.startsWith(prefix)).sort().slice(-100)
9 items=[]
10 for(const key of keys) {
11 const item=await $.store.get(key)
12 if(item && typeof item.text==='string')items.push({...item,key})
13 }
14 $.ui.invalidate('ui.render')
15}
16async function save($, value) {
17 try {
18 const content=bounded(value.trim(),4000)
19 if(!content)return
20
21 const date=new Date(await $.clock.now()).toISOString()
22 const key=prefix+date+'-'+crypto.randomUUID()
23 await $.store.set(key,{text:content,done:false,date})
24 message='Saved locally.'
25 await load($)
26 } catch(error){message=error.message;$.ui.invalidate('ui.render')}
27}
28
29export function register(on) {
30 on('session.start', async ($, e, next) => {
31 prefix='workspace:'+encodeURIComponent(e.cwd)+':item:'
32await load($)
33 await $.command.register({name:ID, description:"Save reusable prompts and put one into the composer as a draft.", immediate:true, argumentHint:"[entry]"})
34 return next(e)
35 })
36 on('command.run', {command:"prompt-shelf"}, async ($, e) => {
37 await load($)
38if(e.args.trim()) await save($,e.args)
39 await $.ui.open({id:ID,title:"Prompt Shelf",focus:true,closeOnEscape:true})
40 return {}
41 })
42
43 on('ui.render', {component:'Pane'}, async ($, e, next) => {
44 if(e.requestId !== ID) return next(e)
45 const E = $.ui.resolve(e)
46 try {
47 const body = await draw($, E)
48 return frame(E,"Prompt Shelf","Save reusable prompts and put one into the composer as a draft.",body)
49 } catch(error) {
50 return frame(E,"Prompt Shelf",'Unable to inspect this data.',[text(E,error.message,{color:'yellow'}),E.Button({key:'refresh',label:'Refresh',onPress:()=>$.ui.invalidate('ui.render')})])
51 }
52 })
53}
54async function draw($, E) {
55 const refresh = E.Button({key:'refresh',label:'Refresh',hotkey:'r',plain:true,onPress:()=>$.ui.invalidate('ui.render')})
56
57return [text(E,"Reusable prompts"+' · '+items.length+' items',{bold:true}),
58 E.Input({key:'entry',label:"Prompt",value:'',placeholder:'Type and press Enter',submitLabel:'save',onSubmit:(v)=>save($,v)}),
59 ...items.map((item,i)=>E.Box({flexDirection:'column',children:[row(E,[text(E,item.text),E.Button({key:'draft-'+i,label:'Draft',onPress:async()=>{const r=await $.prompt.fill({text:item.text});message=r.isFilled?'Draft placed in composer; review and send it yourself.':'Composer is busy; draft was not placed.';$.ui.invalidate('ui.render')}})]),E.Button({key:'delete-'+i,label:'Delete',plain:true,dimColor:true,onPress:async()=>{await $.store.delete(item.key);await load($)}})]})),
60 text(E,message || 'Saved per workspace. Refresh to see changes from other sessions.',{dimColor:true}),
61 E.Button({key:'refresh',label:'Reload saved items',onPress:()=>load($)})]
62
63}
64hooks/ui.js 36 lines1// Pure UI helpers. No engine access; each plugin contains its own copy.
2export function clean(value, limit = 9000) {
3 return String(value ?? '').replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g, '').slice(0, limit)
4}
5export function text(E, value, props = {}) {
6 return E.Text({ ...props, children: [clean(value)] })
7}
8export function code(E, value, language = 'text') {
9 return E.Code({ source: clean(value), language })
10}
11export function row(E, children) {
12 return E.Box({ flexDirection: 'row', columnGap: 2, flexWrap: 'wrap', children })
13}
14export function frame(E, title, subtitle, children) {
15 return E.Box({ flexDirection: 'column', gap: 1, children: [
16 text(E, title, { bold: true, color: 'cyan' }),
17 text(E, subtitle, { dimColor: true }), ...children,
18 ] })
19}
20export function bar(percent, width = 24) {
21 const p = Math.max(0, Math.min(100, Number(percent) || 0))
22 const n = Math.round(p / 100 * width)
23 return '[' + '#'.repeat(n) + '-'.repeat(width - n) + '] ' + p.toFixed(1) + '%'
24}
25export function pretty(value) { return JSON.stringify(value, null, 2) }
26export function bounded(value, max = 9000) {
27 if (value.length > max) throw new Error('Input exceeds ' + max + ' characters. Use a smaller selection.')
28 return value
29}
30export function entries(value) { return value && typeof value === 'object' ? Object.entries(value) : [] }
31export function safePath(value) {
32 const path = value.trim()
33 if (!path || path.startsWith('-') || /[\x00-\x1f]/.test(path)) throw new Error('Enter a path without control characters or leading flags.')
34 return path
35}
36