agentleFS
asgardeoasgardeo/thunder/frontend/AGENTS.md

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.

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
  1. Very specific:

    Read with the root AGENTS.md.

    line 3
  2. Very specific:

    Every package's rolldown.config.js builds external from Object.keys(pkg.dependencies) and Object.keys(pkg.peerDependencies), which only …

    line 42
  3. Very specific:

    When scaffolding a new frontend/packages/* package, or adding an import of a subpath (somepkg/subpath) from an existing dependency: add …

    line 51
  4. Very specific:

    Read .agent/skills/ui-development/SKILL.md before writing or changing any UI: a page, dialog, form, table, card, shared component, or …

    line 59
  5. Very specific:

    Import components from @wso2/oxygen-ui and icons from @wso2/oxygen-ui-icons-react.

    line 65
  6. Very specific:

    Follow the existing page anatomy: PageContent + PageTitle + DocumentTitle for pages in the app shell, FullScreenCreationWizardLayout for …

    line 70
  7. Very specific:

    Read a component's docs before using or reconfiguring it.

    line 72
  8. Very specific:

    Every route destination is centralized in a per-app RouteConfig (frontend/apps/console/src/configs/RouteConfig.ts, …

    line 82
  9. Very specific:

    Never: write navigate('/some/path'), `navigate(/some/${id}), or <Link to="/some/path">.

    line 86
  10. Very specific:

    Never add a navigate('/new/path') call without registering the path there.

    line 100
  11. Very specific:

    Do not put the error toast in the mutation hook.

    line 112
  12. Distinctive:

    Read failures render in place of the data.

    line 120
  13. Very specific:

    Never surface server-returned error text.

    line 138
  14. Very specific:

    Keep one surface per failure.

    line 150
  15. Very specific:

    Use make / pnpm targets, not Nx (frontend build tooling is migrating to Turborepo).

    line 163
  16. Very specific:

    Inner loop: run the touched feature/page/component tests first (pnpm test in the relevant app or package).

    line 165
  17. Very specific:

    Final gate: run only the tests, lints, and Prettier formatting checks targeting the files you changed (pnpm test, pnpm lint, and pnpm …

    line 166
  18. Very specific:

    Every t('key') call must pass a fallback default string, either positionally as the second argument (third if interpolation values follow), …

    line 182
  19. Very specific:

    Never write ThunderID in text a user can see or hear: i18n values, t() fallbacks, JSX text, and alt, aria-label, title, or placeholder …

    line 190

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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/components first, 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-ui and icons from @wso2/oxygen-ui-icons-react. Never import from @mui/* or lucide-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 sx and theme tokens (p: 2, color: 'text.secondary', Typography variant). No hex or rgba() colors, px spacing, style={{}}, or CSS files.
  • Follow the existing page anatomy: PageContent + PageTitle + DocumentTitle for pages in the app shell, FullScreenCreationWizardLayout for create flows, SettingsCard sections and UnsavedChangesBar on 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 bundled node_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 Box or Typography, 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 through RouteConfig (app-local code) or a package's use<Domain>Routes() hook (see below).
  • Console's App.tsx <Route path> declarations and DashboardLayout.tsx's sidebar are built from the same RouteConfig/ROUTE_SEGMENTS, so the mounted route and every place that navigates to it share one source and can't drift apart. Read frontend/apps/console/src/configs/RouteConfig.ts directly — 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 a use<Domain>Routes() hook in hooks/use<Domain>Routes.ts, next to its route-shape interface and the defaults matching Console's current paths (for example GroupRoutePaths and defaultGroupRoutePaths in useGroupRoutes.ts). The hook reads the host-supplied paths with @thunderid/contexts's useRoutes and 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's use<Domain>Routes.ts) first, then consuming it. Never add a navigate('/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 own error state. 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 onError plus a call-site one is the standard way duplicates get introduced. Hooks keep their onSuccess toast; 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's onSuccess. That is already the pattern in every use{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 on isError, which is a signal the error belongs inline.
  • Render every read failure with QueryErrorNotice from @thunderid/components rather than a hand-rolled ListingTable.EmptyState or <Alert>. Use variant="block" (the default) for a list, grid, or page body, and variant="inline" for a tab section or in-card region. It takes the error and t and resolves the message itself — there is no description prop, so error.message is not representable through it. Pass resolveErrorMessage for a feature-specific resolver (e.g. getUserErrorMessage); it defaults to getErrorMessage. Pass onRetry for the default refresh button and action for a second action stacked below it (e.g. an edit page's "Back to X"); with no onRetry, action renders 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, no response.data.message, and no description defaultValue from 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 that error.message ?? t('fallback') never reaches the fallback — Error.message is always a string — so that idiom silently guarantees the raw text wins.
  • Resolve every message through the error catalog: getErrorMessage from @thunderid/utils, or a feature-specific wrapper such as getApplicationErrorMessage, so a backend error code maps to errors.<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 rendering create.error at the user. Codes shared across services (e.g. SSE-4030 for an authorization denial) resolve from common:errors.<CODE> when the feature namespace has no entry, so they need mapping only once. This requires t to forward an explicit ns: 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-call mutate(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, since ToastProvider holds 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 test in 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, and pnpm prettier --check scoped 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.