Skip to main content
rule CX Codex

0-folder-size — Claude Code rule: folder file limit

The 0-folder-size rule keeps directories from growing past ten direct .ts files. It also records why an oversized directory exists instead of encouraging file shuffling.

MIT ★ 571 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/0-folder-size.md
Open on GitHub

What 0-folder-size does

The rule targets files under src/**/*.ts and sets a ceiling of ten direct .ts files in one directory. When a directory goes beyond that count, record its size and the reason it has grown.

Remove that record once the underlying defect is fixed. Do not move files merely to hit the number; the rule is meant to expose duplicated helpers and explain exceptions. For Claude Code, put the file at .claude/rules/0-folder-size.md.

What it helps with

  • count direct .ts files in each directory
  • record why a directory exceeds the limit
  • spot directories where helpers may be duplicated
  • remove an exception after the defect is fixed
  • avoid reshuffling files to meet a threshold

Example prompts for the agent

  • Review src/**/*.ts against the 0-folder-size rule and list directories with more than ten direct .ts files.
  • For every oversized directory, record its file count and the reason for its size.
  • Remove the directory entry after the defect that caused it has been fixed.

How to install 0-folder-size

Manually: put the files in place

.claude/rules/0-folder-size.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about 0-folder-size

How do I install 0-folder-size in Claude Code?

Place the rule file at .claude/rules/0-folder-size.md.

What does 0-folder-size do?

It limits a directory to ten direct .ts files and asks for the count and reason when that limit is exceeded. It also rejects moving files solely to satisfy the threshold.

Which files does the 0-folder-size rule cover?

It applies to files matched by src/**/*.ts.

Source text

0-folder-size.md · MIT
---
description: Apply when a directory grows; ten direct source files is the limit.
paths:
  - "src/**/*.ts"
---

# Folder Size

- Ten direct `.ts` files per directory (`folder-size.arch.test.ts`).
- Past that, helpers get written twice.
- Baseline an oversize directory with its count and reason.
- An entry leaves when the defect is fixed.
- Never shuffle files to satisfy a number.

© ai-driven-dev · MIT · ai-driven-dev/framework

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set80

The whole set →
rule.generated The rule.generated rule requires adding the comment // Team reviewed domain change above every newly declared exported function in src/domain/. It tracks which domain changes have passed team review. CX Codex +1 ★ 571repo stars 1-type-honesty 1-type-honesty prevents dangerous TypeScript casts like any and eliminates compiler error suppressions in source code. CX Codex +1 ★ 571repo stars 0-orchestration The 0-orchestration rule sets boundaries for TypeScript orchestrators: one dependency per area crossed and a cap of four other use cases. CX Codex +1 ★ 571repo stars 1-comments 1-comments — a rule that keeps AI-written comments to facts the code cannot express and bans pointers to tickets, PRs and dates. CX Codex +1 ★ 571repo stars 01-ticket-info 01-ticket-info is a Claude Code skill that fetches ticket details from a configured issue tracker and displays its fields in the agent chat. It reads the ticket identified in the prompt or conversation context. CX Codex +1 ★ 571repo stars 0-shared-modules The 0-shared-modules rule sets a bar for moving code into shared/: callers must come from two application areas. Use it when reviewing modules under src/contexts/. CX Codex +1 ★ 571repo stars 01-hello 01-hello is a Claude Code skill that runs the greet action to confirm the aidd-ui plugin is loaded. It checks plugin availability. CX Codex +1 ★ 571repo stars 7-auth 7-auth governs how assistant code reads and saves auth credentials: lazy GitHub token lookup, tight file permissions, and delayed error handling. CX Codex +1 ★ 571repo stars

Project sponsors

Companies that keep this analytics open