module-organisation

A guide to organizing a Claude Code project by responsibility: tools perform actions, commands handle user-invoked commands, services coordinate logic, state stores application data, and components and hooks handle the terminal interface.

In plain words
What is it for?
Use it when adding files, choosing where new code belongs, or tracing how a capability moves through tools, services, state, hooks, and the terminal interface.
Why use it?
It prevents business logic, user-interface code, state handling, and command execution from becoming mixed together, which makes changes and debugging harder.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/techymt/claude-code-superpowers/module-organisation
Any agent
npx skills add TechyMT/claude-code-superpowers --skill module-organisation
Clone the repo
git clone --depth 1 https://github.com/TechyMT/claude-code-superpowers

Made for: Claude Code, Codex.

Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,784 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00087 $0.01784
Opus 5 $0.00044 $0.00892
Sonnet 5 $0.00017 $0.00357
Haiku 4.5 $0.00009 $0.00178

Measured 2d ago against content hash e9165b514d88, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

module-organisation 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 2d 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.

skills/module-organisation/SKILL.md · 139 lines

How it starts

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

Module Organisation

The pattern

Claude Code organizes code by responsibility, not by feature. Each top-level directory under src/ owns a specific layer of the system. Tools live in tools/, each in its own subdirectory named [Name]Tool/. Commands live in commands/, each in its own subdirectory or file. Business logic lives in services/. AppState lives in state/. React hooks live in hooks/. React components (TUI rendering) live in components/. Pure utility functions live in utils/.

The rule: a tool knows how to execute a capability. A service knows how to coordinate across multiple tools or external systems. A component knows how to render state. A hook knows how to subscribe to state. These never cross — a tool does not render, a component does not call a bash command.

Why this matters

Claude Code is a React application running in a terminal. It has the full complexity of a web app (UI state, async data, event handling) plus the additional complexity of a capability system (tools, permissions, streaming). Without strict layer separation, service logic leaks into components, rendering logic leaks into tools, and state management becomes implicit.

The per-tool subdirectory pattern (tools/BashTool/BashTool.tsx) is intentional: each tool is large enough to warrant its own namespace. BashTool.tsx uses .tsx because bash output can be rendered as JSX in the TUI. FileReadTool.ts uses .ts because its output is plain data. The file extension signals whether the tool has UI concerns.

How to apply it

  1. New capability (file operation, shell command, web request, subagent): create src/tools/[Name]Tool/[Name]Tool.ts[x]. Export the tool as a named constant. Register it in src/tools.ts.
  2. New user command (/something): create src/commands/something/index.ts or src/commands/something.ts. Register it in src/commands.ts.
  3. New external service integration (API client, MCP adapter): create src/services/[name]/. Keep all HTTP/socket code here.
  4. New AppState field: add it to AppStateStore.ts's AppState type. Add it to initialState. Expose a selector in state/selectors.ts.
  5. New React hook (subscribes to state, calls an API): create src/hooks/use[Name].ts.
  6. New UI component (renders in the terminal): create src/components/[Name].tsx.
  7. Pure utility (string manipulation, path normalization, type guards): create src/utils/[name].ts. No side effects, no imports from state/ or tools/.

Read the full file on GitHub · 139 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. 2d ago First seen · 139 lines · 87 tokens per session scan A e9165b514d88

Subscribe to this mod's changes

module-organisation is a skill published in the GitHub repository TechyMT/claude-code-superpowers (5 stars, last pushed 5mo ago), licensed MIT. It adds 87 tokens to every session and 1,784 once invoked, about $0.0004 per session on Opus 5. 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.

Related

Other skills, from other repositories

article-writing

Write articles, guides, blog posts, tutorials, newsletter issues, and other long-form content in a distinctive voice derived from supplied examples or brand guidance. Use when the user wants polished written content longer than a paragraph, especially when voice consistency, structure, and credibility matter.

affaan-m/ECC · 57 tokens

a-evolve

Apply A-Evolve's agentic evolution methodology to improve AI agent performance across runs. Use when the user wants to diagnose agent failures, generate targeted skills from error patterns, evolve system prompts, or accumulate episodic knowledge. Works standalone or inside AutoResearchClaw pipelines. Triggers on…

aiming-lab/AutoResearchClaw · 100 tokens

hive.chart-creation-foundations

Required reading whenever any chart tool is available. Teaches the one-tool embedding contract (call chartrender → live chart appears in chat AND a downloadable PNG lands in the queen session dir), the ECharts (data viz) vs Mermaid (structural diagrams) decision, the BI/financial-grade aesthetic baseline (no…

aden-hive/hive · 133 tokens

code-documenter

Use when adding docstrings, creating API documentation, or building documentation sites. Invoke for OpenAPI/Swagger specs, JSDoc, doc portals, tutorials, user guides.

zebbern/claude-code-guide · 39 tokens

deck-course-module

暖纸背景 + Playfair, 左侧学习目标常驻, 含 MCQ 自测页.

nexu-io/html-anything · 25 tokens

creating-skills

Guide for creating Claude Code skills following Anthropic's official best practices. Use when user wants to create a new skill, build a skill, write SKILL.md, update an existing skill, or needs skill creation guidelines. Provides structure, frontmatter fields, naming conventions, and new features like dynamic context…

redai-infra/Relax · 70 tokens