Agent skill

Klingai Known Pitfalls

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Avoid common mistakes when using Kling AI API. An agent skill from jeremylongshore/tons-of-skills-marketplace.

MITAuto-check passedMedia & Creative

Install Klingai Known Pitfalls

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-known-pitfalls -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace klingai-known-pitfalls --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/klingai-known-pitfalls .claude/skills/klingai-known-pitfalls && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
klingai-known-pitfalls
GitHub stars
2.8k
Token cost
~1.8k tokens
SKILL.md length
524 words
Files
4 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Avoid common mistakes when using Kling AI API. An agent skill from jeremylongshore/tons-of-skills-marketplace.

  • Works in 4 steps: Reproduce pitfalls with a single… → Check authentication, model/mode,… → Stop and remove the draft if a… → …
  • Troubleshooting
  • SKILL.md covers Overview, Pitfall 1: Duration as Integer, Pitfall 2: JWT Without… and Pitfall 3: Token Generated…, plus 14 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Klingai Known Pitfalls is an agent skill from jeremylongshore/tons-of-skills-marketplace. Avoid common mistakes when using Kling AI API. Use when troubleshooting or learning best practices. Trigger with phrases like 'klingai pitfalls', 'kling ai mistakes', 'klingai gotchas', 'klingai best practices'.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/common-pitfalls.md`, `references/errors.md` and `references/examples.md`). Compatibility notes: Designed for Claude Code

It sits in Media & Creative, covering AI video generation. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Troubleshooting
  • Learning best practices
  • With phrases like klingai pitfalls
  • Kling ai mistakes

Example prompts

  • “klingai pitfalls”
  • “kling ai mistakes”
  • “klingai gotchas”
  • “/klingai-known-pitfalls”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm:*), Grep

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Reproduce pitfalls with a single watermarked sandbox draft; do not use private, unlicensed, or policy-restricted materials.
  2. Check authentication, model/mode, duration, policy/rights status, credit use, destination, and retention before applying a workaround.
  3. Stop and remove the draft if a workaround introduces policy, attribution, quality, budget, or retention drift.
  4. Record the remediation as a redacted receipt and restore the known-good configuration before further testing.

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm:*)
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Klingai Known Pitfalls loads about 1.8k tokens when it runs, and up to ~3.8k if it reads all its reference files. Until then it costs about 59 tokens; SKILL.md has 524 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 524 words, ~1,781 tokens.

Download SKILL.mdSave it as .claude/skills/klingai-known-pitfalls/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
klingai-known-pitfalls
description
Avoid common mistakes when using Kling AI API. Use when troubleshooting or learning best practices. Trigger with phrases like 'klingai pitfalls', 'kling ai mistakes', 'klingai gotchas', 'klingai best practices'.
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatibility
Designed for Claude Code
version
1.18.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, kling-ai, troubleshooting, best-practices

Kling AI Known Pitfalls

Overview

Documented mistakes, gotchas, and anti-patterns from real Kling AI integrations. Each pitfall includes the symptom, root cause, and tested fix.

Pitfall 1: Duration as Integer

Symptom: 400 Bad Request on valid-looking requests.

python
# WRONG -- duration as integer
{"duration": 5}

# CORRECT -- duration as string
{"duration": "5"}

The API requires duration as a string "5" or "10", not an integer.

Pitfall 2: JWT Without Explicit Headers

Symptom: 401 Unauthorized even with correct AK/SK.

python
# WRONG -- missing headers parameter
token = jwt.encode(payload, sk, algorithm="HS256")

# CORRECT -- explicit JWT headers
token = jwt.encode(payload, sk, algorithm="HS256",
                   headers={"alg": "HS256", "typ": "JWT"})

Some JWT libraries don't include typ: "JWT" by default. Kling requires it.

Pitfall 3: Token Generated Once at Import Time

Symptom: Works for 30 minutes, then all requests fail with 401.

python
# WRONG -- token generated once
TOKEN = generate_token()  # at module import
headers = {"Authorization": f"Bearer {TOKEN}"}

# CORRECT -- generate fresh token per request (or auto-refresh)
def get_headers():
    return {"Authorization": f"Bearer {generate_token()}"}

JWT tokens expire after 30 minutes. Always implement auto-refresh.

Pitfall 4: Polling Without Timeout

Symptom: Script hangs forever on a failed task.

python
# WRONG -- infinite loop
while True:
    result = check_status(task_id)
    if result["status"] == "succeed":
        break
    time.sleep(10)

# CORRECT -- with timeout and failure check
start = time.monotonic()
while time.monotonic() - start < 600:  # 10 min max
    result = check_status(task_id)
    if result["status"] == "succeed":
        break
    elif result["status"] == "failed":
        raise RuntimeError(result["error"])
    time.sleep(10)
else:
    raise TimeoutError("Generation timed out")

Pitfall 5: Not Downloading Videos Promptly

Symptom: Video URLs return 404 or 403 after a day.

Kling CDN URLs are temporary (24-72 hours). Always download and store on your own infrastructure immediately after generation completes.

python
# WRONG -- storing only the Kling URL
db.save(video_url=kling_cdn_url)  # will expire

# CORRECT -- download and rehost
local_path = download_video(kling_cdn_url)
permanent_url = upload_to_s3(local_path, bucket)
db.save(video_url=permanent_url)

Pitfall 6: Mixing Mutually Exclusive Features (I2V)

Symptom: 400 Bad Request on image-to-video with multiple features.

These are mutually exclusive for image-to-video:

  • camera_control
  • dynamic_masks / static_mask
  • image_tail

You can only use ONE group per request.

Pitfall 7: Wrong Model for Text-to-Video

Symptom: 400 or unexpected behavior.

python
# WRONG -- kling-v2-1 is I2V-only
{"model_name": "kling-v2-1", "prompt": "A sunset..."}  # fails

# CORRECT -- use models that support T2V
{"model_name": "kling-v2-master", "prompt": "A sunset..."}
{"model_name": "kling-v2-5-turbo", "prompt": "A sunset..."}

Check the model catalog: kling-v1-5 and kling-v2-1 support image-to-video only.

Pitfall 8: No Error Handling on Task Status

Symptom: Silent failures, missing videos.

python
# WRONG -- only check for success
if result["task_status"] == "succeed":
    process(result)
# silently ignores failures

# CORRECT -- handle all terminal states
if result["task_status"] == "succeed":
    process(result)
elif result["task_status"] == "failed":
    log_failure(result["task_status_msg"])
    retry_or_alert(task_id)

Pitfall 9: Ignoring Credit Costs with Audio

Symptom: Credits depleted 5x faster than expected.

Native audio (v2.6, motion_has_audio: true) multiplies credit cost by 5x:

  • 5s standard without audio: 10 credits
  • 5s standard WITH audio: 50 credits

Always check motion_has_audio in cost estimates.

Pitfall 10: Vague Prompts

Symptom: Low-quality, incoherent video output.

python
# WEAK -- too vague
"A nice video of nature"

# STRONG -- specific and descriptive
"Close-up of a monarch butterfly landing on a lavender flower, "
"soft bokeh background, golden hour lighting, macro lens, 4K"

Good prompts: specific subject, clear action, lighting, camera angle, style.

Show full SKILL.md (244 more words)Show less

Quick Reference

PitfallFix
Duration as intUse string: "5"
JWT headers missingAdd headers={"alg":"HS256","typ":"JWT"}
Token not refreshedAuto-refresh with 5-min buffer
No poll timeoutMax 600s with failure check
Kling URLs as permanentDownload and rehost immediately
Mixed I2V featuresOne feature group per request
Wrong model for T2VCheck model supports text-to-video
No failure handlingCheck for "failed" status
Audio cost surprise5x multiplier with motion_has_audio
Vague promptsSpecific subject, action, style, lighting

Prerequisites

  • An approved sandbox brief, rights-cleared or synthetic inputs, secret references, content-policy review, credit cap, draft-only destination, and a removal owner.

Instructions

  1. Reproduce pitfalls with a single watermarked sandbox draft; do not use private, unlicensed, or policy-restricted materials.
  2. Check authentication, model/mode, duration, policy/rights status, credit use, destination, and retention before applying a workaround.
  3. Stop and remove the draft if a workaround introduces policy, attribution, quality, budget, or retention drift.
  4. Record the remediation as a redacted receipt and restore the known-good configuration before further testing.

Output

Produce a pitfall receipt with environment, failure category, synthetic/rights-cleared classification, remedial setting, aggregate task result, policy/rights/budget checks, draft-only status, cleanup proof, and rollback reference. Exclude prompts, assets, identities, and credentials.

Error Handling

ConditionResponse
Workaround changes ownership, attribution, or policy postureReject it, remove temporary drafts, and seek owner review.
Repeated task or budget failureCancel queued work and restore the approved test configuration.

Examples

env=sandbox; pitfall=timeout; fixture=synthetic; remedy=bounded-polling; policy=pass; destination=draft-only; cleanup=verified is valid evidence.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/.curated/klingai-known-pitfalls of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/common-pitfalls.md
  • references/errors.md
  • references/examples.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Klingai Known Pitfalls next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Klingai Known Pitfalls compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Klingai Known Pitfalls this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.8kAutomated safety check: PassMIT
Clipmivo VideoBarneyD66/clipmivo-tools142—~945Automated safety check: PassMIT
Video Generationbytedance/deer-flow84k3 repos~1.4kAutomated safety check: PassMIT
Video Cover Imageitwanger/toBeBetterJavaer18k—~3.3kAutomated safety check: PassNone
Seedancesongguoxs/seedance-prompt-skill2.9k1 repos~2.5kAutomated safety check: PassNone
HyperFrames Video Entry Pointheygen-com/hyperframes60k3 repos~5.2kAutomated safety check: PassApache-2.0

Similar skills

  • Clipmivo Video

    BarneyD66/clipmivo-tools

    Create and manage AI video tasks through ClipmivoAI using its MCP server, CLI or REST API.

    142 GitHub stars~945 tokensUpdated 25 days ago
    Media & CreativeAuto-check passed
  • Video Generation

    bytedance/deer-flow

    Generates short videos from a structured JSON prompt, optionally guided by a reference image used as the first or last frame.

    84k GitHub starsUsed in 3 repos~1.4k tokens
    Media & CreativeAuto-check passed
  • Video Cover Image

    itwanger/toBeBetterJavaer

    Generate matched 3:4, 16:9, and 4:3 short-video cover images from toBeBetterJavaer video scripts or AI/Java technical topics.

    18k GitHub stars~3.3k tokensUpdated yesterday
    Media & CreativeAuto-check passed
  • Seedance

    songguoxs/seedance-prompt-skill

    This skill should be used when the user asks to "generate video prompts", "create Seedance prompts", "write video descriptions", mentions "Seedance", "seedance", "即梦", "即梦平台", "视频提示词", "视频生成"…

    2.9k GitHub starsUsed in 1 repo~2.5k tokens
    Media & CreativeAuto-check passed
  • HyperFrames Video Entry Point

    heygen-com/hyperframes

    Entry point for making, editing and rendering videos from HTML compositions with HyperFrames, routing each request to the right workflow.

    60k GitHub starsUsed in 3 repos~5.2k tokens
    Media & CreativeAuto-check passed
  • Lanshu Create AI Presenter Video

    cclank/lanshu-create-ai-presenter-video

    Turn a topic or finished script into a complete, publish-ready explainer video — led by an AI presenter from an authorized adult presenter image, or performed in one of nine visual explainer styles…

    2.6k GitHub stars~3.6k tokensUpdated today
    Media & CreativeAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Klingai Known Pitfalls

What does Klingai Known Pitfalls do?

Avoid common mistakes when using Kling AI API. An agent skill from jeremylongshore/tons-of-skills-marketplace. Klingai Known Pitfalls is an agent skill from jeremylongshore/tons-of-skills-marketplace. Avoid common mistakes when using Kling AI API.

When should I use Klingai Known Pitfalls?

Klingai Known Pitfalls fits situations like: troubleshooting; learning best practices; with phrases like klingai pitfalls; kling ai mistakes.

How do I install Klingai Known Pitfalls in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-known-pitfalls -a claude-code`. Or copy the skill folder (skills/.curated/klingai-known-pitfalls in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/klingai-known-pitfalls in your project. Claude Code loads it when a task matches its description.

How do I install Klingai Known Pitfalls in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-known-pitfalls -a codex`. Or copy the skill folder (skills/.curated/klingai-known-pitfalls in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/klingai-known-pitfalls in your project. Codex loads it when a task matches its description.

Can I use Klingai Known Pitfalls in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-known-pitfalls -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/klingai-known-pitfalls, .gemini/skills/klingai-known-pitfalls, .github/skills/klingai-known-pitfalls and .opencode/skills/klingai-known-pitfalls in your project.

What does Klingai Known Pitfalls need to run?

SKILL.md names no scripts, command-line tools or credentials: Klingai Known Pitfalls is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*), Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Klingai Known Pitfalls access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Klingai Known Pitfalls safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Klingai Known Pitfalls use?

Klingai Known Pitfalls is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Klingai Known Pitfalls use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2k tokens, read only when the agent opens those files.

What are the alternatives to Klingai Known Pitfalls?

Skills that share tags, products or a category with Klingai Known Pitfalls: Clipmivo Video (BarneyD66/clipmivo-tools, 142 stars), Video Generation (bytedance/deer-flow, 84k stars), Video Cover Image (itwanger/toBeBetterJavaer, 18k stars) and Seedance (songguoxs/seedance-prompt-skill, 2.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Klingai Known Pitfalls?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.