Skip to content

anbeime/skill / skills/cy-carousel-skill/cy-carousel-skill

cy-carousel

Verified

制作 AI 科技类小红书图文轮播(封面+10张内页,1440×1920,暗底或浅色纸底,电子青强调色):讲一个 AI 概念、一篇论文或一个产品,体裁是「AI 学习笔记」。查证一手出处、找开放授权素材(论文原文、真实截图、人物照),用 scripts/手排.py 照 ELIZA 的做法逐页手排(毛笔双色标题、原文纸条放大加红圈、电子青大数字、问句贴条),再用 render.py 渲染、check_all.py 检查、package.py 打包。用户要做 AI/科技/论文/产品类图文,或复用、精修这类轮播时使用。

FileKindSize
.github/ISSUE_TEMPLATE/bug_report.ymlconfig1.4 KB
.github/ISSUE_TEMPLATE/config.ymlconfig27 B
.github/ISSUE_TEMPLATE/feature_request.ymlconfig932 B
.github/agent/implement.mdmarkdown1.9 KB
.github/agent/review.mdmarkdown1.5 KB
.github/agent/triage.mdmarkdown2.9 KB
.github/labels.jsonconfig2.2 KB
.github/pull_request_template.mdmarkdown409 B
.github/scripts/apply_triage.pyscript6.4 KB
.github/scripts/dump_issue.shscript509 B
.github/scripts/intake_feedback.pyscript4.0 KB
.github/scripts/open_agent_pr.shscript3.8 KB
.github/workflows/agent-cleanup.ymlconfig1.9 KB
.github/workflows/agent-implement.ymlconfig4.5 KB
.github/workflows/agent-review.ymlconfig2.8 KB
.github/workflows/agent-triage.ymlconfig4.6 KB
.github/workflows/claude.ymlconfig2.9 KB
.github/workflows/feedback-intake.ymlconfig2.0 KB
.github/workflows/sync-labels.ymlconfig798 B
.github/workflows/validate.ymlconfig1.1 KB
.gitignoreother65 B
CLAUDE.mdmarkdown2.3 KB
LICENSEother1.2 KB
README.mdmarkdown10.6 KB
SKILL.mdskill md9.7 KB
assets/banner.jpgbinary422.3 KB
assets/fonts/LXGWWenKai-Medium.ttfbinary24.2 MB
assets/fonts/MaShanZheng-Regular.ttfbinary5.6 MB
assets/fonts/NotoSansSC[wght].ttfbinary16.9 MB
assets/fonts/NotoSerifSC[wght].ttfbinary24.0 MB
assets/fonts/README.mdmarkdown677 B
assets/fonts/licensed/README.mdmarkdown1.0 KB
assets/fonts/lxgwwenkai-OFL.txtmarkdown5.0 KB
assets/fonts/mashanzheng-OFL.txtmarkdown4.3 KB
assets/fonts/notosanssc-OFL.txtmarkdown4.3 KB
assets/fonts/notoserifsc-OFL.txtmarkdown4.2 KB
assets/fonts/来源与许可证.jsonconfig1.3 KB
docs/agent-workflow.mdmarkdown7.8 KB
examples/01-ELIZA/README.mdmarkdown846 B
examples/01-ELIZA/全套预览.jpgbinary408.3 KB
examples/01-ELIZA/标题.txtmarkdown67 B
examples/01-ELIZA/正文.txtmarkdown1.7 KB
examples/02-Dots/README.mdmarkdown875 B
examples/02-Dots/全套预览.jpgbinary408.9 KB
examples/02-Dots/标题.txtmarkdown69 B
examples/02-Dots/正文.txtmarkdown1.8 KB
examples/03-聪明汉斯/README.mdmarkdown1.1 KB
examples/03-聪明汉斯/全套预览.jpgbinary450.1 KB
examples/03-聪明汉斯/制作.pyscript14.2 KB
examples/04-AI幻觉/README.mdmarkdown1.4 KB
examples/04-AI幻觉/全套预览.jpgbinary668.3 KB
examples/04-AI幻觉/制作.pyscript12.7 KB
examples/04-AI幻觉/标题.txtmarkdown131 B
examples/04-AI幻觉/正文.txtmarkdown1010 B
references/排字细节.mdmarkdown6.9 KB
requirements.txtmanifest91 B
scripts/blind_test.pyscript3.6 KB
scripts/build.pyscript43.6 KB
scripts/check_all.pyscript13.3 KB
scripts/cutout.swiftscript858 B
scripts/emoji.swiftscript1.6 KB
scripts/io_paths.pyscript1.0 KB
scripts/layouts_v2.pyscript67.0 KB
scripts/ocr.swiftscript1.3 KB
scripts/ocrfind.swiftscript1.3 KB
scripts/package.pyscript4.0 KB
scripts/render.pyscript47.9 KB
scripts/保脸裁切.pyscript2.1 KB
scripts/图像等比.pyscript3.2 KB
scripts/对照.pyscript12.3 KB
scripts/手排.pyscript26.9 KB
scripts/检测人脸.swiftscript935 B
scripts/浅色排版.pyscript10.3 KB
scripts/验证排版.pyscript23.8 KB
scripts/验证留白.pyscript1.4 KB
scripts/验证背景.pyscript17.5 KB
tests/test_agent_workflow.pyscript7.4 KB
tests/test_cache_and_config.pyscript6.1 KB
tests/test_cross_platform.pyscript5.1 KB
tests/test_render_smoke.pyscript3.8 KB
tests/test_strict_visual.pyscript10.6 KB
tests/test_strict_visual_integration.pyscript6.7 KB
tools/submit_feedback.pyscript2.6 KB
tools/validate_repo.pyscript4.5 KB

scripts/浅色排版.py

View on GitHub
from io_paths import asset_path
"""浅色矩形照片路径:密度取自成图,不能用噪声或背景标签代替内容。"""
from pathlib import Path
from PIL import Image, ImageOps, ImageColor, ImageDraw
import numpy as np
from render import normalize_tone

def box_mean(a,k=9):
    padded=np.pad(a,k//2,mode='reflect')
    integral=np.pad(padded,((1,0),(1,0))).cumsum(0).cumsum(1)
    return (integral[k:,k:]-integral[:-k,k:]-integral[k:,:-k]+integral[:-k,:-k])/(k*k)

def blank_paper(image):
    # 与监管统计校准:240宽,9×9局部RGB平均亮度标准差;P02 v1≈62.8%、P05≈59.1%。
    im=ImageOps.contain(image.convert('RGB'),(240,10000),Image.Resampling.LANCZOS)
    a=np.asarray(im,dtype=np.float64).mean(2)
    std=np.sqrt(np.maximum(0,box_mean(a*a)-box_mean(a)**2))
    return float(((std<3)&(a>170)).mean())

def face_text_rules(p,record):
    """cover保脸后还要避开文字贴条;检查逐行字宽,不能拿整段空文本框代替。"""
    hits=[]
    for e in [v for v in p.get('elements',[]) if v['kind']=='image']:
        t=next((v for v in record.get('image_transforms',[]) if v.get('source')==e['path']),{})
        fc=t.get('face_check',{}); crop=fc.get('source_crop_box')
        if not crop:continue
        cw,ch=t['source_region_size'];x0,y0,_,_=crop;x,y,w,h=e['box']
        faces=[]
        for f in fc.get('detected_local_faces',[]):
            if f['id'] not in fc.get('retained_face_ids',[]):continue
            a,b,c,d=f['box']
            faces.append((f['id'],[x*1440+(a-x0)*w*1440/cw,y*1920+(b-y0)*h*1920/ch,
                                   x*1440+(c-x0)*w*1440/cw,y*1920+(d-y0)*h*1920/ch]))
        for tx in [v for v in p.get('elements',[]) if v['kind'] in ('text','caption')]:
            tr=next((v for v in record['text'] if v['text']==tx['text'] and v['box']==tx['box']),None);regions=[]
            # 脚本/报告一致性由统一geometry_rules核SHA;此处不把缺失审计误写成已验脸。
            if tr is None:continue
            if tx.get('bg'):
                for ln in set(g['line'] for g in tr['glyphs']):
                    gl=[g['ink_bounds'] for g in tr['glyphs'] if g['line']==ln and g['ink_bounds']]
                    if not gl:continue
                    yy=tx['box'][1]*1920+ln*tx['lineheight']
                    regions.append([min(a[0] for a in gl)-9,yy-4,max(a[2] for a in gl)+9,yy+tx['lineheight']-3])
            else:regions=[g['ink_bounds'] for g in tr['glyphs'] if g['ink_bounds']]
            for fid,(a,b,c,d) in faces:
                # Union avoids double-counting overlapping glyph/strip boxes (>100% was impossible).
                import math
                ox,oy=math.floor(a),math.floor(b);fw,fh=math.ceil(c)-ox,math.ceil(d)-oy
                face_mask=Image.new('1',(max(1,fw),max(1,fh)));drawer=ImageDraw.Draw(face_mask)
                for q in regions:
                    x0,y0,x1,y1=max(a,q[0]),max(b,q[1]),min(c,q[2]),min(d,q[3])
                    if x1>x0 and y1>y0:drawer.rectangle((math.floor(x0)-ox,math.floor(y0)-oy,math.ceil(x1)-ox-1,math.ceil(y1)-oy-1),fill=1)
                overlap=float(np.asarray(face_mask,dtype=bool).mean())
                if overlap>.03:hits.append({'source_id':e['source_id'],'face_id':fid,'text':tx['text'],'face_area_overlap':overlap,'basis':'文字墨迹外接框/逐行贴条与脸框相交像素并集,保守检查'})
    return {'passed':not hits,'collisions':hits}

def light_editorial_rules(data,reports,script,pages_dir):
    errors=[];rows=[];red_brush=0
    if normalize_tone(data.get('tone',data.get('config',{}).get('tone')))!='浅':
        errors.append('light-editorial-v2只能用于浅色篇')
    for n,p in enumerate(data['pages'],1):
        if p['layout']=='cover':continue
        from render import page_config
        cfg=page_config(data.get('config',{}),p)
        record=next(r for r in reports if r['page']==n)
        wm=record.get('watermark') or {}
        if wm.get('style')!='neutral' or wm.get('text')!=cfg.get('watermark_text',str(cfg.get('account_name','账号名')).replace('{','').replace('}','')) or wm.get('size',100)>26 or len(set(ImageColor.getrgb(wm.get('color','#FF0000'))))!=1:
            errors.append(f'P{n:02}预览水印不是灰色小字账号名')
        for t in record['text']:
            ink=t.get('effect_bounds') or t.get('ink_bounds')
            if ink and (ink[0]<0 or ink[1]<0 or ink[2]>1440 or ink[3]>1920):
                errors.append(f'P{n:02}文字实际墨迹出画布:{t["text"][:20]}')
        face_text=face_text_rules(p,record)
        errors.extend(f'P{n:02}文字/贴条覆盖人脸:{hit["text"][:15]}' for hit in face_text['collisions'])
        output=Path(record.get('output_file',pages_dir/f'p{n:02}.png'))
        with Image.open(output) as im: blank=blank_paper(im)
        if blank>.38:errors.append(f'P{n:02}空白纸面{blank:.2%}>38%')
        photos=[];cutouts=[];body=[];names=[];headings=[];circles=[];marks=[]
        for e in p.get('elements',[]):
            kind=e['kind']
            if kind=='image':
                with Image.open(asset_path(script.parent,e['path'])) as im:
                    transparent=im.mode=='RGBA' and im.getchannel('A').getextrema()[0]<255
                if transparent or e.get('mask'):cutouts.append(e['source_id'])
                elif e.get('photo_role'):
                    shadow=e.get('soft_shadow',{})
                    photos.append({'source_id':e['source_id'],'width_ratio':e['box'][2],
                                   'box':e['box'],'shadow':shadow,'fit':e.get('fit')})
                    if e.get('fit')!='cover':errors.append(f'P{n:02}矩形照片不是等比cover')
                    if shadow.get('offset')!=[6,8] or shadow.get('blur')!=10 or not .30<=shadow.get('opacity',0)<=.40:
                        errors.append(f'P{n:02}矩形照片缺少6/8、模糊10、透明度约0.35的柔影')
            elif kind=='disc_portrait':cutouts.append(e['source_id'])
            elif kind=='text':
                size=e.get('size',60);rgb=ImageColor.getrgb(e.get('fill','#FFFFFF'))
                if e.get('font','body')=='body':
                    body.append({'text':e['text'],'size':size,'width_ratio':e['box'][2],
                                 'lineheight_ratio':e.get('lineheight',size*1.5)/size})
                    if not 58<=size<=64:errors.append(f'P{n:02}正文{size}px不在58–64px')
                    if not .45<=e['box'][2]<=.60:errors.append(f'P{n:02}正文宽度{e["box"][2]:.1%}不在45–60%')
                    if not 1.45<=e.get('lineheight',size*1.5)/size<=1.55:errors.append(f'P{n:02}正文行高不是约1.5倍')
                if e.get('text_role')=='photo-name':
                    names.append(e)
                    if e.get('font')!='sans-bold' or not 28<=size<=34 or e.get('bg')!='#000000' or rgb!=(255,255,255):
                        errors.append(f'P{n:02}人名标签须黑底白字、黑体Bold、28–34px')
                if e.get('heading_level')=='primary':
                    headings.append(e['text'])
                    if max(rgb)>45 or e.get('font') not in ('serif-black','headline'):
                        errors.append(f'P{n:02}主标题未用黑色粗重字')
                t=next((a for a in record['text'] if a['text']==e['text'] and a['box']==e['box']),{})
                if 'MaShanZheng' in t.get('font_file',{}).get('path','') and max(rgb)-min(rgb)>35:
                    red_brush+=1
            if kind in ('hand_circle','hand_underline'):
                marks.append(e.get('target_text'));circles.append(e.get('target_text')) if kind=='hand_circle' else None
                if not e.get('target_text'):errors.append(f'P{n:02}手绘标记没有真实关键字目标')
                else:
                    import re
                    target=e['target_text']
                    tr=next((t for t in record['text'] if target in re.sub(r'\[\[|\]\]|\n','',t['text'])),{})
                    glyphs=[g for g in tr.get('glyphs',[]) if g.get('ink_bounds')]
                    start=''.join(g['char'] for g in glyphs).find(target)
                    if start<0:errors.append(f'P{n:02}手绘关键词缺少实际字形审计:{target}')
                    elif len({g['line'] for g in glyphs[start:start+len(target)]})>1:
                        errors.append(f'P{n:02}手绘关键词跨行变成大圈/长线:{target}')
        if not photos or max(e['width_ratio'] for e in photos)<.40:errors.append(f'P{n:02}缺少宽≥40%的矩形主照片')
        if len(cutouts)>1:errors.append(f'P{n:02}人物抠图{len(cutouts)}>1')
        if len(circles)>2:errors.append(f'P{n:02}红圈{len(circles)}>2')
        # 只核确名人物;匿名泳者不编名字。矩形/圆盘的名字标签须靠照片一角。
        identified={e['subject_name'] for e in p.get('elements',[]) if e['kind'] in ('image','disc_portrait') and e.get('subject_name')}
        for name in identified:
            if not any(name==t.get('person_name',t['text']) for t in names):errors.append(f'P{n:02}确名人物{name}缺少黑白人名标签')
        rows.append({'page':n,'blank_paper_ratio':round(blank,6),'rectangular_photos':photos,
                     'person_cutouts':cutouts,'body_blocks':body,'photo_name_labels':[e['text'] for e in names],
                     'black_primary_headings':headings,'red_circles':circles,'hand_marks':marks,'face_text_check':face_text})
    if red_brush>3:errors.append(f'全篇深红毛笔标题{red_brush}>3处')
    return {'profile':'light-editorial-v2','passed':not errors,'measurement':{
        'blank':'240宽等比LANCZOS;9×9反射边界局部窗口,RGB平均亮度标准差<3且亮度>170的成图像素占比;整页不排除照片/文字,不添加噪声凑密度',
        'blank_limit':.38,'body_size':[58,64],'body_width':[.45,.60],
        'photo':'原图不透明矩形、等比cover;每页≥1,主图宽≥40%,柔影6/8、10、0.35',
        'priority':'浅篇矩形照片取代暗篇抠图≥5页/圆盘≥2页配额;出现的抠图≤1且圆盘仍验露出≥40%,不因深红最多3处而强制每页彩色大字。'},
        'summary':{'blank_max':max((r['blank_paper_ratio'] for r in rows),default=0),
                   'blank_mean':sum(r['blank_paper_ratio'] for r in rows)/max(1,len(rows)),
                   'red_brush_count':red_brush,'rectangular_photo_pages':sum(bool(r['rectangular_photos']) for r in rows)},
        'pages':rows,'errors':errors}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall