keep-astro-frontmatter-clean
Installation
SKILL.md
Summary
Keep the "Code Fence" (the area between ---) in .astro files focused on View Logic (fetching props, transforming data for display). Move complex business logic, data fetching wrappers, or heavy computations into separate .ts utility files.
Rationale
- Testability: Code inside
.astrofiles is hard to unit test isolated from the markup..tsfiles are easy to test. - Readability: Huge frontmatter blocks hurt the scannability of the component structure.
- Reusability: Logic in
.tsfiles can be shared across endpoints and components.
Guidance
- Extract: If the frontmatter exceeds 20-30 lines, consider extracting classes or functions.
- Imports: Import the logic and call it.