agentleFS
Git-on-my-levelGit-on-my-level/zcc/CLAUDE.md

zcc

CLAUDE.md16 starsChanged 15 months agoMITView on GitHub

zcc is to Claude Code what zsh is to bash. We enhance, customize, and empower Claude Code through themes (modes), plugins (agents/workflows), configuration (.zcc/config), and automation (hooks). Think of this project as building oh-my-zsh for AI development. We are dogfooding zcc while developing it. This means: - The generator CLI source code (src/, scripts/, templates/) is what we're developing - The generated .zcc directory contains our own project's modes/workflows/tickets - The generated .claude directory contains Claude Code configuration generated by…

  • Installs packages

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

21 rules. About 0 are common, 13 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When making updates, always modify the CLI source code, then run npm run dev init -- --force --pack essentials to update our own dogfooding …

    line 15
  2. Distinctive:

    When making changes to zcc:

    line 24
  3. Distinctive:

    After adding new features: Test them on our own project first

    line 34
  4. Distinctive:

    After changing pack discovery: Verify packs are found

    line 41
  5. Distinctive:

    Template Frontmatter Format: All templates are self-describing

    line 46
  6. Distinctive:

    Add shebang for direct execution

    line 185
  7. Very specific:

    Create command file in src/commands/

    line 245
  8. Very specific:

    Add tests in src/commands/__tests__/

    line 248
  9. Very specific:

    Create template in appropriate templates/ subdirectory:

    line 251
  10. Very specific:

    Update metadata.json with component metadata

    line 256
  11. Distinctive:

    Test installation via CLI commands

    line 257
  12. Very specific:

    Create a directory templates/[pack-name]/ and add a manifest.json:

    line 261
  13. Very specific:

    Ensure referenced component files exist under templates/

    line 278
  14. Very specific:

    Create hook definition JSON in templates/hooks/

    line 282
  15. Distinctive:

    Create corresponding shell script

    line 283
  16. Distinctive:

    Test with real Claude Code interactions

    line 285
  17. Distinctive:

    Schema Validation: Test pack definitions against JSON schema

    line 321
  18. Distinctive:

    Component References: Ensure all referenced components exist

    line 322
  19. Distinctive:

    Dependency Resolution: Test dependency chains and circular detection

    line 323
  20. Distinctive:

    Installation Simulation: Verify pack installation logic

    line 324
  21. Distinctive:

    Error Handling: Test invalid packs, missing components, conflicts

    line 325

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

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

Core Concept: The zsh for Claude Code

zcc is to Claude Code what zsh is to bash. We enhance, customize, and empower Claude Code through themes (modes), plugins (agents/workflows), configuration (.zcc/config), and automation (hooks). Think of this project as building oh-my-zsh for AI development.

Important: Dogfooding Context

We are dogfooding zcc while developing it. This means:

  • The generator CLI source code (src/, scripts/, templates/) is what we're developing
  • The generated .zcc directory contains our own project's modes/workflows/tickets
  • The generated .claude directory contains Claude Code configuration generated by our CLI
  • When making updates, always modify the CLI source code, then run npm run dev init -- --force --pack essentials to update our own dogfooding setup

NEVER confuse:

  • Editing the CLI code (what we want) vs editing generated files (usually wrong)
  • The zcc CLI commands vs Claude Code custom commands
  • Templates in templates/ (source) vs installed components in .zcc/ (generated)

Dogfooding Guide

When making changes to zcc:

  1. After modifying templates: Templates now use YAML frontmatter for metadata
    # Rebuild to regenerate metadata.json from frontmatter
    npm run build
    # Reinstall in our own project
    npm run dev init -- --force --pack essentials
  2. After adding new features: Test them on our own project first
    # Use dev mode to test new commands
    npm run dev <command>
    # Example: npm run dev list
  3. After changing pack discovery: Verify packs are found
    npm run dev pack list  # Should show all available packs
  4. Template Frontmatter Format: All templates are self-describing
    ---
    name: component-name
    description: What this component does
    author: zcc  
    version: 1.0.0
    tags: [tag1, tag2]
    ---
    # Component content here

Commands

Build and Development

# Install dependencies
npm install

# Validate dependencies and build the project (bundles with esbuild, adds shebang, copies templates)
npm run build

# Development mode (run TypeScript directly)
npm run dev

# Watch mode for development
npm run watch

# Validate dependencies without building
npm run validate

# Clean build artifacts
npm run clean

Testing

# Run all tests
npm test

# Run tests with coverage (thresholds: 30% branches, 45% functions/lines/statements)
npm run test:coverage

# Run a specific test file
npx jest src/commands/__tests__/init.test.ts

# Run tests matching a pattern
npx jest --testNamePattern="should create ticket"

Publishing

# Prepare for publishing (runs tests and build)
npm run prepublishOnly

# The actual publish is handled by scripts/npm/commit-tag-and-publish.sh

Development CLI

Non-Interactive Initialization

  • To run the current development CLI: yarn dev init --force --pack frontend-react
  • This regenerates our dogfooding .zcc and .claude directories

Architecture

Core Structure

zcc is the "zsh for Claude Code" - a meta-framework that transforms Claude Code from a basic shell into a highly customizable power tool.

Key Concepts (zsh Analogies):

  • Modes: AI personalities (like zsh themes - robbyrussell, agnoster, powerlevel10k)
  • Workflows: Reusable procedures (like zsh functions/scripts)
  • Agents: Specialized capabilities (like zsh plugins - git, docker, kubectl)
  • Tickets: Persistent task tracking (like tmux sessions)
  • Hooks: Automation points (like zsh hooks - precmd, preexec, chpwd)
  • Custom Commands: Slash commands (like zsh aliases)
  • Fuzzy Matching: Smart completions (like zsh's completion system)
  • .zcc/config.yaml: Project config (like .zshrc)

Directory Layout

src/
├── cli.ts                 # Main entry point, command registration
├── commands/              # CLI command implementations
│   ├── init.ts           # Initialize zcc
│   ├── pack.ts           # Pack management (install/list/show/uninstall/update)
│   ├── ticket.ts         # Ticket management (create/move/resolve)
│   ├── config.ts         # Configuration management
│   ├── hook.ts           # Hook management
│   └── acronym.ts        # Acronym expansions
└── lib/                  # Core functionality
     ├── configManager.ts  # Config hierarchy (default->global->project->env)
     ├── ticketManager.ts  # Ticket lifecycle management
     ├── commandGenerator.ts # Generate Claude Code custom commands
     ├── projectDetector.ts # Detect project language/framework
     └── hooks/            # Hook system implementation
        ├── HookManager.ts # Main hook orchestrator
        ├── HookRegistry.ts # Hook registration system
        └── builtin/      # Built-in hooks (routing, security, etc.)

templates/                # Component templates
├── modes/               # Built-in modes (architect, engineer, etc.)
├── workflows/           # Built-in workflows (review, summarize, etc.)
├── agents/              # Claude Code subagents (claude-code-research)
├── hooks/               # Hook templates and scripts
├── scripts/             # Utility scripts (mode-switch, ticket-context)
└── metadata.json        # Component metadata

Generated Directories:
.zcc/                # Project-specific zcc data
├── modes/              # Installed mode definitions
├── workflows/          # Installed workflow definitions
├── tickets/            # Ticket storage (next/in-progress/done)
├── hooks/              # Hook configurations and scripts
├── scripts/            # Generated utility scripts
└── config.yaml         # Project configuration

.claude/                 # Claude Code configuration
├── agents/             # Installed Claude Code agents
├── commands/           # Custom slash commands
│   ├── mode.md        # Mode switching command
│   ├── ticket.md      # Ticket management command
│   └── zcc.md     # zcc status command
└── settings.local.json # Claude Code project settings

Key Design Patterns

  1. Enhancement Philosophy: Like zsh enhances bash, we enhance Claude Code without replacing it
  2. Plugin Architecture: Components (modes/workflows/agents) work like zsh plugins - modular and composable
  3. Configuration Cascade: Settings layer like zsh (defaults → global ~/.zcc → project .zcc → environment)
  4. Template System: Components are templates that can be customized (like oh-my-zsh themes/plugins)
  5. Hook System: Event-driven automation (like zsh's hook functions)
  6. Dual Directory Structure: .zcc/ (like ~/.oh-my-zsh/) and .claude/ (Claude Code integration)

Build Process

The build uses esbuild (scripts/build.js) to:

  1. Bundle TypeScript into a single CLI executable
  2. Inject version from package.json
  3. Add shebang for direct execution
  4. Copy templates to dist directory

Testing Strategy

  • Uses Jest with ts-jest preset
  • Mocks inquirer for interactive testing
  • Coverage thresholds enforced
  • Tests organized alongside source files in tests directories

Error Handling

  • Custom error types in lib/errors.ts
  • Global error handlers in cli.ts
  • Verbose/debug logging options for troubleshooting

Component System

Modes (Themes)

  • AI personalities for different development tasks (like zsh themes change prompt appearance/behavior)
  • Support fuzzy matching: exact match → substring → acronym (like zsh completions)
  • Example: apm → autonomous-project-manager (like gst → git status in oh-my-zsh)
  • Stored as markdown in .zcc/modes/ (like themes in ~/.oh-my-zsh/themes/)
  • Activated via /mode [name] custom command (like setting ZSH_THEME)

Workflows (Functions/Scripts)

  • Reusable development procedures and patterns (like zsh functions)
  • Stored as markdown in .zcc/workflows/ (like custom functions in .zshrc)
  • Can be referenced in prompts or modes (like calling functions in zsh)

Agents (Plugins)

  • Claude Code subagents for specialized tasks (like zsh plugins add specific capabilities)
  • Installed to .claude/agents/ directory (like plugins in ~/.oh-my-zsh/plugins/)
  • Example: claude-code-research agent (like the 'git' plugin in oh-my-zsh)
  • Added via zcc pack install <name>

Hooks (Event Functions)

  • Claude Code integration points for automated behavior (like zsh hook functions)
  • Built-in hooks:
    • zcc-routing (like preexec - runs before commands)
    • project-overview (like chpwd - runs on directory change)
    • git-context-loader (like precmd - runs before prompts)
    • acronym-expander (like alias expansion)
  • Custom hooks can be added (like adding custom hook functions)
  • Configured in .zcc/hooks/definitions/

Custom Commands

  • Project-specific slash commands generated in .claude/commands/
  • /mode - Switch between modes with fuzzy matching
  • /ticket - Manage tickets and load context
  • /zcc - Show project status

Ticket Workflow

Tickets follow a lifecycle:

  1. Created in .zcc/tickets/next/
  2. Moved to .zcc/tickets/in-progress/ when started
  3. Moved to .zcc/tickets/done/ when completed
  4. Can include context that gets injected into CLAUDE.md

Development Guidelines

Adding New Commands

  1. Create command file in src/commands/
  2. Export a Command instance
  3. Register in src/cli.ts
  4. Add tests in src/commands/__tests__/

Adding New Components

  1. Create template in appropriate templates/ subdirectory:
    • Modes: markdown with personality/behavior instructions
    • Workflows: markdown with step-by-step procedures
    • Agents: markdown with frontmatter for tools and description
    • Hooks: JSON definition + shell script implementation
  2. Update metadata.json with component metadata
  3. Test installation via CLI commands
  4. For agents, ensure proper .claude/agents/ targeting

Adding New Starter Packs

  1. Create a directory templates/[pack-name]/ and add a manifest.json:
    {
      "name": "pack-name",
      "version": "1.0.0", 
      "description": "Pack description",
      "author": "author-name",
      "category": "frontend|backend|fullstack|devops|mobile|ai-ml|data|general",
      "components": {
        "modes": [{ "name": "mode-name", "required": true }],
        "workflows": [{ "name": "workflow-name", "required": false }],
        "agents": [{ "name": "agent-name", "required": false }]
      },
      "hooks": []
    }
  2. Validate fields against templates/schema.json
  3. Ensure referenced component files exist under templates/
  4. Preview with zcc packs show <pack> and install with zcc init -p <pack>

Hook Development

  1. Create hook definition JSON in templates/hooks/
  2. Create corresponding shell script
  3. Define trigger events and configuration options
  4. Test with real Claude Code interactions

StarterPackManager API

The StarterPackManager class handles pack operations:

import { StarterPackManager } from '../lib/StarterPackManager';

const manager = new StarterPackManager(projectRoot);

// List available packs
const packs = await manager.listPacks();

// Load specific pack
const pack = await manager.loadPack('essentials');

// Resolve dependencies
const deps = await manager.resolveDependencies('essentials');

// Install pack
const result = await manager.installPack('essentials', { force: true });

// Show installed packs
const installed = await manager.getInstalledPacks();

// Uninstall pack
await manager.uninstallPack('essentials');

Key Features:

  • JSON schema validation against templates/starter-packs/schema.json
  • Component reference validation (ensures modes/workflows/agents exist)
  • Dependency resolution with circular dependency detection
  • Installation simulation (actual installation in Phase 2)

Testing Guidelines for Starter Packs

  1. Schema Validation: Test pack definitions against JSON schema
  2. Component References: Ensure all referenced components exist
  3. Dependency Resolution: Test dependency chains and circular detection
  4. Installation Simulation: Verify pack installation logic
  5. Error Handling: Test invalid packs, missing components, conflicts

Example test structure:

describe('StarterPackManager', () => {
  it('should load valid pack', async () => {
    const pack = await manager.loadPack('frontend-react');
    expect(pack.name).toBe('frontend-react');
  });

  it('should validate pack schema', async () => {
    const result = await manager.validatePack(validPackData);
    expect(result.valid).toBe(true);
  });
});

Code Style

  • TypeScript with strict mode
  • CommonJS modules for Node.js compatibility
  • Async/await for asynchronous operations
  • Comprehensive error messages for CLI users

Dependencies

  • commander: CLI framework
  • inquirer: Interactive prompts
  • esbuild: Build tool
  • jest/ts-jest: Testing framework
  • ajv: JSON schema validation for starter packs

Recent Enhancements

The zsh Philosophy Implementation

  • Fuzzy Matching: Like zsh's smart completions (eng → engineer, apm → autonomous-project-manager)
  • Plugin System: Agents work like zsh plugins - modular, focused, composable
  • Theme System: Modes are like themes - completely change behavior/personality
  • Configuration Hierarchy: Like zsh's config loading (defaults → global → project → env)
  • Hook System: Event-driven automation like zsh hooks (precmd, preexec, chpwd)
  • Alias System: Custom commands work like zsh aliases

Starter Packs System

  • Current: Functional pack loading, dependency resolution, installation, and uninstall
  • Validation: Manifest and component reference checking
  • Available Packs: essentials, advanced-code-refactoring
  • Management: StarterPackManager handles list/show/install/uninstall

Coming Soon (oh-my-zcc)

  • More Packs: Backend API, DevOps, Data Science starter packs
  • ~/.zcc/config.yaml: Global config file (unified structure with project config)
  • Community Hub: Share modes/workflows (like awesome-zsh-plugins)
  • Plugin Manager: Easy installation/updates (like zplug, zinit)
  • Visual Configurator: GUI setup (like zsh configuration tools)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.