Langsung ke konten
Skillpedia
Website & UI (frontend)48k Β· #4662

frontend-architecture

Fungsinya

Skill ini menjelaskan cara mengatur kode untuk aplikasi React atau React Native. Skill ini membantu menjaga semuanya rapi dalam modul, memisahkan data server dari data layar, serta menetapkan aturan yang jelas tentang bagaimana bagian kode dapat berkomunikasi.

Kapan dipakai

  • βœ“Saat memulai proyek React/React Native baru.
  • βœ“Saat kode proyek mulai berantakan dan sulit dipahami.
  • βœ“Agar setiap developer mengikuti aturan pengorganisasian yang sama.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/frontend-architecture/SKILL.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/frontend-architecture/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBagaimana cara menyusun kode React Native saya agar mudah dipahami dan dirawat?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill ini membagi aplikasi menjadi 'modul' (bagian fungsional), di mana setiap modul memiliki halaman, komponen, dan datanya sendiri. Aturan menentukan bagaimana modul-modul ini dapat berinteraksi, yaitu hanya melalui titik masuk publik.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Frontend Architecture (portable, module-based)

When to Use

Use this skill when you need a portable, framework-agnostic architecture style for any React or React Native frontend. Organizes apps into feature modules with page/screen directories, a strict server-state vs UI-state split, barrel-only cross-module imports, co-located styles, and clear component-promotion rules....

Portable skill β€” readable by Claude Code, OpenCode, Codex, Cursor, Windsurf, and others. This skill describes a structure and a set of rules, not a component library, a state library, or a visual style. It is deliberately global: the same module/page/state model maps onto Next.js (App Router), React + Vite (SPA), Remix, and Expo / React Native, and it works with any state-management and styling stack.

The goal: a codebase where any contributor can instantly answer three questions β€” "where does this code live?", "what is allowed to import what?", and "is this server state or UI state?" β€” without asking anyone. The structure makes the answers obvious.


0. The five core ideas

  1. Feature modules own their world. Each feature is a self-contained modules/{feature}/ folder with its own pages, components, hooks, state, types, and a single public barrel.
  2. Pages/screens are directories, not files. A route is a folder that co-locates its component, its styles, and the components/hooks used only by it.
  3. State is split by origin. Server data lives in a query/cache layer. UI/client state lives in a store. They never overlap β€” regardless of which libraries you pick.
  4. Imports cross boundaries only through barrels. Reaching into another module's internals is forbidden; you import from @/modules/{feature} and nothing deeper.
  5. Code is promoted, not pre-placed. It starts as local as possible and moves outward only when a second consumer appears.

Everything below is the mechanical application of these five ideas. None of it is tied to a specific library β€” pick your stack in Sections 4 and 6.


1. Directory layout

The shape is identical across frameworks; only the routing layer on top differs (see Section 7).

src/
β”œβ”€β”€ app/ or routes/ or navigation/   ← framework routing layer (thin β€” see Β§7)
β”œβ”€β”€ modules/                         ← feature modules (the heart of the app)
β”‚   └── {feature}/
β”‚       β”œβ”€β”€ index.ts                 ← PUBLIC BARREL β€” the only cross-module entry point
β”‚       β”œβ”€β”€ README.md                ← what this module owns, its routes, its data deps
β”‚       β”œβ”€β”€ components/              ← components reused by 2+ pages IN THIS MODULE
β”‚       β”œβ”€β”€ pages/                   ← page/screen directories (one per route)
β”‚       β”‚   └── {page}/
β”‚       β”‚       β”œβ”€β”€ {page}.tsx               ← the page/screen component
β”‚       β”‚       β”œβ”€β”€ {page}.styles.ts         ← ALL styling for this page
β”‚       β”‚       β”œβ”€β”€ index.ts                 ← re-exports the page component
β”‚       β”‚       β”œβ”€β”€ components/              ← components used ONLY by this page
β”‚       β”‚       β”œβ”€β”€ hooks/                   ← hooks used ONLY by this page
β”‚       β”‚       β”œβ”€β”€ constants/
β”‚       β”‚       └── README.md                ← route, params, permissions, data deps
β”‚       β”œβ”€β”€ hooks/                   ← data hooks (query/mutation) + module hooks
β”‚       β”œβ”€β”€ stores/                  ← UI/client state store(s) β€” never server data
β”‚       β”œβ”€β”€ services/                ← data-access (API calls) for this feature
β”‚       β”œβ”€β”€ utils/                   ← pure module utilities (co-located *.test.ts)
β”‚       β”œβ”€β”€ constants/
β”‚       └── types/                   ← module request/response + view-model types
└── shared/                          ← cross-module building blocks
    β”œβ”€β”€ components/                  ← components used by 2+ MODULES
    β”œβ”€β”€ hooks/                       ← cross-cutting hooks
    β”œβ”€β”€ api-client/                  ← one typed client; the only place that talks to the network
    β”œβ”€β”€ store/                       ← root store wiring (if your state lib needs one β€” see Β§4)
    β”œβ”€β”€ utils/                       ← formatters, cn()/clsx, helpers
    β”œβ”€β”€ constants/
    └── types/

Every folder that can be empty at scaffold time keeps a .gitkeep so the structure is visible from day one.


2. Feature modules

A module is a vertical slice of the product (e.g. auth, billing, dashboard, settings). It contains everything that feature needs and exposes a deliberately small surface.

…

Pertanyaan umum

Apakah saya harus menggunakan library React tertentu?

Tidak, pengorganisasian ini bisa digunakan dengan library state atau styling apa pun yang Anda pilih untuk proyek React atau React Native.

Apa itu 'modul'?

Modul seperti kotak yang mengelompokkan semua bagian yang terkait dengan fitur aplikasi tertentu, misalnya 'autentikasi' atau 'pembayaran'.

Mengapa halaman dibuat sebagai folder, bukan file?

Membuat halaman sebagai folder sejak awal memudahkan Anda menambahkan file lain (seperti komponen atau style khusus halaman) tanpa perlu mengubah struktur di kemudian hari.

Detail

Deskripsi asli dari pembuat

A portable, framework-agnostic architecture style for any React or React Native frontend. Organizes apps into feature modules with page/screen directories, a strict server-state vs UI-state split, barrel-only cross-module imports, co-located styles, and clear component-promotion rules.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#4662
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa