Skip to content

Feat/markdown agent format#1267

Merged
claude-code-best merged 1 commit into
claude-code-best:mainfrom
James-FE:feat/markdown-agent-format
Jun 10, 2026
Merged

Feat/markdown agent format#1267
claude-code-best merged 1 commit into
claude-code-best:mainfrom
James-FE:feat/markdown-agent-format

Conversation

@James-FE

@James-FE James-FE commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

支持在 ~/.claude/modes/ 目录下使用 Markdown + YAML frontmatter 格式
定义自定义 Mode,与 OpenCode / Cursor / Codex 等工具的 Agent 定义格式
完全统一。

Motivation

社区反馈:当前 Mode 使用 CCP 专有 YAML 格式,而 OpenCode 和 Claude Code
的 Agent/SKILL.md 都使用 --- YAML frontmatter + Markdown body 的通用格式。
统一后同一份 claude.md 可在多个工具间零修改迁移。

Changes

src/modes/store.ts — 仅一个文件,+34 / -3:

  • kebabCase() — 从 name 自动生成 slug
  • parseMarkdownFrontmatter() — 提取 frontmatter + Markdown body
  • .md 数据标准化后复用现有 CCBMode 映射,零重复
  • 现有 .yaml/.yml 路径一字符未改

Usage


name: Claude
description: Anthropic's Claude persona

Character

You have a genuine, stable character...

激活: /mode claude 或 settings.json 中 "ccbMode": "claude"

Summary by CodeRabbit

  • New Features
    • Custom modes can now be defined in Markdown files using YAML frontmatter; the Markdown body becomes the system prompt.
    • Mode entries will derive a slug from the name and default to a robot icon when none is provided.
    • Added optional model specification to mode definitions.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad575d73-198f-4a49-b1c4-16c7b87b6d20

📥 Commits

Reviewing files that changed from the base of the PR and between bcc2907 and 1f44e2b.

📒 Files selected for processing (2)
  • src/modes/store.ts
  • src/modes/types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/modes/types.ts
  • src/modes/store.ts

📝 Walkthrough

Walkthrough

Adds Markdown (.md) support for custom mode files by extracting YAML frontmatter and using the Markdown body as the system prompt; introduces kebabCase and a frontmatter parser, includes .md in file discovery, derives missing slugs/icons, and adds an optional model field to CCBMode.

Changes

Markdown Mode Support

Layer / File(s) Summary
Markdown parsing helpers
src/modes/store.ts
kebabCase normalizes slugs and parseMarkdownFrontmatter extracts ----delimited YAML frontmatter and returns the remaining Markdown body as system prompt text.
Mode loading and type updates
src/modes/store.ts, src/modes/types.ts
File discovery includes .md files; Markdown files are parsed via frontmatter extraction with system_prompt set to the Markdown body, slug derived from name when absent, and icon defaulted to 🤖; YAML parsing for .yml/.yaml remains; the invalid-file catch comment now mentions YAML or Markdown; CCBMode gains optional model field.

Sequence Diagram

sequenceDiagram
  participant FileSystem
  participant loadCustomModes
  participant parseMarkdownFrontmatter
  participant CCBMode
  FileSystem->>loadCustomModes: discover .md/.yml/.yaml files
  alt Markdown file
    loadCustomModes->>parseMarkdownFrontmatter: extract YAML frontmatter and Markdown body
    parseMarkdownFrontmatter->>loadCustomModes: return frontmatter + body
    loadCustomModes->>CCBMode: merge frontmatter, set system_prompt from body, derive slug, default icon
  else YAML file
    loadCustomModes->>CCBMode: parse YAML directly
  end
  CCBMode->>loadCustomModes: custom mode object
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • claude-code-best/claude-code#1255: Adds initial mode store/types and built-in presets; this PR extends the custom-mode loader to support Markdown frontmatter and adds optional model field.
  • claude-code-best/claude-code#1259: Integrates mode.systemPrompt into dynamic persona prompt construction; this PR changes how systemPrompt can be provided (Markdown body).

Poem

🐇 I nibble YAML stems at night,

frontmatter petals gleam so bright,
Body-strings become the guiding voice,
Slugs and icons find their choice—
Hoppity, modes sing: deploy with delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/markdown agent format' directly describes the main change: adding support for Markdown files with YAML frontmatter in mode definitions, which is the primary feature introduced in this PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@James-FE James-FE force-pushed the feat/markdown-agent-format branch 3 times, most recently from 493e69f to bcc2907 Compare June 10, 2026 03:37
…de loader

Extends the mode loader to accept .md files alongside .yaml/.yml in
~/.claude/modes/. Markdown files use YAML frontmatter for metadata
and the body as systemPrompt — the same format supported by
OpenCode, Claude Code agents, and Cursor rules.

.md data is normalized to the same shape as .yaml data, reusing
the existing CCBMode mapping with zero code duplication.

- Add kebabCase() helper for slug derivation from name
- Add parseMarkdownFrontmatter() helper (uses existing yaml package)
- .md: body → system_prompt, auto-slug if missing, icon default 🤖
- Add optional model field to CCBMode for cross-tool alignment
- Existing .yaml/.yml path: unchanged
@James-FE James-FE force-pushed the feat/markdown-agent-format branch from bcc2907 to 1f44e2b Compare June 10, 2026 03:43
@claude-code-best claude-code-best merged commit 83e891d into claude-code-best:main Jun 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants