section-colocation

Organizes Astro page builder section companion files into colocated folders.

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/malikkotb/shellpluscore --skill section-colocation-malikkotb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: section-colocation
Source: https://github.com/malikkotb/shellpluscore/tree/main/.agents/skills/section-colocation
Command: npx skills add https://github.com/malikkotb/shellpluscore --skill section-colocation-malikkotb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When an Astro page builder section grows beyond a single file, developers must decide where companion files (client-side components, server actions, data, helpers) belong without breaking the project's conventions or the Sanity schema registry. ## Core Features & Use Cases - Scoped vs shared decision rule: Applies a reuse test to decide whether a file is colocated in the section folder or placed in the shared src/components/ library. - Folder promotion convention: Promotes a flat {Name}Section.astro file into a sections/{Name}Section/ folder with no index.astro and no barrel files. - Import and registry maintenance: Re-bases relative imports one level deeper and updates the PageSections.astro registry path while leaving schema names untouched. - Use Case: You add a custom element to a contact form section; the skill moves ContactFormSection.astro into its own folder, colocates ContactFormElement.ts beside it, and updates the registry import. ## Quick Start Ask the assistant to colocate a new client-side component with an existing page builder section and update the registry import accordingly.

Frequently Asked Questions about section-colocation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize companion files for an Astro component?

Promote the flat component file into a folder named after it, keeping the component filename unchanged, and colocate scoped companions beside it. Import siblings with relative paths like ./ContactFormElement and avoid index.astro barrel files.

When should a component go in a shared components folder instead of a section folder?

Apply the reuse test: if another section could plausibly reuse the file, place it under src/components/ and import it via the ~/components/ alias. Only section-specific logic belongs colocated in the section folder.

Does moving a section into a folder change its Sanity schema name?

No. The Sanity schema name, the section component name, and the registry map key stay unchanged. Only the import path in PageSections.astro gains the folder segment.

Should I use index.astro as the entry file for a component folder?

No. The convention repeats the folder name for the entry file, such as ContactFormSection/ContactFormSection.astro, so the component is identifiable in editor tabs and search. Barrel files and re-exports are not used.

When should I not use section colocation?

Do not use it to create a brand-new section, which belongs to scaffolding, or to place reusable design-system components, which belong in src/components/. It only applies once an existing section needs companion files.