bili-rs

Development skill for bili-rs, a Rust CLI tool for Bilibili (B站). Use when implementing features, fixing bugs, or extending the bilibili-cli-rust codebase. Provides architecture conventions, API endpoints, coding patterns, and project-specific constraints. Triggers on tasks involving adding CLI commands, calling Bilibili APIs, handling authentication, implementing output formatting, or working with the layered cli/commands/client/payloads architecture.

3,891 stars
Complexity: easy

About this skill

The `bili-rs` Development Skill acts as a comprehensive guide for AI coding agents tasked with developing for the `bili-rs` project, a Rust-based command-line interface for interacting with Bilibili (B站). It meticulously outlines the project's strict layering architecture, which segments responsibilities into `cli/` (for Clap structs), `commands/` (for business logic), `client/` (for HTTP async functions), and `payloads/` (for normalizing raw JSON into Rust structs). This skill details specific rules for each layer, ensuring that AI-generated code adheres to the project's structure. Key use cases include implementing new CLI commands, calling Bilibili APIs, handling user authentication, and implementing various output formatting options. By leveraging this skill, an AI agent can efficiently contribute to the `bili-rs` codebase, ensuring consistency, maintainability, and correct implementation of new features or bug fixes according to project standards.

Best use case

The primary use case for this skill is to empower AI coding agents to efficiently and accurately develop for the `bili-rs` Rust CLI project. Developers working on `bili-rs` benefit most by offloading routine coding tasks or complex feature implementations to an AI agent, knowing the agent will follow the project's established conventions, leading to maintainable and correct code.

Development skill for bili-rs, a Rust CLI tool for Bilibili (B站). Use when implementing features, fixing bugs, or extending the bilibili-cli-rust codebase. Provides architecture conventions, API endpoints, coding patterns, and project-specific constraints. Triggers on tasks involving adding CLI commands, calling Bilibili APIs, handling authentication, implementing output formatting, or working with the layered cli/commands/client/payloads architecture.

An AI agent will generate Rust code for the `bili-rs` project that adheres to its strict architectural layers and coding patterns, successfully implementing new features or fixes.

Practical example

Example input

AI, implement a new `bili-rs` command `bili watch history` to list the user's watch history. Ensure it uses the `client` layer for API calls and `payloads` for normalization.

Example output

```rust
// src/cli/watch.rs
#[derive(Debug, Subcommand)]
pub enum Watch {
    History,
}

// src/commands/watch.rs (simplified)
pub async fn history(format: OutputFormat) -> Result<(), AppError> { /* ... */ }

// src/client/watch.rs (simplified)
pub async fn get_watch_history() -> Result<serde_json::Value, AppError> { /* ... */ }

// src/payloads/watch.rs (simplified)
pub struct WatchHistoryEntry { /* ... */ }
```

When to use this skill

  • When implementing new CLI commands for the `bili-rs` project.
  • When integrating with or calling Bilibili APIs within the `bili-rs` codebase.
  • When refactoring or adding authentication logic to `bili-rs`.
  • When developing new output formatting features for `bili-rs`.

When not to use this skill

  • When working on Rust projects other than `bili-rs`.
  • For general Rust development tasks unrelated to Bilibili or this specific CLI tool.
  • When the task involves using `bili-rs` as an end-user, not developing it.
  • For tasks requiring creative solutions outside the established architectural patterns.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/bili-rs/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/18621063286/bili-rs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/bili-rs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How bili-rs Compares

Feature / Agentbili-rsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Development skill for bili-rs, a Rust CLI tool for Bilibili (B站). Use when implementing features, fixing bugs, or extending the bilibili-cli-rust codebase. Provides architecture conventions, API endpoints, coding patterns, and project-specific constraints. Triggers on tasks involving adding CLI commands, calling Bilibili APIs, handling authentication, implementing output formatting, or working with the layered cli/commands/client/payloads architecture.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# bili-rs Development Skill

Rust rewrite of [bilibili-cli](https://github.com/jackwener/bilibili-cli). Single binary, no runtime deps. Full feature parity with the Python original.

## Architecture (strict layering)

```
cli/ (clap structs only)  →  commands/ (business logic)  →  client/ (HTTP async fn)
                                      ↓
                               payloads/ (normalize raw JSON → structs)
                                      ↓
                               formatter.rs (JSON/YAML/Rich output)
```

**Rules:**
- `cli/` — clap derive structs only, zero business logic
- `commands/` — calls `client/`, never builds HTTP requests directly
- `client/` — never imports clap or formatter

## Adding a New Command

1. Add clap struct in `src/cli/<domain>.rs`
2. Add handler in `src/commands/<domain>.rs`
3. Add API call(s) in `src/client/<domain>.rs`
4. Add payload normalizer in `src/payloads/<domain>.rs` if needed
5. Wire into `src/main.rs` `run()` match arm

## Key Patterns

### Error handling
```rust
// client/ layer: always map API errors
let code = body["code"].as_i64().unwrap_or(-1);
if code != 0 {
    return Err(map_api_error(code, body["message"].as_str().unwrap_or("unknown")));
}

// commands/ layer
match result {
    Ok(data) => formatter::output(data, format),
    Err(e) => { emit_error(&e, format); std::process::exit(1); }
}
```

### Output envelope (never change the field names)
```rust
SuccessEnvelope { ok: true, schema_version: "1", data: T }
ErrorEnvelope   { ok: false, schema_version: "1", error: ErrorBody }
```

### Output format resolution
```rust
--json > --yaml > $OUTPUT env var > TTY→Rich / non-TTY→YAML
```

### Authentication levels
- `Optional` — load saved creds if available, don't fail if missing
- `Read` — requires SESSDATA
- `Write` — requires SESSDATA + bili_jct

Credential file: `~/.bilibili-cli/credential.json` (0o600, 7-day TTL)

## WBI Signature

Some Bilibili endpoints require a WBI request signature (a per-request HMAC-like parameter). Use `src/client/wbi.rs`:
```rust
let (img_key, sub_key) = fetch_wbi_keys(cred).await?;
let params = sign_params(vec![("bvid".to_string(), bvid)], &img_key, &sub_key);
req = req.query(&params);
```

Known endpoints needing WBI: `/x/web-interface/view/conclusion/get`

## Output & Terminal

- Status/errors → **stderr** with `console::style`
- Data → **stdout** as table (`comfy-table`) or JSON/YAML
- Counts ≥ 10000 → `"X.X万"` format

## Quality Gate (run before every commit)

```bash
cargo build && cargo clippy -- -D warnings && cargo fmt --check && cargo test
```

## References

- **All CLI commands & options**: See [references/commands.md](references/commands.md)
- **API endpoints & payloads**: See [references/api.md](references/api.md)
- **Full project spec**: `PRD.md` in project root
- **Implementation conventions**: `CLAUDE.md` in project root

Related Skills

Go Production Engineering

3891
from openclaw/skills

You are a Go production engineering expert. Follow this system for every Go project — from architecture decisions through production deployment. Apply phases sequentially for new projects; use individual phases as needed for existing codebases.

Coding & Development

Database Engineering Mastery

3891
from openclaw/skills

> Complete database design, optimization, migration, and operations system. From schema design to production monitoring — covers PostgreSQL, MySQL, SQLite, and general SQL patterns.

Coding & Development

afrexai-code-reviewer

3891
from openclaw/skills

Enterprise-grade code review agent. Reviews PRs, diffs, or code files for security vulnerabilities, performance issues, error handling gaps, architecture smells, and test coverage. Works with any language, any repo, no dependencies required.

Coding & Development

API Documentation Generator

3891
from openclaw/skills

Generate production-ready API documentation from endpoint descriptions. Outputs OpenAPI 3.0, markdown reference docs, and SDK quickstart guides.

Coding & Development

Puppeteer

3891
from openclaw/skills

Automate Chrome and Chromium with Puppeteer for scraping, testing, screenshots, and browser workflows.

Coding & Development

pharaoh

3891
from openclaw/skills

Codebase knowledge graph with 23 development workflow skills. Query architecture, dependencies, blast radius, dead code, and test coverage via MCP. Requires GitHub App installation (read-only repo access) and OAuth authentication. Connects to external MCP server at mcp.pharaoh.so.

Coding & Development

git-commit-helper

3891
from openclaw/skills

Generate standardized git commit messages following Conventional Commits format. Use this skill when the user asks to commit code, write a commit message, or create a git commit. Enforces team conventions for type prefixes, scope naming, message length, and breaking change documentation.

Coding & Development

ask-claude

3891
from openclaw/skills

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Coding & Development

bnbchain-mcp

3891
from openclaw/skills

Interact with the BNB Chain Model Context Protocol (MCP) server. Blocks, contracts, tokens, NFTs, wallet, Greenfield, and ERC-8004 agent tools. Use npx @bnb-chain/mcp@latest or read the official skill page.

Coding & Development

helius-phantom

3891
from openclaw/skills

Build frontend Solana applications with Phantom Connect SDK and Helius infrastructure. Covers React, React Native, and browser SDK integration, transaction signing via Helius Sender, API key proxying, token gating, NFT minting, crypto payments, real-time updates, and secure frontend architecture.

Coding & Development

micropython-skills/sensor

3891
from openclaw/skills

MicroPython sensor reading — DHT11/22, BME280, MPU6050, ADC, ultrasonic HC-SR04, photoresistor, generic I2C sensors.

Coding & Development

micropython-skills/network

3891
from openclaw/skills

MicroPython networking — WiFi STA/AP, HTTP requests, MQTT pub/sub, BLE, NTP time sync, WebSocket.

Coding & Development