explaingit

anthonystepvoy/modular-code-guard

12Audience · developerComplexity · 1/5Setup · easy

TLDR

A set of instruction files you add to your project to stop AI coding agents from piling everything into one giant file, by prompting the agent to plan file structure before it writes any code.

Mindmap

mindmap
  root((modular code guard))
    What it does
      File structure planning
      Prevents bloated files
      MCP code separation
    Compatible agents
      Claude Code
      Codex
    Problems prevented
      Files over 1000 lines
      UI and API mixed
      Logic in route files
    Installation
      Copy skill file
      Reference in prompts
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Stop Claude Code or Codex from putting all feature code into a single bloated file during a refactor.

USE CASE 2

Keep API call logic separated from UI components when asking an AI agent to build a new feature.

USE CASE 3

Add planning guardrails to AI coding sessions without locking the agent into a fixed folder structure.

Tech stack

Claude CodeCodex

Getting it running

Difficulty · easy Time to first run · 5min

Copy one file to .claude/skills/modular-code-guard/ for Claude Code or .agents/skills/ for Codex.

In plain English

modular-code-guard is a set of instruction files designed to be added to software projects that use AI coding agents, specifically Claude Code and Codex. It does not add commands or run any code itself. Instead, it works by giving the agent a short set of guidelines that prompt it to think about file structure before it writes or changes code. The problem the project targets is familiar to anyone who has used AI agents to build features: agents tend to put everything in one file. UI code, API calls, business logic, validation rules, and state management can all end up in a single route or component file. This makes the resulting codebase difficult to review, test, and change safely. modular-code-guard adds a small planning step before the agent starts writing, so it considers where each responsibility should live. The skill tries to prevent files that balloon to one thousand or more lines during feature work, routing files that contain all feature logic, and API calls embedded inside UI components. It also includes guidance for organizing MCP (Model Context Protocol) code, which refers to tooling that lets AI agents interact with external services. The guidance keeps that code separate from UI rendering logic. To install, you copy a single skill file into the correct folder in your project. For Claude Code, the file goes into .claude/skills/modular-code-guard/. For Codex, it goes into .agents/skills/. After that, you reference the skill in your prompts when asking the agent to work on non-trivial features or refactors. The project is clear about its limits. It does not enforce a fixed folder layout, does not automatically refactor code, and does not replace code review or tests. It describes itself as a practical guardrail that gives agents better defaults without imposing a heavy workflow.

Copy-paste prompts

Prompt 1
Using modular-code-guard, ask Claude Code to add a file upload feature to my app and show the file structure plan before writing any code.
Prompt 2
Activate modular-code-guard in Codex and refactor this 1200-line route file by separating business logic, API calls, and UI into proper modules.
Prompt 3
With modular-code-guard installed, ask the agent to build a new auth flow and ensure MCP tool code is kept separate from rendering logic.
Open on GitHub → Explain another repo

← anthonystepvoy on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.