Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement content policy compliance for Kling AI prompts and outputs. Use when filtering user prompts or handling moderation. Trigger with phrases like 'klingai content policy', 'kling ai moderation', 'safe video generation', 'klingai content filter'.
.claude/skills/jeremylongshore-klingai-content-policy/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 40% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 42% | 0% |
Kling AI enforces content policies server-side. Tasks with policy-violating prompts return task_status: "failed" with a content policy message. This skill covers pre-submission filtering to avoid wasted credits and API calls.
Kling AI prohibits prompts that generate:
| Category | Examples | |----------|---------| | Violence/gore | Graphic injuries, torture, weapons used violently | | Adult/sexual | Explicit nudity, sexual acts, suggestive content | | Hate/discrimination | Slurs, targeted harassment, supremacist imagery | | Illegal activity | Drug manufacturing, terrorism, fraud instructions | | Real people | Deepfakes of identifiable individuals without consent | | Copyrighted characters | Trademarked characters (Mickey Mouse, Spider-Man) | | Misinformation | Fake news, fabricated events presented as real | | Self-harm | Suicide, eating disorders, self-injury instructions |
pythonimport re class PromptFilter: """Filter prompts before sending to Kling AI to save credits.""" BLOCKED_PATTERNS = [ r"\b(nude|naked|explicit|nsfw|porn)\b", r"\b(gore|dismember|torture|mutilat)\b", r"\b(bomb|terroris|weapon|firearm)\b", r"\b(suicide|self.harm|kill.yourself)\b", r"\b(deepfake|impersonat)\b", ] BLOCKED_TERMS = { "blood splatter", "graphic violence", "child abuse", "drug manufacturing", "hate speech", } def __init__(self): self._patterns = [re.compile(p, re.IGNORECASE) for p in self.BLOCKED_PATTERNS] def check(self, prompt: str) -> tuple[bool, str]: """Returns (is_safe, reason).""" lower = prompt.lower() for term in self.BLOCKED_TERMS: if term in lower: return False, f"Blocked term: '{term}'" for pattern in self._patterns: match = pattern.search(prompt) if match: return False, f"Blocked pattern: '{match.group()}'" if len(prompt) > 2500: return False, "Prompt exceeds 2500 character limit" if len(prompt.strip()) < 5: return False, "Prompt too short" return True, "OK" def sanitize(self, prompt: str) -> str: """Remove problematic terms and return cleaned prompt.""" for pattern in self._patterns: prompt = pattern.sub("[removed]", prompt) return prompt.strip()
Always include safety-related negative prompts:
pythonDEFAULT_NEGATIVE_PROMPT = ( "violence, gore, blood, nudity, sexual content, " "weapons, drugs, hate symbols, distorted faces, " "watermark, text overlay, low quality, blurry" ) def safe_request(prompt: str, negative_prompt: str = ""): """Build request with safety defaults.""" combined_negative = f"{DEFAULT_NEGATIVE_PROMPT}, {negative_prompt}".strip(", ") return { "model_name": "kling-v2-master", "prompt": prompt, "negative_prompt": combined_negative, "duration": "5", "mode": "standard", }
pythonclass SafeKlingClient: """Kling client with pre-submission content filtering.""" def __init__(self, base_client): self.client = base_client self.filter = PromptFilter() def text_to_video(self, prompt: str, **kwargs): is_safe, reason = self.filter.check(prompt) if not is_safe: raise ValueError(f"Content policy violation: {reason}") # Add safety negative prompt kwargs.setdefault("negative_prompt", "") kwargs["negative_prompt"] = ( f"{DEFAULT_NEGATIVE_PROMPT}, {kwargs['negative_prompt']}".strip(", ") ) return self.client.text_to_video(prompt, **kwargs)
pythondef handle_policy_rejection(task_id: str, result: dict): """Handle content policy rejections gracefully.""" status_msg = result["data"].get("task_status_msg", "") if "content policy" in status_msg.lower() or "policy violation" in status_msg.lower(): return { "error": "content_policy_violation", "message": "Your prompt was rejected by Kling AI's content policy. " "Please revise to remove restricted content.", "task_id": task_id, "credits_consumed": False, # policy rejections typically don't consume credits } return {"error": "generation_failed", "message": status_msg, "task_id": task_id}
When building apps with user-submitted prompts:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 23,973 | 21,983 | -8% | 1 | 1 | 0% | 3,740 | 4,145 | +11% | 0 | 0 | — |
case-02 | fail→pass | 16,728 | 14,677 | -12% | 1 | 1 | 0% | 2,414 | 3,385 | +40% | 0 | 0 | — |
case-03 | fail→pass | 17,086 | 16,206 | -5% | 1 | 1 | 0% | 3,370 | 4,139 | +23% | 0 | 0 | — |
case-04 | pass→pass | 31,273 | 11,404 | -64% | 1 | 1 | 0% | 2,346 | 2,297 | -2% | 0 | 0 | — |
case-05 | fail→fail | 22,284 | 15,284 | -31% | 1 | 1 | 0% | 1,188 | 3,291 | +177% | 0 | 0 | — |
case-06 | pass→pass | 15,729 | 15,019 | -5% | 1 | 1 | 0% | 2,905 | 3,130 | +8% | 0 | 0 | — |
case-07 | pass→pass | 14,992 | 10,768 | -28% | 1 | 1 | 0% | 1,531 | 2,298 | +50% | 0 | 0 | — |
case-08 | pass→pass | 23,262 | 21,158 | -9% | 1 | 1 | 0% | 2,680 | 3,454 | +29% | 0 | 0 | — |
case-09 | pass→pass | 22,623 | 16,618 | -27% | 1 | 1 | 0% | 2,364 | 3,492 | +48% | 0 | 0 | — |
case-10 | pass→pass | 11,682 | 2,860 | -76% | 1 | 1 | 0% | 2,139 | 1,887 | -12% | 0 | 0 | — |
case-11 | fail→fail | 11,487 | 7,248 | -37% | 1 | 1 | 0% | 2,054 | 2,756 | +34% | 0 | 0 | — |
case-20 | pass→pass | 17,918 | 2,671 | -85% | 1 | 1 | 0% | 1,670 | 1,801 | +8% | 0 | 0 | — |
case-12 | pass→fail | 19,698 | 17,958 | -9% | 1 | 1 | 0% | 2,147 | 3,208 | +49% | 0 | 0 | — |
case-13 | pass→pass | 10,241 | 4,271 | -58% | 1 | 1 | 0% | 1,549 | 2,006 | +30% | 0 | 0 | — |
case-14 | pass→pass | 20,240 | 19,784 | -2% | 1 | 1 | 0% | 2,940 | 3,976 | +35% | 0 | 0 | — |
case-15 | pass→fail | 14,098 | 21,042 | +49% | 1 | 1 | 0% | 2,168 | 3,820 | +76% | 0 | 0 | — |
case-16 | pass→pass | 20,376 | 13,419 | -34% | 1 | 1 | 0% | 2,464 | 2,644 | +7% | 0 | 0 | — |
case-17 | fail→pass | 21,967 | 8,719 | -60% | 1 | 1 | 0% | 1,564 | 1,984 | +27% | 0 | 0 | — |
case-18 | fail→pass | 12,261 | 8,916 | -27% | 1 | 1 | 0% | 2,051 | 2,916 | +42% | 0 | 0 | — |
case-19 | pass→pass | 12,685 | 8,145 | -36% | 1 | 1 | 0% | 2,030 | 1,891 | -7% | 0 | 0 | — |
case-21 | pass→pass | 15,700 | 7,387 | -53% | 1 | 1 | 0% | 1,541 | 2,674 | +74% | 0 | 0 | — |
case-22 | pass→pass | 13,198 | 12,322 | -7% | 1 | 1 | 0% | 2,538 | 3,354 | +32% | 0 | 0 | — |
case-23 | pass→pass | 10,981 | 32,276 | +194% | 1 | 1 | 0% | 2,090 | 3,054 | +46% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of 0 percentage points is the difference between those two pass rates over the 23 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.