dashscope-videogen
Skill1 starsChanged 7 months agoMITView on GitHub
Generate short text-to-video clips via Aliyun DashScope's async video synthesis API (e.g. `happyhorse-1.0-t2v`, Wan series). Trigger when the user asks to create, generate, or make a video / animation / clip / 视频 from a text description — and they have not specified a different generator (Sora, Runway, Pika, Kling, Luma, etc.). Also trigger when the user mentions DashScope, 通义万相, 阿里视频生成, or `happyhorse` / Wan video models.
- Reads credentials
In this repository3 other files it gives its agents.
- codex-imagegenSkill
- deck-to-pdfSkill
- svg-animationsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
If neither is set, the script exits with code 2 and a clear message.
- Very specific: line 22
If it reports MISSING, ask the user once, in plain language, for their DashScope API key (link them to …
- Distinctive: line 23
When they paste it, persist it:
- Very specific: line 32
If the user prefers not to persist, they can export DASHSCOPE_API_KEY=...
- Very specific: line 58
Verify the key is configured: if you have any doubt — videogen.py check-key.
- Very specific: line 66
If the polling step is interrupted (network drop, user Ctrl-C, timeout) but you still have the task_id printed at submission time:
- Distinctive: line 84
No image-to-video / video-to-video: Only the text-to-video synthesis endpoint is wired up.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
dashscope-videogen
Generates short videos from a text prompt using Aliyun DashScope's async video synthesis endpoint. The bundled videogen.py owns submission, polling, key resolution, and download — Claude just chooses parameters and invokes it.
Key management — do this first if invocation fails
The script needs DASHSCOPE_API_KEY. Resolution order:
DASHSCOPE_API_KEYexported in the current shell.~/.claude/skill-env/dashscope-videogen.env(the persistent local file the skill writes — outside any source tree, chmod 600).
If neither is set, the script exits with code 2 and a clear message. Never hard-code, log, or commit a key. Never write the key into a file inside this skill folder or any other git-tracked path — only set-key (which writes to ~/.claude/skill-env/) is acceptable.
When the user has not yet provided a key
- Run
python3 ~/.claude/skills/dashscope-videogen/videogen.py check-key. - If it reports
MISSING, ask the user once, in plain language, for their DashScope API key (link them to https://dashscope.console.aliyun.com/apiKey if they don't know where to find it). When they paste it, persist it:
python3 ~/.claude/skills/dashscope-videogen/videogen.py set-key sk-XXXXXXXXThe script writes to
~/.claude/skill-env/dashscope-videogen.env(chmod 600) and prints a masked confirmation. Future Claude sessions reuse it automatically.- Then proceed with the actual generation request.
If the user prefers not to persist, they can export DASHSCOPE_API_KEY=... in their shell instead — the script picks up the env var first.
How to invoke (the happy path)
python3 ~/.claude/skills/dashscope-videogen/videogen.py generate <output.mp4> "<prompt>" \
[--model happyhorse-1.0-t2v] \
[--resolution 720P] \
[--ratio 16:9] \
[--duration 5]<output.mp4>— absolute or workspace-relative path. Default to the current working directory; do not write to/tmpunless the user asks.<prompt>— pass the user's prompt verbatim unless they asked for refinement. The API accepts Chinese and English.- Optional flags map 1:1 to the DashScope
parametersblock. Defaults match the most common request (720P, 16:9, 5s,happyhorse-1.0-t2v).
The script:
- Submits the async job with
X-DashScope-Async: enable. - Prints the
task_idand a one-liner showing how toresumeif polling is interrupted. - Polls
/api/v1/tasks/{task_id}every 10s. Status transitions:PENDING→RUNNING→SUCCEEDED(typical 60–120s for a 5s/720P clip). - Downloads the resulting mp4 to
<output.mp4>.
Allow up to ~5 minutes wall-clock. Don't kill it early.
Standard workflow
- Verify the key is configured if you have any doubt —
videogen.py check-key. Skip this if you've just used the skill in this session. - Pick a sensible filename in the user's working directory (e.g.
video.mp4,cardboard_city.mp4). Don't invent random names. - Run
videogen.py generatevia Bash. The script streams progress lines (task_status=RUNNING, thenSUCCEEDED). - Verify the output — confirm the file exists and report its size (e.g.
ls -lh <output.mp4>). The video URL the API returns is presigned and short-lived; the local mp4 is the deliverable. - Report briefly: filename, file size, duration/resolution actually requested, and the prompt used. Do not embed the presigned
video_urlin your reply — it leaks via screenshots and expires anyway.
Resuming an interrupted job
If the polling step is interrupted (network drop, user Ctrl-C, timeout) but you still have the task_id printed at submission time:
python3 ~/.claude/skills/dashscope-videogen/videogen.py resume <task_id> <output.mp4>This skips submission and goes straight to poll-then-download. Useful if the user comes back later — DashScope retains finished tasks for a while.
Failure modes
HTTP 401/InvalidApiKey— the saved key is wrong or revoked. Runset-keyagain with a fresh key. Do not retry silently.HTTP 429/ throttling — back off and tell the user; do not auto-retry hard.task_status=FAILED— the response body usually containscode/message(e.g.DataInspectionFailedfor prompt content). Surface those fields verbatim to the user and adjust the prompt; do not try to bypass content policy.- Polling timeout (default 30 min) — for unusually long jobs, the job is probably still running server-side. Re-run with
resume <task_id>to keep polling without resubmitting. ModuleNotFoundError— should not happen, the script uses only the Python stdlib. If it does, check the user has Python 3.8+.
What this skill does NOT do
- No image-to-video / video-to-video. Only the text-to-video synthesis endpoint is wired up. If the user wants i2v or extend, say so and either propose extending this skill or fall back to writing a one-shot Python call.
- No Stable Diffusion / Sora / Pika. This is DashScope-specific. If the user explicitly asks for another provider, do not use this skill.
- No watermark removal. The default
happyhorse-1.0-t2vreturns a watermarked mp4 (..._watermark.mp4). That's a model-side decision — mention it to the user if relevant; do not attempt to strip it. - No key sharing. The key is per-user. Never echo the key back in chat, never put it in a commit, never store it inside the skill directory or any directory that could be a git repo.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

