frontend-architecture

frontend-architecture is a cursor rule for Cursor from tomasz-tomczyk/crit. It costs 4 tokens per session (1,359 once invoked), scanned A, original, MIT.

Frontend architecture rules for a JavaScript application with live review and code-review modes. The rules describe which modules each mode loads and how shared code is structured and exposed.

In plain words
What is it for?
Use them when adding or reviewing frontend modules, deciding where shared code belongs, or maintaining the application’s two page modes and Node.js tests.
Why use it?
They reduce inconsistencies in a project without a build step, including accidental use of unsupported JavaScript module syntax.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when adding or reviewing frontend modules, deciding where shared code belongs, or maintaining the application’s two page modes and Node.js tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tomasz-tomczyk/crit/frontend-architecture
About the project

Crit is a local review tool for examining agent-generated plans, code changes, web applications, and static HTML. Developers use it to point to specific problems and send feedback back to their coding agent, with a different review interface for each type of output.

tomasz-tomczyk/crit · 1,223 stars · on GitHub · crit.md

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/tomasz-tomczyk/crit

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for frontend-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/tomasz-tomczyk/crit/frontend-architecture/github.svg)](https://agentmods.dev/rules/tomasz-tomczyk/crit/frontend-architecture)
Your own site
<a href="https://agentmods.dev/rules/tomasz-tomczyk/crit/frontend-architecture"><img src="https://agentmods.dev/badge/rules/tomasz-tomczyk/crit/frontend-architecture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for frontend-architecture

Your own site · 80×15
<a href="https://agentmods.dev/rules/tomasz-tomczyk/crit/frontend-architecture"><img src="https://agentmods.dev/badge/rules/tomasz-tomczyk/crit/frontend-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,359 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00004 $0.01359
Opus 5.5 $0.00002 $0.00544
Sonnet 5.5 $0.00001 $0.00272
Haiku 4.5 $0.00000 $0.00136

Measured 22d ago against content hash 4b45c5f03578, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

frontend-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 22d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/frontend-architecture.mdc · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Frontend Architecture

Two-Paradigm Page Fork

index.html serves both modes from a single HTML shell. A script block at load time checks window.location.pathname:

  • /live → live mode (iframe-based pin review)
  • Everything else → code-review mode (file tree + diff/document views)

Each mode dynamically loads its own script set. They share: theme pill, settings overlay, and extracted modules.

Module Pattern

All custom JS uses the IIFE + dual-export pattern:

(function () {
  'use strict';
  // ... implementation ...
  var api = { publicFn1, publicFn2 };
  if (typeof window !== 'undefined') {
    window.crit = window.crit || {};
    window.crit.<namespace> = api;
  }
  if (typeof module === 'object' && module.exports) {
    module.exports = api;
  }
})();
  • Runtime: accessed via window.crit.<namespace>
  • Tests: required via module.exports (Node.js --test)
  • Never use ES modules (import/export) — no build step exists

Shared Modules (used by both modes)

Module Namespace Purpose
crit-shared.js window.crit.shared Cookie helpers, theme, tip rotation, image upload
crit-renderer.js window.crit.renderer ContentRenderer registry (register/deregister/current)
crit-sse.js window.crit.sse SSE client factory (createSSE)
crit-draft.js window.crit.draft Autosave drafts to localStorage
crit-comment-templates.js window.crit.commentTemplates Template bar + saved-snippet CRUD
crit-comment-form.js window.crit.commentForm Shared comment form creation
crit-comment-card.js window.crit.commentCard Comment card rendering + reply threading
crit-comment-card-helpers.js window.crit.commentCardHelpers Author colors, timestamps, markdown rendering
crit-settings-overlay.js window.crit.settingsOverlay Settings dialog lifecycle
crit-settings-panes.js window.crit.settingsPanes Settings tab content

Read the full file on GitHub · 120 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 22d ago Changed · +3 lines 4b45c5f03578
  2. 1mo ago First seen · 117 lines · 4 tokens per session scan A 423ec65efa7a

Subscribe to this mod's changes

frontend-architecture is a cursor rule published in the GitHub repository tomasz-tomczyk/crit (1,223 stars, last pushed 2d ago), licensed MIT. It adds 4 tokens to every session and 1,359 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.