timewarpengineering/timewarp-architecture/tw-slice-isolation

Claude Code and agent skill by timewarpengineering/timewarp-architecture

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

**TIMEWARP SKILL** — product slice placement and TWA0009 isolation (SliceRoot, namespaces, platform Applications, Components/contracts sharing, CrossSliceReference opt-out). Invoke before scaffolding a new feature/slice/page or when fixing TWA0009 / cross-slice references. WHEN: Add a new clients feature page, Where does this state live?, TWA0009 slice references another product slice, CrossSliceReference, new product area under features/, greenfield slice scaffolding.

Install

npx vskill@latest install timewarpengineering/timewarp-architecture/tw-slice-isolation

SKILL.md

Slice isolation (TWA0009)

Slices are independently removable vertical units. Folders organize humans; the namespace under SliceRoot is the law. Analyzer TWA0009 is the reactive safety net; this skill is for correct first placement so greenfield work does not couple product areas by accident.

Enforcement ships in TimeWarp.Architecture.Analyzers (and monorepo ProjectReference). Do not re-interpret rules here — mirror the analyzer.

Detection — when to invoke

SignalHow to find it
Product area under features/SPA: web-spa/features/…; server product code: web/features/<slice>/ (axis-1 cohesive tree; layer projects glob *-{layer}.cs)
Namespace under SliceRoot…Features.<Id> (or nested …Features.Admin.Roles)
TWA0009 / CrossSliceReferencediagnostic text or attribute on a type
“Where does this page/state live?”any new product capability before scaffolding

Terms

TermMeaning
SliceRemovable vertical capability; the isolation unit
FeatureInformal product language only — not the analyzer’s unit name
ModuleIModule / host DI composition — not a product slice

Prefer saying slice in diagnostics, opt-outs, and agent prose. Namespace path may still use …Features.* (familiar VSA / contracts layout).

SliceRoot

SettingValue
Default{RootNamespace}.Features (from MSBuild RootNamespace)
OverrideMSBuild property TimeWarpSliceRoot (must be CompilerVisibleProperty)

Slice id = path under SliceRoot after stripping structural suffixes Pages, Components, Application. Nested ids are the full path:

NamespaceSlice id / tier
…FeaturesSubstrate (bare root)
…Features.ApplicationsPlatform id Applications
…Features.CountersProduct id Counters
…Features.Counters.PagesProduct id Counters (suffix stripped)
…Features.Admin.RolesProduct id Admin.Roles
…Components, layouts, app root typesOutside SliceRoot

Folders usually mirror slices (features/counter/ ↔ …Features.Counters) but moving a file does not change legal dependencies — only the namespace does.

Tiers (dependency rules)

TierExampleMay reference
Outside…Components, shell, layoutsAnything (composition free)
Substratebare …Features (BaseComponent, shared base types)Outside, substrate, platform — not product without opt-out
Platform…Features.ApplicationsOutside, substrate, platform — not product without opt-out
Product…Features.Counters, …Features.Admin.RolesOutside, substrate, platform, own product id, contracts (other assembly). Not another product id without opt-out

Forbidden without opt-out (TWA0009):

  • product A → product B (A ≠ B)
  • platform → product
  • substrate → product

Free by design:

  • product → platform (Applications) — e.g. CounterPage → ApplicationState
  • any code → other assemblies (contracts are sharing-by-design)
  • Outside → product (nav shell, shared components)

Placement matrix

ArtifactWhere
Page, state, actions, slice-local UIInside the product slice namespace
App chrome / shell / empty MainLayoutOutside SliceRoot (e.g. …Components) — see tw-blazor-layout
Shared UI used by multiple slicescomponents/ → namespace outside SliceRoot
Shared API shapesContracts project (other assembly; free under TWA0009)
Host-wide modal / menu / branding statePlatform Applications

Living anchors (timewarp-architecture template):

RolePathNamespace
Productweb-spa/features/counter/…Features.Counters
Nested productweb-spa/features/admin/roles/…Features.Admin.Roles
Platformweb-spa/features/application/…Features.Applications
Substrateweb-spa/features/base/base-component.cs…Features
Outside shellweb-spa/components/TimeWarpPage.razor…Components

Greenfield scaffold workflow

  1. Name the slice — plural, domain-oriented (Clients, Admin.Roles).
  2. Folder — kebab path under the project’s features/ tree (match sibling casing).
  • SPA UI stays under web-spa/features/<slice>/ (conventional; not rehomed by axis-1).
  • Contracts / application / server product files live in the cohesive tree

web/features/<slice>/ with filename grammar <name>[-<function>]-<layer>.cs (see tw-feature-placement for the full grammar and registry).

  1. Namespace — {RootNamespace}.Features.{SliceId} (plural segments; nested with .).

Folders rehome freely; namespaces are not renamed with folder moves.

  1. Colocate page, state, actions, and slice-private components in that namespace (pages are

not shared infrastructure — no grab-bag …Pages for product UI).

  1. Contracts — same plural slice path under web/features/<slice>/ with -contracts.cs

suffix (tw-web-api-contracts skill). Other assembly → free across SPA slices.

  1. Wire nav / DI from Outside or platform — not from another product slice.
  2. Prefer share (Components / contracts) over [CrossSliceReference].
  3. Build — fix TWA0009 by relocating code first; mute only for deliberate demo/integration edges.

Share vs opt-out

Prefer share
  • Promote shared controls to …Components.
  • Share API shapes via contracts assembly.
  • Depend product → platform without attributes when the dependency is real host state.
Opt-out — deliberate edges only
csharp
using TimeWarp.Foundation.Features;
[CrossSliceReference(typeof(CounterState), "Living design system exercises the counter throw-exception pipeline.")]
partial class DesignSystemPage;

Rules:

  • Attribute on the referencing type (AllowMultiple = true for multiple foreign slices).
  • typeof(T) maps to the target product slice; only edges into that slice are suppressed.
  • Reason must be non-empty (human paperwork).
  • Partial-safe (semantic attributes).
  • Type: TimeWarp.Foundation.Features.CrossSliceReferenceAttribute (package

TimeWarp.Foundation.Contracts / monorepo foundation-contracts).

Living examples:

  • Design system → Counters: web-spa/features/design-system/pages/DesignSystemPage.razor.cs
  • Auth pipeline deliberate edges: authentication code-behinds with multiple

[CrossSliceReference(...)] when needed

Limits agents must know

LimitImplication
Same assembly onlyContracts / NuGet metadata types never trip TWA0009
Hand-written C#GeneratedCodeAnalysisFlags.None — pure .razor without .razor.cs is not scanned; put deliberate edges on code-behind
Folders can lieNamespace still owns the type
Structural suffixes…Counters.Pages is still product id Counters

Good / bad examples

BadWhyFix
…Features.Counters type uses WeatherForecastsStateproduct → productShare via Components/contracts, or reasoned [CrossSliceReference]
Product page in grab-bag …Pages outside any slicenot removable with the capabilityNamespace under …Features.<Id>
Platform type reaches into Countersplatform ↛ productInvert dependency (product → platform) or rare opt-out on platform type
Mute TWA0009 globally / without reasonhides real couplingRelocate or scoped opt-out
GoodWhy
CounterPage uses ApplicationStateproduct → platform free
TimeWarpPage in …ComponentsOutside composition free
Admin.Roles only uses own types + contracts + platformnested product isolation

Agent checklist

  • [ ] New capability has a slice id and matching {Root}.Features.{Id} namespace
  • [ ] Page, state, and actions live in that namespace
  • [ ] Shell/layout stay outside SliceRoot (or platform only when truly host state)
  • [ ] Cross-slice data via Components or contracts first
  • [ ] Any remaining edge has [CrossSliceReference(typeof(T), "reason")]
  • [ ] No silent coupling or unexplained suppressions

Removing a demo slice

Counter and the analytics client slice ship in every generated app. They are teaching material, not template flags — remove them by deleting code.

A slice is an independently removable vertical unit. Identity is the namespace under {RootNamespace}.Features (e.g. …Features.Counters), not the folder path. The compiler is the checklist: delete the slice folder, then fix every compile error until dev build is 0/0.

Deleting a SPA demo touches, at minimum:

  1. The slice folder (web-spa/features/counter/, web-spa/features/analytics/).
  2. Nothing in components/NavMenu.razor: the menu renders the generated page registry, so a

deleted page leaves the menu with it.

  1. global-usings.cs / _Imports.razor — its namespace usings.
  2. Tests under tests/container-apps/web/web-spa-integration-tests/ plus shared pipeline

tests that exercise its state (e.g. CloneStateBehavior uses CounterState).

  1. Cross-slice opt-outs that targeted it — e.g. Design System's

[CrossSliceReference(typeof(CounterState), …)].

SPA-only demos have no EF mapping. If you remove a mapped entity (one that participates in PostgresDbContext / IEntityTypeConfiguration), delete the domain type, configuration, and DbSet, then add an EF migration that drops the unused tables. Do not hand-edit only the live database — AppHost AddEFMigrations applies committed migrations. See tw-aggregate-pattern (schema evolution).

Related skills and pointers

  • tw-feature-placement — filename grammar and layer membership once you know which slice a

file belongs to (<name>[-<function>]-<layer>.cs, TWA0015/TWA0016, membership guard)

  • tw-web-api-contracts — contract placement; contracts assemblies are free under TWA0009; still use plural …Features.* aligned with SPA product slices
  • tw-blazor-layout — empty layout + shell; chrome outside SliceRoot
  • tw-blazor-css-strategy — shell/component styling only
  • tw-agent-context-regions — Purpose/Design on new files (TWA0004)
  • Diagnostic catalog: AnalyzerReleases.Unshipped.md in the convention-analyzers project

(TWA0009 row). This skill is the placement rule.

  • Analyzer (source of truth): source/analyzers/timewarp-architecture-convention-analyzers/slice-isolation-analyzer.cs
  • Opt-out attribute: source/foundation/foundation-contracts/base/cross-slice-reference-attribute.cs

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/timewarpengineering/timewarp-architecture/tw-slice-isolation/badge)](https://verified-skill.com/skills/timewarpengineering/timewarp-architecture/tw-slice-isolation)

Something wrong with this skill or its page? Tell us.