

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234567# Deepen Architecture89Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.1011**Distinct from `define-language` and `model-domain`:** Use this skill to find module-level refactoring opportunities in the codebase. Use `define-language` to produce a canonical glossary of terms. Use `model-domain` to stress-test a plan through a domain-model interview.1213> **HARD GATE** — Deep modules must solve a forcing function, not just be "nice abstractions." If you cannot articulate why the abstraction exists, it is premature.1415## Glossary1617Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in [LANGUAGE.md](LANGUAGE.md).1819- **Module** — anything with an interface and an implementation (function, class, package, slice).20- **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature.21- **Implementation** — the code inside.22- **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation.23- **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.")24- **Adapter** — a concrete thing satisfying an interface at a seam.25- **Leverage** — what callers get from depth.26- **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place.2728Key principles (see [LANGUAGE.md](LANGUAGE.md) for the full list):2930- **Deletion test**: imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.31- **The interface is the test surface.**32- **One adapter = hypothetical seam. Two adapters = real seam.**3334This skill is _informed_ by the project's domain model — `specs/tech-architecture/tech-stack.md` and any `specs/adr/`. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate. See [CONTEXT-FORMAT.md](../model-domain/CONTEXT-FORMAT.md) and [ADR-FORMAT.md](../model-domain/ADR-FORMAT.md).3536## Process3738### 1. Explore3940Read existing documentation first:4142- `specs/tech-architecture/tech-stack.md` (or `specs/tech-architecture/tech-stack.md` + each `specs/tech-architecture/tech-stack.md` in a multi-context repo)43- Relevant ADRs in `specs/adr/`4445If any of these files don't exist, proceed silently — don't flag their absence or suggest creating them upfront.4647**Look-here-first (churn heuristic):** Before organic exploration, rank candidate modules by recent commit frequency. High-churn files are architectural friction magnets — start there.4849```bash50bash scripts/bp-churn-rank.sh --since 90.days --limit 2051```5253Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:5455- Where does understanding one concept require bouncing between many small modules?56- Where are modules **shallow** — interface nearly as complex as the implementation?57- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called?58- Where do tightly-coupled modules leak across their seams?59- Which parts of the codebase are untested, or hard to test through their current interface?6061Apply the **deletion test** to anything you suspect is shallow.6263### 2. Module Depth score6465For each candidate module, assign a **Module Depth score** (1–5, Ousterhout):6667| Score | Meaning |68|-------|---------|69| 1 | Shallow — interface complexity ≈ implementation |70| 3 | Balanced |71| 5 | Deep — small interface, substantial hidden behavior |7273Include the score in each candidate row. Prioritize score ≤ 2 for deepening.7475### 3. Present candidates7677Present a numbered list of deepening opportunities. For each candidate:7879- **Files** — which files/modules are involved80- **Problem** — why the current architecture is causing friction81- **Solution** — plain English description of what would change82- **Benefits** — explained in terms of locality and leverage, and how tests would improve8384**Use `specs/tech-architecture/tech-stack.md` vocabulary for the domain, and [LANGUAGE.md](LANGUAGE.md) vocabulary for the architecture.**8586**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly. Don't list every theoretical refactor an ADR forbids.8788Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"8990### 4. Grilling loop9192Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.9394Side effects happen inline as decisions crystallize:9596- **Naming a deepened module after a concept not in `specs/tech-architecture/tech-stack.md`?** Add the term to `specs/tech-architecture/tech-stack.md` — same discipline as `model-domain` (see [CONTEXT-FORMAT.md](../model-domain/CONTEXT-FORMAT.md)). Create the file lazily if it doesn't exist.97- **Sharpening a fuzzy term during the conversation?** Update `specs/tech-architecture/tech-stack.md` right there.98- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer. See [ADR-FORMAT.md](../model-domain/ADR-FORMAT.md).99- **Want to explore alternative interfaces for the deepened module?** See [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md).100101### 5. Import-boundary hygiene (e45s14)102103When a deepening move **splits or merges modules**, update `specs/import-boundaries.json` (Playwright `DEPS.list` pattern) — declare which `scripts/lib/*.sh` files may `source` which peers. CI enforces via:104105```bash106bash scripts/check-import-boundaries.sh107```108109Run the check before proposing cross-module `source` edges. Convention docs alone do not authorize new imports; the allowlist must list them.110111## Verify112113→ verify: `test -f specs/import-boundaries.json && bash scripts/check-import-boundaries.sh`114115116117<!-- story: e07s02 -->118119---120121# Deepening122123How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**.124125## Dependency categories126127When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.128129### 1. In-process130131Pure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.132133### 2. Local-substitutable134135Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.136137### 3. Remote but owned (Ports & Adapters)138139Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.140141Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*142143### 4. True external (Mock)144145Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.146147## Seam discipline148149- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.150- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.151152## Testing strategy: replace, don't layer153154- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.155- Write new tests at the deepened module's interface. The **interface is the test surface**.156- Tests assert on observable outcomes through the interface, not internal state.157- Tests should survive internal refactors — they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.158159---160161# Interface Design162163When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best.164165Uses the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.166167## Process168169### 1. Frame the problem space170171Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:172173- The constraints any new interface would need to satisfy174- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))175- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete176177Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.178179### 2. Spawn sub-agents180181Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.182183Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:184185- Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point."186- Agent 2: "Maximise flexibility — support many use cases and extension."187- Agent 3: "Optimise for the most common caller — make the default case trivial."188- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."189190Include both [LANGUAGE.md](LANGUAGE.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.191192Each sub-agent outputs:1931941. Interface (types, methods, params — plus invariants, ordering, error modes)1952. Usage example showing how callers use it1963. What the implementation hides behind the seam1974. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))1985. Trade-offs — where leverage is high, where it's thin199200### 3. Present and compare201202Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.203204After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu.205206---207208# Language209210Shared vocabulary for every suggestion this skill makes. Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.211212## Terms213214**Module**215Anything with an interface and an implementation. Deliberately scale-agnostic — applies equally to a function, class, package, or tier-spanning slice.216_Avoid_: unit, component, service.217218**Interface**219Everything a caller must know to use the module correctly. Includes the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics.220_Avoid_: API, signature (too narrow — those refer only to the type-level surface).221222**Implementation**223What's inside a module — its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.224225**Depth**226Leverage at the interface — the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface. A module is **shallow** when the interface is nearly as complex as the implementation.227228**Seam** _(from Michael Feathers)_229A place where you can alter behaviour without editing in that place. The *location* at which a module's interface lives. Choosing where to put the seam is its own design decision, distinct from what goes behind it.230_Avoid_: boundary (overloaded with DDD's bounded context).231232**Adapter**233A concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).234235**Leverage**236What callers get from depth. More capability per unit of interface they have to learn. One implementation pays back across N call sites and M tests.237238**Locality**239What maintainers get from depth. Change, bugs, knowledge, and verification concentrate at one place rather than spreading across callers. Fix once, fixed everywhere.240241## Principles242243- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts — they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.244- **The deletion test.** Imagine deleting the module. If complexity vanishes, the module wasn't hiding anything (it was a pass-through). If complexity reappears across N callers, the module was earning its keep.245- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.246- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.247248## Relationships249250- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).251- **Depth** is a property of a **Module**, measured against its **Interface**.252- A **Seam** is where a **Module**'s **Interface** lives.253- An **Adapter** sits at a **Seam** and satisfies the **Interface**.254- **Depth** produces **Leverage** for callers and **Locality** for maintainers.255256## Rejected framings257258- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.259- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.260- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.261
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.cursor/rules/simple-english.mdc · 139 | Cursor rules | styletypesgitdatabase+6 | 47/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/assess-impact.mdc · 139 | Cursor rules | testtesting-strategydeployment | 66/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-plan.mdc · 139 | Cursor rules | buildteststylegit | 74/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/build-epic.mdc · 139 | Cursor rules | buildgit | 58/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/change-request.mdc · 139 | Cursor rules | no sections | 48/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/commit-message.mdc · 139 | Cursor rules | lint-formatstyletypesgit+3 | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/compose-workflow.mdc · 139 | Cursor rules | styledo-notagent-behaviour | 65/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/context7-mcp.mdc · 139 | Cursor rules | style | 54/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/deepen-architecture.mdc · 139 | Cursor rules | testtesting-strategydo-not | 57/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-language.mdc · 139 | Cursor rules | lint-formatdo-not | 65/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-success.mdc · 139 | Cursor rules | no sections | 4/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/delegate-task.mdc · 139 | Cursor rules | git | 62/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/deploy.mdc · 139 | Cursor rules | setupbuildtestdeployment | 77/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/verify-work.md · 139 | Windsurf rules | buildtestlint-formatagent-behaviour | 74/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/develop-tdd.mdc · 139 | Cursor rules | teststylearchtesting-strategy+5 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-root.mdc · 139 | Cursor rules | no sections | 39/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-stall.mdc · 139 | Cursor rules | no sections | 44/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/dispatch-agents.mdc · 139 | Cursor rules | git | 54/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/edit-document.mdc · 139 | Cursor rules | no sections | 39/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/elaborate-spec.mdc · 139 | Cursor rules | test | 58/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 139 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/guard-git.md · 139 | Windsurf rules | stylearchgitsecurity+2 | 89/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 139 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 139 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/extract-design.md · 139 | Windsurf rules | lint-formatstyledependenciesui | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 139 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/session-state.md · 139 | Windsurf rules | lint-formatstyleagent-behaviour | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 139 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/danielvm-git-bigpowers-windsurf-rules-deepen-architecture)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.