Awesome-omni-skill portal-dev
Coding standards and patterns for the SIO Delhi portal. Use when writing new portal features, components, API endpoints, or fixing bugs in the portal codebase. Automatically loaded for portal development tasks.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/portal-dev" ~/.claude/skills/diegosouzapw-awesome-omni-skill-portal-dev && rm -rf "$T"
manifest:
skills/development/portal-dev/SKILL.mdsource content
Portal Development Standards
Tech Stack
- Frontend: React 19 + TypeScript 5.9 + Vite 7 (strict mode ON)
- Styling: Custom CSS design tokens (portal-tokens.css), NOT Tailwind in portal
- Auth: Clerk (JWT RS256, phone/email login)
- Backend: PHP (plain, no framework) on cPanel with MySQL via PDO
- State: React Context + hooks (PortalAuthContext, NotificationContext)
TypeScript Rules
- No
— useany
and narrow with type guardsunknown - No
— fix the type instead@ts-ignore - Prefer
overinterface
for object shapestype - All API responses typed in
src/portal/types.ts - Use discriminated unions for state (loading | error | success)
React Rules
- Functional components only, custom hooks for reusable logic (useX naming)
- No prop drilling > 2 levels — use context or composition
- useEffect only for sync with external systems (API, DOM, subscriptions)
- Never store derived state — compute inline or useMemo
- Handle loading, error, empty states in every async component
- Dialog pattern: parent owns
state, dialog hasshowDialog
propsopen/onConfirm/onCancel
CSS Rules (Portal)
- Use portal design tokens:
,--p-red
,--p-bg-card
,--p-border
,--p-cream
,--p-amber--p-text-muted - Class naming:
(e.g.portal-{component}-{modifier}
,portal-btn-primary
)portal-badge-revoked - Add reusable styles to
, inline styles OK for one-off layoutportal-components.css - Responsive: test at 320px, 768px, 1024px, 1440px
PHP Backend Rules
- PDO prepared statements for ALL queries — never concatenate user input into SQL
- JSON responses:
or{ success: true, data: ... }{ success: false, error: "..." } - Function naming:
(e.g.portalVerbNoun
,portalGetUsers
,portalCreateUnit
)portalRevokeUser - Always check JWT + role before data access
- Return appropriate HTTP status codes (200, 201, 400, 401, 403, 404, 500)
API Call Pattern (Frontend)
// In api.ts — all API calls go through apiFetch with auth header // Errors thrown as Error objects, caught in component try/catch // Always show error to user via setSaveError or setError state
Date Handling
- Storage: DDMMYYYY string (e.g. "25031999")
- Display: DD/MM/YYYY or "25 Mar 1999"
- Input:
component (calendar picker, always DD/MM/YYYY)<DateInput> - Never use raw
— always use DateInput component<input type="date">
File Naming
components/ PascalCase.tsx (DateInput.tsx, StatusBadge.tsx) pages/ PascalCase.tsx (DashboardPage.tsx, ViewMemberPage.tsx) hooks/ camelCase.ts (useNotifications.ts) context/ PascalCase.tsx (PortalAuthContext.tsx) __tests__/ camelCase.test.ts (api.test.ts) *.ts camelCase.ts (api.ts, types.ts, constants.ts) *.css kebab-case.css (portal-components.css)
Build Verification
Always run after changes:
npx tsc --noEmit # Type check npx vite build # Production build
Key Files
- Types:
src/portal/types.ts - API client:
src/portal/api.ts - Constants & field definitions:
src/portal/constants.ts - Routes:
src/portal/PortalRoutes.tsx - Auth context:
src/portal/context/PortalAuthContext.tsx - Backend routes:
api/routes/portal.php - API router:
api/index.php - Design tokens:
src/portal/portal-tokens.css - Component styles:
src/portal/portal-components.css
Role Hierarchy
admin > zonal_secretary > regional_president > unit_president/campus_president > member
Member Statuses
active | inactive | migrated | revoked
- inactive: reversible, stores reasons + who set it
- revoked: reversible, hidden from unit/regional, stores reason + who revoked
- Delete: permanent removal (admin/zonal only)