zcf Documentation

Zero-Config Code Flow for Claude code & Codex

6,077 stars TypeScript TypeScript 1 file · ~19,816 tokens #agent#ai#ai-agent#bmad-method#ccr#claude#claude-4#claude-ai
RAW Doc

File: README.md

npm version
npm downloads
License
Claude Code
codecov
JSDocs
Ask DeepWiki

🚀 Quick Start

  • Recommended: npx zcf opens the interactive menu — pick what you need.
  • Common commands:
bash
npx zcf i        # Full initialization: install + workflows + API/CCR + MCP
npx zcf u        # Update workflows only
npx zcf --lang zh-CN  # Switch interface language (example)
  • Non-interactive example (provider preset):
bash
npx zcf i -s -p 302ai -k "sk-xxx"

More usage, options, and workflows: see documentation.

📖 Full Documentation

♥️ Sponsors


Thanks to AICodeMirror for sponsoring this project! AICodeMirror provides highly reliable official relay services for Claude, Codex, and Gemini, supporting enterprise-grade concurrency, fast invoice issuance, and dedicated 24/7 technical support. Official Codex access is available for as little as 7% of the standard price, with additional discounts on account top-ups! AICodeMirror also offers an exclusive benefit to users of the ZCF project: register through this link to receive 20% off your first top-up.


This project is sponsored by Z.ai, supporting us with their GLM CODING PLAN.
GLM CODING PLAN is a subscription service designed for AI coding, starting at just $10/month. It provides access to their flagship GLM-5.2 model across 10+ popular AI coding tools (Claude Code, Cline, Roo Code, etc.), offering developers top-tier, fast, and stable coding experiences.
Get 10% OFF GLM CODING PLAN:https://z.ai/subscribe?ic=8JVLJQFSKB



Thanks to code0.ai for sponsoring this project! code0.ai is an AI coding workspace for developers and technical teams, bringing together mainstream Agent coding capabilities such as Claude Code and Codex. It supports common development scenarios including code generation, project understanding, debugging, code review, and documentation. It is suitable for independent developers, Agent engineers, open-source maintainers, and enterprise R&D teams, with invoicing and team onboarding supported. Register through the exclusive link and contact customer support to claim free test credits and experience a more efficient AI coding workflow.



Thanks to Claude API for sponsoring this project! Claude API is an official-channel API provider focused on Claude models. Built on Anthropic official keys and AWS Bedrock official channels, it provides a stable integration experience for Claude Code and Agent applications, supports the full Claude model family, and preserves official capabilities such as Tool Use and long context. The service is not reverse-engineered and does not downgrade model capabilities, making it suitable for heavy Claude Code users, Agent engineers, and enterprise technical teams. Register through the exclusive link and contact customer support to claim free test credits. Invoicing and team onboarding are also supported.



PatewayAI is a high-quality model API relay service provider focused on official direct connections for serious AI developers, offering the full range of Claude and Codex series models. 100% official source supply with no adulteration — open to inspection. Transparent billing with token-level invoices auditable line by line. Enterprise-grade concurrency support with a dedicated management platform for enterprise customers, including formal contracts and invoicing. PatewayAI offers an exclusive benefit for ZCF users: register via this link to get $3 free trial credit, recharges as low as 60% off, with bilateral invite rewards up to $150!



302.AI is a pay-as-you-go enterprise AI resource hub that offers the latest and most comprehensive AI models and APIs on the market, along with a variety of ready-to-use online AI applications.

Thanks to PackyCode for sponsoring this project! PackyCode is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more. PackyCode provides special discounts for our software users: register using this link and enter the "zcf" promo code during recharge to get 10% off.
Thanks to APIKEY.FUN for sponsoring this project! APIKEY.FUN is a professional enterprise-grade AI relay platform dedicated to providing stable, efficient, and low-cost API access for both companies and individual developers. The platform supports popular models including Claude, OpenAI, and Gemini, with pricing as low as 7% of official rates. Register via this link to enjoy an exclusive offer of up to permanent 95% recharge pricing (5% off).
Thanks to Crazyrouter for sponsoring this project! Crazyrouter is a high-performance AI API aggregation gateway — one API key for 300+ models (GPT, Claude, Gemini, DeepSeek, and more). All models at 55% of official pricing with auto-failover, smart routing, and unlimited concurrency. Fully OpenAI-compatible, works seamlessly with Claude Code, Codex, and Gemini CLI. Crazyrouter offers an exclusive deal for ZCF users: register via this link to get $2 free credit instantly!
Thanks to AIHub for sponsoring this project! AIHub is a high-availability AI model API relay platform for individual developers and enterprise teams, supporting Codex and Claude Code at prices below ~10% of official rates. Register via this link and enter the promo code ZCF to claim $3 trial credit.
Thanks to Sublyx for sponsoring this project! Sublyx is a reliable AI API aggregation gateway, providing unified access to popular models including GPT, Claude, Gemini, Grok, and more through a single API key. It is compatible with Codex, Claude Code, OpenAI SDK, and other common AI development tools. Sublyx offers an exclusive benefit for our users: register via this link and use the promo code ZCF to receive an additional $10 in credit.

💬 Community

Join our Telegram group for support, discussions, and updates:

🙏 Acknowledgments

This project is inspired by and incorporates work from:

Thanks to these community contributors for sharing!

❤️ Support & Sponsors

If you find this project helpful, please consider sponsoring its development. Your support is greatly appreciated!

Our Sponsors

A huge thank you to all our sponsors for their generous support!

【Corporate Sponsors】

  • 302.AI (first corporate sponsorship 🤠)

  • GLM (first AI model sponsorship 🤖)

  • PackyCode (first API proxy service sponsor 🧝🏻‍♀️)

  • APIKEY.FUN (enterprise AI relay sponsor 🎁)

  • AICodeMirror (official high-stability relay service sponsor 🪞)

  • UUCode (sponsored $100 proxy credits 💰)

  • Crazyrouter (AI API aggregation gateway sponsor 🚀)

  • PatewayAI (official direct-connect relay service sponsor 🛡️)

  • code0 (AI coding workspace sponsor 🎁)

  • Claude API (Claude official API provider sponsor 🎁)

  • AIHub (high-availability AI API relay platform sponsor 🎁)

  • Sublyx (AI API aggregation gateway sponsor 🎁)

【Individual Sponsors】

  • Tc (first sponsor)
  • Argolinhas (first ko-fi sponsor ٩(•̤̀ᵕ•̤́๑))
  • r*r (first anonymous sponsor 🤣)
  • **康 (first KFC sponsor 🍗)
  • *东 (first coffee sponsor ☕️)
  • 炼*3 (first Termux user sponsor 📱)
  • chamo101 (first GitHub issue sponsor 🎉)
  • 初屿贤 (first Codex user sponsor 🙅🏻‍♂️)
  • Protein (first 1688 sponsor 😏)
  • musistudio (first open source project author sponsor, the author of CCR 🤩)
  • *年 (first 100 CNY sponsor 💴)
  • BeatSeat (community expert 😎, provided $1000 Claude credits)
  • wenwen (community expert 🤓, provided daily $100 Claude&GPT credits)
  • 16°C coffee (My best friend 🤪, offered ChatGPT Pro $200 package)

Promotion Thanks

Thanks to the following authors for promoting this project:

📄 License

MIT License


🚀 Contributors

⭐️ Star History

If this project helps you, please give me a ⭐️ Star!


File: docs/en/advanced/api-providers.md


title: API Provider Presets

API Provider Presets

ZCF provides an API provider preset system that can greatly simplify API configuration. Using presets can reduce configuration from 5+ parameters to just 2 (provider + API key).

Supported Providers

ZCF currently supports the following API provider presets:

Preset ID Provider Name Description Claude Code Support Codex Support Authentication Method
302ai 302.AI Enterprise-level AI API service ✅ ✅ api_key
packycode PackyCode PackyCode API service ✅ ✅ auth_token
aicodemirror AICodeMirror Global High-Quality Line ✅ ✅ auth_token
aicodemirror-cn AICodeMirror CN China Optimized Line ✅ ✅ auth_token
crazyrouter Crazyrouter AI API aggregation gateway ✅ ✅ api_key
z-ai Z.ai Z.ai API service ✅ ❌ auth_token
minimax MiniMax MiniMax API service ✅ ✅ auth_token
minimax-cn MiniMax CN MiniMax China API service ✅ ✅ auth_token
kimi Kimi (Moonshot) Moonshot AI service ✅ ✅ auth_token
custom Custom Custom API endpoint ✅ ✅ Must specify

Provider Details

302.AI

Official Link: 302.AI

Features:

  • 🎯 Enterprise-level AI resource platform
  • 📊 Pay-as-you-go pricing
  • 🔄 Provides latest and most comprehensive AI models and APIs
  • 🌐 Supports multiple online AI applications

Configuration Information:

  • Claude Code Base URL: https://api.302.ai/cc
  • Codex Base URL: https://api.302.ai/v1
  • Authentication Method: api_key
  • Codex Wire API: responses

Usage Example:

bash
# Claude Code
npx zcf init -s -p 302ai -k "sk-xxx"

# Codex
npx zcf init -s -T codex -p 302ai -k "sk-xxx"

AICodeMirror

Provider Name: AICodeMirror

Features:

  • 🌐 Global High-Quality Line
  • 🚀 High-speed stable connection
  • 🔧 Supports both Claude Code and Codex

Configuration Information:

  • Claude Code Base URL: https://api.aicodemirror.com/api/claudecode
  • Codex Base URL: https://api.aicodemirror.com/api/codex/backend-api/codex
  • Authentication Method: auth_token
  • Codex Wire API: responses

Usage Example:

bash
# Claude Code
npx zcf init -s -p aicodemirror -k "your-auth-token"

# Codex
npx zcf init -s -T codex -p aicodemirror -k "your-auth-token"

AICodeMirror CN

Provider Name: AICodeMirror CN (China Optimized Line)

Features:

  • 🇨🇳 China Optimized Line
  • ⚡ Low-latency access
  • 🔧 Supports both Claude Code and Codex

Configuration Information:

  • Claude Code Base URL: https://api.claudecode.net.cn/api/claudecode
  • Codex Base URL: https://api.claudecode.net.cn/api/codex/backend-api/codex
  • Authentication Method: auth_token
  • Codex Wire API: responses

Usage Example:

bash
# Claude Code
npx zcf init -s -p aicodemirror-cn -k "your-auth-token"

# Codex
npx zcf init -s -T codex -p aicodemirror-cn -k "your-auth-token"

Crazyrouter

Official Link: Crazyrouter

Features:

  • 🚀 High-performance AI API aggregation gateway
  • 🔑 One API key for 300+ models (GPT, Claude, Gemini, DeepSeek, etc.)
  • 💰 All models at 55% of official pricing
  • 🔄 Auto-failover, smart routing, unlimited concurrency
  • ✅ Fully OpenAI-compatible; works with Claude Code, Codex, and Gemini CLI

Configuration Information:

  • Claude Code Base URL: https://crazyrouter.com
  • Codex Base URL: https://crazyrouter.com/v1
  • Authentication Method: api_key
  • Codex Wire API: responses

Usage Example:

bash
# Claude Code
npx zcf init -s -p crazyrouter -k "your-api-key"

# Codex
npx zcf init -s -T codex -p crazyrouter -k "your-api-key"

Z.ai

Provider Name: Z.ai

Features:

  • 🌍 Global GLM coding API service
  • 💰 Cost-effective subscription plans
  • 🚀 Supports Claude Code integration
  • 📚 GLM CODING PLAN support

Configuration Information:

  • Claude Code Base URL: https://api.z.ai/api/anthropic
  • Authentication Method: auth_token

Usage Example:

bash
# Claude Code
npx zcf init -s -p z-ai -k "your-auth-token"

MiniMax

Provider Name: MiniMax

Official Link: MiniMax Platform

Features:

  • MiniMax-M3 with a 1,000,000-token context window
  • MiniMax-M2.7 with a 204,800-token context window
  • Anthropic-compatible API for Claude Code and OpenAI-compatible Responses API for Codex

Configuration Information:

  • Claude Code Base URL (Global): https://api.minimax.io/anthropic
  • Codex Base URL (Global): https://api.minimax.io/v1
  • Claude Code Base URL (China): https://api.minimaxi.com/anthropic
  • Codex Base URL (China): https://api.minimaxi.com/v1
  • Authentication Method: auth_token
  • Claude Code Default Models: MiniMax-M3 (primary), MiniMax-M2.7 (secondary)
  • Codex Default Model: MiniMax-M3

Usage Example:

bash
# Claude Code with the global endpoint
npx zcf init -s -p minimax -k "your-auth-token"

# Codex with the global endpoint
npx zcf init -s -T codex -p minimax -k "your-auth-token"

# Claude Code with the China endpoint
npx zcf init -s -p minimax-cn -k "your-auth-token"

# Codex with the China endpoint
npx zcf init -s -T codex -p minimax-cn -k "your-auth-token"

Kimi (Moonshot)

Provider Name: Kimi / Moonshot AI

Features:

  • 🌙 Moonshot AI service
  • 📝 Good at long text processing
  • 🚀 High-performance models

Configuration Information:

  • Claude Code Base URL: https://api.moonshot.cn/anthropic
  • Codex Base URL: https://api.moonshot.cn/v1
  • Authentication Method: auth_token
  • Codex Wire API: chat
  • Claude Code Default Model: kimi-k2-0905-preview (primary), kimi-k2-turbo-preview (fast)
  • Codex Default Model: kimi-k2-0905-preview

Usage Example:

bash
# Claude Code
npx zcf init -s -p kimi -k "your-auth-token"

# Codex
npx zcf init -s -T codex -p kimi -k "your-auth-token"

Custom

Provider Name: Custom

Features:

  • 🔧 Fully customizable configuration
  • 🌐 Supports arbitrary API endpoints
  • 📝 Requires manual configuration of all parameters

Usage:

bash
# Use custom provider (requires URL)
npx zcf init -s -p custom -k "sk-xxx" -u "https://api.example.com/v1"

# Or use traditional method (without preset)
npx zcf init -s -t api_key -k "sk-xxx" -u "https://api.example.com/v1"

Usage Methods

Basic Usage

Using provider presets is very simple, only need two parameters:

bash
# Use provider preset
npx zcf init -s -p  -k <api-key>

# Example: Use 302.AI
npx zcf init -s -p 302ai -k "sk-xxx"

Automatic Configuration

When using presets, ZCF will automatically configure:

  1. ✅ Base URL: Automatically fill in correct API endpoint
  2. ✅ Authentication Method: Automatically set authentication type (api_key or auth_token)
  3. ✅ Default Model: If provider supports, automatically set default model
  4. ✅ Codex Configuration: If using Codex, automatically configure wireApi protocol

Override Default Configuration

Even when using presets, you can still override default configuration:

bash
# Use preset but override model
npx zcf init -s -p 302ai -k "sk-xxx" \
  -M "claude-sonnet-4-5" \
  -F "claude-haiku-4-5"

# Use preset but override URL (not recommended, unless testing)
npx zcf init -s -p 302ai -k "sk-xxx" \
  -u "https://custom.302.ai/api"

Multi-Configuration Scenarios

Configure Multiple Providers

Using --api-configs or --api-configs-file can configure multiple providers simultaneously:

bash
# Configure multiple providers using JSON string
npx zcf init -s --api-configs '[
  {
    "provider": "302ai",
    "key": "sk-302ai-xxx",
    "default": true
  },
  {
    "provider": "z-ai",
    "key": "sk-glm-yyy"
  },
  {
    "provider": "minimax",
    "key": "sk-minimax-zzz"
  }
]'

Mix Presets with Custom Configuration

bash
# Configuration file example (api-configs.json)
{
  "configs": [
    {
      "provider": "302ai",
      "key": "sk-302ai-xxx",
      "default": true
    },
    {
      "name": "custom-api",
      "type": "api_key",
      "key": "sk-custom-xxx",
      "url": "https://custom.api.com/v1",
      "primaryModel": "claude-sonnet-4-5",
      "fastModel": "claude-haiku-4-5"
    }
  ]
}

# Use configuration file
npx zcf init -s --api-configs-file ./api-configs.json

Provider Switching

After configuring multiple providers, you can switch anytime:

Claude Code

bash
# List all configurations
npx zcf config-switch --list

# Switch to specified provider
npx zcf config-switch 302ai-config

Codex

bash
# List Codex providers
npx zcf config-switch --code-type codex --list

# Switch to specified provider
npx zcf config-switch minimax-provider --code-type codex

Best Practices

1. Prefer Presets

Use provider presets whenever possible, which can:

  • ✅ Reduce configuration errors
  • ✅ Automatically get latest endpoints
  • ✅ Simplify configuration process
bash
# Recommended: Use preset
npx zcf init -s -p 302ai -k "sk-xxx"

# Not recommended: Manually configure all parameters
npx zcf init -s -t api_key -k "sk-xxx" -u "https://api.302.ai/cc" -M "claude-sonnet-4-5"

2. Test Configuration

Before formal use, it's recommended to test configuration first:

bash
# 1. Initialize using preset
npx zcf init -s -p 302ai -k "test-key"

# 2. Test API connection
# Test conversation in Claude Code or Codex

# 3. If normal, reconfigure with production key
npx zcf init -s -p 302ai -k "production-key"

3. Multi-Provider Strategy

Configure different providers for different projects:

bash
# Project A: Use 302.AI provider
npx zcf config-switch 302ai-provider

# Project B: Use Z.ai provider
npx zcf config-switch z-ai-provider

# Project C: Use MiniMax provider
npx zcf config-switch minimax-provider

4. Key Security

  • ⚠️ Do not commit keys to version control
  • ✅ Use environment variables to manage keys
  • ✅ Regularly rotate keys
  • ✅ Use principle of least privilege
bash
# Use environment variables
export ZCF_API_KEY="sk-xxx"
npx zcf init -s -p 302ai -k "$ZCF_API_KEY"

# Or read from file (ensure file permissions are correct)
npx zcf init -s -p 302ai -k "$(cat ~/.zcf/api-key)"

Troubleshooting

Provider Not Supported

If using unsupported provider ID:

bash
# Error message will display all valid values
npx zcf init -s -p invalid-provider -k "sk-xxx"
# Error: Invalid provider 'invalid-provider'. Valid providers: 302ai, z-ai, minimax, kimi, custom

Authentication Failed

If authentication fails:

  1. Check API Key Format: Confirm key format is correct
  2. Check Authentication Method: Confirm using correct authentication type
  3. Verify Endpoint URL: Confirm endpoint URL is correct
bash
# Verify configuration
cat ~/.claude/settings.json | jq .env.ANTHROPIC_API_KEY
cat ~/.codex/config.toml | grep apiKey

Model Unavailable

If default model is unavailable:

bash
# Override default model
npx zcf init -s -p 302ai -k "sk-xxx" -M "claude-sonnet-4-5"

# Or manually edit configuration file
vim ~/.claude/settings.json

💡 Tip: Using API provider presets can greatly simplify the configuration process. It's recommended to prefer presets, only use custom configuration when necessary. Regularly check provider documentation to get latest configuration information.


File: docs/en/advanced/configuration.md


title: Configuration Management

Configuration Management

ZCF provides a comprehensive configuration management system, supporting incremental management, backup strategies, and flexible configuration switching. Understanding the structure and mechanisms of the configuration system can help you better manage and maintain your development environment.

Directory Structure Overview

ZCF's configurations are distributed across the following directories:

Main Configuration Directories

Directory Description Main Files
~/.claude/ Claude Code main configuration directory settings.json, CLAUDE.md, prompts/, workflows/
~/.codex/ Codex main configuration directory config.toml, auth.json, prompts/, AGENTS.md
~/.ufomiao/zcf/ ZCF global configuration directory config.toml
~/.claude-code-router/ CCR configuration directory config.json
~/.claude/backup/ Claude Code backup directory Timestamp backup files
~/.codex/backup/ Codex backup directory Timestamp backup files

Configuration File Details

Claude Code Configuration

text
~/.claude/
├── settings.json          # Main configuration file (API, MCP, permissions, etc.)
├── CLAUDE.md              # Project memory and system prompts
├── prompts/               # Prompts directory
│   ├── output-style/      # Output style templates
│   └── memory/            # Memory templates
└── workflows/             # Workflows directory
    ├── zcf-workflow/      # Six-stage workflow
    ├── feat/              # Feature development workflow
    ├── git/               # Git workflow
    └── bmad/              # BMad workflow

Codex Configuration

text
~/.codex/
├── config.toml            # Main configuration file (TOML format)
├── auth.json              # API key configuration (encrypted storage)
├── AGENTS.md              # System prompts and agent configuration
├── prompts/               # Prompts directory
│   └── workflow/          # Workflow prompts
└── system-prompt/         # System prompt templates

ZCF Global Configuration

text
~/.ufomiao/zcf/
├── config.toml            # ZCF global configuration (TOML format)
│   ├── preferredLang      # CLI language preference
│   ├── templateLang       # Template language preference
│   ├── aiOutputLang       # AI output language preference
│   └── codeToolType       # Current active tool type
└── backup/                # ZCF configuration backup

Incremental Management Mode

When ZCF detects existing configuration, it will ask for operation strategy.

Configuration Handling Strategies

Strategy Description Use Case Risk
backup Backup then overwrite (default) Recommended default option Low (has backup)
merge Try to merge new configuration Need to preserve custom content Medium (may conflict)
new Ignore existing content and regenerate Need brand new configuration High (overwrites existing)
docs-only Only update documents and prompts Only need to update templates Low
skip Skip current step Don't need to modify None

Automatic Strategy Application

In non-interactive mode (--skip-prompt), ZCF will automatically apply default strategy:

  • Default strategy: backup
  • Can specify strategy via --config-action parameter
bash
# Specify configuration handling strategy
npx zcf init -s --config-action merge

# Only update documents
npx zcf init -s --config-action docs-only

Merge Strategy Details

merge strategy will try to intelligently merge configurations:

  • ✅ MCP Services: New services will be merged into existing configuration
  • ✅ Workflows: New workflows will be added to existing workflows
  • ⚠️ API Configuration: May require manual confirmation
  • ⚠️ Output Styles: New styles will be added to existing styles

API Model Configuration

Four-Model Architecture

ZCF uses a four-model architecture to provide granular control over AI model selection:

Model Type Environment Variable Default Value Purpose
Primary Model ANTHROPIC_MODEL claude-sonnet-4-5-20250929 Default model for general tasks
Haiku Model ANTHROPIC_DEFAULT_HAIKU_MODEL claude-haiku-4-5-20250910 Fast, cost-effective model for simple tasks
Sonnet Model ANTHROPIC_DEFAULT_SONNET_MODEL claude-sonnet-4-5-20250929 Balanced model for most workflows
Opus Model ANTHROPIC_DEFAULT_OPUS_MODEL claude-opus-4-5-20251101 Most capable model for complex tasks

Model Configuration Parameters

When configuring API settings, you can specify each model individually:

bash
# Configure all four models
npx zcf i -s \
  --api-key "sk-xxx" \
  --api-model "claude-sonnet-4-5" \
  --api-haiku-model "claude-haiku-4-5" \
  --api-sonnet-model "claude-sonnet-4-5" \
  --api-opus-model "claude-opus-4-5"

Multi-Profile Model Configuration

When using multiple API profiles, each profile can have its own model configuration:

json
{
  "name": "production",
  "type": "api_key",
  "key": "sk-prod-xxx",
  "primaryModel": "claude-sonnet-4-5",
  "defaultHaikuModel": "claude-haiku-4-5",
  "defaultSonnetModel": "claude-sonnet-4-5",
  "defaultOpusModel": "claude-opus-4-5"
}

Environment Variable Mapping

The configuration system maps profile model settings to environment variables:

  • primaryModel → ANTHROPIC_MODEL
  • defaultHaikuModel → ANTHROPIC_DEFAULT_HAIKU_MODEL
  • defaultSonnetModel → ANTHROPIC_DEFAULT_SONNET_MODEL
  • defaultOpusModel → ANTHROPIC_DEFAULT_OPUS_MODEL

Migration from Legacy Configuration

If you're upgrading from the old two-model system:

Old Configuration (Deprecated):

json
{
  "primaryModel": "claude-sonnet-4-5",
  "fastModel": "claude-haiku-4-5"
}

New Configuration (Recommended):

json
{
  "primaryModel": "claude-sonnet-4-5",
  "defaultHaikuModel": "claude-haiku-4-5",
  "defaultSonnetModel": "claude-sonnet-4-5",
  "defaultOpusModel": "claude-opus-4-5"
}

💡 Note: The old fastModel parameter is still supported for backward compatibility but is deprecated. The system will automatically clean up the legacy ANTHROPIC_SMALL_FAST_MODEL environment variable when switching profiles.

Model Selection Best Practices

  1. Haiku: Use for simple tasks like formatting, basic transformations, quick responses
  2. Sonnet: Default choice for most development workflows and general coding tasks
  3. Opus: Reserve for complex reasoning, architectural decisions, and critical code generation
  4. Primary: Acts as the fallback when no specific model is requested

AI Output Language Directives

Configuration Mechanism

The applyAiLanguageDirective function will write corresponding language directives to system prompt files based on --ai-output-lang parameter.

Supported Language Options

  • zh-CN: Chinese output directive
  • en: English output directive
  • custom: Custom language directive

Custom Language Directives

Using custom option allows input of custom language directives:

bash
npx zcf init --ai-output-lang custom
# Enter: Reply in Japanese, maintain professional and polite tone

Custom directives will be written to:

  • Claude Code: ~/.claude/CLAUDE.md
  • Codex: ~/.codex/AGENTS.md

Configuration Location

Language directive configuration locations:

  • Claude Code: Top of CLAUDE.md file
  • Codex: Top of AGENTS.md file

Template Language Selection

Language Resolution Mechanism

The resolveTemplateLanguage function determines template language by considering the following factors:

  1. Command Line Parameters: --config-lang or --all-lang
  2. Configuration File: templateLang in ~/.ufomiao/zcf/config.toml
  3. Interactive Input: If not specified, will prompt user to select
  4. System Default: Finally fallback to en

Language Independence

Template language and AI output language are independent of each other and can be flexibly combined:

bash
# Chinese templates + English output (suitable for projects requiring English code comments)
npx zcf init --config-lang zh-CN --ai-output-lang en

# English templates + Chinese output (suitable for international teams)
npx zcf init --config-lang en --ai-output-lang zh-CN

Template Language Effects

Template language affects:

  • Language version of workflow templates
  • Language of prompts and instructions
  • Language of system prompt templates
  • Language of output style templates

Change Tracking Recommendations

Use Version Control

It's recommended to use Git to manage configuration directories:

bash
# Create configuration repository
mkdir ~/zcf-configs
cd ~/zcf-configs
git init

# Add configuration files (note: exclude sensitive information)
cat > .gitignore << EOF
*.key
auth.json
settings.json
config.toml
EOF

# Add templates and workflows (without sensitive information)
git add prompts/ workflows/ templates/
git commit -m "Add ZCF templates and workflows"

Compare Differences

Compare differences before and after executing zcf update:

bash
# Before update
git add ~/.claude/
git commit -m "Before update"

# Execute update
npx zcf update

# View differences
git diff ~/.claude/

# Review changes then commit
git add ~/.claude/
git commit -m "After update"

Backup Restoration

If custom content is accidentally overwritten, you can restore from backup directory:

bash
# View backups
ls -lt ~/.claude/backup/

# Restore specific backup
cp -r ~/.claude/backup/backup_2025-01-15_10-30-45/* ~/.claude/

# Or restore specific file
cp ~/.claude/backup/backup_*/workflows/custom/my-workflow.md ~/.claude/skills/custom/

Configuration Management Best Practices

1. Layered Configuration Management

  • Global Configuration: Team-shared templates and workflows
  • Personal Configuration: Personal API keys and preferences
  • Project Configuration: Project-specific workflows and templates

2. Sensitive Information Handling

  • ⚠️ Do not commit sensitive information to version control
  • ✅ Use environment variables to manage API keys
  • ✅ Use .gitignore to exclude sensitive files
  • ✅ Regularly rotate keys

3. Configuration Synchronization

Synchronize configurations across multiple devices:

bash
# Method 1: Use Git
git clone ~/zcf-configs
cp -r zcf-configs/templates/* ~/.claude/skills/

# Method 2: Use cloud storage
rsync -av ~/.claude/skills/ ~/Cloud/.claude/workflows/

# Method 3: Use Git Worktree
/git-worktree migrate

4. Regular Review

Regularly review and clean configurations:

bash
# Clean old backups (keep last 30 days)
find ~/.claude/backup -name "*.bak" -mtime +30 -delete

# Review unused configurations
ls -la ~/.claude/skills/
# Remove custom workflows that are no longer needed

5. Team Collaboration

In team environments:

  • Unify configuration templates and standards
  • Share workflows and output styles
  • Maintain configuration change logs
  • Regularly sync configuration updates

Configuration Migration

Migrate from Old Version

If upgrading from old version of ZCF:

bash
# ZCF will automatically detect and migrate configuration
npx zcf init

# Or manually check migration
cat ~/.ufomiao/zcf/config.toml
# Check if there are migration prompts

Cross-Tool Migration

Migrate from Claude Code to Codex:

bash
# 1. Backup Claude Code configuration
cp -r ~/.claude ~/.claude.backup

# 2. Initialize Codex
npx zcf init -T codex

# 3. Manually migrate workflows and templates (if needed)
# Note: Template formats for Claude Code and Codex may differ

Troubleshooting

Configuration Conflicts

If you encounter configuration conflicts:

bash
# 1. View conflict details
npx zcf init
# View conflict prompts when selecting merge strategy

# 2. Manually merge configuration
# Edit configuration file, manually merge conflicting items

# 3. Use backup strategy to start over
npx zcf init --config-action backup

Configuration Lost

If configuration is lost:

bash
# 1. Find backup
ls -lt ~/.claude/backup/ | head -5

# 2. Restore backup
cp -r ~/.claude/backup/backup_latest_timestamp/* ~/.claude/

# 3. Reinitialize (if backup unavailable)
npx zcf init --config-action new

Configuration File Corrupted

If configuration file is corrupted:

bash
# 1. Check configuration file format
cat ~/.claude/settings.json | jq .

# 2. Restore from backup
cp ~/.claude/backup/backup_*/settings.json ~/.claude/

# 3. Or reinitialize
npx zcf init --config-action new

💡 Tip: Proper configuration management can improve development efficiency and team collaboration quality. It's recommended to use version control to manage templates and workflows, while properly storing configuration files containing sensitive information. Regularly backup and review configurations to ensure development environment stability.


File: docs/en/advanced/i18n.md


title: Internationalization and Languages

Internationalization and Languages

ZCF provides comprehensive internationalization (i18n) support, allowing you to flexibly configure CLI interface language, AI output language, and template language to meet language needs in different scenarios.

Language Configuration Levels

ZCF's language system is divided into three independent but related levels:

  1. CLI Language: Interface language of ZCF tool itself
  2. AI Output Language: Language used for AI assistant replies
  3. Template Language: Language of workflow templates and prompts

These three levels can be configured independently to meet various mixed scenario needs.

CLI Language

CLI language controls the interface display language of ZCF command-line tool.

Supported Languages

  • zh-CN: Simplified Chinese
  • en: English

Language Priority

CLI language is determined according to the following priority:

  1. Command line parameters --all-lang or --lang
  2. preferredLang in configuration file
  3. Interactive selection
  4. System default (en)

Set CLI Language

bash
# Through command line parameters
npx zcf --lang zh-CN
npx zcf init --lang zh-CN

# Through unified language parameter (recommended)
npx zcf --all-lang zh-CN

# Switch in main menu
npx zcf
# Enter 0 to switch language

# Configuration file location
cat ~/.ufomiao/zcf/config.toml | grep preferredLang

Language Switch Implementation

Language switching is implemented through the following functions:

  • changeLanguage: Switch i18n language
  • resolveAndSwitchLanguage: Resolve and switch language (considering priority)

AI Output Language

AI output language controls the language used for AI assistant replies and generated content, which can be different from CLI language.

Supported Language Options

  • zh-CN: Chinese output
  • en: English output
  • custom: Custom language instructions

Set AI Output Language

bash
# Set during initialization
npx zcf init --ai-output-lang zh-CN

# Or use unified parameter
npx zcf init --all-lang zh-CN

# Configure in main menu
npx zcf
# Select 6 (Configure AI Memory & Output Style)
# Then select AI output language

Custom Language Instructions

Using custom option allows input of custom language instructions:

bash
npx zcf init --ai-output-lang custom
# Then enter: Reply in Japanese, maintain professional and polite tone

Custom instructions will be written to CLAUDE.md or AGENTS.md, affecting AI output language and style.

AI Output Language Configuration Location

  • Claude Code: Language instructions in ~/.claude/CLAUDE.md
  • Codex: Language instructions in ~/.codex/AGENTS.md

Template Language

Template language controls the language version of workflow templates, prompts, and system prompts.

Supported Languages

  • zh-CN: Chinese templates
  • en: English templates

Template Language Independence

Template language is independent of CLI language and can be flexibly combined:

bash
# Chinese interface + English templates (suitable for scenarios requiring English documentation)
npx zcf init --lang zh-CN --config-lang en

# English interface + Chinese templates (suitable for international teams)
npx zcf init --lang en --config-lang zh-CN

# Unified language (recommended for most scenarios)
npx zcf init --all-lang zh-CN

Set Template Language

bash
# Set during initialization
npx zcf init --config-lang zh-CN

# Set during update
npx zcf update --config-lang zh-CN

# Or use unified parameter
npx zcf init --all-lang zh-CN

Template Language Resolution

Template language is determined through resolveTemplateLanguage function:

  1. Command line parameter --config-lang
  2. templateLang in configuration file
  3. Current CLI language (if not specified)
  4. System default (en)

Codex Language Configuration

After switching to Codex, language configuration rules are the same:

bash
# Codex initialization, use Chinese
npx zcf init -T codex --all-lang zh-CN

# Switch language in Codex menu
# Menu in Codex mode will provide language switch options

Usage Scenarios

Suitable for most Chinese users:

bash
npx zcf init --all-lang zh-CN

Result:

  • CLI Interface: Chinese
  • AI Output: Chinese
  • Template Files: Chinese

Scenario 2: Chinese Interface + English Code

Suitable for projects requiring English code comments:

bash
npx zcf init --lang zh-CN --ai-output-lang en --config-lang zh-CN

Result:

  • CLI Interface: Chinese
  • AI Output: English (code comments and documentation)
  • Template Files: Chinese

Scenario 3: International Team

Suitable for international teams requiring English documentation:

bash
npx zcf init --lang en --config-lang en --ai-output-lang en

Result:

  • CLI Interface: English
  • AI Output: English
  • Template Files: English

Scenario 4: Mixed Configuration

Flexibly combine to meet specific needs:

bash
# Chinese interface, Chinese templates, custom AI output
npx zcf init \
  --lang zh-CN \
  --config-lang zh-CN \
  --ai-output-lang custom
# Enter: Use Chinese to reply, code comments use English

Best Practices

1. Team Unified Configuration

In team collaboration, it's recommended to unify language configuration:

bash
# Team uniformly uses Chinese
npx zcf init --all-lang zh-CN

# Or team uniformly uses English
npx zcf init --all-lang en

This ensures:

  • Consistent team member experience
  • Unified document formats
  • Smoother collaboration

2. Project-Specific Configuration

Different projects may have different needs:

bash
# Open source projects: Use English
npx zcf init --all-lang en

# Internal projects: Use Chinese
npx zcf init --all-lang zh-CN

# Mixed projects: Chinese interface + English output
npx zcf init --lang zh-CN --ai-output-lang en

3. Multi-Language Documentation

If multi-language documentation is needed:

bash
# 1. First generate complete documentation in Chinese
npx zcf init --all-lang zh-CN
# Complete feature development, generate Chinese documentation

# 2. Switch to English, update documentation
npx zcf update --config-lang en
# Generate English version of documentation

# 3. Use GitBook multi-language functionality to manage

4. Configuration File Management

Language configuration is saved in ZCF global configuration:

bash
# View current configuration
cat ~/.ufomiao/zcf/config.toml

# Configuration file fields
# preferredLang: CLI language preference
# templateLang: Template language preference
# aiOutputLang: AI output language preference

5. Scripted Configuration

Explicitly specify language in automation scripts:

bash
#!/bin/bash
# Deployment script

# Explicitly specify all language parameters
npx zcf init -s \
  --all-lang zh-CN \
  --provider 302ai \
  --api-key "$API_KEY"

Troubleshooting

Language Configuration Not Effective

If language configuration is not effective:

bash
# 1. Check configuration file
cat ~/.ufomiao/zcf/config.toml | grep -E "preferredLang|templateLang|aiOutputLang"

# 2. Reinitialize and explicitly specify
npx zcf init --all-lang zh-CN

# 3. Check environment variables (if set)
echo $LANG

Template Language Doesn't Match Expected

If template language doesn't match expected:

bash
# 1. Explicitly specify template language
npx zcf init --config-lang zh-CN

# 2. Update existing configuration
npx zcf update --config-lang zh-CN

# 3. Check template files
ls -la ~/.claude/skills/
# View language version of template files

AI Output Language Incorrect

If AI output language is incorrect:

bash
# 1. Check CLAUDE.md or AGENTS.md
cat ~/.claude/CLAUDE.md | grep -i language
cat ~/.codex/AGENTS.md | grep -i language

# 2. Reconfigure AI output language
npx zcf
# Select 6 (Configure AI Memory & Output Style)

# 3. Or directly edit configuration file
vim ~/.claude/CLAUDE.md
# Add language instructions

💡 Tip: Proper language configuration can greatly improve development efficiency and team collaboration experience. It's recommended to choose appropriate language configuration based on project needs and team situation. Most Chinese users are recommended to use --all-lang zh-CN for the best experience.


File: docs/en/advanced/index.md


title: Advanced Guide

Advanced Guide

This chapter focuses on advanced configuration, template management, internationalization, and troubleshooting. Suitable for users who need large-scale deployment, team collaboration, or deep customization.


File: docs/en/advanced/templates.md


title: Templates and Output Styles

Templates and Output Styles

ZCF provides a complete template system, including workflow templates, output style templates, and system prompt templates. These templates support multiple languages (Chinese and English) and can be customized to meet team-specific needs.

Template System Overview

ZCF's template system is divided into the following levels:

  1. Workflow Templates: Structured development workflows
  2. Output Style Templates: AI assistant personality and output styles
  3. System Prompt Templates: Project-level system prompts and standards
  4. MCP Service Templates: MCP service usage guides

Template Directory Structure

Claude Code Templates

text
templates/claude-code/
├── common/                      # Common configuration templates
│   └── settings.json           # Claude settings template
├── zh-CN/                      # Chinese template collection
│   ├── output-styles/         # Output style templates
│   │   ├── engineer-professional.md
│   │   ├── nekomata-engineer.md
│   │   ├── laowang-engineer.md
│   │   └── ojousama-engineer.md
│   └── workflow/              # Workflow templates
│       ├── common/            # Common tools workflow
│       ├── plan/              # Planning workflow
│       ├── sixStep/          # Six-stage workflow
│       ├── bmad/              # BMad enterprise workflow
│       └── git/               # Git workflow
└── en/                         # English template collection
    ├── output-styles/         # Output style templates
    └── workflow/              # Workflow templates (same structure)

Codex Templates

text
templates/codex/
├── common/                     # Common configuration templates
│   └── config.toml            # Codex configuration template
├── zh-CN/                      # Chinese template collection
│   ├── system-prompt/         # System prompt templates
│   └── workflow/              # Workflow templates
│       ├── sixStep/          # Six-stage workflow
│       └── git/              # Git workflow
└── en/                         # English template collection
    ├── system-prompt/         # System prompt templates
    └── workflow/              # Workflow templates (same structure)

Output Style Templates

Output styles define AI assistant personality and output methods. These templates are stored in the prompts/output-style/ directory.

Pre-configured Output Styles

Style ID Name Description Use Case
engineer-professional Professional Engineer Professional, rigorous engineer style Formal projects, enterprise environments
nekomata-engineer Nekomata Engineer Light, friendly nekomata style Personal projects, relaxed atmosphere
laowang-engineer Laowang Engineer Humorous, down-to-earth Chinese style Chinese projects, domestic teams
ojousama-engineer Ojousama Engineer Elegant, refined style Specific scenarios, stylized projects

Built-in Output Styles

In addition to pre-configured styles, built-in styles are also supported:

  • default - Default output style
  • explanatory - Explanatory style, focuses on explanation
  • learning - Learning style, focuses on teaching

Install Output Styles

bash
# Install all output styles
npx zcf init -o all

# Install specific styles
npx zcf init -o engineer-professional,nekomata-engineer

# Set default output style
npx zcf init -o all -d engineer-professional

# Skip output style installation
npx zcf init -o skip

Switch Output Style

Claude Code:

text
/output-style engineer-professional

Codex:
Configure through system prompt or edit systemPromptStyle in config.toml.

Custom Output Styles

  1. Edit Template File:
bash
# Find template file
cd ~/.claude/prompts/output-style/

# Edit or create new style
vim my-custom-style.md
  1. Use During Initialization:
bash
# Initialize first, then manually copy custom style
cp my-custom-style.md ~/.claude/prompts/output-style/
  1. Team Sharing:
bash
# Include custom style in version control
git add prompts/output-style/my-custom-style.md
git commit -m "Add custom output style"

Workflow Templates

Workflow templates define structured development processes. Each workflow includes skill templates and optional agent templates.

Workflow Types

1. Common Tools Workflow (`common/`)

Commands:

  • init-project.md - Project initialization command

Agents:

  • init-architect.md - Initialization architect
  • get-current-datetime.md - Time tool

Purpose: Provide project initialization, common tools, and time handling functionality

2. Planning Workflow (`plan/`)

Commands:

  • feat.md - Feature development command

Agents:

  • planner.md - Planner
  • ui-ux-designer.md - UI/UX Designer

Purpose: New feature design and planning

3. Six-Stage Workflow (`sixStep/`)

Commands:

  • workflow.md - Six-stage development process (Research→Ideate→Plan→Execute→Optimize→Review)

Purpose: Structured development process

4. BMad Workflow (`bmad/`)

Commands:

  • bmad-init.md - BMad initialization

Agents:

  • Complete enterprise-level development team simulation (PO, PM, Architect, Developer, QA, etc.)

Purpose: Enterprise-level agile development process

5. Git Workflow (`git/`)

Commands:

  • git-commit.md - Smart Git commit
  • git-rollback.md - Safe rollback
  • git-cleanBranches.md - Clean merged branches
  • git-worktree.md - Git worktree management

Purpose: Git operation automation

Workflow Installation

bash
# Install all workflows
npx zcf init -w all

# Install specific workflows
npx zcf init -w sixStepsWorkflow,gitWorkflow

# Skip workflow installation
npx zcf init -w skip

Custom Workflows

  1. Fork Repository and Modify Templates:
bash
# 1. Fork ZCF repository
git clone https://github.com/your-org/zcf.git
cd zcf

# 2. Modify templates
vim templates/claude-code/zh-CN/workflow/custom/my-workflow.md

# 3. Build and test
pnpm build
npm link
  1. Use During Initialization:
bash
# Initialize using custom template directory
npx zcf init -w custom
  1. Team Publishing Custom Templates:
bash
# Publish npm package containing custom templates
npm publish @your-org/zcf-templates

System Prompt Templates

System prompt templates define project-level AI behavior standards and guidelines.

CLAUDE.md

CLAUDE.md is Claude Code's project memory file, recommended structure:

markdown
# Project Configuration

## Language Instructions
Use Chinese to reply

## Coding Standards
- Use TypeScript
- Follow ESLint rules
- Use 2-space indentation

## Workflow Standards
Use six-stage workflow for development

Project Memory Best Practices

  1. Hierarchical Organization:
text
Project Root/
├── CLAUDE.md              # Global configuration (concise)
└── .claude/
    ├── plan/              # Plan documents
    ├── memory/            # Project memory
    │   ├── architecture.md
    │   ├── api-design.md
    │   └── coding-standards.md
    └── workflows/         # Workflow templates
  1. Avoid Excessive Context:
  • Global CLAUDE.md only keeps necessary settings
  • Complex standards go into output styles or project memory
  • Use /init-project to generate hierarchical structure
  1. Regular Updates:
bash
# Update templates and prompts
npx zcf update -g zh-CN

Template Language Support

ZCF supports templates in two languages:

Chinese Templates (`zh-CN`)

  • Complete Chinese localization
  • Chinese AI interaction mode
  • Chinese technical documentation standards
  • Chinese workflow descriptions

English Templates (`en`)

  • Complete English localization
  • English AI interaction mode
  • English technical documentation standards
  • English workflow descriptions

Language Switching

bash
# Initialize using Chinese templates
npx zcf init -c zh-CN

# Initialize using English templates
npx zcf init -c en

# Switch language during update
npx zcf update -c en

Template Update Strategy

Update Methods

Method Command Description
Complete Update npx zcf update Update all templates
Documents Only npx zcf init --config-action docs-only Only update prompts and documents
Merge Update npx zcf init --config-action merge Merge new templates into existing configuration

Preserve Custom Content

If you modified templates, it's recommended to:

  1. Backup Custom Templates:
bash
# Backup custom templates
tar -czf my-custom-templates.tar.gz ~/.claude/skills/custom/
  1. Use Version Control:
bash
# Include custom templates in Git
git add ~/.claude/skills/custom/
git commit -m "Add custom workflow templates"
  1. Check During Updates:
bash
# Compare differences before updating
diff -r ~/.claude/skills/ ~/.claude/backup/latest/workflows/

Team Collaboration

Unified Templates

Unify template standards within team:

  1. Create Team Template Repository:
bash
# Create template repository
mkdir team-zcf-templates
cd team-zcf-templates
git init

# Add template files
cp -r ~/.claude/skills/team-* ./
git add .
git commit -m "Initial team templates"
  1. Team Member Sync:
bash
# Pull team templates
git pull origin main
cp -r team-* ~/.claude/skills/

Template Version Management

  • Use semantic versioning for template changes
  • Provide migration guides for major changes
  • Maintain backward compatibility as much as possible
  • Test template updates on existing configurations

Troubleshooting

Templates Not Installed

If templates are not correctly installed:

bash
# Reinstall templates
npx zcf init --config-action new

# Check template directories
ls -la ~/.claude/skills/
ls -la ~/.claude/prompts/output-style/

Custom Templates Lost

If custom templates are lost after update:

bash
# Restore from backup
cp -r ~/.claude/backup/backup_*/workflows/custom/ ~/.claude/skills/

# Or restore from version control
git checkout HEAD -- ~/.claude/skills/custom/

Language Mismatch

If template language doesn't match configuration:

bash
# Reinitialize and specify language
npx zcf init --config-action backup -c zh-CN

# Or only update template language
npx zcf update -c zh-CN

💡 Tip: Proper use of template system can greatly improve development efficiency. It's recommended to unify template standards within teams and regularly update templates to get latest features.


File: docs/en/best-practices/index.md


title: Best Practices

Best Practices

This chapter compiles experiences and tips for daily use of ZCF, helping you maximize benefits in team collaboration and multi-project scenarios.


File: docs/en/best-practices/output-styles.md


title: Output Style Strategy

Output Style Strategy

Output styles are high-priority system prompts, suitable for defining team standards, coding standards, and AI behavior guidelines. By configuring different output styles, you can control AI assistant personality and working methods.

What is Output Style

Output styles are Markdown files stored in the prompts/output-style/ directory, defining AI assistant's:

  • 🎭 Personality Traits: AI's speaking style and behavior
  • 📝 Coding Standards: Code style, comment requirements, naming conventions
  • ✅ Quality Standards: Code review standards, testing requirements
  • 🔍 Working Methods: Problem analysis methods, decision processes

Management Methods

Install Output Styles

Specify styles to install via --output-styles parameter during initialization:

bash
# Install all output styles
npx zcf init -o all

# Install specific styles
npx zcf init -o engineer-professional,nekomata-engineer

# Skip output style installation
npx zcf init -o skip

Switch Output Style

Switch in Main Menu

bash
npx zcf
# Select 6 (Configure AI Memory & Output Style)
# Then select output style management

Switch in Project

Claude Code:

text
/output-style engineer-professional

Codex:
Edit systemPromptStyle in config.toml or use system prompt configuration.

Edit Output Style

Output style files are located in prompts/output-style/ directory:

bash
# View installed styles
ls -la ~/.claude/prompts/output-style/

# Edit specific style
vim ~/.claude/prompts/output-style/engineer-professional.md

# Create custom style
vim ~/.claude/prompts/output-style/my-custom-style.md

Pre-configured Output Styles

ZCF provides the following pre-configured output styles:

Style ID Name Features Use Case
engineer-professional Professional Engineer Rigorous, professional, focuses on code quality Formal projects, enterprise environments
nekomata-engineer Nekomata Engineer Light and friendly, maintains professionalism Personal projects, relaxed atmosphere
laowang-engineer Laowang Engineer Humorous and down-to-earth, direct and effective Chinese projects, domestic teams
ojousama-engineer Ojousama Engineer Elegant and refined, focuses on details Specific scenarios, stylized projects
rem-engineer Rem Maid Engineer Gentle devotion, calm decisiveness Projects requiring meticulous care

Built-in Output Styles

In addition to pre-configured styles, the following built-in styles are also supported (always available):

  • default: Default output style
  • explanatory: Explanatory style, focuses on detailed explanation
  • learning: Learning style, focuses on teaching and explanation

Practice Recommendations

1. Write Team Standards into Output Style

Output style is an ideal place to define team development standards:

markdown
# ~/.claude/prompts/output-style/team-standards.md

## Coding Standards

- Use TypeScript, strict mode
- Functions no more than 50 lines
- Must write unit tests
- Use ESLint and Prettier
- Follow SOLID principles

## Code Review Requirements

- All PRs must go through code review
- Ensure test coverage > 80%
- Check performance impact
- Verify security

2. Create Multiple Styles for On-Demand Switching

Create different output styles for different scenarios:

bash
# During development: Use professional engineer style
/output-style engineer-professional

# During code review: Use review-specific style
/output-style code-review

# During documentation: Use documentation style
/output-style documentation

3. Project-Specific Styles

For projects requiring independent styles, use project-level output styles:

text
# Create in project root directory
Project Root/.claude/output-style/project-specific.md

# Use in conversation
/output-style project-specific

Project-specific styles override global styles but only take effect in that project.

4. Style Priority

Output style priority:

  1. Project-Specific Style (.claude/output-style/ or .codex/output-style/)
  2. Global Default Style (default settings in ~/.claude/prompts/output-style/)
  3. Built-in Style (default, explanatory, learning)

5. Version Control

Include team output styles in version control:

bash
# Create team style repository
mkdir team-output-styles
cp ~/.claude/prompts/output-style/team-standards.md team-output-styles/

# Include in Git
git add team-output-styles/
git commit -m "Add team output style standards"

# Team member sync
git pull
cp team-output-styles/team-standards.md ~/.claude/prompts/output-style/

Output Style Structure

Typical output style file structure:

markdown
# Output Style Name

## Personality Traits
Describe AI's speaking style and behavior

## Coding Standards
- Code style requirements
- Naming conventions
- Comment requirements

## Quality Standards
- Code review standards
- Testing requirements
- Performance standards

## Working Methods
- Problem analysis methods
- Decision processes
- Collaboration methods

Custom Output Styles

Create Custom Style

  1. Create Style File:
bash
vim ~/.claude/prompts/output-style/my-style.md
  1. Write Style Content:
markdown
# My Custom Style

You are a professional full-stack engineer, focusing on:
- Code quality and maintainability
- Performance optimization
- Security considerations
- User experience

## Coding Standards
- Use TypeScript
- Follow Airbnb code standards
- Write complete type definitions
- Must include error handling

## Working Methods
- Understand requirements before coding
- Write tests for test-driven development
- Focus on code reuse
- Continuous refactoring and optimization
  1. Use Custom Style:
bash
# Set default style
npx zcf
# Select 6, then select my-style

# Or use in project
/output-style my-style

Team Shared Styles

Share custom styles with team:

bash
# 1. Export style file
cp ~/.claude/prompts/output-style/team-style.md ./team-styles/

# 2. Include in version control
git add team-styles/
git commit -m "Add team output style"

# 3. Team members import
git pull
cp team-styles/team-style.md ~/.claude/prompts/output-style/

Best Practices

1. Layered Definition of Standards

  • Global Style: Team-common coding standards and standards
  • Project Style: Project-specific requirements and constraints
  • Role Style: Styles for different roles (developer, reviewer, document writer)

2. Keep Styles Concise

Output styles should be concise and clear, avoid being too verbose:

  • ✅ Recommended: Core standards and key requirements
  • ❌ Not Recommended: Overly detailed details (should be in project documentation)

3. Regular Style Updates

As projects develop and teams grow, regularly update output styles:

bash
# Regular review and update
vim ~/.claude/prompts/output-style/engineer-professional.md

# Update after team discussion
git add prompts/output-style/
git commit -m "Update output style standards"

4. Test Style Effects

After creating new style, test its effects:

bash
# 1. Set new style
/output-style my-new-style

# 2. Conduct test conversation
Please help me implement a simple Todo feature

# 3. Evaluate if output meets expectations

# 4. Adjust style based on feedback

5. Document Styles

Write documentation for custom styles:

markdown
# team-standards.md

## Style Description

This style defines our team's development standards and quality standards.

## Usage Scenarios

- Formal project development
- Code review
- Technical review

## Update History

- 2025-01-15: Initial version
- 2025-02-01: Added performance requirements

Notes

Claude Code Version Requirements

  • ⚠️ Version Requirement: Claude Code version must be > 1.0.81 to support output styles
  • ✅ Check Version: Use npx zcf check-updates to check and update
  • 📝 Migration Note: Global memory rules from old versions have been migrated to engineer-professional style

Style File Locations

  • Claude Code: ~/.claude/prompts/output-style/
  • Codex: ~/.codex/prompts/output-style/ (if supported)
  • Project Level: .claude/output-style/ or .codex/output-style/

Style Conflict Handling

If multiple styles exist simultaneously:

  1. Project-level style takes priority
  2. Global default style is next
  3. Built-in style as fallback

💡 Tip: Proper use of output styles can greatly improve code quality and development efficiency. It's recommended to unify output style standards within teams and customize appropriately based on project characteristics. Output styles should be concise and clear, focusing on core standards and key requirements.


File: docs/en/best-practices/tips.md


title: Usage Tips

Usage Tips

This document compiles practical tips and best practices for daily use of ZCF, helping you use ZCF more efficiently in various scenarios.

Core Tips

1. Make Good Use of Interactive Menu

Tip: Get used to starting with npx zcf. All functions have numbered prompts, avoiding the need to remember command details.

bash
# Open interactive menu
npx zcf

# Menu options include:
# 1 - Complete Initialization
# 2 - Import Workflows
# 3 - Configure API or CCR
# 4 - Configure MCP
# 5 - Configure Default Model
# 6 - Configure AI Memory
# 7 - Configure Environment Permissions
# R - CCR Management
# U - ccusage Usage Analysis
# L - CCometixLine Management
# + - Check Updates
# ... etc.

Advantages:

  • ✅ No need to remember complex command parameters
  • ✅ Can browse all available functions
  • ✅ Suitable for users unfamiliar with commands
  • ✅ Reduces input errors

2. Regular Updates

Tip: Keep workflows and templates up to date, and trigger version checks.

bash
# Update once per week (recommended)
npx zcf update

# Or use abbreviation
npx zcf u

# Non-interactive update
npx zcf u -s -g zh-CN

Best Practices:

  • 📅 Update once per week to get latest workflow templates
  • 🔔 Pay attention to version update prompts, upgrade tools in time
  • 💾 Automatic backup before update, can update with confidence

3. Multi-Language Switching Strategy

Tip: Flexibly use language parameters to adapt to different scenario needs.

bash
# Set all languages to Chinese uniformly
npx zcf init -g zh-CN

# Templates Chinese, AI output English (suitable for scenarios requiring English code comments)
npx zcf init -c zh-CN -a en

# Only switch language during update
npx zcf update -c en

Usage Scenarios:

  • 🌐 International Projects: Use English templates for team collaboration
  • 🇨🇳 Chinese Projects: Use Chinese templates to improve readability
  • 🔀 Mixed Scenarios: Templates Chinese, AI output English code comments

4. Multi-Device Configuration Sync

Tip: Sync configurations across multiple devices to maintain consistent development environment.

Method 1: Use Git Worktree

bash
# Create worktree in project and migrate configuration
/git-worktree migrate

# Or use command line
git worktree add ../project-config
cp -r ~/.claude/* ../project-config/.claude/

Method 2: Use Cloud Storage Sync

bash
# Use Dropbox, iCloud, OneDrive, etc.
# Link configuration directory to cloud storage

# macOS/iCloud
ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs/.zcf-configs ~/.zcf-sync

# Sync configuration
rsync -av ~/.claude/ ~/.zcf-sync/claude/
rsync -av ~/.codex/ ~/.zcf-sync/codex/

Method 3: Use Version Control

bash
# Create configuration repository
mkdir ~/zcf-configs && cd ~/zcf-configs
git init

# Add configuration files (note: exclude sensitive information)
echo "*.key" >> .gitignore
echo "auth.json" >> .gitignore
git add .claude/ .codex/
git commit -m "Initial ZCF configs"

# Pull across multiple devices
git pull origin main

5. Scripted Operations Deployment

Tip: Combine --skip-prompt parameter with JSON configuration to achieve automated deployment.

CI/CD Script Example

bash
#!/bin/bash
# deploy-zcf.sh - Automated ZCF configuration deployment

# Read configuration from environment variables
API_KEY=${ZCF_API_KEY}
PROVIDER=${ZCF_PROVIDER:-302ai}
LANG=${ZCF_LANG:-zh-CN}

# Non-interactive initialization
npx zcf init -s \
  --provider "$PROVIDER" \
  --api-key "$API_KEY" \
  --all-lang "$LANG" \
  --mcp-services all \
  --workflows all \
  --output-styles all

echo "ZCF configuration deployment completed"

New Employee Onboarding Script

bash
#!/bin/bash
# onboard-dev.sh - New developer onboarding configuration script

echo "Configuring development environment..."

# 1. Configure ZCF (using configuration file)
npx zcf init -s --api-configs-file ./team-api-configs.json

# 2. Update workflows
npx zcf update -s -g zh-CN

# 3. Check tool versions
npx zcf check-updates

echo "Development environment configuration completed!"

Batch Deployment Script

bash
#!/bin/bash
# batch-deploy.sh - Batch server deployment

SERVERS=("server1" "server2" "server3")

for server in "${SERVERS[@]}"; do
  echo "Deploying to $server..."
  ssh "$server" "npx zcf init -s -p 302ai -k '${API_KEY}' -g zh-CN"
done

6. Monitor Usage

Tip: Use ccu command to monitor API usage and prevent excessive calls.

bash
# View usage statistics
npx zcf ccu

# Output JSON format (for integration into monitoring systems)
npx zcf ccu --json > usage.json

# View detailed statistics
npx zcf ccu --verbose

Integration Example:

bash
#!/bin/bash
# monitor-usage.sh - Usage monitoring script

# Get usage
USAGE=$(npx zcf ccu --json)

# Parse JSON (using jq)
TOKENS=$(echo "$USAGE" | jq '.tokens.total')
COST=$(echo "$USAGE" | jq '.cost.total')

# Send alert (if exceeds threshold)
if [ "$TOKENS" -gt 1000000 ]; then
  echo "Warning: Token usage exceeds 1 million!" | mail -s "ZCF Usage Alert" [email protected]
fi

Advanced Tips

7. Use API Provider Presets

Tip: Use provider presets to simplify configuration, reducing from 5+ parameters to just 2.

bash
# Traditional method (requires multiple parameters)
npx zcf init -s \
  -t api_key \
  -k "sk-xxx" \
  -u "https://api.302.ai/v1" \
  -M "claude-sonnet-4-5" \
  -F "claude-haiku-4-5"

# Use preset (only 2 parameters needed)
npx zcf init -s -p 302ai -k "sk-xxx"

Supported Providers: 302ai, z-ai, minimax, kimi, custom

8. Multi-Configuration Management

Tip: Use configuration switching to quickly switch between different environments.

bash
# List all configurations
npx zcf config-switch --list

# Switch to work configuration
npx zcf config-switch work

# Switch to personal configuration
npx zcf config-switch personal

# Switch in Codex
npx zcf config-switch work --code-type codex

Naming Suggestions:

  • work - Work environment configuration
  • personal - Personal environment configuration
  • test - Test environment configuration
  • demo - Demo environment configuration

9. Workflow Combination

Tip: Combine different workflows to improve development efficiency.

bash
# 1. Use feature development workflow to plan features
/feat Add user comment functionality

# 2. Use six-stage workflow to implement details
/workflow Implement comment CRUD operations

# 3. Use Git workflow to commit code
/git-commit

# 4. Use BMad workflow for iteration
/bmad-init

10. Output Style Strategy

Tip: Choose appropriate output styles for different scenarios.

bash
# View available styles
npx zcf init -s -o all

# Switch style in conversation
# Claude Code: /output-style engineer-professional
# Codex: Configure through system prompt

Style Selection Recommendations:

  • engineer-professional - Professional engineer style, suitable for formal projects
  • nekomata-engineer - Nekomata engineer style, suitable for relaxed atmosphere
  • laowang-engineer - Laowang engineer style, suitable for Chinese environment
  • ojousama-engineer - Ojousama engineer style, suitable for specific scenarios

11. MCP Service Optimization

Tip: Select MCP services based on project needs, avoid installing unnecessary services.

bash
# Only install necessary services
npx zcf init -s -m context7,open-websearch

# View all available services
npx zcf
# Select 4 (Configure MCP), view list

Service Selection Recommendations:

  • Document Query: context7 - Query library documentation
  • Web Search: open-websearch - Multi-engine search
  • Requirements Analysis: spec-workflow - Structured requirements
  • Code Search: serena - Semantic code search
  • Browser Operations: Playwright - Automated testing

12. Backup Strategy

Tip: Properly use backup functionality to ensure configuration security.

bash
# Automatic backup (automatically executed during init and update)
npx zcf init  # Automatic backup

# Manual backup of specific configuration
cp -r ~/.claude ~/.claude.backup.$(date +%Y%m%d)

# Regularly clean old backups (keep last 7 days)
find ~/.claude/backup -name "*.bak" -mtime +7 -delete

13. Quick Recovery from Failures

Tip: Quickly recover configuration when encountering problems.

bash
# 1. Find recent backup
ls -lt ~/.claude/backup/ | head -5

# 2. Restore backup
cp -r ~/.claude/backup/backup_2025-01-15_10-30-45/* ~/.claude/

# 3. Or reinitialize (will create new backup)
npx zcf init --config-action backup

14. Version Control Integration

Tip: Include configuration in version control, but exclude sensitive information.

bash
# Create .gitignore
cat > ~/.zcf-configs/.gitignore << EOF
# Exclude sensitive information
*.key
auth.json
settings.json
config.toml

# Include templates and workflows
!templates/
!workflows/
!prompts/
EOF

# Commit configuration
git add .gitignore templates/ workflows/
git commit -m "Add ZCF templates and workflows"

15. Performance Optimization

Tip: Optimize configuration to improve response speed.

bash
# 1. Only install needed MCP services
npx zcf init -s -m context7,open-websearch  # Only install necessary services

# 2. Use local cache (if supported)
# Some MCP services support local cache, can speed up response

# 3. Regularly clean backups
npx zcf uninstall --mode custom --items backups

Team Collaboration Tips

16. Unified Team Configuration

Tip: Unify configuration standards within team.

bash
# Create team configuration template
cat > team-config.json << EOF
{
  "provider": "302ai",
  "lang": "zh-CN",
  "mcpServices": ["context7", "open-websearch", "spec-workflow"],
  "workflows": ["sixStepsWorkflow", "gitWorkflow", "featPlanUx"],
  "outputStyle": "engineer-professional"
}
EOF

# Team members use same configuration
npx zcf init -s --api-configs-file team-config.json -k "Personal API Key"

17. Document Sharing

Tip: Share workflow templates and configuration templates.

bash
# Export workflow templates
tar -czf team-workflows.tar.gz ~/.claude/skills/

# Team members import
tar -xzf team-workflows.tar.gz -C ~/.claude/

18. Code Review Integration

Tip: Integrate ZCF workflows into code review process.

bash
# Use workflow-generated content in PR description
/feat New feature name

# Generated documents can be directly used for PR description

Troubleshooting Tips

19. Quick Diagnosis

Tip: Use built-in commands to quickly diagnose problems.

bash
# Check configuration
cat ~/.claude/settings.json | jq .

# Check MCP services
cat ~/.claude/settings.json | jq .mcpServers

# Check workflows
ls -la ~/.claude/skills/

# Check version
npx zcf check-updates

20. Log Analysis

Tip: View ZCF execution logs to locate problems.

bash
# Enable verbose output
npx zcf init --verbose 2>&1 | tee zcf.log

# View logs
cat zcf.log | grep -i error

💡 Tip: These tips can be flexibly combined according to actual needs. It's recommended to start with basic tips and gradually master advanced tips.