Provides Astro/Starlight implementation patterns, best practices, and critical rules with tiered context loading
Provides Astro/Starlight implementation patterns, best practices, and critical rules with tiered context loading
/plugin marketplace add superbenefit/sb-marketplace/plugin install astro-dev@sb-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/README.mdSmart, context-aware implementation patterns for Astro and Starlight development. Provides the knowledge needed to write high-quality, standards-compliant Astro code.
The astro-coding skill is a knowledge provider that supplies Astro-specific coding patterns, critical rules, and best practices. It uses a tiered loading strategy to minimize token usage while ensuring all critical rules are always available.
The non-negotiable rules that prevent breaking errors. Loaded for every Astro/Starlight task.
Source: ${CLAUDE_PLUGIN_ROOT}/knowledge-base/critical-rules.md
Contains:
.astro, .ts, .js)astro:content not astro/content)class not className in .astro filesSECRET_* client-sidegetStaticPaths() for dynamic routesAstro.params inside getStaticPaths()CollectionEntry<'name'>)set:htmlPattern-specific knowledge loaded based on task type detection.
Sources:
${CLAUDE_PLUGIN_ROOT}/knowledge-base/astro-patterns.md - Core Astro patterns${CLAUDE_PLUGIN_ROOT}/knowledge-base/error-catalog.md - 100+ error patterns indexed by symptom${CLAUDE_PLUGIN_ROOT}/knowledge-base/starlight-guide.md - Starlight-specific patternsLoad based on keywords:
getStaticPathsComprehensive references for complex integrations and advanced features.
Source: ${CLAUDE_PLUGIN_ROOT}/knowledge-base/deep-dive/
Files:
integrations.md - External data integrations and custom loaderscontent-collections-reference.md - Complete collections APIcontent-loader-api.md - Advanced loader patternsexternal-data-integration.md - Multi-source content systemsrouting-pages-reference.md - Advanced routing patternsstarlight-specific.md - Deep Starlight customizationLoad for:
These rules are ALWAYS enforced, loaded from Tier 1:
// ✅ CORRECT
import Header from './Header.astro';
import { formatDate } from '../utils/dates.ts';
// ❌ WRONG - Build error
import Header from './Header';
// ✅ CORRECT - Use colon
import { getCollection } from 'astro:content';
// ❌ WRONG - Module not found
import { getCollection } from 'astro/content';
class Not className ✅<!-- ✅ CORRECT in .astro files -->
<div class="container">
<!-- ❌ WRONG - React/JSX syntax -->
<div className="container">
---
// ✅ CORRECT
const posts = await getCollection('blog');
---
<ul>{posts.map(p => <li>{p.data.title}</li>)}</ul>
<!-- ❌ WRONG - Await in template -->
<ul>{(await getCollection('blog')).map(...)}</ul>
// ✅ CORRECT - Server-side only
const apiKey = import.meta.env.SECRET_API_KEY;
// ❌ WRONG - Exposed to client
<script>
const key = import.meta.env.SECRET_API_KEY; // ❌ NEVER
</script>
---
interface Props {
title: string;
items: string[];
variant?: 'primary' | 'secondary';
}
const { title, items, variant = 'primary' } = Astro.props;
---
<div class={`component component--${variant}`}>
<h2>{title}</h2>
<ul>
{items.map(item => <li>{item}</li>)}
</ul>
</div>
<style>
.component {
padding: 1rem;
}
.component--primary {
background: var(--color-primary);
}
</style>
---
// File: src/pages/blog/[slug].astro
import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map(post => ({
params: { slug: post.slug },
props: { post },
}));
}
interface Props {
post: CollectionEntry<'blog'>;
}
const { post } = Astro.props;
const { Content } = await post.render();
---
<article>
<h1>{post.data.title}</h1>
<time datetime={post.data.publishDate.toISOString()}>
{post.data.publishDate.toLocaleDateString()}
</time>
<Content />
</article>
// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
description: z.string(),
publishDate: z.date(),
author: z.string(),
tags: z.array(z.string()).optional(),
draft: z.boolean().default(false),
}),
});
export const collections = { blog };
Task: "Create a Card component"
Load:
- Tier 1: Critical rules (always)
- Tier 2: Component patterns from astro-patterns.md
Tokens: ~300 total
Task: "Add blog with pagination"
Load:
- Tier 1: Critical rules (always)
- Tier 2: Routing patterns + Collection patterns + Starlight guide
Tokens: ~600 total
Task: "Integrate GitBook API with custom loader"
Load:
- Tier 1: Critical rules (always)
- Tier 2: Collection patterns + error catalog
- Tier 3: integrations.md + external-data-integration.md
Tokens: ~1200 total
Task: "Fix TypeScript errors in components"
Load:
- Tier 1: Critical rules (always)
- Tier 2: Error catalog + TypeScript patterns
Tokens: ~400 total
The skill detects keywords to load appropriate patterns:
| Keywords | Patterns Loaded |
|---|---|
| component, card, button, layout | Component patterns, Props typing |
| page, route, [slug], dynamic | Routing patterns, getStaticPaths |
| collection, content, blog, docs | Collection patterns, schemas |
| config, integration, tailwind | Configuration patterns |
| starlight, sidebar, nav | Starlight patterns |
| error, fix, debug, failing | Error catalog |
| api, fetch, external, loader | Integration patterns (Tier 3) |
| authentication, auth, login | Security patterns + integrations |
knowledge-base/
├── critical-rules.md # Tier 1: Always loaded
├── astro-patterns.md # Tier 2: Core patterns
├── error-catalog.md # Tier 2: 100+ errors indexed
├── starlight-guide.md # Tier 2: Starlight specifics
└── deep-dive/ # Tier 3: On-demand
├── integrations.md
├── content-collections-reference.md
├── content-loader-api.md
├── external-data-integration.md
├── routing-pages-reference.md
└── starlight-specific.md
Minimal loading (~100 tokens):
Standard loading (~400 tokens):
Full loading (~1200 tokens):
The error catalog indexes 100+ error patterns by symptom for quick diagnosis:
Example lookup:
Symptom: "Cannot find module './Header'"
→ Error catalog points to: Missing file extension
→ Solution: Add .astro extension to import
Categories in catalog:
/dev - Uses this skill for all implementation tasks/design - References architecture patterns from Tier 2/3/lookup - Uses Tier 2 patterns for quick API referenceWhen writing code with this skill:
Validation checklist (from critical rules):
astro:content not astro/contentclass not classNameawait in frontmatter, not templatesSECRET_* in <script> tagsgetStaticPaths()Skill Version: 3.0 (Tiered Loading) Plugin Version: v0.4.0+ Last Updated: 2025-11-05
This skill provides comprehensive Astro/Starlight knowledge with intelligent, token-efficient loading based on task requirements.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.