← Back to Skills Marketplace
GI Vue Component Guide
by
laimiaohua
· GitHub ↗
· v1.0.0
· MIT-0
253
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install gi-vue-component-guide
Description
Design and implement Vue 3 components following best practices. Use when creating Vue components, defining props/emits, or when the user asks for Vue compone...
README (SKILL.md)
Vue 3 组件规范
按团队规范设计与实现 Vue 3 组件,适用于 Composition API + Ant Design 技术栈。
何时使用
- 用户请求「写一个 Vue 组件」「设计组件结构」
- 定义 Props、Emits、Slots
- 使用 Composition API 组织逻辑
- 与 Ant Design 组件集成
项目结构
src/
├── components/ # 可复用组件
├── views/ # 页面级组件
├── router/
├── services/
├── stores/
├── types/
└── utils/
组件设计原则
1. 命名
- 组件文件:PascalCase,如
UserCard.vue、DataTable.vue - 组件注册:与文件名一致
- Props:camelCase,如
userName、isLoading
2. 单文件结构顺序
\x3Cscript setup lang="ts">
// 1. imports
// 2. props & emits 定义
// 3. 响应式状态
// 4. 计算属性
// 5. 方法
// 6. 生命周期 / watch
\x3C/script>
\x3Ctemplate>
\x3C!-- 模板 -->
\x3C/template>
\x3Cstyle scoped>
/* 样式 */
\x3C/style>
3. Props 定义
interface Props {
/** 用户 ID */
userId: number
/** 是否加载中 */
loading?: boolean
/** 自定义类名 */
class?: string
}
const props = withDefaults(defineProps\x3CProps>(), {
loading: false
})
- 必填项不加
? - 提供默认值用
withDefaults - 复杂类型从
types/导入
4. Emits 定义
const emit = defineEmits\x3C{
(e: 'update', value: string): void
(e: 'submit', payload: { id: number; name: string }): void
}>()
5. 与 Ant Design 集成
- 表单:
a-form+a-form-item,使用v-model或v-decorator(视版本) - 表格:
a-table,columns 用defineColumns或常量 - 弹窗:
a-modal,v-model:open控制显隐 - 按钮:
a-button,type 区分 primary/default/danger
6. 请求与状态
// 从 services 调用 API
import { getUserList } from '@/services/user'
const loading = ref(false)
const data = ref\x3CUser[]>([])
async function fetchData() {
loading.value = true
try {
data.value = await getUserList(params)
} finally {
loading.value = false
}
}
7. 类型定义
- 组件 Props/Emits 的 payload 类型放在
types/或组件同目录 - 使用
interface或type,避免any
示例模板
\x3Cscript setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import type { User } from '@/types/user'
interface Props {
title?: string
}
const props = withDefaults(defineProps\x3CProps>(), { title: '默认标题' })
const emit = defineEmits\x3C{ (e: 'confirm', id: number): void }>()
const list = ref\x3CUser[]>([])
const loading = ref(false)
onMounted(() => {
// 初始化
})
\x3C/script>
\x3Ctemplate>
\x3Cdiv class="user-card">
\x3Ca-spin :spinning="loading">
\x3C!-- 内容 -->
\x3C/a-spin>
\x3C/div>
\x3C/template>
\x3Cstyle scoped>
.user-card { /* ... */ }
\x3C/style>
常见模式
- 受控/非受控:优先受控(v-model),必要时支持非受控
- 插槽:默认 slot + 具名 slot(如
header、footer) - 样式:优先
scoped,避免污染;使用 CSS 变量统一主题
Usage Guidance
This skill is a static guide for writing Vue 3 components (Composition API + Ant Design). It does not install software or ask for secrets. Before using, ensure your project actually uses the stated stack (Vue 3, TypeScript conventions, Ant Design) and adapt any patterns to your team's linting/build rules and dependency versions. If you prefer guidance in another language or for a different UI library, look for a matching skill instead.
Capability Analysis
Type: OpenClaw Skill
Name: gi-vue-component-guide
Version: 1.0.0
The skill bundle is a standard coding style guide for Vue 3 development using the Composition API and Ant Design. It contains only documentation and code templates (SKILL.md) intended to guide an AI agent in generating consistent frontend components, with no evidence of malicious intent, data exfiltration, or prompt injection.
Capability Assessment
Purpose & Capability
The name/description (Vue 3 component guide) matches the SKILL.md content: guidance on Composition API, props/emits, project layout, and Ant Design integration. There are no unrelated requirements (no env vars, no binaries).
Instruction Scope
Instructions are purely prescriptive for component structure and patterns. They reference project paths (src/components, services, types) as expected for a coding style guide and do not instruct reading system files, accessing credentials, or sending data externally.
Install Mechanism
No install specification and no code files — the skill is instruction-only, so nothing is downloaded or written to disk.
Credentials
The skill requires no environment variables, credentials, or config paths. This is proportional for a documentation/style-guide skill.
Persistence & Privilege
always is false and the skill does not request elevated or persistent privileges. Normal autonomous invocation is allowed by platform default and is not a concern here given the skill's low surface area.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install gi-vue-component-guide - After installation, invoke the skill by name or use
/gi-vue-component-guide - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release. Gravitech Innovations.
Metadata
Frequently Asked Questions
What is GI Vue Component Guide?
Design and implement Vue 3 components following best practices. Use when creating Vue components, defining props/emits, or when the user asks for Vue compone... It is an AI Agent Skill for Claude Code / OpenClaw, with 253 downloads so far.
How do I install GI Vue Component Guide?
Run "/install gi-vue-component-guide" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is GI Vue Component Guide free?
Yes, GI Vue Component Guide is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does GI Vue Component Guide support?
GI Vue Component Guide is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created GI Vue Component Guide?
It is built and maintained by laimiaohua (@laimiaohua); the current version is v1.0.0.
More Skills