Index of every page on this site: llms.txt
All skills
tristanmanchester avatar

/ai-codebase-deep-modules

@3323bc9
Run it yourself

Design or refactor cohesive modules with small, useful public contracts and enforceable dependency boundaries. Use for concrete architecture, coupling, refactoring, or agent-editability problems. Do not restructure a working codebase merely because an AI agent will edit it.

Use this Skill: https://skilld.dev/gh/tristanmanchester/agent-skills/ai-codebase-deep-modules

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈75 tokens for metadata: the name and description. ≈1.3k when used: this file. ≈3.2k more on demand in 5 files.

Description uses 3.8% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈301 characters, or 3.8%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Deep modules and fast feedback

Hide meaningful complexity behind a contract that lets callers do useful work. The objective is lower cognitive/change cost with preserved behaviour, not more folders, a prescribed export count, or an abstraction around every function. Agent productivity is a hypothesis to measure, not a benefit proved by the tree shape.

Inspect a real change path

Start from the task and trace the relevant entry point through domain policy, state/data ownership, side effects, callers, and tests. Read actual dependencies, not only README architecture. Identify which information callers must know and which coordinated edits recur. A large file can be cohesive; a tiny wrapper can leak a complicated protocol. Do not equate lines of code with module depth.

State the behaviour to preserve, the specific coupling or duplication to remove, and the smallest proposed seam. For a review, deliver actionable findings. For an implementation request, make the coherent patch and tests; do not stop at a mandatory nine-section architecture plan. Use the existing plan asset only when a substantial design decision needs it.

Design the contract around ownership

Define operations, input/output types, errors, state transitions, resource ownership, lifetime, authority, and concurrency/cancellation semantics. Keep invariants with the module that owns them. Separate validation at an external boundary from already- validated internal values without duplicating defensive checks everywhere.

Expose domain operations rather than a bag of internals or a universal manager. A public entry point can be a useful convention, but several intentional surfaces may better fit types, platform adapters, lazy loading, or server/client boundaries. Avoid a giant root barrel that changes import side effects or bundles server-only code into a client. Preserve the language/framework's actual loading contract.

Draw an explicit dependency direction. A direct acyclic dependency through another domain's public contract can be simpler than a new event bus. Use inversion when the dependency/ownership problem calls for it, and events when temporal decoupling is actually useful. Events add delivery, ordering, idempotency, and observability obligations; they do not make coupling disappear. Keep shared code genuinely shared, not the destination for every disputed type.

Enforce and test the seam

Read boundary enforcement before writing a lint rule. A rule must distinguish a module using its own internals from a foreign consumer crossing that boundary. Test allowed and forbidden imports through every supported spelling/resolver. Filenames, all, and grep are conventions/signals, not universal privacy or security mechanisms.

Create behavioural tests at the public boundary, including meaningful failure, empty/boundary data, state/restart, cancellation, and concurrency cases where applicable. Retain focused internal tests when they diagnose important algorithms. Mocks of the implementation's own call sequence do not prove its contract; a test that the stub returns not-implemented does not implement the domain behaviour.

Use the fastest relevant test/lint/typecheck first, then the actual build/integration path touched by the refactor. Measure feedback cost and correctness, not a fixed quota of mocks or files. Read testing and feedback for a deeper checklist, adapting it to the project's tooling and risks.

Refactor as one coherent change

Use the existing module examples as sketches, not scaffolding to install unchanged. Update the interface, implementation, consumers, dependency rules, and tests together. Do not create compatibility aliases, dead wrappers, speculative exports, or a second implementation when no consumer contract requires them. A destructive data/schema transition still needs an explicit rollout/recovery plan; removing source compatibility is not permission to lose data.

The old scaffold_deep_module.py is removed. It interpolated unchecked names into paths/source, skipped existing files while reporting them as created, and generated placeholder APIs/tests rather than a useful domain contract. Create the actual requested files through the normal reviewed patch workflow. No replacement CLI is needed to make four empty files.

Deliver evidence

Explain the seam, what it hides, dependencies it permits, and why it reduces the specific change burden. Report tests actually run and unresolved integration risks. Do not claim architecture enforcement because one import example fails, or that agent speed improved without a comparative task measurement. Keep project-specific assumptions explicit and avoid a blanket clean-architecture rewrite.

References are relative to this installed skill, not target-project folders. Authoring baseline reviewed 2026-09-13: https://agentskills.io/specification. Current language/linter sources are recorded in the boundary reference.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides architectural guidelines and templates for designing software modules. It contains no executable code and demonstrates security awareness by documenting the removal of previously insecure scripts. No security risks were identified.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer8mo

    1/7 files flagged

  • ZeroLeaks6mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 3323bc9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Steadyupdated last month
metadata
{
  "version": "2.0.0",
  "reviewed": "2026-09-13"
}

README badge

README badge for tristanmanchester/agent-skills/ai-codebase-deep-modules