Stop Claude Code or Codex from putting all feature code into a single bloated file during a refactor.
Keep API call logic separated from UI components when asking an AI agent to build a new feature.
Add planning guardrails to AI coding sessions without locking the agent into a fixed folder structure.
Copy one file to .claude/skills/modular-code-guard/ for Claude Code or .agents/skills/ for Codex.
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.
← anthonystepvoy on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.