feat: add plugin integration analysis to config-analyze command

Add automatic detection of active marketplace plugins and verification
that CLAUDE.md properly references them. This ensures projects using
marketplace plugins will have proper documentation to guide Claude Code
in using available tools.

Changes:
- Add claude-md-integration.md snippets to all 4 plugins (projman,
  cmdb-assistant, claude-config-maintainer, project-hygiene)
- Update marketplace.json with MCP server mappings for plugin detection
- Enhance /config-analyze to detect active plugins via MCP server names
- Update maintainer agent with plugin integration workflow
- Add plugin coverage percentage to analysis report
- User confirmation required before adding plugin references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 18:24:29 -05:00
parent 15e0654950
commit 113839b0d8
8 changed files with 361 additions and 18 deletions

View File

@@ -31,7 +31,11 @@ You are the **Maintainer Agent** - a specialist in creating and optimizing CLAUD
### 1. Analyze CLAUDE.md Files
When analyzing a CLAUDE.md file, evaluate:
When analyzing a CLAUDE.md file, perform two types of analysis:
#### A. Content Analysis
Evaluate:
**Structure:**
- Is the file well-organized?
@@ -57,6 +61,49 @@ When analyzing a CLAUDE.md file, evaluate:
- Are there verbose explanations that could be shortened?
- Is the file too long for effective use?
#### B. Plugin Integration Analysis
After content analysis, check for marketplace plugin integration:
**Step 1: Detect Active Plugins**
Read `.claude/settings.local.json` and identify enabled MCP servers:
```json
{
"mcpServers": {
"gitea": { ... }, // → projman plugin
"netbox": { ... } // → cmdb-assistant plugin
}
}
```
Use this mapping to identify active plugins:
| MCP Server | Plugin |
|------------|--------|
| `gitea` | projman |
| `netbox` | cmdb-assistant |
Also check for hook-based plugins (project-hygiene uses `PostToolUse` hooks).
**Step 2: Check CLAUDE.md for Plugin References**
For each detected plugin, search CLAUDE.md for:
- Plugin name mention (e.g., "projman", "cmdb-assistant")
- Command references (e.g., `/sprint-plan`, `/cmdb-search`)
- MCP tool mentions (e.g., `list_issues`, `dcim_list_devices`)
**Step 3: Load Integration Snippets**
For plugins not referenced in CLAUDE.md, load their integration snippet from:
`plugins/{plugin-name}/claude-md-integration.md`
**Step 4: Report and Offer Integration**
Report plugin coverage percentage and offer to add missing integrations:
- Show which plugins are detected but not referenced
- Display the integration content that would be added
- Ask user for confirmation before modifying CLAUDE.md
### 2. Optimize CLAUDE.md Structure
**Recommended Structure:**
@@ -145,7 +192,42 @@ Suggested Actions:
Would you like me to implement these improvements?
```
### 5. Create New CLAUDE.md Files
### 5. Insert Plugin Integrations
When adding plugin integration content to CLAUDE.md:
**Placement:**
- Add plugin sections after the main project documentation
- Group all plugin integrations together under a clear header
- Use consistent formatting across all plugin sections
**Process:**
1. Read the plugin's `claude-md-integration.md` file
2. Show the content to the user for review
3. Ask for confirmation: "Add this plugin integration? [Y/n]"
4. If confirmed, insert at appropriate location in CLAUDE.md
5. Repeat for each missing plugin
**User Confirmation Flow:**
```
Plugin Integration: projman
--------------------------
[Show content from plugins/projman/claude-md-integration.md]
Add this integration to CLAUDE.md?
[1] Yes, add this integration
[2] Skip this plugin
[3] Add all remaining plugins
[4] Cancel
```
**Best Practices:**
- Never modify CLAUDE.md without user confirmation
- Show exactly what will be added before making changes
- Allow users to skip specific plugins they don't want documented
- Preserve existing CLAUDE.md structure and content
### 6. Create New CLAUDE.md Files
When creating a new CLAUDE.md:

View File

@@ -0,0 +1,30 @@
## CLAUDE.md Maintenance (claude-config-maintainer)
This project uses the **claude-config-maintainer** plugin to analyze and optimize CLAUDE.md configuration files.
### Available Commands
| Command | Description |
|---------|-------------|
| `/config-analyze` | Analyze CLAUDE.md for optimization opportunities with 100-point scoring |
| `/config-optimize` | Automatically optimize CLAUDE.md structure and content |
| `/config-init` | Initialize a new CLAUDE.md file for a project |
### Scoring System
The analysis uses a 100-point scoring system across four categories:
| Category | Points | What It Measures |
|----------|--------|------------------|
| Structure | 25 | Organization, headers, navigation, grouping |
| Clarity | 25 | Instructions, examples, language, detail level |
| Completeness | 25 | Overview, quick start, critical rules, workflows |
| Conciseness | 25 | Efficiency, no repetition, appropriate length |
### Usage Guidelines
- Run `/config-analyze` periodically to assess CLAUDE.md quality
- Target a score of **70+/100** for effective Claude Code operation
- Address HIGH priority issues first when optimizing
- Use `/config-init` when setting up new projects to start with best practices
- Re-analyze after making changes to verify improvements

View File

@@ -1,10 +1,10 @@
---
description: Analyze CLAUDE.md for optimization opportunities
description: Analyze CLAUDE.md for optimization opportunities and plugin integration
---
# Analyze CLAUDE.md
This command analyzes your project's CLAUDE.md file and provides a detailed report on optimization opportunities.
This command analyzes your project's CLAUDE.md file and provides a detailed report on optimization opportunities and plugin integration status.
## What This Command Does
@@ -12,7 +12,9 @@ This command analyzes your project's CLAUDE.md file and provides a detailed repo
2. **Analyze Structure** - Evaluates organization, headers, and flow
3. **Check Content** - Reviews clarity, completeness, and conciseness
4. **Identify Issues** - Finds redundancy, verbosity, and missing sections
5. **Generate Report** - Provides scored assessment with recommendations
5. **Detect Active Plugins** - Identifies marketplace plugins enabled in the project
6. **Check Plugin Integration** - Verifies CLAUDE.md references active plugins
7. **Generate Report** - Provides scored assessment with recommendations
## Usage
@@ -52,6 +54,29 @@ Analyze the CLAUDE.md file in this project
- Appropriate length for project size
- No generic filler content
## Plugin Integration Analysis
After the content analysis, the command detects and analyzes marketplace plugin integration:
### Detection Method
1. **Read `.claude/settings.local.json`** - Check for enabled MCP servers
2. **Map MCP servers to plugins** - Use marketplace registry to identify active plugins:
- `gitea` → projman
- `netbox` → cmdb-assistant
3. **Check for hooks** - Identify hook-based plugins (project-hygiene)
4. **Scan CLAUDE.md** - Look for plugin integration content
### Plugin Coverage Scoring
For each detected plugin, verify CLAUDE.md contains:
- Plugin section header or mention
- Available commands documentation
- MCP tools reference (if applicable)
- Usage guidelines
Coverage is reported as percentage: `(plugins referenced / plugins detected) * 100`
## Expected Output
```
@@ -101,10 +126,37 @@ Recommendations:
Estimated improvement: 15-20 points after changes
---
Plugin Integration Analysis
===========================
Detected Active Plugins:
✓ projman (via gitea MCP server)
✓ cmdb-assistant (via netbox MCP server)
✓ project-hygiene (via PostToolUse hook)
Plugin Coverage: 33% (1/3 plugins referenced)
✓ projman - Referenced in CLAUDE.md
✗ cmdb-assistant - NOT referenced
✗ project-hygiene - NOT referenced
Missing Integration Content:
1. cmdb-assistant
Add infrastructure management commands and NetBox MCP tools reference.
2. project-hygiene
Add cleanup hook documentation and configuration options.
---
Would you like me to:
[1] Implement all recommended changes
[2] Show before/after for specific section
[3] Generate optimized version for review
[1] Implement all content recommendations
[2] Add missing plugin integrations to CLAUDE.md
[3] Do both (recommended)
[4] Show preview of changes first
```
## When to Use
@@ -115,6 +167,8 @@ Run `/config-analyze` when:
- Claude seems to miss instructions
- Before major project changes
- Periodic maintenance (quarterly)
- After installing new marketplace plugins
- When Claude doesn't seem to use available plugin tools
## Follow-Up Actions