diff --git a/CHANGELOG.md b/CHANGELOG.md index 36cb842..98e3cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,14 @@ ClaudeForge v2.0.0 modernizes the toolkit for Claude Code v2.1.4+ with hooks, mo - Documents hooks functionality - Provides troubleshooting guide - Includes rollback procedures +- **Testing Scripts**: Complete test suite in `test/` directory + - `test/validate_migration.sh` - 18 automated validation tests + - `test/rollback.sh` - One-command rollback to v1.x + - `test/README.md` - Testing documentation and workflows + - `test/LOCAL_TESTING_GUIDE.md` - Step-by-step local testing guide - **Updated Documentation**: All docs now reference Claude Code v2.1.4+ features + - `CLAUDE.md` - Updated with v2.0.0 features and permission syntax examples + - `README.md` - Added "New in v2.0" section highlighting features ### Changed diff --git a/CLAUDE.md b/CLAUDE.md index be2a7bc..992575b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,6 +14,19 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co --- +## What's New in v2.0.0 + +**Claude Code v2.1.4+ Support:** +- **Lifecycle Hooks**: Guardian agent uses SessionStart, PreToolUse, PostToolUse hooks +- **Modern Permissions**: Updated to `permissions:` array syntax +- **Hot-Reload**: Skills auto-reload when modified (no restart needed) +- **Fork-Safe Mode**: Guardian runs independently with `fork_safe: true` +- **Auto-Migration**: Seamless upgrade from v1.x with automatic backups + +**Migration:** See `docs/MIGRATION_V2.md` for upgrading from v1.0.0. + +--- + ## Architecture ### Component Interaction Flow @@ -152,15 +165,32 @@ When updating `claude-md-guardian` agent: 1. Edit `agent/claude-md-guardian.md` 2. Key YAML frontmatter fields: - - `tools`: Limited to Bash, Read, Write, Edit, Grep, Glob, Skill + - `permissions`: [Bash, Read, Write, Edit, Grep, Glob, Skill] - `model`: Set to `haiku` for token efficiency - `color`: Visual indicator (purple) + - `fork_safe`: Set to `true` for independent execution + - `hooks`: Array of lifecycle hooks (SessionStart, PreToolUse, PostToolUse) 3. Agent workflow phases: - Phase 1: Assessment (check git changes) - Phase 2: Analysis (determine scope) - Phase 3: Update (invoke skill for targeted updates) 4. Test: `cp agent/claude-md-guardian.md ~/.claude/agents/` +**Example Agent Definition with v2.0.0 Syntax:** +```yaml +--- +name: claude-md-guardian +permissions: [Bash, Read, Write, Edit, Grep, Glob, Skill] +model: haiku +color: purple +fork_safe: true +hooks: + - SessionStart + - PreToolUse + - PostToolUse +--- +``` + ### Adding New Templates To add a new reference template (e.g., Rust, mobile): @@ -382,11 +412,28 @@ Claude Code recognizes the skill name `claude-md-enhancer` and calls Python modu The agent uses the skill as its core capability: ```yaml # In agent/claude-md-guardian.md: -tools: Bash, Read, Write, Edit, Grep, Glob, Skill +permissions: [Bash, Read, Write, Edit, Grep, Glob, Skill] +hooks: + - SessionStart # Detects project changes on session start + - PreToolUse # Validates before tool execution + - PostToolUse # Validates after CLAUDE.md updates ``` Agent invokes skill with: `Skill: claude-md-enhancer` in agent workflow. +**Example Hook Usage:** +```markdown +# When SessionStart hook triggers: +1. Check git diff for changes +2. If significant changes detected → invoke skill +3. Update CLAUDE.md automatically + +# When PostToolUse hook triggers after Edit/Write to CLAUDE.md: +1. Validate updated content with validator.py +2. Report quality score +3. Suggest improvements if needed +``` + ### Agent ↔ Git Agent detects changes via git commands: @@ -448,15 +495,15 @@ When updating references: ## Version Management -**Current Version:** 1.0.0 (see CHANGELOG.md) +**Current Version:** 2.0.0 (see CHANGELOG.md) **Versioning:** Semantic Versioning (MAJOR.MINOR.PATCH) When releasing new version: 1. Update `CHANGELOG.md` with changes under new version header 2. Update version in `README.md` badge 3. Update version in `skill/SKILL.md` bottom section -4. Create git tag: `git tag -a v1.1.0 -m "Release v1.1.0"` -5. Push tag: `git push origin v1.1.0` +4. Create git tag: `git tag -a v2.1.0 -m "Release v2.1.0"` +5. Push tag: `git push origin v2.1.0` 6. Create GitHub release with CHANGELOG excerpt --- diff --git a/agent/README.md b/agent/README.md index 7929b75..edebfac 100644 --- a/agent/README.md +++ b/agent/README.md @@ -45,7 +45,7 @@ Available in all your Claude Code projects: ```bash # Copy agent to user directory -cp generated-agents/claude-md-guardian/claude-md-guardian.md ~/.claude/agents/ +cp agent/claude-md-guardian.md ~/.claude/agents/ # Restart Claude Code ``` @@ -59,7 +59,7 @@ Available only in current project: mkdir -p .claude/agents # Copy agent -cp generated-agents/claude-md-guardian/claude-md-guardian.md .claude/agents/ +cp agent/claude-md-guardian.md .claude/agents/ # Restart Claude Code ``` @@ -83,12 +83,15 @@ Automatically check for updates at session start: **Note**: The hook creates awareness, but the agent only updates if significant changes detected. +**v2.0.0 Update**: Hooks now support advanced features like `run_in_background`, environment variables, and conditional execution. See [docs/MIGRATION_V2.md](../docs/MIGRATION_V2.md) for details. + ## Prerequisites **Required**: -- `claude-md-enhancer` skill must be installed - - User-level: `~/.claude/skills/claude-md-enhancer/` - - Project-level: `.claude/skills/claude-md-enhancer/` +- `claudeforge-skill` must be installed + - User-level: `~/.claude/skills/claudeforge-skill/` + - Project-level: `.claude/skills/claudeforge-skill/` + - **v2.0.0**: Auto-migrates from old `claude-md-enhancer` name **Optional** (but recommended): - `/enhance-claude-md` slash command @@ -329,23 +332,26 @@ In the agent file, you can adjust when updates trigger: ### Skill Not Found Error -**Problem**: "claude-md-enhancer skill not found" +**Problem**: "claudeforge-skill not found" **Solution**: ```bash # Install the skill -cp -r generated-skills/claude-md-enhancer ~/.claude/skills/ +cp -r skill ~/.claude/skills/claudeforge-skill/ # Restart Claude Code +# Note: v2.0.0 auto-migrates from old claude-md-enhancer name ``` ## Integration -### With claude-md-enhancer Skill +### With claudeforge-skill The agent uses this skill as its core capability: ``` Agent detects changes → Invokes skill → Skill updates sections → Agent validates ``` +**v2.0.0**: Uses new `permissions:` syntax for tool access control. + ### With /enhance-claude-md Command The slash command can invoke the agent: @@ -389,16 +395,17 @@ The slash command can invoke the agent: ## Version -- **Version**: 1.0.0 -- **Last Updated**: November 2025 -- **Compatible**: Claude Code 2.0+ -- **Dependencies**: claude-md-enhancer skill v1.0.0+ +- **Version**: 2.0.0 +- **Last Updated**: January 2026 +- **Compatible**: Claude Code 2.1.4+ +- **Dependencies**: claudeforge-skill v2.0.0+ +- **Migration**: See [docs/MIGRATION_V2.md](../docs/MIGRATION_V2.md) for upgrade guide ## Related Resources -- **Skill**: `generated-skills/claude-md-enhancer/` -- **Slash Command**: `generated-commands/enhance-claude-md/` -- **Agent File**: `generated-agents/claude-md-guardian/claude-md-guardian.md` +- **Skill**: `skill/` (claudeforge-skill) +- **Slash Command**: `command/` (enhance-claude-md) +- **Agent File**: `agent/claude-md-guardian.md` --- diff --git a/command/README.md b/command/README.md index 3f58bc4..bec25d4 100644 --- a/command/README.md +++ b/command/README.md @@ -9,6 +9,7 @@ Initialize or enhance CLAUDE.md files using the `claude-md-enhancer` skill with - **Quality Analysis**: For existing projects, analyzes current CLAUDE.md and provides actionable recommendations - **100% Native Format Compliance**: Generates files with project structure diagrams, setup instructions, architecture sections - **Modular Architecture Support**: Creates context-specific CLAUDE.md files (backend/, frontend/, database/) +- **v2.0.0**: Enhanced hooks support with background execution and conditional triggers ## Installation @@ -16,17 +17,17 @@ Initialize or enhance CLAUDE.md files using the `claude-md-enhancer` skill with ```bash # Copy command to your project -cp -r generated-commands/enhance-claude-md /path/to/your/project/.claude/commands/ +cp -r command /path/to/your/project/.claude/commands/ # Or create symlink -ln -s $(pwd)/generated-commands/enhance-claude-md /path/to/your/project/.claude/commands/enhance-claude-md +ln -s $(pwd)/command /path/to/your/project/.claude/commands/enhance-claude-md ``` ### Option 2: User-Level (All Projects) ```bash # Copy command to user commands directory -cp -r generated-commands/enhance-claude-md ~/.claude/commands/ +cp -r command ~/.claude/commands/ # Restart Claude Code ``` @@ -140,9 +141,10 @@ The command follows the **Multi-Phase Pattern** (similar to `codebase-analyze`): ## Prerequisites **Required**: -- `claude-md-enhancer` skill must be installed - - Project-level: `.claude/skills/claude-md-enhancer/` - - User-level: `~/.claude/skills/claude-md-enhancer/` +- `claudeforge-skill` must be installed + - Project-level: `.claude/skills/claudeforge-skill/` + - User-level: `~/.claude/skills/claudeforge-skill/` + - **v2.0.0**: Auto-migrates from old `claude-md-enhancer` name **Recommended**: - Git repository (for better context detection) @@ -184,7 +186,7 @@ The command follows the **Multi-Phase Pattern** (similar to `codebase-analyze`): ## Output -The command can invoke either the `claude-md-enhancer` skill directly OR the `claude-md-guardian` agent (recommended for maintenance). +The command can invoke either the `claudeforge-skill` directly OR the `claude-md-guardian` agent (recommended for maintenance). ### Option A: Direct Skill Invocation @@ -316,9 +318,10 @@ Proceed? ### "Skill not found" error -**Solution**: Install the `claude-md-enhancer` skill first: +**Solution**: Install the `claudeforge-skill` first: ```bash -cp -r generated-skills/claude-md-enhancer ~/.claude/skills/ +cp -r skill ~/.claude/skills/claudeforge-skill/ +# Note: v2.0.0 auto-migrates from old claude-md-enhancer name ``` ### Command not recognized @@ -350,11 +353,26 @@ Discovery → Analysis → Task ↓ Invokes claude-md-guardian (agent) ↓ -Agent uses claude-md-enhancer (skill) +Agent uses claudeforge-skill (skill) ↓ CLAUDE.md updated and synchronized ``` +**v2.0.0 Enhancement**: Hooks can now trigger background validation checks. Example: + +```json +{ + "hooks": { + "AfterCommit": { + "command": "/enhance-claude-md", + "run_in_background": true, + "timeout": 10000, + "description": "Validate CLAUDE.md after commits" + } + } +} +``` + ### When to Use the Agent **Via this command**: @@ -369,21 +387,22 @@ CLAUDE.md updated and synchronized - Silent if no significant changes - Updates only when needed -**See**: `generated-agents/claude-md-guardian-README.md` for complete agent documentation +**See**: [agent/README.md](../agent/README.md) for complete agent documentation ## Related Resources -- **Skill Documentation**: `generated-skills/claude-md-enhancer/README.md` -- **Skill Examples**: `generated-skills/claude-md-enhancer/examples/` -- **Agent Documentation**: `generated-agents/claude-md-guardian-README.md` +- **Skill Documentation**: [../skill/README.md](../skill/README.md) +- **Skill Examples**: [../skill/examples/](../skill/examples/) +- **Agent Documentation**: [../agent/README.md](../agent/README.md) - **Official Slash Command Reference**: `documentation/references/slash-command-update-claude-md-example.md` ## Version -- **Version**: 1.0.0 -- **Last Updated**: November 2025 -- **Compatible**: Claude Code 2.0+ -- **Dependencies**: claude-md-enhancer skill v1.0.0+ +- **Version**: 2.0.0 +- **Last Updated**: January 2026 +- **Compatible**: Claude Code 2.1.4+ +- **Dependencies**: claudeforge-skill v2.0.0+ +- **Migration**: See [docs/MIGRATION_V2.md](../docs/MIGRATION_V2.md) for upgrade guide --- diff --git a/skill/README.md b/skill/README.md index f5784e2..858035b 100644 --- a/skill/README.md +++ b/skill/README.md @@ -1,9 +1,11 @@ -# claude-md-enhancer +# claudeforge-skill > **Analyze, generate, and enhance CLAUDE.md files for any project type with intelligent templates and best practices.** A comprehensive Claude Code skill that helps teams create and maintain high-quality CLAUDE.md files. Supports analysis, validation, generation, and enhancement with tech stack customization, team size adaptation, and modular architecture. +**v2.0.0 Update**: Now uses modern `permissions:` syntax for tool access control, replacing deprecated `tools:` and `allowed-tools:` configurations. + ## Features 🆕 **Interactive Initialization** - Explore repository, detect project context, and create CLAUDE.md through conversational workflow @@ -27,7 +29,7 @@ A comprehensive Claude Code skill that helps teams create and maintain high-qual ```bash # Copy skill folder to your project -cp -r claude-md-enhancer /path/to/your/project/.claude/skills/ +cp -r skill /path/to/your/project/.claude/skills/claudeforge-skill/ # Restart Claude Code or reload skills ``` @@ -36,9 +38,10 @@ cp -r claude-md-enhancer /path/to/your/project/.claude/skills/ ```bash # Copy skill folder to user skills directory -cp -r claude-md-enhancer ~/.claude/skills/ +cp -r skill ~/.claude/skills/claudeforge-skill/ # Available across all your projects +# Note: v2.0.0 auto-migrates from old claude-md-enhancer name ``` #### Option 3: Claude Apps @@ -55,7 +58,7 @@ cp -r claude-md-enhancer ~/.claude/skills/ #### New Project (Interactive Initialization) ``` -Hey Claude—I just added the "claude-md-enhancer" skill. I don't have a CLAUDE.md file yet. Can you help me create one for this project? +Hey Claude—I just added the "claudeforge-skill". I don't have a CLAUDE.md file yet. Can you help me create one for this project? ``` Claude will: @@ -67,7 +70,7 @@ Claude will: #### Existing Project ``` -Hey Claude—I just added the "claude-md-enhancer" skill. Can you analyze my CLAUDE.md and suggest improvements? +Hey Claude—I just added the "claudeforge-skill". Can you analyze my CLAUDE.md and suggest improvements? ``` See [HOW_TO_USE.md](HOW_TO_USE.md) for comprehensive examples. @@ -79,18 +82,21 @@ See [HOW_TO_USE.md](HOW_TO_USE.md) for comprehensive examples. ### Module Overview ``` -claude-md-enhancer/ +claudeforge-skill/ ├── SKILL.md # Skill definition with YAML frontmatter ├── analyzer.py # Analyzes existing CLAUDE.md files ├── validator.py # Validates against best practices ├── generator.py # Generates new content ├── template_selector.py # Selects appropriate templates +├── workflow.py # Interactive initialization workflow ├── sample_input.json # Example inputs ├── expected_output.json # Expected outputs ├── HOW_TO_USE.md # Usage examples └── README.md # This file ``` +**v2.0.0**: Updated SKILL.md now uses `permissions:` instead of `tools:` for better security and control. + ### Python Modules #### `workflow.py` - Initialization Workflow (New!) @@ -459,9 +465,10 @@ Before finalizing any CLAUDE.md generation: ## Version -**Version**: 1.0.0 -**Last Updated**: November 2025 -**Compatible**: Claude Code 2.0+, Claude Apps, Claude API +**Version**: 2.0.0 +**Last Updated**: January 2026 +**Compatible**: Claude Code 2.1.4+, Claude Apps, Claude API +**Migration**: See [../docs/MIGRATION_V2.md](../docs/MIGRATION_V2.md) for upgrade guide from v1.x --- @@ -505,23 +512,34 @@ For automatic CLAUDE.md maintenance throughout your project lifecycle, use the * ```bash # User-level (all projects) -cp generated-agents/claude-md-guardian.md ~/.claude/agents/ +cp agent/claude-md-guardian.md ~/.claude/agents/ # Project-level (current project) -cp generated-agents/claude-md-guardian.md .claude/agents/ +cp agent/claude-md-guardian.md .claude/agents/ ``` ### How They Work Together ``` -claude-md-guardian (agent) → Uses → claude-md-enhancer (skill) +claude-md-guardian (agent) → Uses → claudeforge-skill (skill) ↓ Detects changes → Invokes skill → Updates CLAUDE.md ``` **Result**: Your CLAUDE.md stays synchronized with your codebase automatically! -See `generated-agents/claude-md-guardian-README.md` for complete agent documentation. +**v2.0.0**: Agent now uses `permissions:` syntax for controlled tool access. Example: + +```yaml +permissions: + allow: + - Bash(git:*) + - Read + - Write + - Skill(claudeforge-skill) +``` + +See `agent/README.md` for complete agent documentation. --- @@ -529,8 +547,9 @@ See `generated-agents/claude-md-guardian-README.md` for complete agent documenta - **Documentation**: See [SKILL.md](SKILL.md) for complete documentation - **Examples**: See [HOW_TO_USE.md](HOW_TO_USE.md) for usage examples -- **Companion Agent**: See `../../generated-agents/claude-md-guardian-README.md` -- **Slash Command**: See `../../generated-commands/enhance-claude-md/README.md` +- **Companion Agent**: See [../agent/README.md](../agent/README.md) +- **Slash Command**: See [../command/README.md](../command/README.md) +- **Migration Guide**: See [../docs/MIGRATION_V2.md](../docs/MIGRATION_V2.md) - **Issues**: Report bugs in the main repository - **Community**: Share your CLAUDE.md setups and best practices diff --git a/skill/examples/README.md b/skill/examples/README.md index d5c203d..efe14b2 100644 --- a/skill/examples/README.md +++ b/skill/examples/README.md @@ -2,7 +2,9 @@ This folder contains reference implementations of CLAUDE.md files for different project types and team sizes. -**✨ NEW**: All examples now follow **100% native Claude Code format** with proper project structure diagrams, setup instructions, architecture sections, and file structure explanations - matching the official `/update-claude-md` slash command format. +**✨ v2.0.0 Update**: All examples now follow **100% native Claude Code format** with proper project structure diagrams, setup instructions, architecture sections, and file structure explanations - matching the official `/update-claude-md` slash command format. + +**New in v2.0.0**: Examples demonstrate modern `permissions:` syntax for skills and agents, replacing deprecated `tools:` configurations. ## Available Examples @@ -59,16 +61,18 @@ cp examples/modular-backend-CLAUDE.md /path/to/your/project/backend/CLAUDE.md cp examples/modular-frontend-CLAUDE.md /path/to/your/project/frontend/CLAUDE.md ``` -### 3. Using with claude-md-enhancer Skill +### 3. Using with claudeforge-skill These examples demonstrate the output quality you can expect from the skill: ``` -Hey Claude—I just added the "claude-md-enhancer" skill. +Hey Claude—I just added the "claudeforge-skill". Can you create a CLAUDE.md similar to the core-small-team example but customized for my Go API project? ``` +**v2.0.0**: The skill now uses `permissions:` syntax for secure tool access control. + ## Template Selection Guide ### Choose Minimal Template When: @@ -114,6 +118,8 @@ All examples now include these **native Claude Code sections**: **Why This Matters**: These sections match the official `/update-claude-md` slash command format, ensuring Claude Code can navigate and understand your codebase efficiently. +**v2.0.0 Compatibility**: All examples are compatible with Claude Code 2.1.4+ and use modern permission syntax where applicable. + ### Expected Quality Scores | Example | Quality Score | @@ -132,7 +138,22 @@ All examples now include these **native Claude Code sections**: 3. **Add Team Standards**: Include team-specific conventions 4. **Update Commands**: Replace commands with your actual npm/yarn/poetry scripts 5. **Add Context**: Include project-specific context that helps Claude understand your goals +6. **v2.0.0**: Use `permissions:` syntax in skills/agents instead of deprecated `tools:` or `allowed-tools:` ## Contributing -These examples represent best practices as of November 2025. If you have improvements or additional examples, please contribute them! +These examples represent best practices as of January 2026. If you have improvements or additional examples, please contribute them! + +## Version + +- **Version**: 2.0.0 +- **Last Updated**: January 2026 +- **Compatible**: Claude Code 2.1.4+ +- **Migration Guide**: See [../../docs/MIGRATION_V2.md](../../docs/MIGRATION_V2.md) for upgrade instructions + +## Related Documentation + +- **Skill Documentation**: [../README.md](../README.md) +- **Agent Documentation**: [../../agent/README.md](../../agent/README.md) +- **Command Documentation**: [../../command/README.md](../../command/README.md) +- **Migration Guide**: [../../docs/MIGRATION_V2.md](../../docs/MIGRATION_V2.md)