thunder / frontend
AGENTS.md614 starsChanged 7 months agoApache-2.0View on GitHub
Read with the root AGENTS.md. The frontend is a pnpm monorepo under frontend/ with three React apps, frontend/apps/console (admin console), frontend/apps/console-cp (the console the control plane serves: the same shell plus gateway management, with every administration operation running natively rather than through a flow) and frontend/apps/gate (login, registration, recovery), plus shared and feature packages under frontend/packages/. For feature-package layout and app boundaries, see the Frontend Development overview. Console management features ship as @thunderid/configure-* packages (e.g. @thunderid/configure-users) under frontend/packages/. Shared building…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- backend/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
19 rules. About 0 are common, 1 is distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 3
Read with the root AGENTS.md.
- Very specific: line 42
Every package's rolldown.config.js builds external from Object.keys(pkg.dependencies) and Object.keys(pkg.peerDependencies), which only …
- Very specific: line 51
When scaffolding a new frontend/packages/* package, or adding an import of a subpath (somepkg/subpath) from an existing dependency: add …
- Very specific: line 59
Read .agent/skills/ui-development/SKILL.md before writing or changing any UI: a page, dialog, form, table, card, shared component, or …
- Very specific: line 65
Import components from @wso2/oxygen-ui and icons from @wso2/oxygen-ui-icons-react.
- Very specific: line 70
Follow the existing page anatomy: PageContent + PageTitle + DocumentTitle for pages in the app shell, FullScreenCreationWizardLayout for …
- Very specific: line 72
Read a component's docs before using or reconfiguring it.
- Very specific: line 82
Every route destination is centralized in a per-app RouteConfig (frontend/apps/console/src/configs/RouteConfig.ts, …
- Very specific: line 86
Never: write navigate('/some/path'), `navigate(/some/${id}), or <Link to="/some/path">.
- Very specific: line 100
Never add a navigate('/new/path') call without registering the path there.
- Very specific: line 112
Do not put the error toast in the mutation hook.
- Distinctive: line 120
Read failures render in place of the data.
- Very specific: line 138
Never surface server-returned error text.
- Very specific: line 150
Keep one surface per failure.
- Very specific: line 163
Use make / pnpm targets, not Nx (frontend build tooling is migrating to Turborepo).
- Very specific: line 165
Inner loop: run the touched feature/page/component tests first (pnpm test in the relevant app or package).
- Very specific: line 166
Final gate: run only the tests, lints, and Prettier formatting checks targeting the files you changed (pnpm test, pnpm lint, and pnpm …
- Very specific: line 182
Every t('key') call must pass a fallback default string, either positionally as the second argument (third if interpolation values follow), …
- Very specific: line 190
Never write ThunderID in text a user can see or hear: i18n values, t() fallbacks, JSX text, and alt, aria-label, title, or placeholder …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md 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
Frontend — Agent Guide
Read with the root AGENTS.md. The frontend is a pnpm monorepo under frontend/ with three React apps,
frontend/apps/console (admin console), frontend/apps/console-cp (the console the control plane serves: the same
shell plus gateway management, with every administration operation running natively rather than through a flow) and
frontend/apps/gate (login, registration, recovery), plus shared and feature packages under frontend/packages/.
For feature-package layout and app boundaries, see the Frontend Development overview.
Feature Packages
Console management features ship as @thunderid/configure-* packages (e.g. @thunderid/configure-users) under
frontend/packages/. Shared building blocks live in packages such as @thunderid/components, @thunderid/hooks,
@thunderid/contexts, and @thunderid/i18n.
The Admin Console's (apps/admin-console) pages ship as @thunderid/manage-* packages (manage-users,
manage-groups, manage-roles, manage-agents), built on the React SDK's admin components. The two families split by
runtime: configure-* call the native management APIs only, while manage-* run destructive and lifecycle operations
through the server's administration flows (administrationMode: 'flow' by default), so grants are revoked and sessions
end first. Don't add flow handling to a configure-* package.
Gate consumes ThunderID's published SDK packages — @thunderid/react and @thunderid/react-router — from the separate
javascript-sdks repository. Clone that repository only to develop or
debug the SDK itself, or to test against unreleased SDK changes.
Project Scope
console-cp mounts projectDashboardRoutes() and projectFullScreenRoutes() from apps/console-cp/src/App.tsx twice:
under the project's path, where ProjectScopeProvider holds the selected project, and at the root, where no project is
selected. A configure-* package for a resource that can belong to a project reads the project with useProjectScope()
from @thunderid/contexts, puts projectId in its query keys, and sends it on list requests and in create requests.
Where no project is selected, as at the root or in the main console, projectId is undefined: lists show every
resource, in a project or not, and a create sends no project. For a type that needs a project, pass
createInProjectsOnly to its list and create pages, as the organization unit, notification template, and verifiable
credential pages do. To add a page, mount it in one of those two functions and add its domain to
PROJECT_SCOPED_DOMAINS in apps/console-cp/src/configs/RouteConfig.ts, which keeps its links under the project's
path. Backend rules for such a resource are in the backend skill's resource.md.
rolldown External Subpaths
Every package's rolldown.config.js builds external from Object.keys(pkg.dependencies) and
Object.keys(pkg.peerDependencies), which only matches a dependency's bare specifier (e.g. @thunderid/logger).
rolldown matches external by exact string, so an import of a subpath of that dependency (e.g.
@thunderid/logger/react, @hookform/resolvers/zod) is not covered and gets inlined into this package's own dist
output instead of staying external. For a dependency backed by a React context (e.g. @thunderid/logger), this silently
creates a second createContext() instance in this package's bundle, so the copy's useContext never sees the value
the host app's provider supplies — a use<Thing> must be used within a <Thing>Provider crash that reproduces in
production only (dev aliases workspace packages to source, masking it) and never in tests.
When scaffolding a new frontend/packages/* package, or adding an import of a subpath (somepkg/subpath) from an
existing dependency: add that exact subpath as a string literal to the package's rolldown.config.js external array,
next to the existing // Peer dep subpaths are not matched by exact string - add them explicitly. entries (see
packages/configure-resource-servers/rolldown.config.js). Do this for every subpath actually imported by the package's
source, not just @thunderid/logger/react.
UI Components and Styling
Read .agent/skills/ui-development/SKILL.md before writing or changing any UI: a page, dialog, form, table, card, shared component, or styling. The rules that matter most:
- Reuse before you build. Check
@thunderid/componentsfirst, then Oxygen UI's own components, and write a new component only when neither has it. A component a second package needs moves into@thunderid/components. It is never copied. - Import components from
@wso2/oxygen-uiand icons from@wso2/oxygen-ui-icons-react. Never import from@mui/*orlucide-react. For a product category (Overview, Deploy, Gateways, and others), use the icon the WSO2 unification guidelines assign to it, listed in the skill's Category Icons table. - Style with
sxand theme tokens (p: 2,color: 'text.secondary',Typography variant). No hex orrgba()colors,pxspacing,style={{}}, or CSS files. - Follow the existing page anatomy:
PageContent+PageTitle+DocumentTitlefor pages in the app shell,FullScreenCreationWizardLayoutfor create flows,SettingsCardsections andUnsavedChangesBaron edit pages. - Read a component's docs before using or reconfiguring it. The Oxygen Storybook (https://wso2.github.io/oxygen-ui, and
the story source at the pinned version's git tag) says which variant to use when, for example for
ListingTable. The bundlednode_modules/@wso2/oxygen-ui/.ai/docs are a quick reference but can lag the stories. Use a documented prop before writing custom styling. - Meet WCAG 2.1 AA, as Oxygen does. Follow each component's Accessibility section in Storybook: every control has an
accessible name, nothing clickable is a
BoxorTypography, focus stays visible, and state is never shown by color alone.
Route Configuration — Never Hardcode a Path
Every route destination is centralized in a per-app RouteConfig (frontend/apps/console/src/configs/RouteConfig.ts,
frontend/apps/console-cp/src/configs/RouteConfig.ts, frontend/apps/gate/src/configs/RouteConfig.ts), never a literal
path string scattered through app code.
- Never write
navigate('/some/path'),navigate(`/some/${id}`), or<Link to="/some/path">. Always resolve the destination throughRouteConfig(app-local code) or a package'suse<Domain>Routes()hook (see below). - Console's
App.tsx<Route path>declarations andDashboardLayout.tsx's sidebar are built from the sameRouteConfig/ROUTE_SEGMENTS, so the mounted route and every place that navigates to it share one source and can't drift apart. Readfrontend/apps/console/src/configs/RouteConfig.tsdirectly — do not trust a copied route table, which goes stale. - A
@thunderid/configure-*package must never hardcode or assume the host app's URL structure. Each package that links to or navigates between pages defines ause<Domain>Routes()hook inhooks/use<Domain>Routes.ts, next to its route-shape interface and the defaults matching Console's current paths (for exampleGroupRoutePathsanddefaultGroupRoutePathsinuseGroupRoutes.ts). The hook reads the host-supplied paths with@thunderid/contexts'suseRoutesand falls back to the package's own defaults for any key the host does not supply. Components call this hook and build destinations from its returned functions, never a literal string. This is what lets a package be mounted under a different URL by a different host app without touching the package's code. - Adding a new route means updating
RouteConfig(or a package'suse<Domain>Routes.ts) first, then consuming it. Never add anavigate('/new/path')call without registering the path there.
Error Display
Failed writes belong inline, next to the form or action that failed. Failed reads belong wherever the missing data was
going to render. useToast from @thunderid/contexts is for confirmations, and for failures that have nowhere on the
page to live.
- A mutation failure renders inline wherever the action has a form or dialog — create wizards, edit pages, and confirm
dialogs. Put an
<Alert severity="error">beside the submit control, driven off the mutation's ownerrorstate. The user has to read the reason, correct an input, and retry, and a toast dismisses itself before that. Some messages are long and interpolated (e.g.errors.APP-1039) and do not fit a snackbar at all. - Do not put the error toast in the mutation hook. A hook cannot know whether its caller has somewhere to show the
message, and a hook-level
onErrorplus a call-site one is the standard way duplicates get introduced. Hooks keep theironSuccesstoast; failures are the caller's decision. - Mutations fired straight from a row action, toggle, or menu item may toast, because there is no form to attach to and no dialog to keep open. Decide by asking where the user's attention already is and whether they need the text to persist while they fix something, not by the HTTP verb.
- Mutation successes stay toasts —
showToast(t('create.success'), 'success')in the hook'sonSuccess. That is already the pattern in everyuse{Create,Update,Delete}*hook. - Read failures render in place of the data. If a query is a surface's primary content — a list, a grid, a detail page,
a tab body — render an error component where that content would have gone, with a way to retry. A toast alongside it
is fine, but never instead of it: a toast auto-dismisses and leaves the user staring at an empty page with no
explanation. If the query is secondary and the page is still usable without it (a picker's options, an optional count,
a background prefetch), a toast on its own is right, because there is nowhere natural to put it inline. React Query
has no query
onError, so a query hook cannot toast on its own — reaching for one means adding a render-phase or effect watcher onisError, which is a signal the error belongs inline. - Render every read failure with
QueryErrorNoticefrom@thunderid/componentsrather than a hand-rolledListingTable.EmptyStateor<Alert>. Usevariant="block"(the default) for a list, grid, or page body, andvariant="inline"for a tab section or in-card region. It takes the error andtand resolves the message itself — there is nodescriptionprop, soerror.messageis not representable through it. PassresolveErrorMessagefor a feature-specific resolver (e.g.getUserErrorMessage); it defaults togetErrorMessage. PassonRetryfor the default refresh button andactionfor a second action stacked below it (e.g. an edit page's "Back to X"); with noonRetry,actionrenders alone. - Clear an inline error as soon as the user acts on it. Any change to the form invalidates the message, so a
duplicate-name error must disappear when the name is edited rather than sitting there contradicting the field. Reset
the mutation (
mutation.reset()) or the local error state from whatever the form's field-change path is, and on cancel or reset too. A stale error next to a now-valid form is worse than no error. - Never surface server-returned error text. No
error.message, noresponse.data.message, and nodescriptiondefaultValuefrom the error envelope. That text is unlocalized, is written for API consumers rather than end users, and leaks backend and HTTP wording into the product. This applies to read failures exactly as much as to writes. Note thaterror.message ?? t('fallback')never reaches the fallback —Error.messageis always a string — so that idiom silently guarantees the raw text wins. - Resolve every message through the error catalog:
getErrorMessagefrom@thunderid/utils, or a feature-specific wrapper such asgetApplicationErrorMessage, so a backend error code maps toerrors.<CODE>with a generic fallback key. Pass the fallback's default string too, per the i18n Fallback Values rule below, so a missing key degrades to readable English instead of renderingcreate.errorat the user. Codes shared across services (e.g.SSE-4030for an authorization denial) resolve fromcommon:errors.<CODE>when the feature namespace has no entry, so they need mapping only once. This requirestto forward an explicitns:prefix, so a per-call-site namespace wrapper must pass keys that already carry one straight through. - Keep one surface per failure. TanStack Query fires both
useMutation({onError})and the per-callmutate(vars, {onError}), so defining an error surface in both is how duplicates appear. Two toasts for one failure are worse than visibly duplicated: the second silently replaces the first, sinceToastProviderholds only one message at a time, so the user may never see the specific one. - An error from a dialog belongs in that dialog. If the action was fired from a modal, close the modal only in the
success path and render the
<Alert>inside it, next to the confirm button. Closing on submit, or rendering the error on the surface behind the modal, leaves the user looking at a re-enabled dialog with no explanation. When the parent component owns the mutation because it also serves a non-dialog path, pass the error into the dialog as a prop rather than rendering it in the parent. Never discard the user's input — a selection, a filled form — on failure; only clear it once the mutation succeeds, or the error costs them the whole task.
Build & Test
Use make / pnpm targets, not Nx (frontend build tooling is migrating to Turborepo).
- Inner loop: run the touched feature/page/component tests first (
pnpm testin the relevant app or package). - Final gate: run only the tests, lints, and Prettier formatting checks targeting the files you changed
(
pnpm test,pnpm lint, andpnpm prettier --checkscoped to the affected app or package), not the full frontend suite.
Cross-OS Path Handling
Build tooling and Node scripts must work on Windows as well as macOS/Linux. Node's path (join, resolve, sep)
produces the OS-native separator, a backslash on Windows, while many build-tool APIs and identifiers (e.g. Vite module
ids/importers, glob patterns) are always POSIX forward-slash. Never compare an OS-native path against one of these with
startsWith/===, and never hand a backslash path back to a tool that expects POSIX paths. Normalize to forward
slashes first (e.g. normalizePath from vite, or replacing \ with /) and compare using a literal '/' rather
than sep. This applies to any string built from join/resolve/realpathSync that will be matched against, or
returned to, such a tool.
i18n Fallback Values
Every t('key') call must pass a fallback default string, either positionally as the second argument (third if
interpolation values follow), e.g. t('applications:foo.bar', 'Fallback text', {count}), or as defaultValue inside
the options object, e.g. t('applications:foo.bar', {defaultValue: 'Fallback text', count}). Both forms are valid;
prefer whichever the surrounding code already uses. This matches the existing convention across the codebase and ensures
the UI degrades gracefully if a key or locale is missing.
Product Name
Never write ThunderID in text a user can see or hear: i18n values, t() fallbacks, JSX text, and alt, aria-label,
title, or placeholder attributes. Deployments rebrand through the runtime brand config, so read the name from it. In
a translation, use the {{productName}} placeholder and pass the value at the call site:
const {config} = useConfig(); // from @thunderid/contexts
t('settings:page.subtitle', 'Settings that apply across your entire {{productName}} deployment.', {
productName: config.brand.product_name,
});Elsewhere, use config.brand.product_name directly. License headers, import paths, identifiers, test fixtures, and the
default product_name in an app's public/config.js are exempt.
Browser Automation
Load .agent/skills/console/SKILL.md only when browser navigation or UI verification is actually required.
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.

