frontend-solidjs-patterns
Use when the user asks about SolidJS forms, createResource and Suspense data fetching, SolidJS component composition, transitions or animation. Produces…
by j4flmao★ 47 GitHub stars
Install frontend-solidjs-patterns in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
SolidJS Patterns
Purpose
Apply production patterns to SolidJS applications: async data with createResource, controlled forms with signals and Zod, component composition patterns, and animation.
Agent Protocol
Trigger
Exact user phrases: "SolidJS pattern", "SolidJS form", "SolidJS data fetching", "SolidJS component pattern", "SolidJS animation".
Input Context
Before activating, verify:
- SolidJS project with solid-js package.
- Whether @tanstack/solid-form or custom forms are used.
- If css transitions or Solid Flip is available for animation.
Output Artifact
No file output. Produces code patterns for data fetching, forms, composition, and animation.
Response Format
Code: show resource, form, and composition examples. No imports beyond SolidJS APIs.
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- Data fetching uses createResource with Suspense boundaries.
- createResource refetches when source signal changes.
- Forms use controlled inputs with signals and Zod validation.
- Component composition uses JSX children as functions or slot patterns.
- Animation uses createTransition, Solid Flip, or CSS transitions with signals.
Max Response Length
Code: 15 lines per example.
Component Architecture / Decision Trees
Architecture Options
| Approach | Trade-off | When to Use |
|---|---|---|
| createResource + Suspense | Simple async data, loading states | API data fetching |
| createResource with mutate | Optimistic updates, cache control | Dashboard, live data |
| Controlled form with signals | Full control over validation | Complex forms |
| Children as functions (render props) | Flexible composition | List, Table, Dropdown |
| Slot pattern via props | Explicit API | Card, Layout, Modal |
| createTransition | Pending state for deferred updates | Tab switching, navigation |
Decision Tree: Data Fetching
Is data needed on page load?
├── Yes -> createResource in component
│ ├── Depends on signal? -> Pass signal as source
│ └── Static -> Pass constant source
└── No -> fetch on interaction (event handler)
Decision Tree: Form Complexity
How many fields?
├── 1-3 fields -> createSignal per field
├── 4-10 fields -> createStore for the form object
└── 10+ fields or nested -> createStore + field arrays
Decision Tree: Component Composition
Does the component need to customize rendering?
├── Yes -> Children as functions or render props
└── No -> Regular props + children
Does the component have optional sections?
├── Yes -> Slot pattern (header, footer, sidebar)
└── No -> Single children slot
Component Design Patterns
Data Fetching with Loading and Error States
function ProductList() {
const [products] = createResource(() => '/api/products', fetchProducts)
return (
<Suspense fallback={<ProductSkeleton />}>
<ErrorBoundary fallback={<div>Failed to load products</div>}>
<For each={products()}>
{(product) => <ProductCard product={product} />}
</For>
</ErrorBoundary>
</Suspense>
)
}
createResource with Dependent Fetching
function UserPosts() {
const params = useParams()
const userId = () => params.id
const [user] = createResource(userId, fetchUser)
const [posts] = createResource(user, (u) => u ? fetchPosts(u.id) : [])
return (
<Suspense fallback={<div>Loading...</div>}>
<h1>{user()?.name}'s Posts</h1>
<For each={posts()}>{(post) => <PostCard post={post} />}</For>
</Suspense>
)
}
Optimistic Update with mutate
function LikeButton(props: { postId: string }) {
const [liked, setLiked] = createSignal(false)
const toggleLike = async () => {
const previous = liked()
setLiked(!liked()) // optimistic update
try {
await api.toggleLike(props.postId)
} catch {
setLiked(previous) // rollback
}
}
return <button onClick={toggleLike}>{liked() ? 'Unlike' : 'Like'}</button>
}
Complex Form with createStore
function OrderForm() {
const [form, setForm] = createStore({
customer: { name: '', email: '' },
items: [] as { productId: string; quantity: number }[],
shipping: { address: '', city: '', zip: '' },
errors: {} as Record<string, string>,
})
const addItem = () => setForm('items', items => [...items, { productId: '', quantity: 1 }])
const removeItem = (i: number) => setForm('items', items => items.filter((_, idx) => idx !== i))
const updateItem = (i: number, field: string, value: any) => setForm('items', i, field, value)
const total = createMemo(() => form.items.reduce((sum, i) => sum + i.quantity * 10, 0))
const handleSubmit = async (e: Event) => {
e.preventDefault()
const result = orderSchema.safeParse(form)
if (!result.success) {
setForm('errors', re
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- references/solid-data.md
- references/solid-forms.md
- references/solidjs-routing.md
- references/solidjs-ssr-streaming.md
- references/solidjs-state.md
- references/solidjs-testing-strategy.md
- references/solidjs-testing.md
- references/solidjs-ui-patterns.md
FAQ
What does the frontend-solidjs-patterns skill do?
Use when the user asks about SolidJS forms, createResource and Suspense data fetching, SolidJS component composition, transitions or animation. Produces reusable Solid patterns for an existing app. Not for Solid project structure and reactivity basics (use frontend-solidjs-architecture).
How do I install the frontend-solidjs-patterns skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the frontend-solidjs-patterns skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…