Skill instructions
kling-ai7.22 KB
View saved version →
---
name: kling-ai
description: Generate images or videos with Kling AI in Codex, or handle existing tasks, conversation references, subject and motion libraries, credits, and account connections. Capabilities depend on the current account's live CLI response. Do not use for media analysis that does not call Kling.
---
# Kling AI for Terminal
Use only the pinned Global CLI in the [CLI contract](references/cli-contract.md). This is a local Skills-only plugin. The CLI owns browser OAuth; do not request or log credentials, private account fields, or signed URLs.
## Load rules by request
- Image generation, editing, posters, and reference-based creation: use `kling-ai-generate-image`.
- Video generation, keyframes, omni references, motion control, and shot planning: first read the [video Skill](../kling-ai-generate-video/SKILL.md) and follow its entry-point routing before choosing a model. Reading only this core Skill and the submission workflow is insufficient.
- Progress, existing results, or refreshed output links: read only [task results](references/task-results.md), without generation recommendations, model parameters, or creative references.
- New generation, edits, or authorized retries: select through the relevant creative Skill, then follow [generation submission](references/tool-workflows.md). Execute dependent steps in order.
- Subject library, motion library, or conversation references: read [asset workflows](references/asset-workflows.md). Read-only asset queries never submit generation.
- Before generation, read [capability discovery](references/capability-discovery.md). After selecting an available model, use the [parameter module table](references/model-parameters.md) to load only supported rules needed for this request.
- Authorization, upload, model, or service errors: read [troubleshooting](references/troubleshooting.md). Read [examples](references/prompt-examples.md) when examples are needed.
## Account visibility and rollout
- The current account's live `who_am_i` response governs models, parameters, specifications, input types, and combination limits. `tool_list` establishes tool availability and call structure; membership pages, tool descriptions, and static examples cannot override account capabilities.
- Display, recommend, or call a model name only when the current `tool_list` exposes its tool and `who_am_i.availableModels` lists it under that tool. Tool counts, newly exposed omni tools, example names, and default-model fields are not substitutes for membership in that model set.
- Compare "latest" only within available models supporting the required output type and intent. Do not mix image and video versions; `defaultModel` does not mean latest. Qualify the conclusion as the latest image/video model available to the current account. If no suitable new model is returned, use an available model without mentioning higher versions, unreleased names, allowlists, or better hidden models. Never fill gaps from Skills, snapshots, other accounts, or earlier sessions.
- If a requested model is absent from filtered discovery, expand discovery as described in [capability discovery](references/capability-discovery.md). If it exists only for another output type, explain the mismatch and let the user choose whether to keep the requested medium or use the model's supported medium; do not switch silently. After complete discovery, report only that the current connection did not return the requested model, without repeating hidden names. Alternatives must be actually available and suitable.
- Rediscover tools and models after reconnecting or changing account/environment. If discovery fails or model membership cannot be established, do not submit using a static fallback.
## Creative and capability selection
Read the video Skill even for read-only video model selection. When `omni_ref_video` exists, inspect its `who_am_i` model set before choosing or falling back. Text-only input does not imply `text_to_video` is the only option: required assets depend on the selected model's input and combination rules, not the tool's name.
Honor supplied asset roles, model, sound, ratio, and quality requirements. Ask only about missing information that materially changes the result. Prefer a user-specified available model; otherwise use these branches without maintaining fixed model lists:
| Live capability | Selection |
| --- | --- |
| The current entry point, or a new one supporting the same intent, returns a suitable newer-generation model | Prefer the newer model. Use live descriptions for quality or speed preferences and actual billing information for budget comparisons. |
| No suitable new model is returned, including a new tool exposing only existing models | Keep the existing entry point and its available `defaultModel`; if that default does not meet requirements, select a suitable model within its available set. Do not mention unopened models. |
Determine newer generations from current descriptions and comparable versions within the same family, not tool count, a new tool, or speed-related names alone. If uncertain, use the existing branch without guessing. Include a new entry point only when it supports the user's asset roles and intent; never move models between tools.
Both branches require live parameters and account visibility. Stop selection when capability reading fails. Required identity/product consistency, text, motion, and sound come before version preferences. Defaults cannot override assets, duration, speed, or budget; do not silently raise resolution/count or reduce requirements. "Best quality" is not synonymous with maximum resolution or fastest generation, and does not justify claims about uninspected results.
Status, display, and link refresh are read-only. Explicit edits, variants, or video creation are new authorized steps: refresh and select the source work, then submit through the shared workflow. A dependent step must wait for a successful predecessor and a clearly selected work.
## Runtime and delivery
Require local shell access and Node.js 18+. Execute the pinned runtime from the CLI contract; explain the npm dependency before first use and respect execution approvals. Capture `who_am_i` stdout in a private temporary regular file and parse it after the process exits; CLI 0.2.1 may truncate a large capability response when stdout is a pipe. Delete the temporary file after reading and do not expose account identity fields. A zero exit code with incomplete JSON is a discovery failure. Start with `who_am_i`; if unauthorized, execute `login --skill-name kling-ai-cli --skill-version 1.1.2`, let the user complete browser consent, then verify identity. Account switching requires an explicit request and `logout` → `login` → `who_am_i`; stop on failure. Never read credentials or call HTTP/MCP directly.
Submit each confirmed paid step at most once. An accepted task is not a completed work: require terminal success and a usable primary media URL of the requested type; a video cover is not a video. Preserve `generationId` and the CLI trace identifier. Use `query_tasks` for status and returned result links for delivery; this CLI does not mount an MCP App. Do not author Markdown image/video syntax, a separate media attachment, or a duplicate download link. Do not claim visual/audio inspection without actually inspecting the result.
Referenced files: 12 — file references are metadata, not package contents.
kling-ai-generate-image6.75 KB
View saved version →
---
name: kling-ai-generate-image
description: Use Kling AI in Codex for text-to-image, image-to-image, editing, repainting, and controlled variants, including posters, products, ads, portraits, and social visuals. For existing tasks, use the core Skill's shared query workflow.
---
# Kling AI image generation
Turn a creative request into one well-specified Kling image request. Follow the [core Skill](../kling-ai/SKILL.md) and [CLI contract](../kling-ai/references/cli-contract.md). Invoke the CLI only, with live command/model definitions.
## Operating rules
- Use CLI browser OAuth. Never request or expose API keys, tokens, cookies, authorization headers, or upload tickets. Requested preview/download URLs may be delivered, but never logged or used as permanent identities.
- Before paid generation, show the final tool/model, prompt summary, resolution or duration, ratio, count, reference roles, and actual billing information when available. Obtain explicit confirmation of these settings immediately before submission; an already confirmed unchanged step needs no repeated confirmation.
- Submit each explicitly authorized step once. Run distinct tasks and cross-media dependencies serially through the shared workflow. Never blindly retry failed or ambiguous submissions.
- Discover live definitions before selecting tools, models, input names, or enum values. Live provider fields override examples.
- Prefer images pasted or attached directly in the conversation. Resolve their actual local paths and pass supported CLI resource flags for auto-upload; no separate upload is needed.
Read [asset workflows](../kling-ai/references/asset-workflows.md) for subjects, motions, or reference preparation.
Before generation, obtain candidates through [capability discovery](../kling-ai/references/capability-discovery.md) and honor [account visibility](../kling-ai/SKILL.md#account-visibility-and-rollout). After selection, read the [parameter module table](../kling-ai/references/model-parameters.md), loading only applicable files. Submit through [generation submission](../kling-ai/references/tool-workflows.md). For existing tasks, go directly to [task results](../kling-ai/references/task-results.md).
## Workflow
Skip generation steps for an existing-task query.
1. Determine candidate entry points from the mode table and supplied assets. Discover relevant models and check required capabilities before choosing one or constructing parameters.
2. Load only applicable parameter modules. Skip output-selection advice only when all relevant specification fields have a single legal value. Resolve unsupported requirements before reading detailed instructions for an unavailable feature.
3. Read [prompt construction](references/prompt-construction.md) for every new generation, edit, or variant. Select a quality profile to decide visible facts and acceptance checks. Only read-only queries and authorized retries with unchanged parameters may skip it. Add [scene patterns](references/scene-patterns.md) when further scene decisions are needed. An existing complete plan is not a reason to skip prompt construction.
4. Internally establish intended use, locked facts, and creative scope. Ask only about missing critical identity/copy or conflicting requirements; choose ordinary lighting, backgrounds, and unspecified optional settings reasonably.
5. Align the prompt with the selected model and actual asset bindings, submit once through the shared workflow, then follow task results. Do not redefine polling or retry behavior here.
## Generation modes
| Intent | Mode | Interpretation |
| --- | --- | --- |
| Text-to-image | New image | Build from text without using a source image to control identity or composition. |
| Image-to-image | Edit or reference-guided image | At least one image controls content, identity, structure, composition, or style. Assign a role to each input. |
| Element reference | An available image entry point | Read the Element and use `who_am_i` to verify its type, binding parameters, and required inputs. Do not allow or forbid it based only on tool name. |
| Variant/restyle | Image-to-image with a defined change scope | State every allowed change and lock other facts. Use a single change dimension only when the user has not specified the scope. |
| Browse/preview motions | Read-only asset query | Use `motion_library_list` and the [motion workflow](../kling-ai/references/asset-workflows.md#motion-library-and-motion-control) for real results and previews; do not generate. |
| Apply a saved motion/reference video | Motion-control video | Use the [video Skill](../kling-ai-generate-video/SKILL.md) with `motion_control`: a subject image and exactly one library `motionId` or source video, with model/required parameters from `who_am_i`. Do not submit as image-to-image. |
| Progress/status | Read-only | Query the existing task without generation. |
Do not silently change modes. An attachment does not automatically imply image-to-image: ignore it only after establishing that it is unrelated to the requested new image. Never downgrade an explicit image-to-image request to text-to-image after upload or schema validation fails.
Before calling tools, internally check mode, ratio, reference roles, and allowed changes. Do not show process messages unless creative clarification is necessary.
## Creative constraints
Use selected-model modules for specification values; do not add fields or tiers from examples. Add new text only when requested. Preserve labels, logos, and product structure outside the edit scope. Variants follow all authorized changes while retaining other facts. Never invent efficacy, certifications, prices, or statistics.
## Quality gates
Before submission, align change scope, copy, ratio, and count across the request, prompt, parameters, and references. Keep a clear focal hierarchy and compatible composition/lighting; do not add details merely to fill a template.
When the host can inspect original outputs, check identity, product structure, text/labels, counts/anatomy, crops/layout, and obvious distortion against intended use. Low-resolution thumbnails cannot validate fine text. Deliver issues through [inspection and iteration](../kling-ai/references/task-results.md), without automatic regeneration.
## Failure handling
- Authorization: run the pinned CLI `login`, then verify with `who_am_i`.
- Unsupported parameters: refresh capabilities and prepare a correction, without automatically resubmitting a prior generation.
- Insufficient credits: explain and stop until recharged; do not retry automatically.
- Lost response: recover or report unknown through task results; never replay blindly.
- Provider failure: summarize safely, retain the task ID, and do not automatically resubmit.
Submit at most once per confirmed paid step. Runtime, polling, and link delivery follow the core CLI workflow.
Referenced files: 3 — file references are metadata, not package contents.
kling-ai-generate-video7.11 KB
View saved version →
---
name: kling-ai-generate-video
description: Use Kling AI in Codex for text-to-video, image-to-video, omni references, keyframes, or motion control, including ads, short films, and single- or multi-shot creation. Use current account capabilities and the shared lifecycle for existing tasks.
---
# Kling AI video generation
Turn the request into coherent motion direction and one authorized remote generation. Follow the [core Skill](../kling-ai/SKILL.md) and [CLI contract](../kling-ai/references/cli-contract.md). Invoke the CLI only, with live command/model definitions.
## Operating rules
- Use CLI browser OAuth. Never request or expose API keys, tokens, cookies, authorization headers, or upload tickets. Requested preview/download URLs may be delivered, but never logged or used as permanent identities.
- Before paid generation, show the final tool/model, prompt summary, resolution or duration, ratio, count, reference roles, and actual billing information when available. Obtain explicit confirmation of these settings immediately before submission; an already confirmed unchanged step needs no repeated confirmation. If a live tool requires billing disclosure, explain its actual returned billing scope before submission without inventing prices or billing methods.
- Submit each explicitly authorized step once. Run distinct tasks and cross-media dependencies serially through the shared workflow. Never automatically retry failed or ambiguous generation.
- Discover live tools and definitions at runtime. Never hardcode model names, input roles, durations, or multi-shot fields from examples.
- Prefer media attached directly in the conversation. Pass supported CLI resource flags for auto-upload; preserve input roles and order.
Read [asset workflows](../kling-ai/references/asset-workflows.md) for subjects, motions, or reference preparation.
Before generation, obtain candidates through [capability discovery](../kling-ai/references/capability-discovery.md) and honor [account visibility](../kling-ai/SKILL.md#account-visibility-and-rollout). After selection, read the [parameter module table](../kling-ai/references/model-parameters.md), loading only applicable files. Submit through [generation submission](../kling-ai/references/tool-workflows.md). For existing tasks, go directly to [task results](../kling-ai/references/task-results.md).
## Load recommendations by capability
Existing-task queries skip recommendations and creative references. For new generation, read the current CLI `tool_list` response, then read exactly one file:
| Tool discovery | Read |
| --- | --- |
| No `omni_ref_video` | [Standard video recommendations](references/standard-video.md) |
| `omni_ref_video` exists | [Omni and new-model recommendations](references/omni-video.md), which branches further using actual model availability |
Then discover models through [CLI capability discovery](../kling-ai/references/capability-discovery.md). When `omni_ref_video` exists, ordinary text/image video requests must inspect its returned models together with the existing entry point in the full `who_am_i` response before deciding whether its models meet input requirements. Recommendation files govern selection; parameter modules govern payloads. Do not preload both files or branch on tool count. Discovery failure is not absence of a new tool: explain the inability to read capabilities and stop selection. Re-evaluate after reconnecting or switching account/environment; discard the invalidated branch.
## Workflow
1. Select the tool/model pair using recommendations and live responses, preferring a requested available model. Use the module table for specifications, required/optional inputs, and sound; do not preload irrelevant modules.
2. Read [motion and shot planning](references/motion-and-shots.md) for every new generation, edit, or variant. Select a profile governing motion budget, camera path, continuity anchors, and acceptance checks. Only read-only queries and authorized retries with unchanged parameters may skip it. Add [scene patterns](references/scene-patterns.md) when products, UGC, explainers, multi-shot stories, or social formats need further decisions. A complete existing plan does not replace motion planning.
3. Internally establish intended use, protected subjects, and target action. Ask only about blocking assets/dialogue or conflicting requirements; choose ordinary camera movement, lighting, and unspecified options reasonably instead of requiring a questionnaire.
4. Write a motion-centered prompt covering subject/camera/environment movement, rhythm, continuity, and protected elements. Translate abstract quality into lighting, materials, depth, and composition.
5. Validate parameters, check credits, and submit once through the shared workflow. After acceptance, follow task results. Do not generate comparison samples automatically or create an unrequested final version after a preview.
## Creative constraints
Load applicable modules for reference roles, frame order, combination caps, sound controls, and output specifications. Never silently discard unsupported inputs, convert them to text, guess fields/models/enums, or switch account/endpoint to probe availability.
Focus the prompt on requested action and visuals. Do not add unrequested narration, on-screen text, characters, or claims. Match single/multi-shot structure to narrative intent and supported parameters; do not split into multiple paid tasks merely to add shots.
## Quality gates
Before submission, align duration, ratio, shot structure, and sound switches with the prompt. Actions need a beginning, progression, and end; frames need plausible transitions; multi-shot continuity must be explicit. Each ad/explainer shot needs a communication purpose.
When the host can inspect video, check opening, key action, transitions, and ending for identity drift, deformation, flicker, discontinuity, and cropping. Listen to required dialogue/audio for wording, lip sync, and original-sound intent. Covers or still frames cannot establish motion or audio quality. Follow [shared inspection rules](../kling-ai/references/task-results.md).
## Failure handling
- Authorization: run the pinned CLI `login`, then verify with `who_am_i`.
- Invalid model/parameters: refresh capabilities and prepare a correction without automatically resubmitting a prior generation.
- Insufficient credits: explain and stop until recharged; do not retry automatically.
- Lost response: recover or report unknown through task results; never replay blindly.
- Provider failure: summarize safely, retain the task ID, and do not automatically resubmit.
Submit at most once per confirmed paid step. Runtime, polling, and link delivery follow the core CLI workflow.
## CLI input mapping
Always pass `--model` from the selected command's live set. `omni_ref_video` uses repeatable `--image`, `--video`, `--audio`, or declared named `--input`; it can be text-only when the model permits. For `image_to_video`, choose either `--image`/`--tailImage` or named `--input`, never both forms. `motion_control` needs a subject `--image` and exactly one `--video` or `--motionId`. CLI 0.2.1 removed `--omni` and `--flash`; do not use them. See the CLI contract before constructing a command.
Referenced files: 5 — file references are metadata, not package contents.