用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/crathgeb/potato-cannon --skill potatocreating-modals命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Use this skill to add comments or notes to an existing task. Comments help track progress, document decisions, or explain issues.
You MUST use this anytime you want to ask the user a question or feel like something is unclear. If you think you want to use the AskUserQuestion tool, first invoke this skill, we may have a different way of asking the user a question.
You MUST use this skill in order to create, update, edit, or build artifacts or files. Artifacts can be of any type but are typically markdown files.
正在显示 SKILL.md
基于 SOC 职业分类
| name | potato:creating-modals |
| description | Use when creating or modifying modal dialogs in the web-react application |
This skill documents the correct patterns for creating modal dialogs in the web-react application.
All modals use the Radix UI-based Dialog components from @/components/ui/dialog:
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
The dialog component uses the project's theme variables by default:
bg-bg-secondaryborder-bordertext-text-primarytext-text-secondaryThese are baked into the base DialogContent, DialogTitle, and DialogDescription components, so you typically don't need to override them.
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Modal Title</DialogTitle>
<DialogDescription>
Description text explaining what this modal does.
</DialogDescription>
</DialogHeader>
{/* Modal body content */}
<div className="space-y-4 py-2">{/* Form fields, content, etc. */}</div>
<DialogFooter>
<Button variant="outline" onClick={() => setIsOpen(false)}>
Cancel
</Button>
<Button onClick={handleSubmit}>Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog>
For destructive actions, use a warning icon and destructive button variant:
import { AlertTriangle } from "lucide-react";
<Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
<DialogContent>
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<AlertTriangle className="h-5 w-5 text-accent-red" />
Delete Item?
</DialogTitle>
<DialogDescription>
Are you sure you want to delete this item? This action cannot be undone.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button
variant="outline"
onClick={() => setShowDeleteDialog(false)}
disabled={isDeleting}
>
Cancel
</Button>
<Button
variant="destructive"
onClick={handleDelete}
disabled={isDeleting}
>
{isDeleting ? "Deleting..." : "Delete"}
</Button>
</DialogFooter>
</>
;
For modals with form inputs:
<Dialog open={isOpen} onOpenChange={(open) => !open && handleClose()}>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Add Item</DialogTitle>
<DialogDescription>
Fill out the form below to add a new item.
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-2">
<div className="space-y-2">
<label htmlFor="field-name" className="text-sm text-text-secondary">
Field Label
</label>
<input
id="field-name"
type="text"
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Enter value"
disabled={isSubmitting}
className="w-full bg-bg-tertiary border border-border rounded-md px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent"
/>
</div>
{error && <p =>{error}}
Cancel
{isSubmitting ? (
Saving...
) : (
"Save"
)}
</>
</>
Use these classes for form inputs inside modals:
className =
"w-full bg-bg-tertiary border border-border rounded-md px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent";
Or use the Input component from @/components/ui/input if available.
const [showModal, setShowModal] = useState(false);
// In stores/appStore.ts
addProjectModalOpen: boolean
openAddProjectModal: () => void
closeAddProjectModal: () => void
// Usage
const isOpen = useAppStore((s) => s.addProjectModalOpen)
const closeModal = useAppStore((s) => s.closeAddProjectModal)
When creating a modal:
@/components/ui/dialogDialogContent (theme styles are built-in)DialogHeader with DialogTitle and DialogDescriptionDialogFooter with Cancel and primary action buttonsdisabled prop on buttonsvariant="destructive" for dangerous actions