skills/astro/SKILL.md
--- name: astro description: Deploy multilingual static websites for free on Cloudflare using Astro framework with markdown source files. Use when: (1) Creating new static sites or blogs, (2) Setting up multilingual (i18n) content, (3) Deploying to Cloudflare Pages, (4) Converting markdown to static websites, (5) Setting up free hosting infrastructure. license: MIT metadata: author: swal version: "1.0.0" --- # Astro Static Site Generator Deploy multilingual static websites for free on Clou
npx skillsauth add iberi22/swal-skills skills/astroInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deploy multilingual static websites for free on Cloudflare using Astro framework.
npm create astro@latest my-site -- --template minimal
cd my-site
npm install
Static Sites (Recommended for most use cases)
No adapter needed. Use default static output:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://your-site.pages.dev',
});
SSR/Edge Functions (Optional)
If you need server-side rendering or edge functions:
npm install @astrojs/cloudflare
// astro.config.mjs
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare(),
site: 'https://your-site.pages.dev',
});
Git Integration (Recommended)
npm run builddistDirect Upload
# Deploy (authenticate via Cloudflare dashboard or wrangler)
npx wrangler pages deploy dist
// astro.config.mjs
export default defineConfig({
i18n: {
defaultLocale: 'en',
locales: ['en', 'es', 'fr', 'de'],
routing: {
prefixDefaultLocale: false, // /about instead of /en/about
},
},
});
Routing Modes:
| Setting | URL Structure | Best For |
|---------|--------------|----------|
| prefixDefaultLocale: false | /about, /es/about | Default locale at root |
| prefixDefaultLocale: true | /en/about, /es/about | All locales prefixed |
src/content/
├── config.ts # Content collection schema
└── docs/
├── en/
│ ├── index.md
│ └── guide.md
├── es/
│ ├── index.md
│ └── guide.md
└── fr/
├── index.md
└── guide.md
// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const docs = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
description: z.string(),
lang: z.enum(['en', 'es', 'fr', 'de']),
}),
});
export const collections = { docs };
Note: Run npx astro sync after adding content collections to generate types.
---
// src/components/LanguageSwitcher.astro
const languages = {
en: 'English',
es: 'Español',
fr: 'Français',
de: 'Deutsch',
};
const currentPath = Astro.url.pathname;
const currentLang = Astro.currentLocale || 'en';
---
<select onchange="window.location = this.value">
{Object.entries(languages).map(([code, name]) => (
<option
value={`/${code}${currentPath}`}
selected={code === currentLang}
>
{name}
</option>
))}
</select>
my-site/
├── astro.config.mjs # Astro configuration
├── package.json
├── public/
│ ├── favicon.svg
│ └── _redirects # Cloudflare redirects (optional)
├── src/
│ ├── components/
│ │ └── LanguageSwitcher.astro
│ ├── content/
│ │ ├── config.ts
│ │ └── blog/
│ │ ├── en/
│ │ └── es/
│ ├── layouts/
│ │ └── BaseLayout.astro
│ └── pages/
│ ├── index.astro
│ ├── en/
│ │ └── index.astro
│ └── es/
│ └── index.astro
| Setting | Value |
|---------|-------|
| Build command | npm run build |
| Build output | dist |
| Node version | 20 |
| Environment | NODE_VERSION=20 |
Cloudflare Dashboard → Pages → your-site → Custom domains → Add domain
Create public/_redirects:
/ /en/ 302
/old-page /new-page 301
| Command | Description |
|---------|-------------|
| npm run dev | Start dev server |
| npm run build | Build for production |
| npm run preview | Preview production build |
| npx astro sync | Generate content collection types |
| npx wrangler login | Authenticate with Cloudflare |
| npx wrangler pages deploy dist | Deploy to Cloudflare |
---
// src/pages/blog/[...slug].astro
import { getCollection } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map(post => ({
params: { slug: post.slug },
props: { post },
}));
}
const { post } = Astro.props;
const { Content } = await post.render();
---
<article>
<h1>{post.data.title}</h1>
<Content />
</article>
Set NODE_VERSION=20 in Cloudflare Pages environment variables.
// astro.config.mjs
export default defineConfig({
trailingSlash: 'always',
});
Ensure:
lang frontmatternpx astro sync after creating content collectionsRun npx astro sync to generate TypeScript types.
| Script | Description |
|--------|-------------|
| astro-new-post.py | Create multilingual blog posts |
| astro-i18n-check.py | Validate translation coverage |
# Create a new post in multiple languages
python scripts/astro-new-post.py --title "My Post" --langs en,es,fr
# Create with author and tags
python scripts/astro-new-post.py --title "Tutorial" --langs en,es --author "John" --tags tutorial,astro
# Check translation coverage
python scripts/astro-i18n-check.py --langs en,es,fr
# Check specific content directory
python scripts/astro-i18n-check.py --content-dir src/content/blog --langs en,es
# Output as JSON
python scripts/astro-i18n-check.py --langs en,es,fr --json
All scripts use only Python standard library (no dependencies).
testing
Xavier2 as the central context engine for SWAL - intelligent memory, decision-making, and context orchestration. Xavier2 is the CEO brain that stores memories, coordinates agents, and maintains project state.
tools
Delegate coding tasks to Codex, Claude Code, or Pi agents via background process. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large codebases, (4) iterative coding that needs file exploration. NOT for: simple one-liner fixes (just edit), reading code (use read tool), thread-bound ACP harness requests in chat (for example spawn/run Codex or Claude Code in a Discord thread; use sessions_spawn with runtime:"acp"), or any work in ~/clawd workspace (never spawn agents here). Claude Code: use --print --permission-mode bypassPermissions (no PTY). Codex/Pi/OpenCode: pty:true required.
testing
Validador automático para WorldExams. Verifica integridad técnica y calidad pedagógica, activando regeneración automática si es necesario.
tools
Generador de bundles de preguntas ICFES Colombia (Matemáticas, Lectura Crítica, Ciencias, Sociales, Inglés) para grados 6, 9 y 11 usando MiniMax MCP.