Claude-skill-registry defining-typescript-models
Defines standard TypeScript interfaces for Appwrite Collections. Use when creating new models for Tours, Users, or Bookings to ensure full type safety.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/defining-typescript-models" ~/.claude/skills/majiayu000-claude-skill-registry-defining-typescript-models && rm -rf "$T"
manifest:
skills/data/defining-typescript-models/SKILL.mdsource content
TypeScript Models and Interfaces
When to use this skill
- When defining the data structure for a new Appwrite collection.
- When creating props for components that data-fetch.
- To avoid using
across the codebase.any
Workflow
- Export interfaces from a central
directory.types/ - Include standard Appwrite fields (
,$id
,$createdAt
,$updatedAt
).$permissions - Use Enums for fields with fixed values (e.g.,
).BookingStatus
Example Template
import { Models } from 'appwrite'; export interface Tour extends Models.Document { title: string; description: string; price: number; location: string; images: string[]; rating: number; availableDates: string[]; // ISO Strings } export type BookingStatus = 'pending' | 'confirmed' | 'cancelled'; export interface Booking extends Models.Document { userId: string; tourId: string; status: BookingStatus; totalPrice: number; }
Instructions
- Generics: Use these interfaces with Appwrite SDK methods:
.databases.listDocuments<Tour>(...) - Readonly: Mark fields as
if they shouldn't be mutated by the frontend.readonly