klingai-content-policy

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'.

1,868 stars

Best use case

klingai-content-policy is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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'.

Teams using klingai-content-policy should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/klingai-content-policy/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/klingai-pack/skills/klingai-content-policy/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/klingai-content-policy/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How klingai-content-policy Compares

Feature / Agentklingai-content-policyStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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'.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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:

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

## Pre-Submission Prompt Filter

```python
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:

```python
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

```python
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

```python
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

- [Kling AI Terms of Service](https://app.klingai.com/global/dev/document-api/protocols/paidServiceProtocol)
- [Developer Portal](https://app.klingai.com/global/dev)

Related Skills

windsurf-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement team-wide Windsurf usage policies, code quality gates, and Cascade guardrails. Use when setting up code review policies for AI-generated code, configuring Turbo mode safety controls, or implementing CI gates for Cascade output. Trigger with phrases like "windsurf policy", "windsurf guardrails", "cascade safety rules", "windsurf team rules", "AI code policy".

vercel-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement lint rules, CI policy checks, and automated guardrails for Vercel projects. Use when setting up code quality rules, preventing secret exposure, or enforcing deployment policies for Vercel applications. Trigger with phrases like "vercel policy", "vercel lint", "vercel guardrails", "vercel best practices check", "vercel secret scan".

supabase-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Enforce organizational governance for Supabase projects: shared RLS policy library with reusable templates, table and column naming conventions, migration review process with CI checks, cost alert thresholds, and security audit scripts scanning for common misconfigurations. Use when establishing Supabase standards across teams, creating RLS policy templates, setting up migration review workflows, or auditing existing projects for security and cost issues. Trigger with phrases like "supabase governance", "supabase policy library", "supabase naming convention", "supabase migration review", "supabase cost alert", "supabase security audit", "supabase RLS template".

snowflake-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Snowflake governance guardrails with network rules, session policies, authentication policies, and automated compliance checks. Use when enforcing security policies, implementing data governance, or configuring automated compliance for Snowflake. Trigger with phrases like "snowflake policy", "snowflake guardrails", "snowflake governance", "snowflake compliance", "snowflake enforce".

shopify-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Shopify app policy enforcement with ESLint rules for API key detection, query cost budgets, and App Store compliance checks. Trigger with phrases like "shopify policy", "shopify lint", "shopify guardrails", "shopify compliance", "shopify eslint", "shopify app review".

sentry-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Enforce organizational governance and policy guardrails for Sentry usage. Use when standardizing Sentry configuration across services, enforcing PII scrubbing, building shared config packages, or auditing drift. Trigger with phrases like "sentry governance", "sentry policy", "sentry standards", "enforce sentry config", "sentry compliance".

salesforce-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Salesforce lint rules, SOQL injection prevention, and API usage guardrails. Use when enforcing Salesforce integration code quality, preventing SOQL injection, or configuring CI policy checks for Salesforce best practices. Trigger with phrases like "salesforce policy", "salesforce lint", "salesforce guardrails", "SOQL injection", "salesforce eslint", "salesforce code review".

retellai-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Retell AI policy guardrails — AI voice agent and phone call automation. Use when working with Retell AI for voice agents, phone calls, or telephony. Trigger with phrases like "retell policy guardrails", "retellai-policy-guardrails", "voice agent".

perplexity-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement content moderation, model selection policy, citation quality enforcement, and per-user usage quotas for Perplexity Sonar API. Trigger with phrases like "perplexity policy", "perplexity guardrails", "perplexity content moderation", "perplexity usage limits", "perplexity safety".

notion-policy-guardrails

1868
from jeremylongshore/claude-code-plugins-plus-skills

Governance for Notion integrations: integration naming standards, page sharing policies, property naming conventions, database schema standards, and access audit scripts. Trigger with phrases like "notion governance", "notion policy", "notion naming convention", "notion access audit", "notion schema standard".

notion-content-management

1868
from jeremylongshore/claude-code-plugins-plus-skills

Create, update, archive, and compose Notion pages and block content. Use when building pages programmatically, appending rich content blocks, updating page properties, or managing page lifecycle (archive/restore). Trigger with phrases like "notion create page", "notion add blocks", "notion update page", "notion archive page", "notion content", "notion block types", "notion rich text".

klingai-webhook-config

1868
from jeremylongshore/claude-code-plugins-plus-skills

Configure webhook callbacks for Kling AI task completion. Use when building event-driven pipelines or replacing polling. Trigger with phrases like 'klingai webhook', 'kling ai callback', 'klingai notifications', 'video completion webhook'.