diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..2934ca6 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,358 @@ +# Copilot Instructions + +This is a frontend React-based repository for the Walrus Archive platform. It focuses on artifact submission, discovery, and governance using Sui + Walrus storage. Please follow these guidelines when contributing. + +--- + +## Code Standards + +### Code Philosophy + +Follow these principles when writing frontend code: + +- Prefer **simple solutions** +- Avoid **unnecessary abstractions** +- Favor **readability over clever code** +- Write **maintainable and predictable code** +- Follow **existing patterns in the codebase** + + + +--- + +## Tech Stack + +### Languages + +- TypeScript +- JavaScript + +### Frontend + +- React (functional components only) +- React Router +- TailwindCSS + +### Testing + +- Jest + +--- + +## Repository Structure (Expected) + +- `components/` — reusable UI components +- `pages/` — route-level pages +- `hooks/` — custom hooks +- `services/` — API / GraphQL / blockchain logic +- `utils/` — helpers +- `assets/` — static files (SVGs, etc.) +- `docs/` — documentation + +--- + +## React Component Rules + +### Functional Components Only + +Always use **functional components**. +Avoid class components. + +--- + +### Component Design + +Prefer **small reusable components**. + +Example structure: + +``` +components/ + Button/ + index.tsx + Avatar/ + index.tsx +``` + +Avoid large monolithic components. + +--- + +### JSX Rules + +Keep JSX **clean and readable**. + +Move complex logic **outside the return statement**. + +Prefer optional chaining instead of long logical chains. + +**Bad:** + +```tsx +
{user && user.profile && user.profile.name}
+``` + +**Preferred:** + +```tsx +const name = user?.profile?.name; + +
{name}
; +``` + +--- + +## Styling & Layout + +### Layout Primitives + +Use layout primitives instead of raw layout CSS. + +Preferred components: + +- `Flex` +- `Stack` +- `Center` + +Avoid inline layout styles like: + +```tsx +
+``` + +--- + +### Tailwind Rules + +Use **TailwindCSS utilities** for styling. + +Avoid: + +- custom CSS files +- `