Logo Module Scaffold

Module Scaffold

Tổ chức
opendatahub-io
module-scaffold

Given a component name, generate a complete standalone ODH module operator repository. Produces Go module, CRD types implementing PlatformObject, controller skeleton with reconciler builder pattern, Helm chart, Makefile, CI config, singleton webhook, and AGENTS.md. Use when starting a new module from scratch.

Tổng quan

Nhà phát hànhopendatahub-io
Kho mãai-helpers
Tên kỹ năngmodule-scaffold
Sao
39
Bản fork
76
Tệp đi kèm
1
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được opendatahub-io công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Module Scaffold trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-modules/skills/module-scaffold
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opendatahub-io/ai-helpers.git /tmp/ai-helpers
mkdir -p .claude/skills
cp -r /tmp/ai-helpers/plugins/odh-modules/skills/module-scaffold .claude/skills/module-scaffold
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Module Scaffold trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Module Scaffold ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Module Scaffold với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

ODH Module Scaffold

Generate a complete standalone module operator repository for the ODH platform.

Step 1: Parse arguments

Extract the component name from $ARGUMENTS. If not provided, ask the user.

Derive these values from the component name (example: model-registry):

VariableExample Value
COMPONENTmodel-registry
COMPONENT_SNAKEmodel_registry
COMPONENT_PASCALModelRegistry
COMPONENT_LOWERmodelregistry
COMPONENT_LOWER_PLURALmodelregistries
MODULE_REPO<COMPONENT>-operator
API_GROUPcomponents.platform.opendatahub.io
API_VERSIONv1alpha1
SINGLETON_NAMEdefault-<COMPONENT>

Ask the user:

  1. Which API group to use: components.platform.opendatahub.io or services.platform.opendatahub.io? Default: components.
  2. Target directory? Default: ./<MODULE_REPO>.

Step 2: Create directory structure

Generate this layout:

text
<MODULE_REPO>/
├── api/<API_VERSION>/
│   ├── <COMPONENT_SNAKE>_types.go
│   ├── <COMPONENT_SNAKE>_common.go
│   ├── groupversion_info.go
│   └── doc.go
├── internal/
│   ├── controller/
│   │   ├── <COMPONENT_SNAKE>_controller.go
│   │   └── <COMPONENT_SNAKE>_controller_actions.go
│   └── webhook/
│       └── singleton.go
├── charts/<MODULE_REPO>/
│   ├── Chart.yaml
│   ├── values.yaml
│   └── templates/
│       ├── deployment.yaml
│       ├── serviceaccount.yaml
│       ├── clusterrole.yaml
│       ├── clusterrolebinding.yaml
│       ├── webhook-service.yaml
│       ├── webhook-certificate.yaml
│       └── _helpers.tpl
├── cmd/
│   └── main.go
├── config/
│   └── samples/
│       └── <COMPONENT_SNAKE>.yaml
├── go.mod
├── Makefile
├── Containerfile
├── .github/workflows/
│   └── ci.yaml
├── .rules/
│   ├── api-types.md
│   ├── controller.md
│   ├── helm-chart.md
│   ├── security.md
│   └── testing.md
├── AGENTS.md
├── README.md
└── .gitignore

Step 3: Generate CRD types

Use the templates from ${CLAUDE_SKILL_DIR}/references/templates.md to generate each file. Key requirements:

api/<API_VERSION>/<COMPONENT_SNAKE>_types.go

The CR type must:

  • Embed metav1.TypeMeta and metav1.ObjectMeta
  • Have Spec field using <COMPONENT_PASCAL>Spec
  • Have Status field using <COMPONENT_PASCAL>Status
  • Include kubebuilder markers: +kubebuilder:object:root=true, +kubebuilder:subresource:status, +kubebuilder:resource:scope=Cluster
  • Include CEL singleton validation for the name
  • Include compile-time assertion: var _ common.PlatformObject = (*<COMPONENT_PASCAL>)(nil)
  • Implement all PlatformObject methods (GetStatus, GetConditions, SetConditions, GetReleaseStatus, SetReleaseStatus)

The status struct must embed common.Status and common.ComponentReleaseStatus both as anonymous (unnamed) fields with json:",inline" tags. Use common.ComponentReleaseStatus \json:",inline"`instead of a named field likeReleases common.ComponentReleaseStatus json:"releases,omitempty"because a named field serializes as a nested object{releases: {releases: [...]}}instead of the flat array{releases: [...]}` the CRD expects, causing status update failures.

api/<API_VERSION>/<COMPONENT_SNAKE>_common.go

Define <COMPONENT_PASCAL>CommonSpec with common.ManagementSpec embedded inline. This struct is inlined into <COMPONENT_PASCAL>Spec.

api/<API_VERSION>/groupversion_info.go

Standard kubebuilder groupversion registration using the chosen API group and version.

api/<API_VERSION>/doc.go

Package doc comment with +groupName=<API_GROUP> marker.

Step 4: Generate controller

internal/controller/<COMPONENT_SNAKE>_controller.go

The controller setup must:

  • Use reconciler.NewReconciler with functional options pattern
  • Register render, deploy, and gc actions (gc MUST be last)
  • Use ReconcilerFor builder pattern with WithReconcilerOpts for release info. The default conditions (Ready + ProvisioningSucceeded) are sufficient for the scaffold. Add WithConditions("Degraded") only when real actions explicitly manage it via rr.Conditions.MarkFalse/MarkTrue
  • Import from odh-platform-utilities packages:
    • framework/controller/reconciler for reconciler setup
    • framework/controller/conditions for condition management
    • framework/controller/actions/deploy for resource deployment
    • framework/controller/actions/gc for garbage collection
    • framework/controller/actions/render for manifest rendering
    • framework/api for Release type
    • pkg/cluster for platform detection
    • pkg/metadata for label/annotation constants

internal/controller/<COMPONENT_SNAKE>_controller_actions.go

Define three action functions:

  1. renderAction -- use framework/controller/actions/render
  2. deployAction -- use framework/controller/actions/deploy with SSA mode
  3. gcAction -- use framework/controller/actions/gc

Each action follows the signature: func(ctx context.Context, rr *types.ReconciliationRequest) error

Step 5: Generate Helm chart

charts/<MODULE_REPO>/Chart.yaml

yaml
apiVersion: v2
name: <MODULE_REPO>
description: Helm chart for the <COMPONENT_PASCAL> module controller
version: 0.1.0
appVersion: "0.1.0"
type: application

charts/<MODULE_REPO>/values.yaml

Provide defaults for: image repository/tag, replicas (1), resources (requests: 100m CPU, 128Mi memory; limits: 500m CPU, 512Mi memory), service account name, node selector, tolerations.

Templates

Generate ONLY controller infrastructure manifests:

  • deployment.yaml -- Controller Deployment with leader election, health/readiness probes, security context (non-root, read-only rootfs)
  • serviceaccount.yaml -- ServiceAccount for the controller
  • clusterrole.yaml -- ClusterRole with module-specific RBAC (no wildcards)
  • clusterrolebinding.yaml -- Bind the ClusterRole to the ServiceAccount
  • webhook-service.yaml -- Service exposing webhook port 443 for the singleton admission webhook
  • webhook-certificate.yaml -- cert-manager Certificate for webhook TLS (uses a self-signed Issuer scoped to the release namespace)
  • _helpers.tpl -- Standard Helm helpers (name, labels, selectors)

Do NOT generate application-level manifests.

Step 6: Generate supporting files

cmd/main.go

Standard controller-runtime manager setup with:

  • Scheme registration for the module API
  • Health/readiness endpoints
  • Leader election support
  • Controller and webhook registration

Makefile

Include targets: build, test, lint, manifests, generate, fmt, vet, docker-build, docker-push, helm-lint.

Containerfile

Multi-stage build: Go builder stage + distroless runtime stage.

.github/workflows/ci.yaml

GitHub Actions workflow with: lint, test, build jobs. Pin actions to full commit SHAs. Set permissions: read-all.

AGENTS.md

Use the comprehensive template from ${CLAUDE_SKILL_DIR}/../module-compliance/references/agents-md-template.md as a starting point. Replace <COMPONENT_PASCAL> and other placeholders with the actual component values. This file provides passive guidance to AI agents working in the module repo -- covering PlatformObject contract, controller patterns, Helm chart rules, security, and separation of concerns.

.rules/ directory

Copy the rule files from ${CLAUDE_SKILL_DIR}/../module-compliance/references/rules/ into the generated repo's .rules/ directory. These are path-scoped rules that fire automatically when agents edit matching files (e.g., api/**/*.go, internal/controller/**/*.go, charts/**). Files to copy:

  • api-types.md -- CRD type conventions
  • controller.md -- Controller patterns and GC ordering
  • helm-chart.md -- Chart content restrictions
  • security.md -- Webhook, TLS, RBAC, and metadata rules
  • testing.md -- Test patterns and conventions

config/samples/<COMPONENT_SNAKE>.yaml

A sample CR manifest with the singleton name and managementState: Managed.

README.md

Brief README with: project description, prerequisites (Go 1.25+, controller-runtime, cert-manager), build instructions, usage instructions.

.gitignore

Standard Go gitignore (bin/, vendor/, *.exe, etc.).

Step 7: Initialize Go module

Run the following commands in the generated directory:

bash
cd <MODULE_REPO>
go mod init github.com/opendatahub-io/<MODULE_REPO>
go mod edit -require github.com/opendatahub-io/odh-platform-utilities@v0.1.0
go mod edit -require github.com/opendatahub-io/odh-platform-utilities/framework@v0.1.0

The root module (api/common, pkg/) is tagged at v0.1.0. The framework sub-module has its own go.mod and requires a separate dependency line.

Note: go mod tidy will fail until the controller code compiles. Inform the user that they should run go mod tidy after filling in the controller implementation details and installing controller-gen.

Step 8: Validate

Suggest the user run the module-compliance skill against the generated repo to verify all contract rules pass. Also suggest running make lint and make test once the Go dependencies are resolved.

Gotchas

  • go mod tidy will fail until controller-gen generates deepcopy methods and all placeholder code compiles. Run make generate first.
  • The Helm chart must contain ONLY controller manifests. Application workloads are embedded in the controller binary and applied by the controller at runtime.
  • Do not import github.com/openshift/api for ManagementState. The shared library uses a plain string type that is wire-compatible.
  • The GC action must always be the last .WithAction() in the reconciler builder chain. Deploy stamps annotations that GC reads -- reversing the order deletes resources that were just deployed.
  • The singleton name in the CEL rule must exactly match what the orchestrator creates. Convention is default-<component>.
  • common.ComponentReleaseStatus MUST be an anonymous inline embed in the status struct: common.ComponentReleaseStatus \json:",inline"`. A named field like Releases common.ComponentReleaseStatuswraps the innerreleasesarray in an extra JSON object, producing{releases: {releases: [...]}}` which fails CRD validation.
  • RBAC resource names (ClusterRole, ClusterRoleBinding) must be unique and must not collide with names the in-tree operator handler creates for the same component. The in-tree handler typically creates resources like <component>-operator-manager-role and will overwrite any resource with the same name via SSA, stripping the standalone controller's permissions. Use the Helm fullname helper (which defaults to the chart name) to generate unique names like <MODULE_REPO> instead of common patterns like *-manager-role.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Module Scaffold làm được gì?

Given a component name, generate a complete standalone ODH module operator repository. Produces Go module, CRD types implementing PlatformObject, controller skeleton with reconciler builder pattern, Helm chart, Makefile, CI config, singleton webhook, and AGENTS.md. Use when starting a new module from scratch.

Vì sao nên dùng Module Scaffold trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Module Scaffold là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Module Scaffold trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-modules/skills/module-scaffold. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Module Scaffold?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Module Scaffold với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Module Scaffold với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Module Scaffold có miễn phí không?

Có. Kỹ năng này được opendatahub-io phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇