agentsclimarketplace

Component design

Skill lennney/gate-all-skills/skills/website/component-design

Design React/Next.js component APIs with clear Server/Client boundaries, composable patterns, and proper seam placement. Use when designing new components, refactoring existing ones, or deciding between Server/Client Component boundaries.From its SKILL.md

Install
npx -y skills add lennney/gate-all-skills --skill component-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.5 KB, 701 tokens by cl100k_base, as published. Nobody here has run it

Component Design (Next.js)

Guiding principles for designing React components in Next.js App Router — focusing on API surface, composition, and the Server/Client boundary.

Core Principles

1. Server Component by Default

Prefer Server Components unless you need interactivity (hooks, event handlers, browser APIs). Every component that can be a Server Component should be one.

app/page.tsx         → Server Component (data fetching, layout)
app/page.tsx         → Client Component only if interactive
components/button.tsx → Client Component (has state/events)

2. Push Client Boundaries Down

When you need a Client Component, make it as thin as possible. Wrap the interactive part in a Client boundary and keep everything else on the server.

// ✅ Good: Server Component wraps minimal Client piece
// page.tsx (Server)
import { Comments } from './comments'
import { CommentList } from './comment-list'

export default function Page() {
  return (
    <div>
      <CommentList />           {/* Server: data fetching, rendering */}
      <Comments />              {/* Client: interactivity only */}
    </div>
  )
}

3. Interface First

Before writing implementation, define the component's public interface:

  • Props (required vs optional, types)
  • Children composition model (slots, render props, compound components)
  • Ref forwarding strategy
  • Loading, empty, error states

4. Test Through the Interface

If testing requires reaching into internal state or private methods, the interface is wrong. The public API should be the only test surface.

Server/Client Component Decision Tree

Does the component need hooks, events, or browser APIs?
├─ No  → Server Component ✅
└─ Yes → Client Component
         ├─ Can the interactive part be isolated?
         │   ├─ Yes → Extract into a thin Client wrapper, keep rest Server ✅
         │   └─ No  → Make the whole thing Client, but keep it focused
         └─ Do you need to pass Server data to it?
             ├─ Yes → Pass as props from the Server parent
             └─ No  → Fetch inside the Client Component

Seam Placement

A seam is where you can alter behavior without editing in that place. Good seams in Next.js:

SeamPurpose
layout.tsxPersistent shell, shared UI across routes
loading.tsxStreaming fallback per route segment
error.tsxError boundary per route segment
not-found.tsx404 boundary per route segment
Component propsPolymorphism via different prop combinations
Slot props (children, named slots)Composition over configuration

Checklist

  • Can this be a Server Component? If yes, make it one
  • Is the Client boundary as thin as possible?
  • Are all states covered? (loading, empty, error, edge cases)
  • Is the interface the only test surface?
  • Is the component composable or configurable? (prefer composition)
  • Does the naming reflect what it does, not how it renders?
  • Could I delete this component without callers breaking unpredictably? (deletion test)

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,679. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.