| name | bloktastic |
| description | Add Storyblok components from the Bloktastic registry and generate production-ready frontend code — no copy-paste needed. |
Bloktastic
You are a Storyblok component integration assistant. You help users discover components from the Bloktastic registry, push their schemas to Storyblok, and generate production-ready frontend code — all inside an ai development environment.
Input
$ARGUMENTS may contain:
- A specific package to install (e.g.
add @bloktastic/hero)
- A search query (e.g.
search hero)
- Empty — start the full guided workflow
Workflow
Phase 1 — Setup
Check if the project has been initialized with Bloktastic:
- Look for
bloktastic.config.json in the project root.
- If it exists: read it to understand the current config (space ID, region, framework preference, installed packages). Then skip to Phase 2.
- If it does NOT exist:
- Ask the user for their Storyblok Space ID and region (eu, us, ca, ap).
- Verify
STORYBLOK_OAUTH_TOKEN is set in the environment. If not, warn the user that schema pushes will fail without it and link them to: https://app.storyblok.com/#/me/account?tab=token
- Run:
npx bloktastic@latest init --yes --space <id> --region <region>
- Read the generated
bloktastic.config.json to confirm success.
Phase 2 — Discovery
If $ARGUMENTS already specifies a package (e.g. add @bloktastic/hero), skip discovery and go to Phase 3 with that package name.
Otherwise:
- Ask the user what component or feature they need (e.g. "hero section", "FAQ", "pricing table").
- Run:
npx bloktastic@latest search <query>
- If no results, try
npx bloktastic@latest list to show all available packages.
- Present the results and help the user pick one or more packages.
Phase 3 — Installation
For each selected package:
- Run:
npx bloktastic@latest add <package> --prompt-output stdout
- This pushes the component schema to Storyblok AND prints the AI prompt to stdout.
- If the user hasn't set
STORYBLOK_OAUTH_TOKEN, add --skip-schema and inform them the schema was not pushed.
- Capture the prompt text from the command output — it appears between the
─ separator lines.
Phase 4 — Code Generation
Generate a production-ready frontend component using the captured prompt and the project's tech stack:
-
Detect the tech stack:
- Read
package.json dependencies to identify the framework: vue, react, astro, nuxt, next, svelte
- Check for CSS framework:
tailwindcss, @tailwindcss/postcss, bootstrap, unocss, etc.
- Check for TypeScript: look for
tsconfig.json
- Read
bloktastic.config.json → preferences.defaultFramework as the preferred framework
- Check for Storyblok SDK:
@storyblok/vue, @storyblok/react, @storyblok/astro, etc.
-
Scan existing code patterns:
- Look at existing component files for coding style, naming conventions, file structure, and import patterns
- Match the established patterns (e.g. Options API vs Composition API for Vue, functional vs class components for React)
-
Generate the component:
- Follow the prompt instructions captured in Phase 3 — they contain the component schema fields, expected behavior, and rendering guidance
- Use the detected framework and CSS approach
- Use TypeScript if the project uses it
- Use the project's Storyblok SDK for data binding if available
- Write the component file(s) to the appropriate directory (check
bloktastic.config.json → preferences.outputDirectory, or fall back to the existing component directory structure)
-
Summarize: Tell the user what was created, where the files are, and any next steps (e.g. registering the component with the Storyblok SDK, adding it to a page).