# Plugins

Plugins extend Clew with custom commands, agents, skills, execution hooks, MCP servers, and LSP integrations. Plugin management is handled by `src/services/plugins/` and `src/utils/plugins/`.

## What Plugins Can Provide

Extension | Description
--- | ---
Slash Commands | Custom `/command` implementations registered via plugin manifest
Agents | Specialized agent configurations with custom prompts and tool access
Skills | Reusable task instructions from plugin skill directories
Execution Hooks | Pre/post hooks at tool, bash, prompt, and edit stages
MCP Servers | Model Context Protocol server definitions bundled with the plugin
LSP Servers | Language Server Protocol integration

## Hook System

Hook Point | When It Fires
--- | ---
`PreToolUse` | Before a tool executes — validation, input modification, logging
`PostToolUse` | After a tool completes — result transformation, audit
`PreBash` | Before shell command execution — sanitization, env injection
`PostPrompt` | After prompt construction — context augmentation
`PreAcceptEdit` | Before accepting an edit — validation, policy enforcement

## Plugin Management

    /plugin                          # List installed plugins
    /plugin-details                  # Show detailed plugin information
    /reload-plugins                  # Activate pending plugin changes
    claude plugin validate /path       # Validate a plugin manifest (CLI)

Plugins are loaded from these locations:

- Bundled — Shipped with Clew
- User — Installed by the user (via marketplace or manual)
- Plugin dir — Custom directories via `--plugin-dir <path>` (repeatable)

The `PluginInstallationManager` (`src/services/plugins/PluginInstallationManager.ts`) handles automatic installation, marketplace reconciliation, and plugin refresh. Use `/reload-plugins` after installing or updating plugins.

## Built-in Plugins

Plugin | Description
--- | ---
`commit-commands` | Git workflow — commit, push, PR creation, branch cleanup (`clean_gone`)
`commit-push-pr` | Commit, push, and open a PR in one step
`code-review` | Automated PR code review
`feature-dev` | Guided feature development with codebase understanding
`frontend-design` | Production-grade UI/UX generation
`verify` | Typecheck, lint, build, and test pipeline
`precommit` | Pre-commit review with full verification
`commit` | Conventional git commit message generation
`simplify` | Code quality and reuse review
`debug` | Debugging assistance and diagnosis
`web-search` | Multi-provider web search
`scrapling` | Web scraping with Scrapling framework
`skillify` | Create reusable skills from workflows
`remember` | Save user preferences

## Plugin Structure

    my-plugin/
      manifest.json         # Plugin metadata and capability declarations
      commands/             # Custom slash commands
      skills/               # Reusable task instructions
      agents/               # Agent configurations
      hooks/                # Hook implementations

## Marketplace

Plugins can be distributed through marketplaces. The `marketplaceManager` (`src/utils/plugins/marketplaceManager.ts`) handles marketplace source discovery, cache management, and plugin installation from remote sources.