SR-9 POST /agents/<type>/skills/preview + "Preview rendered prompt" button #877

Closed
opened 2026-05-05 10:30:23 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As an operator, I want a "Preview rendered prompt" button on the Skills page that shows me the exact final string the dispatcher would send to Claude — body + interpolation + prompt_appendix + caveman + artifact-style — so the skill subsystem stops being a black box.

Acceptance criteria

Endpoint

  • POST /agents/<type>/skills/preview body { name, vars?, instance_id? } → returns { rendered: string, applied: { caveman: boolean, artifact_style: boolean, prompt_appendix: boolean } }.
  • Implementation calls the same renderPrompt(...) from SR-2 — no parallel rendering path.
  • When the skill row is missing → returns 404 with a body matching the dispatch-time abort message ("seed it at /agents//skills"), so the UI can surface the same actionable hint.
  • vars defaults to a minimal stub set ({ issue_number: 0, repo: '<preview>', title: '<preview>' }) so the preview renders even with no real issue context. Caller can override.

UI

  • "Preview" button on every row in SkillsTab (both type and instance modes).
  • Click opens a modal: rendered prompt in a monospace, scrollable, copyable surface; below it, the three booleans showing what was applied.
  • Modal has a "Copy" button.

Tests

  • preview-endpoint.test.ts — happy path (every appendix on/off combination), 404 on missing skill, vars override, instance-scope override returns the instance body.
  • skills-tab.preview.test.tsx — button click, modal renders, copy button copies.

Out of scope

  • Trigger / dispatch surface beyond preview — this is read-only.
  • Live tail of an in-flight dispatch — not modelled here.

References

  • Spec: specs/skills-rework.md §API surface (preview endpoint), §Risks (closes the "black box" gap raised in design discussion).
  • Depends on SR-2, SR-7, SR-8.
## User story As an operator, I want a "Preview rendered prompt" button on the Skills page that shows me the exact final string the dispatcher would send to Claude — body + interpolation + prompt_appendix + caveman + artifact-style — so the skill subsystem stops being a black box. ## Acceptance criteria ### Endpoint - [ ] `POST /agents/<type>/skills/preview` body `{ name, vars?, instance_id? }` → returns `{ rendered: string, applied: { caveman: boolean, artifact_style: boolean, prompt_appendix: boolean } }`. - [ ] Implementation calls the same `renderPrompt(...)` from SR-2 — no parallel rendering path. - [ ] When the skill row is missing → returns 404 with a body matching the dispatch-time abort message ("seed it at /agents/<type>/skills"), so the UI can surface the same actionable hint. - [ ] `vars` defaults to a minimal stub set (`{ issue_number: 0, repo: '<preview>', title: '<preview>' }`) so the preview renders even with no real issue context. Caller can override. ### UI - [ ] "Preview" button on every row in SkillsTab (both type and instance modes). - [ ] Click opens a modal: rendered prompt in a monospace, scrollable, copyable surface; below it, the three booleans showing what was applied. - [ ] Modal has a "Copy" button. ### Tests - [ ] `preview-endpoint.test.ts` — happy path (every appendix on/off combination), 404 on missing skill, vars override, instance-scope override returns the instance body. - [ ] `skills-tab.preview.test.tsx` — button click, modal renders, copy button copies. ## Out of scope - Trigger / dispatch surface beyond preview — this is read-only. - Live tail of an in-flight dispatch — not modelled here. ## References - Spec: `specs/skills-rework.md` §API surface (preview endpoint), §Risks (closes the "black box" gap raised in design discussion). - Depends on **SR-2**, **SR-7**, **SR-8**.
claude-desktop changed title from SR-9 POST /agents/&lt;type&gt;/skills/preview + "Preview rendered prompt" button to SR-9 POST /agents/<type>/skills/preview + "Preview rendered prompt" button 2026-05-05 10:31:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#877
No description provided.