Skip to content
Agentmart
Submit a tool

migrate-layered-module-splitting

Use when an F# source file or module mixes stacked responsibility layers whose dependency direction should be made explicit through files, modules, and a…

Skill by lamg

IndexedApache-2.0★ 13
Write a review

Chalk Labs

Need help deploying migrate-layered-module-splitting?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/lamg-migrate-layered-module-splitting

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when an F# source file or module mixes stacked responsibility layers whose dependency direction should be made explicit through files, modules, and a stable facade.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/migrate-layered-module-splitting

What's inside

Skill name
migrate-layered-module-splitting
Description
Use when an F# source file or module mixes stacked responsibility layers whose dependency direction should be made explicit through files, modules, and a stable facade.
License
Apache-2.0
Instructions
156 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Migrate Layered Module Splitting

## Core principle

A module split should make the reasoning structure of the program explicit.

Do not split files because they are large. Split them when they contain several different levels of knowledge: primitives, metadata, planning, execution, orchestration, or public API composition. A good split lets the reader understand each layer as a smaller problem with a precise obligation, then understand the top layer as composition of those obligations.

Layering is useful when it reduces the number of facts that must be held in mind at once. Lower layers should solve stable, narrower problems. Higher layers should express policy, workflow, and composition. The dependency direction should follow the direction of reasoning: higher layers may use lower layers, but lower layers must not know the stories told above them.

## What counts as a layer

A layer is not merely a group of functions with similar names. A layer owns a distinct kind of knowledge.

Good layer boundaries often separate:

- primitive types and small operations from workflows that use them
- metadata access from decisions based on metadata
- parsing from interpretation
- planning from execution
- SQL or AST construction from user-facing operations
- reusable internal mechanics from public facade functions

Weak boundaries usually separate:

- functions only because the file is long
- functions only by CRUD verb or alphabetic order
- types from the only code that can make sense of them
- helpers whose callers still need to know all their internals
- mutually dependent code that will immediately create cycles or broad re-exports

## When to apply

- Apply this when a file contains a visible ladder of responsibilities and lower-level code supports higher-level workflows in one direction.
- Apply this when understanding a public function requires scanning unrelated primitives, metadata readers, planners, and execution helpers in the same file.
- Apply this when a set of helpers has become a reusable internal domain with its own vocabulary.
- Apply this when compile order can naturally express the dependency order between the responsibilities.

## Design rule

- Put each responsibility layer in its own source file.
- Keep dependencies one-way: higher layers depend on lower layers, never the reverse.
- Place shared types in the lowest layer that can honestly own them.
- Keep public API functions in the top facade unless there is a concrete reason to expose a lower layer.
- Prefer `internal` modules for lower layers.
- Preserve the existing public API shape when practical; moving implementation should not force callers to learn the new internals.
- Use the split to remove accidental knowledge, not to create more ceremony.

## Splitting procedure

1. Identify the public story the original file tells.
2. Identify the kinds of knowledge mixed into that file.
3. Order those responsibilities from most primitive to most orchestration-oriented.
4. Check that dependencies can flow upward without cycles.
5. Create a directory named after the original area or module.
6. Create one source file per layer, ordered from lower to higher responsibility.
7. Add a top-level facade file or module that preserves the public surface when needed.
8. Update the `.fsproj` compile order to match the layer order.
9. Add a `README.md` that records the responsibilities and dependency direction.
10. Re-read the top layer and verify that it now describes composition instead of implementation mechanics.

## File layout guidance

Prefer names that identify the responsibility, not the extraction event.

Good layer names include:

- `Types`
- `Primitives`
- `Metadata`
- `Parsing`
- `Planning`
- `Execution`
- `Operations`
- `Facade`

Avoid names that describe only mechanics or chronology:

- `Helpers`
- `Utils`
- `Common2`
- `Old`
- `Extracted`
- `Misc`

An idiomatic split often looks like this:

```text
Area/
  README.md
  Types.fs
  Metadata.fs
  Planning.fs
  Execution.fs
  Operations.fs
Area.fs
```

The lowest file should compile first. The public facade should compile after the internal layers it exposes or composes.

## README requirements

Write the `README.md` in English and include:

- the purpose of the directory
- each layer's responsibility
- the dependency direction between layers
- a statement that lower layers must not depend on higher layers
- where the public API lives
- guidance for where future code should be placed

The README is part of the design. It should let a future maintainer place new code without rediscovering the architecture.

## F# project requirements

- Update the `.fsproj` compile order explicitly.
- Compile lower layers before higher layers.
- Keep facade files after the internal files they depend on.
- Prefer top-level module declarations for single-module files.

From lamg/migrate, Apache-2.0.

Signals

Stars
13
Forks
0
Open issues
0
Last commit (this folder)
Apr 30, 2026 (6 months ago)
Last release
Apr 1, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from lamg

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get migrate-layered-module-splitting running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying migrate-layered-module-splitting?

CallGet help
Cite this page

migrate-layered-module-splitting skill. Agent Mart. https://agentmart.dev/skills/lamg-migrate-layered-module-splitting (last updated 2026-10-24)