KL

klingai-content-policy

Prevents unauthorized content generation by filtering prompts against Kling AI policies before API submission.

Install

mkdir -p .claude/skills/klingai-content-policy && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2385" && unzip -o skill.zip -d .claude/skills/klingai-content-policy && rm skill.zip

Installs to .claude/skills/klingai-content-policy

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Implement content policy compliance for Kling AI prompts and outputs.
69 charsno explicit “when” trigger
Beginner

Key capabilities

  • Filter prompts for restricted content categories
  • Block prompts containing violent or adult material
  • Prevent generation of copyrighted characters
  • Sanitize prompts by removing problematic terms
  • Add default negative prompts for safety
  • Handle server-side content policy rejections

How it works

The skill uses a Python class with regular expressions and a list of blocked terms to check prompts against predefined content categories. It returns a safety status and can sanitize the prompt or add default negative prompts.

Inputs & outputs

You give it
User-submitted prompt string
You get back
Boolean indicating prompt safety and a reason if unsafe, or a sanitized prompt string

When to use klingai-content-policy

  • Filter user-submitted prompts for restricted content
  • Avoid API errors from policy-violating requests
  • Save generation credits by blocking invalid prompts early
  • Implement safety guardrails for video generation features

About this skill

Kling AI Content Policy

Overview

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.

Restricted Content Categories

Kling AI prohibits prompts that generate:

CategoryExamples
Violence/goreGraphic injuries, torture, weapons used violently
Adult/sexualExplicit nudity, sexual acts, suggestive content
Hate/discriminationSlurs, targeted harassment, supremacist imagery
Illegal activityDrug manufacturing, terrorism, fraud instructions
Real peopleDeepfakes of identifiable individuals without consent
Copyrighted charactersTrademarked characters (Mickey Mouse, Spider-Man)
MisinformationFake news, fabricated events presented as real
Self-harmSuicide, eating disorders, self-injury instructions

Pre-Submission Prompt Filter

import 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()

Safe Negative Prompts

Always include safety-related negative prompts:

DEFAULT_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",
    }

Integration with Client

class 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)

Handling Server-Side Rejections

def 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}

User-Facing Guidelines

When building apps with user-submitted prompts:

  1. Filter before API call -- saves credits on obvious violations
  2. Explain rejections clearly -- tell users what to change
  3. Log violations -- track patterns for filter improvement
  4. Rate limit prompt submissions -- prevent abuse
  5. Review flagged content -- human review for edge cases

Resources

When not to use it

  • When Kling AI content policies are not a concern
  • When content moderation is handled exclusively server-side

Limitations

  • The filter relies on predefined patterns and terms, which may not catch all policy violations
  • Prompt length is limited to 2500 characters
  • Prompts shorter than 5 characters are considered unsafe

How it compares

This skill provides pre-submission filtering of prompts, which avoids API errors and saves generation credits compared to relying solely on server-side moderation.

Compared to similar skills

klingai-content-policy side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
klingai-content-policy (this skill)127dReviewBeginner
senior-security317moReviewAdvanced
security-header-generator59moCautionIntermediate
backend-security-coder244moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

senior-security

davila7

Comprehensive security engineering skill for application security, penetration testing, security architecture, and compliance auditing. Includes security assessment tools, threat modeling, crypto implementation, and security automation. Use when designing security architecture, conducting penetration tests, implementing cryptography, or performing security audits.

3191

security-header-generator

Dexploarer

Generates security HTTP headers (CSP, HSTS, CORS, etc.) for web applications to prevent common attacks. Use when user asks to "add security headers", "setup CSP", "configure CORS", "secure headers", or "HSTS setup".

599

backend-security-coder

sickn33

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

2446

security-audit

ruvnet

Comprehensive security scanning and vulnerability detection. Includes input validation, path traversal prevention, CVE detection, and secure coding pattern enforcement. Use when: authentication implementation, authorization logic, payment processing, user data handling, API endpoint creation, file upload handling, database queries, external API integration. Skip when: read-only operations on public data, internal development tooling, static documentation, styling changes.

337

security-best-practices

openai

Perform language and framework specific security best-practice reviews and suggest improvements. Trigger only when the user explicitly requests security best practices guidance, a security review/report, or secure-by-default coding help. Trigger only for supported languages (python, javascript/typescript, go). Do not trigger for general code review, debugging, or non-security tasks.

732

pcap-analysis

benchflow-ai

Guidance for analyzing network packet captures (PCAP files) and computing network statistics using Python, with tested utility functions.

713

Search skills

Search the agent skills registry