Astro Audit & Remediation Framework (run-astro-audit)
An enterprise-grade, end-to-end audit, static AST linting, and autonomous multi-agent remediation framework for modern Astro applications (Astro 4, 5, and 7+).
This framework couples Astro Sentinel—a high-speed AST linter powered by @astrojs/compiler that deterministically validates 170 architectural best practices across components and schemas—with an autonomous 6-phase remediation lifecycle that drives issues from initial discovery to isolated worktree fixes, dedicated PR creation, review comment harvesting, and conflict-free serial merge queues.
When to Use
- Conducting a comprehensive, full-repository audit of an Astro codebase across routing, performance, hydration, assets, SEO, and edge runtime boundaries.
- Running deterministic static AST and contract validation via Astro Sentinel before pull requests or releases.
- Partitioning broad architectural overhauls or audit findings into parallel, non-conflicting subagent waves in isolated Git worktrees.
- Creating structured, actionable GitHub issue trees and tracking remediation progress across multiple waves.
- Harvesting external code-review feedback (e.g. Codex, automated bot reviews, team human reviews) and routing remediation back to assigned owners.
- Managing serial rebase and merge queues to avoid merge conflicts across dozens of concurrent workload branches.
Do NOT use when:
- Performing simple, single-file bugfixes that do not require multi-wave or worktree orchestration.
- Reviewing PRs without an active audit or remediation workload (use
run-reviewinstead). - Verifying arbitrary general task completion without an Astro architectural scope (use
audit-completioninstead).
Architecture & System Components
skills/run-astro-audit/
├── SKILL.md # Authoritative routing, lifecycle gates, and CLI contracts
├── README.md # Installation and marketplace distribution metadata
├── scripts/ # Core execution engines and helper automation
│ ├── astro-sentinel-runner.mjs # Unified AST & contract runner with CLI flags (--strict, --json)
│ ├── astro-sentinel-guard.mjs # Component AST scanner (@astrojs/compiler AST rules)
│ ├── astro-contract-guard.mjs # Schema, Content Layer, and cross-file contract guard
│ ├── worktree-manager.sh # Worktree lifecycle automation (provision, list, prune, sweep)
│ └── review-harvest.sh # Pull request review and comment harvester for feedback triage
└── references/
├── tooling/ # Modern static analysis, ESLint & Prettier architecture
│ └── eslint-and-prettier-alignment.md # 4-layer hierarchy, Flat Config, A11y, Prettier ordering
├── audit-taxonomy/ # Thematic layer classification and scoping rules
│ └── thematic-layers.md # 7-layer architecture taxonomy (Layer 01 through Layer 07)
├── orchestration/ # Multi-wave autonomous agent lifecycle protocols
│ ├── github-issue-reporting.md # Issue creation contract, naming conventions, and hierarchy
│ ├── wave-planning-and-worktrees.md # Dependency wave mapping and worktree isolation policy
│ ├── subagent-mission-prompting.md # Standalone subagent brief generation engine
│ ├── review-feedback-ingestion.md # PR review comment triage and remediation loop
│ └── serial-merge-and-conflict-queue.md # Conflict-free rebase queue and safe cleanup protocol
├── best-practices/ # 170 atomic Astro architectural rule cards across 10 categories
│ ├── README.md # Rule card index and categorization overview
│ └── */*.md # 10 category directories (01-architecture through 10-auditing)
└── workloads/ # 70 workload specifications across 7 thematic layers
├── README.md # Workload registry and layer mapping index
└── */*.md # 7 layer directories (01-templates through 07-migration)
The 6-Phase Operating Loop
Phase 1: Deterministic AST & Contract Linting (Astro Sentinel)
Before deploying subagents or manual inspection, execute the Astro Sentinel linter engine to deterministically catch syntax flaws, deprecated patterns, missing fallback slots, and schema leaks.
# Full codebase scan with detailed terminal diagnostic report
node scripts/astro-sentinel-runner.mjs
# Strict CI mode (exits with code 1 if errors are detected)
node scripts/astro-sentinel-runner.mjs --strict
# Automated tooling / JSON output mode
node scripts/astro-sentinel-runner.mjs --json
# Run against git staged files only
node scripts/astro-sentinel-runner.mjs --staged
# Isolate a specific rule
node scripts/astro-sentinel-runner.mjs --rule=01-arch/no-virtual-dom-handlers
Rule Invariant Coverage (Astro Sentinel)
1. Component AST Guard (astro-sentinel-guard.mjs):
01-arch/no-virtual-dom-handlers: Prohibits synthetic JSX events (onClick,onChange) in.astrotemplates. Use native Web Components or<script>.01-arch/no-unscoped-global-styles: Prohibits unscoped<style is:global>leaks in leaf components. Encapsulate CSS or relocate to layout root.01-arch/no-process-env: Prohibits legacy Nodeprocess.env.*in frontmatter; enforces standard Astroimport.meta.env.*.02-islands/no-blind-client-load: Prevents hydration bottlenecking withclient:loadon below-the-fold components; enforcesclient:idleorclient:visible.02-islands/no-sensitive-props-leak: Flags sensitive/gated props (token,secret,apiKey,fileUrl) passed into client islands serialized to public HTML.02-islands/require-client-only-fallback: Enforces slotted fallback markup forclient:onlycomponents to prevent layout shift before hydration.06-security/no-set-html-directive: Guards against unescaped XSS injections via rawset:html(exempting structuredapplication/ld+jsonscripts).07-assets/prefer-astro-image: Recommends<Image />or<Picture />over native unoptimized<img>tags.07-assets/require-image-dimensions: Mandates explicitwidthandheighton images to eliminate Cumulative Layout Shift (CLS).07-assets/require-image-alt: Enforces WCAG 2.2 SC 1.1.1 descriptivealtattributes on all image elements.08-i18n/no-hardcoded-locale-routes: Prohibits hardcoded/en/or/tr/prefixes; enforces localized route helpers.09-perf/no-blanket-viewport-prefetch: Flags aggressivedata-astro-prefetch="viewport"on anchor tags to prevent bandwidth exhaustion.10-migration/no-nextjs-ghost-imports: Prohibits residual Next.js imports (next/image,next/link,next/router).10-migration/no-raw-css-file-imports: Flags raw CSS file imports in.astrofrontmatter.
2. Contract & Schema Guard (astro-contract-guard.mjs):
04-content/require-zod-date-coercion: Enforcesz.coerce.date()over rawz.date()in Content Layer schemas.04-content/enforce-entry-id-contract: Enforcesentry.ididentification contracts and prevents directfs.readFileSyncin dynamic routes.04-content/no-deprecated-getentrybyslug: Flags deprecatedgetEntryBySlugin favor ofgetEntry(collection, id).06-middleware/static-asset-bypass-integrity: Verifies/_astro/and/assets/bypass paths in edge middleware to prevent static chunk stalls.05-edge/node-runtime-import-closure: Prohibitsnode:*runtime imports in Cloudflare Workers and client surfaces withoutnodejs_compat.03-routing/no-prerender-outside-pages: Flagsexport const prerenderdefined outsidesrc/pages/route entrypoints.
3. Suppression Syntax: Conscious architectural exceptions can be suppressed with inline pragmas:
---
// @astro-allow 02-islands/no-blind-client-load
---
<!-- @astro-allow 07-assets/prefer-astro-image -->
<img src="/assets/preview.png" alt="Preview" width="800" height="600" />
Phase 1b: Production ESLint, Prettier & Quality Tooling Alignment
Astro Sentinel operates as Layer 1 of a holistic 4-layer static quality architecture. Consult