r/solidjs • u/pkcarreno • 3d ago
I made a `solid-composition-patterns` skill for Solid 2
I've been working on a skill called solid-composition-patterns. The idea came from Vercel's vercel-composition-patterns for React. I wanted the same thing for Solid, basically keeping reusable components and design system primitives clean and scalable instead of letting them turn into a mess of props.
Everything in there is written for Solid 2's model. It covers things like preserving fine-grained proxy reactivity, compound components, lifting state and mutations into { state, actions, meta } providers, and handling async boundaries with <Loading> and <Errored>.
This skill was originally built for Solid 1, but while experimenting with migrating one of my projects, I took what I learned along the way and reworked it around Solid 2. I also purposely left out any mention of Solid 1 APIs or old patterns so the agent doesn't get confused and fall back into v1 habits.
You can check it out on skills.sh or GitHub.
Solid 2 is still pretty new, so if you notice any edge cases, missed idioms, or anything that feels off, I'd love to hear your thoughts.
2
u/Blue_Krow 2d ago
Am I missing something about the "Lift State into Provider Components" examples? (skills/skills/solid-composition-patterns/rules/state-lift-state.md at 94ca538559e312a8d3f7268221f858051d898938 · Pkcarreno/skills) It says:
It seems to me that it's conflating two things: lifting state upwards and using context providers. Context is a mechanism to pass props down implicitly to avoid prop drilling at the cost of, well, making the dependency implicit, which makes things less readable. I would have written the "Correct" example as follows:
Less code, more explicit about intention, and same performance characteristics.
I'd even argue that the "syncing local child state upward with effects and callback props" strategy is valid when you want to create a reusable component that doesn't know whether it owns its own state.
1
u/_dbase 3d ago
This is super neat! I’d love to see this discussed in our Discord and even added to the ecosystem page on your website. Instructions for doing so are on the site itself.
Going to give this a spin myself as well.