add-dialog-component
Create React dialog components with forms for the dealflow-network project using Radix UI, tRPC mutations, and proper state management. Use when adding create/edit dialogs, modals, or form-based UI components.
Best use case
add-dialog-component is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Create React dialog components with forms for the dealflow-network project using Radix UI, tRPC mutations, and proper state management. Use when adding create/edit dialogs, modals, or form-based UI components.
Teams using add-dialog-component should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/add-dialog-component/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How add-dialog-component Compares
| Feature / Agent | add-dialog-component | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create React dialog components with forms for the dealflow-network project using Radix UI, tRPC mutations, and proper state management. Use when adding create/edit dialogs, modals, or form-based UI components.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Add Dialog Component
Create form dialogs following project patterns.
## Quick Start
When adding a dialog, I will:
1. Create component in `client/src/components/`
2. Use Radix UI Dialog primitive
3. Add form state with useState
4. Integrate tRPC mutation
5. Handle loading, success, and error states
## Template: Create Dialog
```tsx
// client/src/components/CreateItemDialog.tsx
import { useState } from "react";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { trpc } from "@/lib/trpc";
import { toast } from "sonner";
interface CreateItemDialogProps {
trigger?: React.ReactNode;
onSuccess?: (item: { id: number; name: string }) => void;
}
export function CreateItemDialog({ trigger, onSuccess }: CreateItemDialogProps) {
const [open, setOpen] = useState(false);
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const utils = trpc.useUtils();
const createMutation = trpc.items.create.useMutation({
onSuccess: (item) => {
utils.items.list.invalidate();
toast.success("Item created successfully");
setOpen(false);
resetForm();
onSuccess?.(item);
},
onError: (error) => {
toast.error(`Failed to create item: ${error.message}`);
},
});
const resetForm = () => {
setName("");
setDescription("");
};
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!name.trim()) {
toast.error("Name is required");
return;
}
createMutation.mutate({ name: name.trim(), description });
};
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
{trigger || <Button>Create Item</Button>}
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Create New Item</DialogTitle>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="name">Name *</Label>
<Input
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Enter item name"
disabled={createMutation.isPending}
/>
</div>
<div className="space-y-2">
<Label htmlFor="description">Description</Label>
<Input
id="description"
value={description}
onChange={(e) => setDescription(e.target.value)}
placeholder="Enter description (optional)"
disabled={createMutation.isPending}
/>
</div>
<div className="flex justify-end gap-2">
<Button
type="button"
variant="outline"
onClick={() => setOpen(false)}
disabled={createMutation.isPending}
>
Cancel
</Button>
<Button type="submit" disabled={createMutation.isPending}>
{createMutation.isPending ? "Creating..." : "Create"}
</Button>
</div>
</form>
</DialogContent>
</Dialog>
);
}
```
## Template: Edit Dialog
```tsx
// client/src/components/EditItemDialog.tsx
import { useState, useEffect } from "react";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { trpc } from "@/lib/trpc";
import { toast } from "sonner";
import type { Item } from "@shared/types";
interface EditItemDialogProps {
item: Item | null;
open: boolean;
onOpenChange: (open: boolean) => void;
onSuccess?: () => void;
}
export function EditItemDialog({
item,
open,
onOpenChange,
onSuccess,
}: EditItemDialogProps) {
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const utils = trpc.useUtils();
// Populate form when item changes
useEffect(() => {
if (item) {
setName(item.name);
setDescription(item.description ?? "");
}
}, [item]);
const updateMutation = trpc.items.update.useMutation({
onSuccess: () => {
utils.items.list.invalidate();
utils.items.get.invalidate({ id: item?.id });
toast.success("Item updated successfully");
onOpenChange(false);
onSuccess?.();
},
onError: (error) => {
toast.error(`Failed to update: ${error.message}`);
},
});
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!item) return;
if (!name.trim()) {
toast.error("Name is required");
return;
}
updateMutation.mutate({
id: item.id,
name: name.trim(),
description,
});
};
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent>
<DialogHeader>
<DialogTitle>Edit Item</DialogTitle>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="edit-name">Name *</Label>
<Input
id="edit-name"
value={name}
onChange={(e) => setName(e.target.value)}
disabled={updateMutation.isPending}
/>
</div>
<div className="space-y-2">
<Label htmlFor="edit-description">Description</Label>
<Input
id="edit-description"
value={description}
onChange={(e) => setDescription(e.target.value)}
disabled={updateMutation.isPending}
/>
</div>
<div className="flex justify-end gap-2">
<Button
type="button"
variant="outline"
onClick={() => onOpenChange(false)}
disabled={updateMutation.isPending}
>
Cancel
</Button>
<Button type="submit" disabled={updateMutation.isPending}>
{updateMutation.isPending ? "Saving..." : "Save Changes"}
</Button>
</div>
</form>
</DialogContent>
</Dialog>
);
}
```
## Template: Confirmation Dialog
```tsx
// client/src/components/DeleteConfirmDialog.tsx
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { trpc } from "@/lib/trpc";
import { toast } from "sonner";
interface DeleteConfirmDialogProps {
itemId: number | null;
itemName: string;
open: boolean;
onOpenChange: (open: boolean) => void;
onSuccess?: () => void;
}
export function DeleteConfirmDialog({
itemId,
itemName,
open,
onOpenChange,
onSuccess,
}: DeleteConfirmDialogProps) {
const utils = trpc.useUtils();
const deleteMutation = trpc.items.delete.useMutation({
onSuccess: () => {
utils.items.list.invalidate();
toast.success("Item deleted");
onOpenChange(false);
onSuccess?.();
},
onError: (error) => {
toast.error(`Failed to delete: ${error.message}`);
},
});
const handleConfirm = () => {
if (itemId) {
deleteMutation.mutate({ id: itemId });
}
};
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Item</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete "{itemName}"? This action cannot be
undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={deleteMutation.isPending}>
Cancel
</AlertDialogCancel>
<AlertDialogAction
onClick={handleConfirm}
disabled={deleteMutation.isPending}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{deleteMutation.isPending ? "Deleting..." : "Delete"}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}
```
## Usage in Page Component
```tsx
// In a page component
import { CreateItemDialog } from "@/components/CreateItemDialog";
import { EditItemDialog } from "@/components/EditItemDialog";
import { DeleteConfirmDialog } from "@/components/DeleteConfirmDialog";
function ItemsPage() {
const [editItem, setEditItem] = useState<Item | null>(null);
const [deleteItem, setDeleteItem] = useState<{ id: number; name: string } | null>(null);
return (
<div>
<CreateItemDialog />
<EditItemDialog
item={editItem}
open={!!editItem}
onOpenChange={(open) => !open && setEditItem(null)}
/>
<DeleteConfirmDialog
itemId={deleteItem?.id ?? null}
itemName={deleteItem?.name ?? ""}
open={!!deleteItem}
onOpenChange={(open) => !open && setDeleteItem(null)}
/>
</div>
);
}
```
## Available UI Components
Import from `@/components/ui/`:
- `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`, `DialogTrigger`
- `AlertDialog`, `AlertDialogAction`, `AlertDialogCancel`, `AlertDialogContent`
- `Button` (variants: default, outline, destructive, ghost)
- `Input`, `Label`, `Textarea`
- `Select`, `SelectContent`, `SelectItem`, `SelectTrigger`, `SelectValue`
- `Checkbox`, `Switch`
## Checklist
- [ ] Form state managed with useState
- [ ] Form populated from props (for edit dialogs)
- [ ] Input validation before mutation
- [ ] Loading state on submit button
- [ ] Inputs disabled during mutation
- [ ] Cache invalidation on success
- [ ] Toast notifications for success/error
- [ ] Form reset on close/success
- [ ] Cancel button availableRelated Skills
add-shadcn-component
Add shadcn/ui components via pnpm dlx, then normalize generated Tailwind color classes to Scaffa theme tokens
add-component
Create a React component with TypeScript and optional tests
grail-miner
This skill assists in setting up, managing, and optimizing Grail miners on Bittensor Subnet 81, handling tasks like environment configuration, R2 storage, model checkpoint management, and performance tuning.
ux
This AI agent skill provides comprehensive guidance for creating professional and insightful User Experience (UX) designs, covering user research, information architecture, interaction design, visual guidance, and usability evaluation. It aims to produce actionable, user-centered solutions that avoid generic AI aesthetics.
lets-go-rss
A lightweight, full-platform RSS subscription manager that aggregates content from YouTube, Vimeo, Behance, Twitter/X, and Chinese platforms like Bilibili, Weibo, and Douyin, featuring deduplication and AI smart classification.
tech-blog
Generates comprehensive technical blog posts, offering detailed explanations of system internals, architecture, and implementation, either through source code analysis or document-driven research.
chrome-debug
This skill empowers AI agents to debug web applications and inspect browser behavior using the Chrome DevTools Protocol (CDP), offering both collaborative (headful) and automated (headless) modes.
thor-skills
An entry point and router for AI agents to manage various THOR-related cybersecurity tasks, including running scans, analyzing logs, troubleshooting, and maintenance.
astro
This skill provides essential Astro framework patterns, focusing on server-side rendering (SSR), static site generation (SSG), middleware, and TypeScript best practices. It helps AI agents implement secure authentication, manage API routes, and debug rendering behaviors within Astro projects.
whisper-transcribe
Transcribes audio and video files to text using OpenAI's Whisper CLI, enhanced with contextual grounding from local markdown files for improved accuracy.
modal-deployment
Run Python code in the cloud with serverless containers, GPUs, and autoscaling using Modal. This skill enables agents to generate code for deploying ML models, running batch jobs, serving APIs, and scaling compute-intensive workloads.
vly-money
Generate crypto payment links for supported tokens and networks, manage access to X402 payment-protected content, and provide direct access to the vly.money wallet interface.