Skip to content

MiniMax-AI/mcode-stack / stacks/jiachen/skills/making-content

making-content

Unverified

Content production in three modes: rewrite, Xiaohongshu (小红书) image post, short video. Rewrite (default): turns an AI-sounding Chinese or mixed Chinese-English draft (post, newsletter, engineering blog, commentary) into the author's restrained style: few emoji, short paragraphs, hedged claims, neutral wording, English terms split by spaces. Triggers: 按我的风格改, 去 AI 味, 润色, 改改这篇, or a vague 帮我改改 when the context is a structured draft. Also for a Xiaohongshu image post from scratch (title, cover, cards, body, hooks); read references/xhs-post.md first. Also turns a document, research, notes or an article into a 60-180 s vertical video (抖音, 小红书, 视频号, B站: real sources, voice-over, captions, cover). Triggers: 做成视频, 做个短视频, 剪个 90 秒版本, 配音, 换成我的声音, or complaints of 字太密, AI 味太重, 容易走神; read references/video-pipeline.md first.

scripts/tts.py

View on GitHub
#!/usr/bin/env python3
"""Synthesize one audio clip per narration line, with word timestamps.

Writes <out>/NN.mp3 and <out>/NN.json = {"text": ..., "words": [{"word", "startTime", "endTime"}]}
(seconds). Existing clips are kept unless --force, so a re-run only fills gaps.

    # draft voice, free, no key (Microsoft Edge read-aloud)
    python3 tts.py --engine edge --voice zh-CN-YunxiNeural
    # final voice: Volcengine Doubao voice clone (needs a key and a trained speaker id)
    VOLC_TTS_API_KEY=... VOLC_TTS_SPEAKER=S_xxxxxxx python3 tts.py --engine volc

Underscores/hyphens between letters are spoken as spaces (rusty_v8 -> "rusty v8"),
otherwise TTS engines read them aloud as "杠"/"underscore". Captions keep the original text.
"""
import argparse, asyncio, base64, json, os, re, ssl, sys, uuid
from concurrent.futures import ThreadPoolExecutor

VOLC_URL = 'https://openspeech.bytedance.com/api/v3/tts/unidirectional'
VOLC_RESOURCE = 'seed-icl-2.0'   # 声音复刻 2.0「字符版」(per-character billing); the「并发版」needs purchased concurrency
VOLC_RATE = 25                   # speech_rate in [-50, 100]; 25 ≈ 5.5 汉字/s, a brisk explainer pace
VOLC_CONTEXT = '用轻松、口语化、像跟朋友聊天的语气说'   # voice instruction; officially for preset voices, harmless on clones
EDGE_RATE = '+12%'               # Edge's default pace is slow for short video
WORKERS = 4                      # stay well under the 10 concurrent requests of the per-character plan
VOLC_ERRORS = {
    45000030: 'resource not granted: in the Doubao voice console, enable 声音复刻 2.0 (字符版) and grant this API key access to it',
    45000292: 'concurrency quota exceeded: the 并发版 resource has 0 purchased concurrency; use the 字符版 resource (seed-icl-2.0)',
}


def speakable(text):
    return re.sub(r'(?<=[A-Za-z0-9])[_-](?=[A-Za-z0-9])', ' ', text)


def volc(text, out):
    import requests
    key, spk = os.environ.get('VOLC_TTS_API_KEY'), os.environ.get('VOLC_TTS_SPEAKER')
    if not key or not spk:
        sys.exit('set VOLC_TTS_API_KEY and VOLC_TTS_SPEAKER (the S_... voice id) first')
    req = {'text': text, 'speaker': spk, 'context_texts': [VOLC_CONTEXT],
           'audio_params': {'format': 'mp3', 'sample_rate': 24000, 'speech_rate': VOLC_RATE, 'enable_subtitle': True}}
    last = None
    for _ in range(3):
        r = requests.post(VOLC_URL, stream=True, timeout=120, json={'user': {'uid': 'video'}, 'req_params': req},
                          headers={'X-Api-Key': key, 'X-Api-Resource-Id': os.environ.get('VOLC_TTS_RESOURCE', VOLC_RESOURCE),
                                   'X-Api-Request-Id': uuid.uuid4().hex,   # required; requests without it were rejected
                                   'Content-Type': 'application/json'})
        audio, words = b'', []
        for line in r.iter_lines():
            if not line:
                continue
            j = json.loads(line)
            if j.get('data'):
                audio += base64.b64decode(j['data'])
            elif (j.get('sentence') or {}).get('words'):
                words += j['sentence']['words']
            else:
                last = j
        code = (last or {}).get('code') or ((last or {}).get('header') or {}).get('code')
        if audio and code == 20000000:
            open(out + '.mp3', 'wb').write(audio)
            return [{'word': w['word'], 'startTime': w['startTime'], 'endTime': w['endTime']} for w in words]
        if code in VOLC_ERRORS:
            sys.exit(f'Volcengine {code}: {VOLC_ERRORS[code]}')
    sys.exit(f'Volcengine TTS failed: {last}')


def edge(text, out, voice):
    import aiohttp, edge_tts

    async def run():
        ca = os.environ.get('SSL_CERT_FILE')   # behind a TLS-inspecting proxy, point this at the proxy CA bundle
        conn = aiohttp.TCPConnector(ssl=ssl.create_default_context(cafile=ca)) if ca else None
        com = edge_tts.Communicate(text, voice, rate=EDGE_RATE, boundary='WordBoundary', connector=conn)
        audio, words = b'', []
        async for ch in com.stream():
            if ch['type'] == 'audio':
                audio += ch['data']
            elif ch['type'] == 'WordBoundary':   # offset/duration are in 100 ns ticks
                s = ch['offset'] / 1e7; words.append({'word': ch['text'], 'startTime': s, 'endTime': s + ch['duration'] / 1e7})
        open(out + '.mp3', 'wb').write(audio)
        return words
    return asyncio.run(run())


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument('--script', default='script.json'); ap.add_argument('--out', default='tts')
    ap.add_argument('--engine', choices=['edge', 'volc'], default='edge'); ap.add_argument('--voice', default='zh-CN-YunxiNeural')
    ap.add_argument('--force', action='store_true'); ap.add_argument('--only', type=int, nargs='*', help='line indexes to (re)generate')
    a = ap.parse_args()
    lines = json.load(open(a.script))['lines']; os.makedirs(a.out, exist_ok=True)

    def one(i):
        base = os.path.join(a.out, f'{i:02d}')
        if a.only is not None and i not in a.only:
            return
        if not a.force and a.only is None and os.path.exists(base + '.json') and os.path.exists(base + '.mp3'):
            return
        text = speakable(lines[i]['n'])
        words = volc(text, base) if a.engine == 'volc' else edge(text, base, a.voice)
        json.dump({'text': text, 'words': words}, open(base + '.json', 'w'), ensure_ascii=False)
        print(f'{i:02d} {len(words)} words')
    with ThreadPoolExecutor(WORKERS) as ex:
        list(ex.map(one, range(len(lines))))


if __name__ == '__main__':
    main()
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 318kUpdated Claude CodeCodexUnverifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 117kUpdated Claude CodeCodexUnverifiedInstall