Files
ui/.cursor/skills/decompose/steps/01-5_module-layout.md
T
2026-04-18 22:04:31 +03:00

2.1 KiB

Step 1.5: Module Layout (default mode only)

Role: Professional software architect Goal: Produce _docs/02_document/module-layout.md — the authoritative file-ownership map used by the implement skill. Separates behavioral task specs (no file paths) from structural file mapping (no behavior). Constraints: Follow the target language's standard project-layout conventions. Do not invent non-standard directory structures.

Steps

  1. Detect the target language from DOCUMENT_DIR/architecture.md and the bootstrap structure plan produced in Step 1.
  2. Apply the language's conventional layout (see table in templates/module-layout.md):
    • Python → src/<pkg>/<component>/
    • C# → src/<Component>/
    • Rust → crates/<component>/
    • TypeScript / React → src/<component>/ with index.ts barrel
    • Go → internal/<component>/ or pkg/<component>/
  3. Each component owns ONE top-level directory. Shared code goes under <root>/shared/ (or language equivalent).
  4. Public API surface = files in the layout's public: list for each component; everything else is internal and MUST NOT be imported from other components.
  5. Cross-cutting concerns (logging, error handling, config, telemetry, auth middleware, feature flags, i18n) each get ONE entry under Shared / Cross-Cutting; per-component tasks consume them (see Step 2 cross-cutting rule).
  6. Write _docs/02_document/module-layout.md using templates/module-layout.md format.

Self-verification

  • Every component in DOCUMENT_DIR/components/ has a Per-Component Mapping entry
  • Every shared / cross-cutting concern has a Shared section entry
  • Layering table covers every component (shared at the bottom)
  • No component's Imports from list points at a higher layer
  • Paths follow the detected language's convention
  • No two components own overlapping paths

Save action

Write _docs/02_document/module-layout.md.

Blocking

BLOCKING: Present layout summary to user. Do NOT proceed to Step 2 until user confirms. The implement skill depends on this file; inconsistencies here cause file-ownership conflicts at batch time.