一键导入
stk-blueprint
// Scaffold a new stk blueprint with models, views, templates, and Alembic migration. Use when creating a new feature module, adding a new section to the app, or scaffolding a blueprint.
// Scaffold a new stk blueprint with models, views, templates, and Alembic migration. Use when creating a new feature module, adding a new section to the app, or scaffolding a blueprint.
Generate async CRUD API endpoints for an existing stk model. Use when adding API routes, REST endpoints, or CRUD operations to an stk blueprint.
Background knowledge for stk async Quart framework development. Auto-loads when working on stk-based code: models, views, templates, database queries, auth patterns, Vue frontend. Provides conventions, patterns, and gotchas so Claude writes correct async Quart code instead of Flask patterns.
Generate and review an Alembic database migration for stk. Use when adding or changing models, creating migrations, or managing database schema changes.
| name | stk-blueprint |
| description | Scaffold a new stk blueprint with models, views, templates, and Alembic migration. Use when creating a new feature module, adding a new section to the app, or scaffolding a blueprint. |
| argument-hint | [blueprint-name] |
Create a complete blueprint for $ARGUMENTS in the stk framework.
Existing blueprints:
!ls -d stk/*/views.py 2>/dev/null | sed 's|stk/||;s|/views.py||'
Registered in app.py:
!grep -E 'register_blueprint|from stk\.' stk/app.py
Navigation items:
!grep -E 'title:|heading:' stk/static/js/navigation.js 2>/dev/null | head -20
Create the blueprint directory at stk/$ARGUMENTS/:
__init__.py (empty)models.py with model(s) inheriting from Baseviews.py with Blueprint, page route, and CRUD API endpointsModels must follow stk conventions:
import dataclasses and use @dataclasses.dataclass decoratorBase from stk.extensions, NOT dbColumn(Type) from sqlalchemy directlylazy="selectin"to_dict() instance methodasync from_dict(self, data) as instance method that mutates self (NOT a classmethod)created_at = Column(DateTime, default=datetime.now, nullable=False)Views must follow the real codebase patterns:
async defimport orjson as json and return Response(json.dumps(data), content_type="application/json") for list endpoints@bp.before_request with @auth_required("session") (add @roles_required("admin") if admin-only)await g.db_session.execute(...) or await g.db_session.get(...){item: {...}}, extract with json_data.get("item", {})await g.db_session.rollback() on errorawait Activity.register(current_user.id, "Action", data){"message": "..."} for create/update/delete responsesPER_PAGE = 25 constantlog = logging.getLogger(__name__) for error loggingCreate template at stk/templates/$ARGUMENTS/index.html or stk/templates/cms/$ARGUMENTS.html:
layout.htmldata(), methods, mounted(), NOT setup()mixins: [layoutMixin] and delimiters: config.delimitersconst vuetify = createVuetify(config.vuetifyConfig)registerStkComponents(app) before app.use(vuetify).mount("#app")v-data-table-server for liststi ti-*), e.g. ti ti-plus, ti ti-pencil, ti ti-trash, ti ti-x<script type="application/json" id="...">{{ data|tojson|safe }}</script>toRaw() from Vue when editing items: const {createApp, toRaw} = VueRegister the blueprint in stk/app.py:
app.register_blueprint(bp) in register_blueprints()Add navigation entry in stk/static/js/navigation.js:
// Simple link (role is singular string, not array)
{ title: '$ARGUMENTS', icon: 'ti ti-<icon>', to: '/$ARGUMENTS', role: 'admin' },
// Or grouped with children
{
title: '$ARGUMENTS', icon: 'ti ti-<icon>', role: 'admin',
children: [
{ title: 'List', icon: 'ti ti-list', to: '/$ARGUMENTS' },
]
},
Generate Alembic migration:
uv run quart db revision -m "add $ARGUMENTS tables"Verify:
uv run ruff check --fix . && uv run ruff format .uv run python checks.pydb.Model, db.Column, db.select(), or any Flask-SQLAlchemy patternsfrom flask import ... or from flask_security import ...async def)jsonify() (return dicts or Response objects)lazy="dynamic" on relationships (breaks async)await on DB operationssetup(), ref(), reactive()) — use Options APIti ti-*){item: {...}}mixins: [layoutMixin] or registerStkComponents(app) in templates