sima-form-edit-mode — community sima-form-edit-mode, community, ide skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Frontend Agents needing dynamic form rendering and editing capabilities with TypeScript and FormMode enum. Sima Board

RosenGray RosenGray
[0]
[0]
Updated: 3/5/2026

Agent Capability Analysis

The sima-form-edit-mode skill by RosenGray is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Frontend Agents needing dynamic form rendering and editing capabilities with TypeScript and FormMode enum.

Core Value

Empowers agents to implement edit functionality for existing forms using the FormMode enum and SerializedEntity types, enabling seamless transitions between create and edit modes with imported props interfaces and type checking.

Capabilities Granted for sima-form-edit-mode

Implementing form edit mode for SerializedEntity instances
Adding FormMode enum support to existing form components
Validating form data with entity-specific props interfaces

! Prerequisites & Limits

  • Requires TypeScript and @/components/Form/types/form.types import
  • Limited to form components with FormNameProps interface
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

sima-form-edit-mode

Install sima-form-edit-mode, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Form Edit Mode Guidelines

Overview

Forms should support both create and edit modes using the FormMode enum. This guide covers implementing edit functionality for existing forms.

Component Props

  • Add props interface to form component:
typescript
1interface FormNameProps { 2 entity?: SerializedEntity; // e.g., SerializedCar, SerializedProfessionalService 3 formMode: FormMode; 4}
  • Import FormMode from @/components/Form/types/form.types
  • Import serialized entity type from appropriate types file (e.g., SerializedCar from @/lib/vehicles/cars/types/cars.types)
  • Component signature: const FormName: FC<FormNameProps> = ({ entity, formMode }) => { ... }

Form Mode Detection

  • Add mode check at the start of component:
typescript
1const isCreateMode = formMode === FormMode.Create;
  • Use isCreateMode to conditionally render UI elements, change button text, or adjust validation

Required Imports for Edit Mode

  • FormMode from @/components/Form/types/form.types
  • SerializedEntity type from appropriate types file
  • ExistingImageItem from @/lib/files/uploadFiles
  • Edit action function (e.g., editCarAd from @/lib/vehicles/cars/actions/editCarAd)

Existing Images State Management

  • Initialize existingImages state from entity data:
typescript
1const [existingImages, setExistingImages] = useState<ExistingImageItem[]>( 2 () => { 3 return ( 4 entity?.images.map((image) => ({ 5 ...image, 6 isExisting: true, 7 toBeDeleted: false, 8 })) || [] 9 ); 10 } 11);
  • Track images marked for deletion:
typescript
1const imagesToDelete = useMemo(() => { 2 return existingImages.filter((image) => image.toBeDeleted); 3}, [existingImages]);
  • Check if all images are being deleted:
typescript
1const allImagesShouldBeDeleted = 2 imagesToDelete.length === existingImages.length;

Action Binding for Edit Mode

  • Bind edit action with context for edit mode:
typescript
1const updateEntityWithImagesToDelete = editEntityAd.bind(null, { 2 entityPublicId: entity?.publicId as string, 3 imagesToDelete, 4 allImagesShouldBeDeleted, 5});
  • Conditionally use create or edit action:
typescript
1const [formState, formAction, isPending] = useActionState( 2 isCreateMode ? publishEntityAd : updateEntityWithImagesToDelete, 3 undefined 4);

Form Default Values for Edit Mode

  • Populate defaultValue object from entity data when in edit mode:
typescript
1const [form, fields] = useForm({ 2 defaultValue: { 3 // String fields 4 fieldName: entity?.fieldName || "", 5 6 // Number fields - convert to string for form inputs 7 numericField: entity?.numericField?.toString() || "", 8 9 // Price fields - convert to string (PriceFormField will format with commas) 10 price: entity?.price?.toString() || "", 11 12 // Enum fields 13 enumField: entity?.enumField || "", 14 15 // Optional fields with defaults 16 optionalField: entity?.optionalField || "", 17 18 // Checkbox fields 19 acceptTerms: entity?.acceptTerms ? "on" : null, 20 21 // Arrays 22 images: [], 23 }, 24 // ... rest of form config 25});
  • Always provide fallback values (empty strings, null, empty arrays)
  • Convert numbers to strings for form inputs (they'll be converted back by schema)
  • For checkboxes, use "on" if entity value is true, null if false/undefined

Image Handling in Edit Mode

  • Update DropFilesInput to account for existing images:
typescript
1<DropFilesInput 2 // ... other props 3 existingFilesLength={ 4 existingImages.filter((image) => !image.toBeDeleted).length 5 } 6/>
  • Update ImagesPreviewer to handle existing images:
typescript
1{(existingImages.length > 0 || selectedFiles.length > 0) && ( 2 <Box> 3 <ImagesPreviewer 4 existingImages={existingImages} 5 images={selectedFiles} 6 setImages={setSelectedFiles} 7 setExistingImages={setExistingImages} 8 maxImages={MAX_FILES} 9 /> 10 </Box> 11)}
  • Show preview when there are existing images OR new selected files

Validation Schema Adjustments

  • Adjust minNumberOfImages based on deletion state:
typescript
1return parseWithZod(updatedFormData, { 2 schema: createEntitySchema({ 3 minNumberOfImages: allImagesShouldBeDeleted ? 1 : 0, 4 }), 5});
  • In edit mode, if all existing images are deleted, require at least 1 new image
  • If some images remain, allow 0 new images (images are optional)

Submit Button Text

  • Conditionally set button text based on mode:
typescript
1<SubmitButton 2 pending={isPending} 3 disabled={acceptTerms.value !== "on"} 4 text={isCreateMode ? "Добавить объявление" : "Сохранить изменения"} 5/>

Page Component Updates

Create Page

  • Pass formMode={FormMode.Create} to form component:
typescript
1<FormName formMode={FormMode.Create} />

Edit Page

  • Fetch entity data using repository:
typescript
1const entity = await entityRepository.getByPublicId(id); 2if (!entity) return notFound();
  • Verify ownership:
typescript
1const isOwner = await thisUserIsOwner(entity.user.id); 2if (!isOwner) return notFound();
  • Pass entity and formMode to form:
typescript
1<FormName entity={entity} formMode={FormMode.Edit} />

Edit Action Server Function Structure

  • Edit action should accept context as first parameter:
typescript
1export async function editEntityAd( 2 context: { 3 entityPublicId: string; 4 imagesToDelete: ExistingImageItem[]; 5 allImagesShouldBeDeleted: boolean; 6 }, 7 initialState: unknown, 8 formData: FormData 9) { 10 // ... implementation 11}
  • Handle image deletion before processing new uploads
  • Merge remaining existing images with newly uploaded images
  • Use repository pattern to update entity

Error Handling

  • Same error handling as create mode
  • Use ErrorModal component
  • Reset form on modal close (same as create mode)

Loading States

  • Same loading states as create mode
  • Show Loader when isPending is true
  • Disable all fields during submission

Best Practices

  • Always check isCreateMode before accessing entity properties
  • Use optional chaining (entity?.property) when accessing entity data
  • Provide sensible defaults for all fields
  • Ensure edit action properly handles partial updates
  • Test both create and edit flows
  • Verify image deletion and upload work correctly together
  • Ensure validation works correctly in both modes
  • Follow the pattern established in ProfessionalServicePublishForm and CarPublishForm

Common Patterns

Conditional Rendering Based on Mode

typescript
1{isCreateMode ? ( 2 <Text>Создание нового объявления</Text> 3) : ( 4 <Text>Редактирование объявления</Text> 5)}

Safe Entity Property Access

typescript
1const defaultValue = entity?.property ?? fallbackValue;

Number Field Conversion

typescript
1// In defaultValue 2numericField: entity?.numericField?.toString() || "", 3 4// Schema handles conversion back to number via z.coerce.number()

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is sima-form-edit-mode?

Perfect for Frontend Agents needing dynamic form rendering and editing capabilities with TypeScript and FormMode enum. Sima Board

How do I install sima-form-edit-mode?

Run the command: npx killer-skills add RosenGray/sima/sima-form-edit-mode. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for sima-form-edit-mode?

Key use cases include: Implementing form edit mode for SerializedEntity instances, Adding FormMode enum support to existing form components, Validating form data with entity-specific props interfaces.

Which IDEs are compatible with sima-form-edit-mode?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for sima-form-edit-mode?

Requires TypeScript and @/components/Form/types/form.types import. Limited to form components with FormNameProps interface.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add RosenGray/sima/sima-form-edit-mode. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use sima-form-edit-mode immediately in the current project.

Related Skills

Looking for an alternative to sima-form-edit-mode or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI