From b82fcc31f2f5cbb560779a9e921532acab0470e1 Mon Sep 17 00:00:00 2001 From: munsunouk <52026496+munsunouk@users.noreply.github.com> Date: Fri, 3 Jul 2026 14:05:34 +0200 Subject: [PATCH] feat: add Astro-specific review rules (#289) --- internal/config/rules/rule_docs/astro.md | 45 ++++++++++++++++++++++ internal/config/rules/system_rules.json | 1 + internal/config/rules/system_rules_test.go | 14 ++++++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 internal/config/rules/rule_docs/astro.md diff --git a/internal/config/rules/rule_docs/astro.md b/internal/config/rules/rule_docs/astro.md new file mode 100644 index 00000000..5bdb8d9d --- /dev/null +++ b/internal/config/rules/rule_docs/astro.md @@ -0,0 +1,45 @@ +#### Obvious Typos or Spelling Errors +- Spelling errors in component names, props, slots, or user-facing strings that affect readability + +#### Dead Code +- Unused islands, framework components, scripts, or template branches that add client cost without affecting rendered behavior + +#### Astro Component Boundaries +- When frontmatter data reaches client HTML, inline scripts, or hydrated islands, verify whether it was computed at build time or request time and whether exposing non-`PUBLIC_` env values, cookies, headers, sessions, `Astro.locals`, secrets, request-only data, or server-only APIs is intentional +- Flag `.astro` templates that appear to assume frontmatter values are reactive in the browser +- Flag framework components used only to render static markup when plain Astro markup would avoid unnecessary client JavaScript + +#### Hydration and Islands +- `client:*` applies only to directly imported UI framework components, not `.astro` components or dynamic tags +- Flag `client:load` on non-critical UI, missed `client:idle` or `client:visible` opportunities, `client:media` where the media query does not actually gate the interaction need, and over-hydration from large or overly numerous islands +- Flag `client:only` without the framework string or without fallback content when the result is blank or confusing pre-hydration UI + +#### Server-to-Client Data Transfer +- Flag hydrated framework component props or server-fetched data passed client-side without reducing to the minimal interaction payload; props crossing hydrated boundaries must use Astro-supported serializable types, so flag functions, class instances, circular objects, secrets, and unnecessarily large payloads. +- `