module-design

module-design is a cursor rule for Cursor from BetterTyped/hype-stack. It costs 0 tokens per session (575 once invoked), scanned A, original, MIT.

A set of guidelines for structuring software into clear, focused modules. It covers keeping modules deep, avoiding unnecessary flexibility, organizing work into vertical slices, and checking designs for warning signs.

In plain words
What is it for?
Use it when designing new modules, organizing features, or reviewing an existing code structure. It is also useful for checking whether a design has unnecessary abstractions or other common problems.
Why use it?
It helps prevent code from being split into too many small pieces or made more complex than the current problem requires. It gives developers a way to review module boundaries before they become costly to change.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when designing new modules, organizing features, or reviewing an existing code structure. It is also useful for checking whether a design has unnecessary abstractions or other common problems.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/bettertyped/hype-stack/module-design
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/BetterTyped/hype-stack

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for module-design

README.md
[![agentmods](https://agentmods.dev/badge/rules/bettertyped/hype-stack/module-design/github.svg)](https://agentmods.dev/rules/bettertyped/hype-stack/module-design)
Your own site
<a href="https://agentmods.dev/rules/bettertyped/hype-stack/module-design"><img src="https://agentmods.dev/badge/rules/bettertyped/hype-stack/module-design/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for module-design

Your own site · 80×15
<a href="https://agentmods.dev/rules/bettertyped/hype-stack/module-design"><img src="https://agentmods.dev/badge/rules/bettertyped/hype-stack/module-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 575 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00575
Opus 5.5 $0.00000 $0.00230
Sonnet 5.5 $0.00000 $0.00115
Haiku 4.5 $0.00000 $0.00057

Measured 1mo ago against content hash 9d08c9498e84, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

module-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/module-design.mdc · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Module Design

The structure rules say where files go. This rule says what a good module looks like once it's there.

Deep modules

Prefer deep modules: a lot of behavior behind a small interface.

  • Fewer functions with real behavior beat many thin pass-through helpers.
  • A module is shallow when its interface is nearly as complex as its implementation — a wrapper that only renames or forwards arguments adds cost, not value.
  • Deletion test: if deleting a helper would just inline one line at each call site, delete it. If deleting it would scatter real complexity across callers, it's earning its place.
  • Routes stay thin because the feature module is the deep part — push logic down into the module, not up into the handler.

No speculative generality

Build for the requirements that exist, not the ones you imagine.

  • No parameters, options, generics, or hooks for needs the current feature does not have.
  • No abstraction until there are at least two real call sites that want it.
  • YAGNI applies to files too: don't scaffold empty helpers/, types/, constants/ folders "for later" — create them when the first file needs a home.

Vertical slices

Implement features as thin end-to-end slices, not layer by layer.

  • One slice = one route + one module + the UI state that consumes it, types flowing through the Hono-to-HyperFetch bridge.
  • Finish and verify a slice before starting the next — never "all backend first, then all frontend."
  • Each slice is a checkpoint the user can review and redirect.

Self-review smells

Before declaring work done, scan your own diff for these. Each is a judgement call, not a hard violation — but if you leave one in, be able to say why.

  • Mysterious name — a function, variable, or type whose name doesn't say what it does. Rename it; if no honest name comes, the design is murky.
  • Duplicated code — the same logic shape in more than one place in the change. Extract the shared shape.
  • Data clumps — the same few fields traveling together through signatures. Bundle them into one type.
  • Primitive obsession — a raw string/number standing in for a domain concept. Give the concept its own type (or Zod schema).
  • Speculative generality — see above. Delete it.
  • Middle man — a function that mostly delegates onward. Cut it, call the real target.

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 46 lines · 0 tokens per session scan A 9d08c9498e84

Subscribe to this mod's changes

module-design is a cursor rule published in the GitHub repository BetterTyped/hype-stack (12 stars, last pushed 15d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 575 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.