state-machine
Fungsinya
Skill ini mendaftar keadaan yang bisa dimiliki sebuah komponen, misalnya memuat, kosong, atau error, dan menampilkan setiap keadaan di halaman sementara. Skill ini ditujukan bagi pengembang dan desainer yang ingin mengerjakan tampilan setiap keadaan.
Kapan dipakai
- ✓Saat Anda ingin melihat tabel atau panel dalam keadaan memuat, kosong, dan error.
- ✓Ketika Anda perlu mengerjakan tampilan sebuah layar untuk setiap paket, peran, atau flag fitur.
- ✓Ketika Anda ingin halaman dengan data tiruan tempat Anda bisa berpindah di antara setiap keadaan dengan satu tombol.
Link skill
https://github.com/jakubkrehel/skills/blob/main/skills/state-machine/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Tampilkan setiap keadaan tabel log audit kami di halaman uji agar saya bisa mengerjakan masing-masing.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill membaca kode komponen untuk menemukan setiap keadaan yang sudah ditangani. Ia membuat halaman sementara dengan data tiruan untuk setiap keadaan dan pengganti untuk berpindah di antaranya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
State machine
This skill takes one component and renders it on a throwaway page in every state it can be in. Mock data feeds each state, a switcher flips between them and the page is deleted in one step when you are done.
It is a workbench, not a review. The page stays up while the user works on the visuals, one state on screen and every other a keypress away. Stacking hostile scenarios on one page for a single look is break, exploring alternative designs is variant and reviewing finished work is interface-review.
1. Scope one component
One component per run: the audit log table, the network panel, the billing card. "The settings page" spans several, so list them and ask which one.
Restate it in one sentence: what the component shows, where it renders in production and where its data comes from.
2. Find the states in the code
The states are the branches the component already has. Read it and its data hooks for every one:
| Kind | States |
|---|---|
| Data | Loading, empty, error, one item, a typical set, a set long enough to scroll or paginate, some requests resolved and others pending, stale data refetching |
| Account | Plan tier, role and permission checks, an owner versus a member |
| Feature | Flags, trials, limits reached, a disabled or locked feature |
A state the code cannot reach is not a state. Do not add a branch to render one. Where the design shows a state the code lacks, list it as missing and leave it out.
Write the set down before building, one line each, named the way the product talks about it: empty, enterprise, member-no-access. Group them under headings in the product's words, by what changes. Use Data and Account or narrower ones such as Connection or Access. The switcher shows these groups. Say which kinds you dropped and why in one line. Combine kinds only where the code branches on the combination, such as member-empty, never as a cross product.
3. Build the throwaway page
A scratch route inside the app holds the real component, imported from the project and untouched. The route inherits the app's layout, fonts, global styles and providers for free.
Where the framework splits server from client components, the page is client code, "use client" in Next. Otherwise fixture data can silently vanish crossing that boundary, and the page renders empty.
Render one instance in a container as wide as the component is in production. The container, the fixtures and the switcher are everything the page adds, with no fonts, styles or themes of its own. Keep the page, its fixtures and its switcher in one folder, such as /states/audit-log, so removal is one delete.
4. Feed each state at the data boundary
Supply the data where the component receives it, from the page, without editing the component. In order of preference:
- Props, where the component takes its data as props.
- The app's own data seam: a seeded query cache, a mock provider or the project's request mocks.
A fixture threaded through props five levels down tests a path production never takes. Where the only way in is editing the component, say so and ask before adding a seam.
Make the data look like the product. Real-shaped names, timestamps, amounts and the item counts users actually have. Three rows of "Test item" make every state look fine.
Loading and pending states hold still. Keep them pending until the switcher moves, rather than resolving after a timeout.
5. Add the switcher
A grouped list beside the component flips the __state search param, so every state is a link. Where there is no room beside the component, it moves above it as a select with the same groups. The double underscore keeps it clear of any param the app's layout reads. switcher.md holds the spec.
6. Confirm every state renders, then hand over
Load the page once in a browser already at hand and flip through every state. The component shows the mock data, not the real data and not a blank region. Mock data that never appears is the common failure here. Live sync, a cache that refetches over the seed or a server boundary dropping the fixture all cause it. Fix the plumbing before handing over.
With no browser at hand, say so and hand the URL over for the user to check.
Then hand over the URL, the state list and the switcher keys. Stop there. Changing how a state looks is the user's next request, not part of this one.
Re-check every state after each change
After a visual change,
Pertanyaan umum
Apakah ia menambahkan keadaan yang tidak bisa dijangkau kode?
Tidak. Ia hanya menampilkan keadaan yang sudah ditangani kode komponen.
Apakah ia mengubah halaman yang asli?
Tidak. Ia bekerja di halaman sekali pakai dengan data tiruan, sehingga halaman asli tidak tersentuh.
Apakah halaman uji disimpan setelah saya selesai?
Tidak. Halaman itu dimaksudkan untuk dihapus dalam satu langkah ketika Anda selesai.
Detail
Deskripsi asli dari pembuat
Renders every state of a component you choose on a throwaway page, with mock data and a switcher, so you can work on each state.
repo: jakubkrehel/skills
Popularitas
- Bintang GitHub
- 10k
- Peringkat
- #11895
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
better-accessibility
10kMeninjau dan memperbaiki masalah keyboard, fokus, pembaca layar, formulir, dan gerakan pada antarmuka, sesuai standar WCAG 2.2.
better-colors
10kMembangun dan memeriksa sistem warna dengan membuat palet, memberi nama token, mengonversi format, dan mengukur kontras.
better-interface
10kMeninjau seluruh layar atau alur dari sisi aksesibilitas, tata letak, penulisan, tipografi, warna, dan kerapian, lalu mengurutkan masalahnya.
better-layout
10kMengatur pengelompokan, perataan, urutan membaca, dan struktur responsif, serta memeriksa bahwa tata letak tetap baik saat diubah ukurannya atau diterjemahkan.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.