chore: 安装 halo-plugin-dev 技能到当前项目(skills CLI 项目级)

This commit is contained in:
2026-11-22 14:06:53 +08:00
parent 19dc0da1eb
commit a38cb4a3b5
4 changed files with 133 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
---
name: halo-plugin-dev
description: >
Create or modify Halo CMS plugins, including Java backend code, plugin.yaml and
extension resources, Gradle and DevTools configuration, plugin APIs and lifecycle,
and Vue-based Console or User Center UI. Use for Halo plugin implementation,
migration, debugging, or integration work; do not use for theme-only changes.
---
# Halo Plugin Development
Work from the target plugin and fetch current Halo documentation only when the
task needs a Halo-specific contract. Do not rely on API details embedded in the
skill or recalled from training data.
## Establish the Target
- Inspect the existing Gradle files, `src/main/resources/plugin.yaml`, UI package
manifest and build configuration, and nearby implementations before editing.
- Determine both the Halo platform dependency and `plugin.yaml` `spec.requires`.
Do not silently raise the requirement or switch the UI build format.
- Preserve an existing plugin's structure and tooling. For a new plugin, prefer
the official `pnpm create halo-plugin` scaffold unless the user chose another
starting point.
## Fetch Documentation on Demand
1. Start with the [plugin documentation index](https://docs.halo.run/developer-guide/plugin/index.md)
when the task involves Halo plugin APIs, configuration, lifecycle, UI, DevTools,
security, or integration contracts.
2. Use the complete [Halo documentation index](https://docs.halo.run/llms.txt)
only when the route is unclear or the task crosses documentation sections.
3. Fetch only the Markdown pages relevant to the current task. Do not load
`llms-full.txt` by default.
4. For version-sensitive work, also read the [plugin API changelog](https://docs.halo.run/developer-guide/plugin/api-changelog.md),
then verify exact signatures and behavior against the target dependency,
source, or existing callers. The target version wins over current-site docs.
If online docs are unavailable, continue from the target checkout and dependency
sources when possible, and disclose what could not be verified instead of guessing.
## Halo-Specific Boundaries
- Keep blocking work off reactive WebFlux paths; follow the current
[reactive development guide](https://docs.halo.run/developer-guide/plugin/basics/server/reactive-development.md).
- Reuse Halo-provided UI components, FormKit inputs, shared utilities, and the
project's installed build tooling before adding dependencies or custom equivalents.
- Use Setting YAML for ordinary plugin settings instead of creating a duplicate
settings route. Use FormKit for page and modal forms, and reuse Halo list,
search, modal, feedback, and permission components before native replacements;
follow the current [forms and page components guide](https://docs.halo.run/developer-guide/plugin/basics/ui/forms.md).
- Use the project's `generateApiClient` task to generate TypeScript models and API
methods from custom models and documented `SpringdocRouteBuilder` endpoints.
Reuse Halo's `axiosInstance`; do not handwrite generated resource types or create
a separate Axios client for `/api` or `/apis`. Follow the current
[API request guide](https://docs.halo.run/developer-guide/plugin/api-reference/ui/api-request.md).
- Treat generated API clients and built UI assets as generated files: change their
inputs and use the project's generator or build task rather than editing output.
- Store passwords, tokens, API keys, and private keys in Halo `Secret`, never in a
ConfigMap or custom-model spec. Validate user-controlled outbound destinations
against SSRF and redirect risks before attaching credentials, and keep public
APIs or security switches closed when configuration loading fails. Follow the
current [outbound HTTP guide](https://docs.halo.run/developer-guide/plugin/security/outbound-http.md).
- Add RoleTemplates only when non-super-admin or anonymous access is required;
grant the narrowest permissions needed.
## Verify
Use the project's existing Gradle and UI scripts. Run the narrowest relevant tests
and checks, and verify packaging when manifest, UI output, or generated resources
affect the plugin JAR. When a runnable Halo instance is available, smoke-test the
changed Console, User Center, API, lifecycle, or theme integration path.
@@ -0,0 +1,4 @@
interface:
display_name: "Halo Plugin Development"
short_description: "Build Halo CMS plugins with Java backend and Vue frontend"
default_prompt: "Help me create a Halo plugin"
@@ -0,0 +1,45 @@
{
"skill_name": "halo-plugin-dev",
"evals": [
{
"id": 1,
"prompt": "Implement a Project custom model, a synchronization endpoint described with SpringdocRouteBuilder, and a Console project list in a Halo 2.26 plugin. Complete the Java API and Vue request code. Do not assume the project has already generated a TypeScript client.",
"expected_output": "Java models and OpenAPI descriptions remain the source of truth, Gradle generates the TypeScript API client, and the UI reuses Halo's axiosInstance.",
"files": [],
"expectations": [
"generateApiClient is configured and run for the custom model and SpringdocRouteBuilder endpoint",
"The UI uses generated models, parameters, and API methods without handwritten duplicate resource types or API paths",
"Generated API classes reuse axiosInstance from @halo-dev/api-client",
"No separate Axios instance is created for /api or /apis",
"Generated directories, build artifacts, and lockfiles are not hand-edited"
]
},
{
"id": 2,
"prompt": "Add ordinary runtime settings and create/edit dialogs for Project resources to a Halo plugin. Implement the Console UI so its visuals, validation, loading states, and error feedback match Halo's built-in pages.",
"expected_output": "Ordinary configuration uses Setting YAML, business forms use the host FormKit installation, and page interactions reuse Halo components.",
"files": [],
"expectations": [
"Ordinary plugin settings are rendered from Setting YAML without a duplicate settings route",
"Create and edit forms use Halo's registered FormKit installation instead of a custom form system",
"Pages, dialogs, lists, search, and feedback reuse @halo-dev/components where available",
"Untrusted input is validated on both frontend and backend, and UI permissions match backend permissions",
"No host component source is copied and no new UI framework is added merely to imitate Halo styling"
]
},
{
"id": 3,
"prompt": "Implement a Halo plugin that periodically synchronizes projects from GitHub or a self-hosted GitLab instance. Administrators can configure the base URL and access token and may enable an anonymous public API. Implement secure storage, outbound requests, and configuration failure handling.",
"expected_output": "Credentials are stored in Secret resources, reactive requests validate SSRF and redirects before attaching credentials, and public access fails closed.",
"files": [],
"expectations": [
"The token is stored in a Halo Secret while ConfigMap and custom models store only the Secret name",
"WebFlux paths use WebClient and reactive Halo APIs without block calls or blocking clients",
"Custom destinations restrict schemes, hosts, resolved DNS addresses, and redirects before credentials are attached",
"Connection, response, and overall request timeouts and response size limits are configured",
"The anonymous API is enabled only after configuration loads successfully and explicitly enables it",
"Logs, errors, and public responses do not expose tokens or Secret contents"
]
}
]
}