rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Assistant — agent workspace with streaming chat

Streaming chat + user-created agents, skills and automations (localStorage) — bring any LLM as an async generator.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
assistant.prompt.mdmarkdown
# Install `assistant` — Assistant — agent workspace with streaming chat

> Streaming chat + user-created agents, skills and automations (localStorage) — bring any LLM as an async generator.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/assistant
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=assistant
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/assistant

## 1. Install

```bash
npx rahman-resources add assistant
# alias: npx rr add assistant
```

The CLI copies `frontend/slices/assistant/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- npm: `lucide-react`
- shadcn primitives: `button`, `input`, `textarea`, `tabs`, `badge`, `scroll-area`, `dropdown-menu`, `dialog`, `select`, `switch`

## 3. Wire it up

Stack: Next 16 + React 19 + Tailwind 4 + shadcn/ui. Agent workspace with streaming chat. Fully client-side; model injected.

STEP 1 — Install. `npx rr add assistant`. Ensure `@/features/assistant` resolves and Tailwind scans the slice folder.

STEP 2 — Deps. npm: `lucide-react`. shadcn: `npx shadcn@latest add button input textarea tabs badge scroll-area dropdown-menu dialog select switch`.

STEP 3 — Mount. `<Assistant />` in a height-bearing box. Unwired, a typing demo stream answers so the UI works offline; agents/skills/automations persist in localStorage.

STEP 4 — Wire a model. `configureAssistantStream(async function* (messages) { ...yield text deltas... })` — SSE endpoint, AI SDK, or an agent loop. Throw Error("no_api_key") / Error("unauthorized") for the chat's friendly error notes.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.