lxmusic: Instructions file for Claude Code

CLAUDE.md

lxmusic CLAUDE.md is an instructions file for Claude Code from tiancheng91/lxmusic. It costs 1,516 tokens per session, scanned A, original, MIT.

Repository instructions for lxmusic, a command-line music tool. They document setup, tests, building, installation, commands, and the main parts of its code structure.

In plain words
What is it for?
They help install dependencies, run all or individual tests, build and install the package, use the command line, and understand its music sources and playback components.
Why use it?
They give a coding agent the project-specific commands and conventions it needs to work on the repository without guessing.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is tiancheng91/lxmusic's own configuration. It tells Claude Code how to work on lxmusic itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything lxmusic configures →

Reuse

Borrowing it

Nothing to install: this file belongs to tiancheng91/lxmusic. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tiancheng91/lxmusic/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/tiancheng91/lxmusic

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lxmusic CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/tiancheng91/lxmusic/claude-md/github.svg)](https://agentmods.dev/instructions/tiancheng91/lxmusic/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/tiancheng91/lxmusic/claude-md"><img src="https://agentmods.dev/badge/instructions/tiancheng91/lxmusic/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for lxmusic CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/tiancheng91/lxmusic/claude-md"><img src="https://agentmods.dev/badge/instructions/tiancheng91/lxmusic/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,516 This file is loaded in full into every session.
When invoked 1,516 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01516 $0.01516
Opus 5 $0.00758 $0.00758
Sonnet 5 $0.00303 $0.00303
Haiku 4.5 $0.00152 $0.00152

Measured 10d ago against content hash e0c22a901165, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

lxmusic CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

常用命令

# 安装依赖
uv sync

# 运行测试
uv run pytest tests/ -v

# 运行单个测试
uv run pytest tests/test_tx_music.py::TestPlaylistStore::test_create_and_get -v

# 构建
uv build

# 本地安装(开发模式)
uv tool install .

# 运行 CLI
uv run lxmusic --help
uv run lxmusic search music "周杰伦"
uv run lxmusic mcp                          # 标准 MCP server

架构

lxmusic/ 包采用三层组合架构:

1. Source 层(搜索与元信息)

lxmusic/sources/__init__.py 定义 Source(ABC) 抽象基类,要求实现: search_music / search_album / get_music_info / get_album_info / get_lyric / get_audio_headers / close

三个实现:

  • tx.py — QQ 音乐(通过 musicu.fcg 接口)
  • wy.py — 网易云音乐
  • local.py — 本地音乐文件 + 歌单 YAML 扫描

LocalSource 特殊性:

  • 扫描 cfg.local_dirs(由 music_dir 拆分而来,逗号分隔多目录)
  • 同时扫描 *.yaml 文件,解析 {name, tracks} 结构为歌单
  • search_album 按 YAML 中 name 字段匹配歌单名
  • get_album_infoalbum_mid(歌单名)查找对应 YAML 返回曲目
  • 文件 ID 使用 MD5 哈希(确定性,跨进程稳定),不能用 hash()(有随机种子)
  • get_music_info 支持 songmid(文件路径)和 song_id(哈希)两种查找

2. PlayURLProvider 层(播放直链)

lxmusic/playurl.py 定义 PlayURLProvider(ABC),实现 ShiqianjiangProvider

  • 调用 https://source.shiqianjiang.cn/api/music/url
  • 需要 API 密钥(从 cfg.api_key 获取)

3. MusicClient 组合层

lxmusic/client.pyMusicClient 组合 Source + PlayURLProvider:

  • _get_source(name) 懒加载并缓存 Source 实例(LocalSource 接收 cfg.local_dirs
  • get_play_url(song, quality) 对本地源直接返回 song.songmid(即文件路径),远程源走 PlayURLProvider
  • 通过 source 参数覆盖默认音源

CLI 与 MCP

入口分发

lxmusic/main.py 根据 sys.argv[1] 分发:

  • mcp → 标准 MCP server(FastMCP,stdio)
  • 其他 → CLI 命令组(click)

CLI 命令组(cli.py

search / play / download / album / playlist / config

关键实现细节:

  • _resolve_play_url(client, song, quality) — 请求音质不可用时自动降级到 128k
  • playlist add 支持 --limit(默认 20)自动翻页拉取搜索结果
  • album 下载时若 URL 是本地路径用 shutil.copy2,否则走 _download_file
  • 下载进度条通过 _progress_bar 回调显示

配置系统

lxmusic/config.py 采用两层优先级:环境变量 > config.yaml > 默认值

Read the full file on GitHub · 144 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 144 lines · 1,516 tokens per session scan A e0c22a901165

Subscribe to this mod's changes

lxmusic CLAUDE.md is an instructions file published in the GitHub repository tiancheng91/lxmusic (2 stars, last pushed 27d ago), licensed MIT. It adds 1,516 tokens to every session, about $0.0076 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens