Skip to content

xyaz1313/xyskill / skills/xy-ops

【团队操盘审查】操盘手视角审查:用起盘阶段匹配度、组织规模临界值、人效红线、分钱执行与人心、一线检验五个维度,审查团队搭建、人效设计和起盘节奏是不是踩在真实业务阶段上,排除「团队大就是强」「GMV 好看就是赚钱」「靠感情能管好团队」这类假信号。用户说「帮我看看团队搭建得对不对」「提成怎么设」「该不该扩团队」「起盘节奏是不是太快」「人效有没有问题」「团队为什么留不住人」时触发。|小爷出品

FileKindSize
SKILL.mdskill md42.4 KB
agents/openai.yamlconfig320 B
evals/evals.jsonconfig1.8 KB
references/atoms.jsonlother4.5 MB
scripts/atoms-search.pyexecutablescript11.5 KB

scripts/atoms-search.py

View on GitHub
#!/usr/bin/env python3
"""XY 原子检索(零依赖)。用法:
  atoms-search "关键词 关键词2" [--skill xy-close] [--type case,anti-pattern] [--topic 成交与话术] [-k 5] [--json] [--expand-related]
默认走云端全量库(api.xyskill.xyz),云端不可达自动回退本地兜底子集;可用 XY_ATOMS 环境变量覆盖成本地路径强制离线,或指向别的 https:// 地址。
评分:knowledge 命中关键词数×3 + original 命中×1 + type 偏好(case/anti-pattern/number +1) + confidence high +1。
--expand-related:命中结果沿 related(rel=supports/example_of优先) 再带出关联原子,形成"结论+佐证"证据链,而非孤立单条。仅本地文件模式支持,云端命中不展开。"""
import json, os, sys, re, argparse
def _find_atoms_local():
    """本地候选路径:本脚本真实路径所在包 > ~/.xy/config.json 的 root > 常见安装位置。
    用 realpath 是因为宿主常以软链方式加载 skill(~/.claude/skills/xy-coach → 仓库),按软链位置找会找到不存在的目录。"""
    here=os.path.dirname(os.path.realpath(__file__))
    cands=[os.path.join(os.path.dirname(here),"knowledge","atoms.jsonl"),            # <root>/scripts/atoms-search
           os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(here))),"knowledge","atoms.jsonl"),  # <root>/skills/<x>/scripts/atoms-search
           os.path.join(os.path.dirname(here),"references","atoms.jsonl")]           # 单拷 skill 文件夹时的本地子集兜底
    try:
        cfg=json.load(open(os.path.expanduser("~/.xy/config.json"),encoding="utf-8"))
        if cfg.get("root"): cands.append(os.path.join(cfg["root"],"knowledge","atoms.jsonl"))
    except Exception: pass
    for base in ("~/.agents/skills/xy","~/.claude/skills/xy","~/.kimi-code/skills/xy","~/.workbuddy/skills/xy"):
        rp=os.path.realpath(os.path.expanduser(base))
        cands.append(os.path.join(os.path.dirname(os.path.dirname(rp)),"knowledge","atoms.jsonl"))
    for c in cands:
        if os.path.isfile(c): return c
    return cands[0]

_CLOUD_DEFAULT = "https://api.xyskill.xyz"

def _find_atoms():
    """XY_ATOMS 环境变量(本地路径或 https:// 地址)优先;未设置时默认走云端全量库,
    云端不可达时下面的调用方会自动回退本地兜底子集(见 _remote_search 的调用点)。"""
    if os.environ.get("XY_ATOMS"): return os.environ["XY_ATOMS"]
    return _CLOUD_DEFAULT

def _remote_search(url, skill, query, topic, top_k):
    """打云端 /v1/atoms/search,2.5 秒超时,任何异常一律交给调用方回退本地。"""
    import urllib.request
    payload={"skill":skill,"query":query,"top_k":top_k}
    if topic: payload["topics"]=[topic]
    req=urllib.request.Request(
        url.rstrip("/")+"/v1/atoms/search",
        data=json.dumps(payload).encode("utf-8"),
        headers={"Content-Type":"application/json"},
        method="POST",
    )
    with urllib.request.urlopen(req, timeout=2.5) as resp:
        return json.loads(resp.read().decode("utf-8")).get("atoms", [])

# === 真 IDF 权重:出现在几千条里的词(提升/转化/品牌)没有定位价值,只有稀有词才算数 ===
_IDF={}
try:
    _ip=os.path.join(os.path.dirname(os.path.abspath(a.file)),"idf.json") if False else None
except Exception: pass
def _load_idf(atoms_path):
    import os as _o
    for cand in [_o.path.join(_o.path.dirname(atoms_path),"idf.json"),
                 _o.path.join(_o.path.dirname(_o.path.dirname(_o.path.realpath(__file__))),"knowledge","idf.json")]:
        if _o.path.isfile(cand):
            try: return json.load(open(cand,encoding="utf-8"))
            except Exception: return {}
    return {}

def _load_concepts(atoms_path):
    """knowledge/concepts.jsonl 跟 atoms.jsonl 同目录;目前只覆盖"私域运营"topic,其余topic文件里没有对应节点,静默跳过不报错。"""
    import os as _o
    cand=_o.path.join(_o.path.dirname(atoms_path),"concepts.jsonl")
    out=[]
    if _o.path.isfile(cand):
        try:
            for _l in open(cand,encoding="utf-8"):
                _l=_l.strip()
                if _l: out.append(json.loads(_l))
        except Exception: return []
    return out

default=_find_atoms()
ap=argparse.ArgumentParser(); ap.add_argument("query"); ap.add_argument("--skill"); ap.add_argument("--type"); ap.add_argument("--topic"); ap.add_argument("-k",type=int,default=5); ap.add_argument("--json",action="store_true"); ap.add_argument("--file",default=default); ap.add_argument("--expand-related",action="store_true"); ap.add_argument("--expand-limit",type=int,default=2); ap.add_argument("--via-concepts",action="store_true",help="query 先匹配概念节点标题,命中则把该节点全部 evidence_atom_ids 作为优先结果前置(目前仅私域运营topic有节点数据,其余topic静默无效果)")
a=ap.parse_args()
if a.file.startswith("http://") or a.file.startswith("https://"):
    try:
        remote_rows=_remote_search(a.file, a.skill, a.query, a.topic, a.k)
        if a.json: print(json.dumps(remote_rows, ensure_ascii=False)); sys.exit(0)
        for o in remote_rows:
            print(f"- [{o['id']}] ({o.get('confidence')}) {o['knowledge']}")
        if not remote_rows: print("(原子库暂无匹配,请明说没有实证)")
        sys.exit(0)
    except Exception:
        a.file=_find_atoms_local()  # 云端不可达/超时/出错,静默回退本地兜底子集,不让 Skill 因此失效
_IDF=_load_idf(a.file)
kws=[w for w in re.split(r"[\s,,、/]+",a.query) if w]
# 长复合词降级:把 >4 字的词同时拆成 2-3 字子串一起检索("核销率提升"→核销/提升),
# 否则库里没有字面一致的复合词就会零命中
_ext=[]
for _w in kws:
    if len(_w)>4:
        _ext += [_w[i:i+2] for i in range(0,len(_w)-1,2)] + [_w[:3],_w[-3:]]
    elif len(_w)==4:
        _ext += [_w[:2],_w[2:]]
kws = kws + [w for w in dict.fromkeys(_ext) if len(w)>=2 and w not in kws]
types=set(a.type.split(",")) if a.type else None
rows=[]
_by_id={}  # 仅 --expand-related 时填充,用于按id反查关联原子
try:
    for l in open(a.file,encoding="utf-8"):
        l=l.strip()
        if not l: continue
        try: o=json.loads(l)
        except: continue
        if (a.expand_related or a.via_concepts) and o.get("id"): _by_id[o["id"]]=o
        if a.skill and "skills" in o and a.skill not in (o.get("skills") or []): continue  # 子集文件无 skills 字段时不过滤,防静默全空
        if types and o.get("type") not in types: continue
        if a.topic and a.topic not in (o.get("topics") or []): continue
        k=o.get("knowledge",""); og=o.get("original","") or ""
        head=k[:30]
        s=0.0
        for w in kws:
            c=k.count(w)
            if c==0:
                if w in og: s+=1
                continue
            # ① 真 IDF 加权:词表里没有=太常见=无定位价值,权重压到 0.3
            _idf=_IDF.get(w)
            if _idf is None: base=0.3
            else: base=min(8.0,_idf)*1.2
            # ② 首句加权:命题通常在前 30 字
            if w in head: base+=2.0
            # ③ 多次出现说明是主题,但收益递减
            s+=base*(1+0.4*min(c-1,3))
            # ④ 顺带提及降权:只出现一次且在末尾三成位置
            if c==1 and k.rfind(w)>len(k)*0.7 and w not in head: s-=1.5
        if s<=0: continue
        # ⑤ 教学信号:含方法/比例/阶梯/红线/步骤 → 这是"教你怎么做"而不是"顺带提到"
        import re as _re
        _teach=0
        if _re.search(r"\d+ ?[%点元条天倍]|阶梯|梯度|红线|上限|下限|三步|四步|五步|第一步|原则[::]|标准[::]|公式|先.{1,6}再|配比|占比", k): _teach+=4
        if _re.search(r"怎么设|如何设|设计|判定|判断标准|自查|checklist|清单", k): _teach+=2
        s+=_teach
        if o.get("type") in ("case","anti-pattern","number","method"): s+=2
        if o.get("confidence")=="high": s+=2
        if o.get("source_type") in ("account_video","course","user_import"): s+=6  # 小爷自有实战优先
        # ⑥ 场景降噪:外部企业/咨询库(CS/CE/CF)在私域·成交·内容·直播·流量类技能里是噪音,降权
        _SCENE={"xy-close","xy-private-ops","xy-content-scan","xy-opener","xy-traffic",
                "xy-newbie","xy-script-glue","xy-human-touch","xy-xhs-headline","xy-idea-desk","xy-replica","xy-clip",
                "xy-selection","xy-ops","xy-mode","xy-goal-card","xy-playbook","xy-question-spec","xy-biz-scan","xy-coach"}
        if a.skill in _SCENE and str(o.get("id","")).startswith(("XY-CS-","XY-CE-","XY-CF-")): s-=6
        rows.append((s,o))
except FileNotFoundError:
    print(f"[atoms-search] 找不到原子库:{a.file}",file=sys.stderr); sys.exit(0)
rows.sort(key=lambda x:-x[0]); rows=rows[:a.k]

# --via-concepts:query 先撞概念节点标题(knowledge/concepts.jsonl),命中则把该节点 evidence_atom_ids
# 整体前置(不受关键词打分排挤),因为这些原子是人工/LLM精判确认过"真的支撑这个判断",比单条关键词命中更可信。
# 目前 concepts.jsonl 只有私域运营topic的节点,其余topic查询这个flag静默无效果(_concepts 为空列表)。
matched_concept=None
if a.via_concepts:
    _concepts=_load_concepts(a.file)
    _best_score,_best=0,None
    for c in _concepts:
        title=c.get("title","")
        hit=sum(1 for w in kws if len(w)>=2 and w in title)
        if hit>_best_score: _best_score,_best=hit,c
    if _best_score>0 and _best:
        matched_concept=_best
        shown_ids={o["id"] for _,o in rows}
        concept_rows=[]
        for eid in _best.get("evidence_atom_ids",[]):
            if eid in shown_ids: continue
            tgt=_by_id.get(eid)
            if tgt: concept_rows.append((999.0,tgt)); shown_ids.add(eid)  # 排序权重给到最高,确保排在关键词命中之前
        rows=(concept_rows+rows)[:a.k]  # 仍然尊重 -k 上限;想要节点全部证据就把 -k 调大

# --expand-related:命中原子沿 related 带出关联证据,supports/example_of 优先于 refines/prerequisite_of
_REL_PRIORITY={"supports":0,"example_of":1,"prerequisite_of":2,"refines":3,"contradicts":0}
expanded={}  # hit_id -> [related_atom, ...]
if a.expand_related and _by_id:
    shown_ids={o["id"] for _,o in rows}
    for _,o in rows:
        rels=[r for r in (o.get("related") or []) if isinstance(r,dict)]
        rels.sort(key=lambda r:_REL_PRIORITY.get(r.get("rel"),9))
        picked=[]
        for r in rels:
            tgt=_by_id.get(r.get("id"))
            if not tgt or r["id"] in shown_ids: continue
            picked.append((r.get("rel"),tgt)); shown_ids.add(r["id"])
            if len(picked)>=a.expand_limit: break
        if picked: expanded[o["id"]]=picked

if a.json:
    out=[]
    for _,o in rows:
        row=dict(o)
        if o["id"] in expanded:
            row["related_expanded"]=[{"rel":rel,**tgt} for rel,tgt in expanded[o["id"]]]
        out.append(row)
    if matched_concept: print(json.dumps({"matched_concept":matched_concept.get("title"),"results":out},ensure_ascii=False)); sys.exit(0)
    print(json.dumps(out,ensure_ascii=False)); sys.exit(0)
if matched_concept: print(f"【命中概念节点:{matched_concept.get('title')}】{matched_concept.get('summary','')}")
for s,o in rows:
    print(f"- [{o['id']}] ({o.get('type')}/{o.get('confidence')}) {o['knowledge']}")
    for rel,tgt in expanded.get(o["id"],[]):
        print(f"    ↳ [{rel}] {tgt['id']} ({tgt.get('type')}) {tgt['knowledge'][:60]}")
if not rows: print("(原子库暂无匹配,请明说没有实证)")
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