RepoGuard Studio: Guarding Next.js Architecture with Sanity Content Lake A developer built RepoGuard Studio, an open-source tool that stores architectural guardrails in Sanity's Content Lake and serves them via GROQ queries to AI coding assistants like Cursor, Claude Code, and Copilot. The project, released under the MIT license, includes a zero-install CLI (npx repoguard-rules audit/init) that scores repo architecture and generates stack-tailored rule files such as .cursorrules and CLAUDE.md to prevent AI-introduced anti-patterns. The developer notes that Cursor itself initially violated the tool's own separation-of-concerns rules during scaffolding, which was corrected using RepoGuard's own .cursorrules. This is a submission for the Sanity Challenge, Path Two: Vibe-Code Something Strange https://dev.to/challenges/sanity-2026-09-16 RepoGuard Studio is a living architectural guardrails hub designed to solve one of the most pressing headaches in modern AI-assisted engineering: AI code rot and layer bypassing . When developers use AI coding assistants Cursor, Claude Code, Windsurf, Copilot , the models write hundreds of lines in seconds. But without strict repo-level context, the AI quietly introduces destructive anti-patterns: : any to make compilers happy. Instead of hardcoding rules into static text files, RepoGuard Studio stores, structures, and serves architectural guardrails directly from Sanity's Content Lake using GROQ queries and structured schemas. .cursorrules , CLAUDE.md , and .windsurfrules with 1-click Copy & Download. dwzoo40f . Run the CLI in your terminal right now with zero installation: 1. Audit your repo architecture score: npx repoguard-rules audit 2. Generate stack-tailored guardrails: npx repoguard-rules init The complete code is open-source under the MIT license on GitHub: 👉 github.com/taylormatematica-beep/repoguard https://github.com/taylormatematica-beep/repoguard rule.ts : js import { defineType, defineField } from 'sanity'; export const ruleType = defineType { name: 'rule', title: 'Architectural Guardrail', type: 'document', fields: defineField { name: 'ruleId', title: 'Rule ID', type: 'string', validation: Rule = Rule.required } , defineField { name: 'title', title: 'Rule Title', type: 'string', validation: Rule = Rule.required } , defineField { name: 'category', title: 'Category', type: 'string', options: { list: 'Architecture', 'Security', 'Type Safety', 'Next.js / SSR', 'API Design', 'Code Quality' } } , defineField { name: 'severity', title: 'Severity Level', type: 'string', options: { list: 'Critical', 'Error', 'Warning', 'Info' } } , defineField { name: 'description', title: 'Description', type: 'text' } , defineField { name: 'rationale', title: 'Engineering Rationale', type: 'text' } , defineField { name: 'badCode', title: 'Violation Snippet', type: 'text' } , defineField { name: 'goodCode', title: 'Clean Architecture Snippet', type: 'text' } , defineField { name: 'fixSuggestion', title: 'Remediation Fix', type: 'string' } , , } ; type == "rule" | order ruleId asc { id, ruleId, title, category, severity, description, rationale, badCode, goodCode, fixSuggestion, frameworks, aiAssistants } This project was built entirely through an AI-native vibe-coding workflow using Cursor and Arena Agent Mode, with Next.js, React, and Sanity. While scaffolding the Next.js components, Cursor initially attempted to run raw database calls directly inside frontend event handlers — committing the very crime RepoGuard was meant to prevent Because the model lacked holistic context about clean separation of concerns, it treated the Sanity client as a generic client-side fetcher without proper error handling and fallback caching. We used RepoGuard's own .cursorrules to constrain the model: /src/sanity/client.js . The result is a fast, robust app that communicates seamlessly with Sanity's Content Lake. As required by the challenge guidelines, here are the project identifiers for the judges: production https://dwzoo40f.api.sanity.io/v2024-01-01/data/query/production?query= type%20==%20%22rule%22 By connecting Sanity's structured content model with real-time AI guardrails, RepoGuard Studio demonstrates how content operating systems can serve as the living memory and quality control system for AI-assisted engineering teams. Happy coding, and guard your codebases 🛡️