Add you-might-not-need-an-effect skill#347
Open
IzumiSy wants to merge 1 commit into
Open
Conversation
ca9294a to
01d1a19
Compare
interacsean
approved these changes
Jul 2, 2026
| **Prefer** | ||
|
|
||
| ```tsx | ||
| function Editor({ initialContent }: { initialContent: string }) { |
Contributor
There was a problem hiding this comment.
Do we need any guidance here that this behaves differently if initialContent changes from the parent component? Truly if we only want to initialize state, and not if we want a controlled component?
|
|
||
| ```tsx | ||
| function ProfilePage({ userId }: { userId: string }) { | ||
| return <Profile key={userId} userId={userId} />; |
Contributor
There was a problem hiding this comment.
Unclear to me what happens to "comment", how this cleanly replaces the idea of having a comment that clears when userId changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
AppShell now has several project-local development skills, but nothing focused on React's
useEffectguidance. In practice, AI coding assistants tend to useuseEffecttoo casually for derived state, event logic, and initialization, so we wanted to package React's official guidance as a lightweight skill that can load during normal development and review.This is especially useful in this repository because AppShell mixes framework code, hooks, and app-like examples, so it is easy to reach for
useEffectfor work that belongs in render logic, event handlers, loaders, or startup code instead.useEffectis still useful in many cases, so this is intentionally not a mechanical checker or lint rule. The goal is to improve judgment at authoring/review time, not to enforce a blanket ban.Design Decision
Instead of building a rigid repo-specific auditing workflow, this adds a small knowledge-oriented skill plus a single reference file of concrete anti-patterns. That keeps the skill easy to load during normal coding, while still grounding it in the React guidance from "You Might Not Need an Effect".
The skill also includes a small AppShell-specific note around initialization: because AppShell embeds React Router, some work may belong in route loaders, auth initialization, or app startup code rather than mount effects.
A few alternatives were considered and intentionally not adopted:
vercel-labs/agent-skills'sreact-best-practiceshas some useful material, but it mixes in Next.js- and Server Component-oriented guidance. AppShell targets SPA usage, so pulling it in wholesale would add noise. It may still be worth curating separately later as a broaderreact-skillsstyle addition.victor36max/use-effect-killerwas a good reference point, but it is effectively just aSKILL.md. Since we wanted to tweak the content, include AppShell-specific guidance, and avoid a pseudo-dependency on an external text file, copying and owning the content locally was the simpler choice.useEffectis case-dependent. This change is meant to teach and steer, not to mechanically fail code that may be perfectly valid.Summary
you-might-not-need-an-effectskill under.agents/skills