modular-and-layered-code
Architect so a future agent can act at a single layer — strict tested contracts between layers, testing concentrated at domain boundaries, pure logic kept…
Skill by kasofsk
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/kasofsk-modular-and-layered-code
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.
About
Use cases: testing, agent-building
Reviews
Write a reviewNo 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/modular-and-layered-code
What's inside
- Skill name
modular-and-layered-code- Description
- Architect so a future agent can act at a single layer — strict tested contracts between layers, testing concentrated at domain boundaries, pure logic kept free of I/O, and impurity confined to the edges. Use when designing module boundaries or abstractions, deciding where to concentrate test effort, extracting side effects out of logic, or judging whether an abstraction is worth building before it is needed.
- License
- MIT
- Instructions
- 60 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Modular and Layered Code ## Core principle Architect code so that a future agent (human or AI) making a modification or improvement can **act at a single layer**. A change to one concern should land in one place, behind one contract — without the agent needing to understand or touch the rest of the system. ## How we get there ### 1. Strict contracts between layers Layer boundaries are defined by explicit, well-specified contracts — not by convention or tribal knowledge. An agent working inside a layer should be able to trust the contract above and below it completely, so the contract itself carries the knowledge that would otherwise require reading the whole codebase. ### 2. Well-defined, well-tested abstractions Abstractions at these boundaries are first-class artifacts: deliberately designed, documented, and covered by tests that pin down their behavior. The tests are what make the contract *strict* rather than aspirational. ### 3. Accept some "premature" abstraction — selectively We are okay with a little premature optimization in this specific regard: when it's likely that future iterations or feature fixes will be touching a system, investing early in its contracts and abstractions pays off. This is a calibrated bet, not a license to abstract everything — the trigger is *expected future churn*. ### 4. Test hardest at domain boundaries Concentrate testing effort at the domain boundaries. Boundary tests are what let an agent modify one layer with confidence that it hasn't broken its neighbors — they are the enforcement mechanism for the contracts in (1). ### 5. Keep impure stuff out of pure logic Do as good a job as possible of keeping I/O and other impure, side-effecting concerns (network calls, disk, auth, clocks, randomness, etc.) out of pure logic functions. Pure functions are the easiest code for any agent to reason about, test, and safely change. ### 6. Contain the blast radius of impurity Where I/O and non-pure code *must* exist, be thoughtful about confining it to deliberate, well-known locations (edges/shells of the system). The goal is that the impure surface area is small, obvious, and doesn't leak into — or destabilize — the pure core. ## Why this matters Every one of these points serves the same end: minimizing how much of the system an agent must load into its head (or context window) to make a correct change. Strict contracts and boundary tests localize *knowledge*; purity and blast-radius containment localize *risk*.
From kasofsk/blessed-practices, MIT.
More from kasofsk/blessed-practices
- 0.524score
comments-describe-the-code
kasofsk
Write comments about the code itself, never about the prompt, conversation, or moment that produced it — and treat a long justifying comment as a signal the…
SkillBFreshness: BClaude Code +9 - 0.524score
design-with-known-limits
kasofsk
Design systems with explicit correctness limits, failure modes, and operational assumptions instead of automatically engineering every weakness away.
SkillBFreshness: BClaude Code +9 - 0.524score
diminishing-returns
kasofsk
Pursue the highest-value work first and stop when the expected value of the next improvement no longer justifies its full cost.
SkillBFreshness: BClaude Code +9 - 0.524score
domain-modelling
kasofsk
Shape the contents of the domain core — ubiquitous language, aggregates as consistency boundaries, entities versus value objects, making illegal states…
SkillBFreshness: BClaude Code +9 - 0.524score
fix-the-assumption-not-the-hack
kasofsk
When a new feature invalidates an assumption the current design rests on, rethink the pattern rather than land a tweak that technically satisfies the request.
SkillBFreshness: BClaude Code +9 - 0.524score
idiomatic-by-default
kasofsk
Take the community-standard path for the language, framework, or ecosystem unless there is an articulable reason not to, and don't escalate a decision the…
SkillBFreshness: BClaude Code +9 - 0.524score
illegal-states-unrepresentable
kasofsk
Make illegal states unrepresentable with precise types, discriminated variants, and boundary parsing.
SkillBFreshness: BClaude Code +9 - 0.524score
layering
kasofsk
Decide where code goes and which way its dependencies point — inward-pointing source dependencies, what the domain, application, adapter and infrastructure…
SkillBFreshness: BClaude Code +9 - 0.524score
push-back-and-verify-assumptions
kasofsk
Treat the operator as a fellow engineer — challenge naive or wrong premises, state assumptions explicitly, keep asking until they are right, and stop rather…
SkillBFreshness: BClaude Code +9 - 0.524score
write-the-present-not-the-diff
kasofsk
Write prose that states what is true now, without narrating the correction, the superseded claim, or the path that got there.
SkillBFreshness: BClaude Code +9 - 0.494score
dependencies
kasofsk
Add, remove, upgrade, or pin a dependency with the ecosystem's package manager instead of hand-editing the manifest.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Aug 20, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/kasofsk/blessed-practices
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from kasofsk
- 0.524score
design-with-known-limits
kasofsk
Design systems with explicit correctness limits, failure modes, and operational assumptions instead of automatically engineering every weakness away.
SkillBFreshness: BClaude Code +9 - 0.524score
diminishing-returns
kasofsk
Pursue the highest-value work first and stop when the expected value of the next improvement no longer justifies its full cost.
SkillBFreshness: BClaude Code +9 - 0.524score
domain-modelling
kasofsk
Shape the contents of the domain core — ubiquitous language, aggregates as consistency boundaries, entities versus value objects, making illegal states…
SkillBFreshness: BClaude Code +9 - 0.524score
fix-the-assumption-not-the-hack
kasofsk
When a new feature invalidates an assumption the current design rests on, rethink the pattern rather than land a tweak that technically satisfies the request.
SkillBFreshness: BClaude Code +9 - 0.524score
idiomatic-by-default
kasofsk
Take the community-standard path for the language, framework, or ecosystem unless there is an articulable reason not to, and don't escalate a decision the…
SkillBFreshness: BClaude Code +9 - 0.524score
illegal-states-unrepresentable
kasofsk
Make illegal states unrepresentable with precise types, discriminated variants, and boundary parsing.
SkillBFreshness: BClaude Code +9
Cite this page
modular-and-layered-code skill. Agent Mart. https://agentmart.dev/skills/kasofsk-modular-and-layered-code (last updated 2026-10-24)