Skip to main content
rule CX Codex

0-deps-wiring — Claude Code rule: dependency wiring and install

The 0-deps-wiring rule sets where application dependencies are composed and how the graph is reused. It fits TypeScript projects with command handlers and use cases.

MIT ★ 571 updated 2026-10-29

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

What 0-deps-wiring does

The rule covers command files, src/cli.ts, and modules under src/runtime/wiring/. createDeps(projectRoot, options, output) builds the full dependency graph. Call it from a command action after program.parse(), not beforehand. The menu has a separate factory, createMenuDeps(projectRoot), which provides a ManifestRepository and a Prompter.

Keep one wiring module per context, then compose those modules in runtime/wiring/framework.ts. In cli.ts, create only the version reader and CLIOutput; adapters belong elsewhere. createDeps caches by projectRoot, while the preAction hook warms the graph for process.cwd(). Setting AIDD_SKIP_UPDATE_CHECK skips that hook, so a command file should not add another cache.

What it helps with

  • build a command's dependency graph through one factory
  • prepare menu dependencies separately from command dependencies
  • split wiring by context and compose it in the framework module
  • avoid adding a second cache in a command file

Example prompts for the agent

  • Check that the command calls createDeps from its action after program.parse().
  • Move the menu setup into createMenuDeps(projectRoot).
  • Split the wiring modules by context and compose them in runtime/wiring/framework.ts.

How to install 0-deps-wiring

Manually: put the files in place

.claude/rules/0-deps-wiring.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-deps-wiring

How do I install 0-deps-wiring in Claude Code?

Add the rule at .claude/rules/0-deps-wiring.md.

What does 0-deps-wiring do?

It defines where command and menu dependencies are created, how wiring is split by context, and how the dependency graph is cached.

When should createDeps run, and what skips preAction?

Call createDeps from a command action after program.parse(). The preAction hook warms dependencies for process.cwd(), unless AIDD_SKIP_UPDATE_CHECK is set.

Source text

0-deps-wiring.md · MIT
---
description: Apply when a command or use case needs a collaborator; every dependency is built once, in the composition root.
paths:
  - "src/presentation/commands/**/*.ts"
  - "src/cli.ts"
  - "src/runtime/wiring/**/*.ts"
---

# Dependency Wiring

## Factories

- `createDeps(projectRoot, options, output)` builds the full graph.
- Call it from a command action, never before `program.parse()`.
- `createMenuDeps(projectRoot)` serves the menu: a `ManifestRepository`, a `Prompter`.
- Extend that factory for a pre-parse need.
- Never instantiate an adapter in `cli.ts`.
- One wiring module per context under `runtime/wiring/`.
- `runtime/wiring/framework.ts` composes them.
- `cli.ts` builds two things: the version reader, the `CLIOutput`.

## Once

- `createDeps` memoizes on `projectRoot`.
- The `preAction` hook warms it for `process.cwd()`.
- `AIDD_SKIP_UPDATE_CHECK` short-circuits that hook.
- No second cache in a command file.

## Not an area

- The composition root never counts as a caller (`0-shared-modules.md`).

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

Similar IDE rules

All IDE rules for Backend and APIs →

From the same set80

The whole set →
04-skill-generate 04-skill-generate generates router-based skills across AI tools through structured scoping and validation. Use it to scaffold new skills, turn manual workflows into skills, or refactor existing ones. CX Codex +1 ★ 571repo stars 03-context-generate The 03-context-generate skill routes requests to create skills, rules, agents, commands, or hooks to the matching generator. If you leave out the artifact type, it asks which one you mean. CX Codex +1 ★ 571repo stars 04-spec 04-spec writes spec.md, the contract for a single feature, from a request, a PRD or review notes. Or rewrites a spec that already exists. CX Codex +1 ★ 571repo stars resolve-conflict resolve-conflict resolves deterministic Git conflicts during merge, rebase, or cherry-pick. Stops right after staging modified files. CX Codex +1 ★ 571repo stars 01-plan 01-plan turns a request, a ticket or a file into a phased implementation plan: gather the input, read the code, hand back a plan. CX Codex +1 ★ 571repo stars 05-improve 05-improve examines conversation logs, evaluates visible token usage, and suggests targeted refinements without touching your code. CX Codex +1 ★ 571repo stars 1-documentation The 1-documentation rule guides edits to project Markdown: it keeps decisions and useful commands while removing repetition and temporary records. It applies to selected files and folders. CX Codex +1 ★ 571repo stars 03-prd 03-prd turns a need, idea or brainstorm into a structured product requirements document: a draft from a template, saved only once you approve it. CX Codex +1 ★ 571repo stars

Project sponsors

Companies that keep this analytics open