This is a submission for the Sanity Challenge, Path Two: Vibe-Code Something Strange
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:
npx repoguard-rules audit
npx repoguard-rules init
The complete code is open-source under the MIT license on GitHub:
👉 github.com/taylormatematica-beep/repoguard
rule.ts):
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! 🛡️