react-feature
Skill3 starsChanged 8 months agoMITView on GitHub
Use when implementing a new React feature, page, component, or hook in a Vite/Bun frontend with testing-library
In this repository36 other files it gives its agents.
- adrSkill
- analyticsSkill
- api-contractSkill
- api-designSkill
- ci-pipelineSkill
- claude-mdSkill
- code-qualitySkill
- data-modelSkill
- db-migrateSkill
- debugSkill
- deploySkill
- dep-updateSkill
- disk-cleanupSkill
- docker-buildSkill
- eng-leadSkill
- event-drivenSkill
- fullstack-healthcheckSkill
- go-featureSkill
- go-integration-testSkill
- go-refactorSkill
- go-scaffoldSkill
- incident-responseSkill
- interactive-clarifySkill
- observabilitySkill
- onboardingSkill
- product-specSkill
- py-featureSkill
- py-integration-testSkill
- py-migrateSkill
- py-refactorSkill
- py-scaffoldSkill
- react-refactorSkill
- react-scaffoldSkill
- review-codeSkill
- securitySkill
- system-designSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Core principle: Test what users see and do, not implementation details.
- Distinctive: line 121
Always handle all three:
- Very specific: line 140
REQUIRED: Follow code-quality standards — virtualize long lists, debounce inputs, paginate API calls, code-split routes
- Very specific: line 141
REQUIRED: Update CLAUDE.md if new conventions, commands, or patterns are introduced (claude-md)
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Feature Development
Overview
TDD workflow for React features using Vitest + testing-library. User-centric testing with MSW for API mocking.
Core principle: Test what users see and do, not implementation details.
When to Use
- Adding a new page or feature module
- Building reusable components
- Creating custom hooks
- Implementing forms, data fetching, or state management
Feature Module Structure
src/features/users/
components/
UserList.tsx
UserList.test.tsx
UserForm.tsx
UserForm.test.tsx
hooks/
useUsers.ts
useUsers.test.ts
api/
users.ts
types/
index.ts
index.ts # public API barrel exportComponent TDD
Test first:
// UserList.test.tsx
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { UserList } from './UserList'
describe('UserList', () => {
it('renders users', () => {
render(<UserList users={[{ id: '1', name: 'Alice', email: 'a@b.com' }]} />)
expect(screen.getByText('Alice')).toBeInTheDocument()
})
it('calls onDelete when delete button clicked', async () => {
const onDelete = vi.fn()
const user = userEvent.setup()
render(<UserList users={[{ id: '1', name: 'Alice', email: 'a@b.com' }]} onDelete={onDelete} />)
await user.click(screen.getByRole('button', { name: /delete/i }))
expect(onDelete).toHaveBeenCalledWith('1')
})
})Custom Hook Testing
import { renderHook, waitFor } from '@testing-library/react'
import { useUsers } from './useUsers'
import { QueryClientProvider, QueryClient } from '@tanstack/react-query'
function wrapper({ children }: { children: React.ReactNode }) {
return <QueryClientProvider client={new QueryClient()}>{children}</QueryClientProvider>
}
it('fetches users', async () => {
const { result } = renderHook(() => useUsers(), { wrapper })
await waitFor(() => expect(result.current.isSuccess).toBe(true))
expect(result.current.data).toHaveLength(2)
})API Mocking with MSW
// src/mocks/handlers.ts
import { http, HttpResponse } from 'msw'
export const handlers = [
http.get('/api/v1/users', () => {
return HttpResponse.json({
data: [{ id: '1', name: 'Alice', email: 'a@b.com' }],
})
}),
]
// src/mocks/server.ts
import { setupServer } from 'msw/node'
import { handlers } from './handlers'
export const server = setupServer(...handlers)
// vitest.setup.ts
beforeAll(() => server.listen())
afterEach(() => server.resetHandlers())
afterAll(() => server.close())State Patterns
| Pattern | When |
useState | Local component state |
useReducer | Complex state transitions |
| React Query | Server state (fetching, caching) |
| Context | Shared UI state (theme, auth) |
| URL params | Filters, pagination, selected tab |
Loading/Error/Empty States
Always handle all three:
if (isLoading) return <Skeleton />
if (error) return <ErrorMessage error={error} onRetry={refetch} />
if (data.length === 0) return <EmptyState message="No users found" />
return <UserList users={data} />Accessibility Checklist
- Interactive elements have accessible names (aria-label or visible text)
- Forms have associated labels
- Error messages linked with aria-describedby
- Keyboard navigation works (Tab, Enter, Escape)
- Focus management after dynamic changes
Chains
- REQUIRED: Invoke
superpowers:test-driven-development - REQUIRED: Follow
code-qualitystandards — virtualize long lists, debounce inputs, paginate API calls, code-split routes - REQUIRED: Update CLAUDE.md if new conventions, commands, or patterns are introduced (
claude-md) - Can develop in parallel with
go-featureorpy-feature
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

