Intelligent command verification for documentation. Discovers all commands in markdown files, validates them using git diff-based cache invalidation, and ensures documentation accuracy with zero token cost after initial setup.
β Zero-token operation - Base system uses only git + file operations β Git diff-based caching - Only revalidates what actually changed β Intelligent invalidation - package.json changed? Revalidate npm commands β Safe by design - Never auto-executes dangerous commands β Fast - < 1s for typical runs with cache β Complete - Finds every command in every .md file
β Cross-platform - Works on Windows, macOS, and Linux with platform-aware command detection
-
Install dependencies:
npm install
-
Run verification:
npm run verify
-
View detailed statistics:
npm run verify:stats
-
Force full validation:
npm run verify:force
When using this skill in Claude Code, you have access to these slash commands:
Verify all commands in markdown documentation with intelligent caching.
What it does:
- Discovers all commands in markdown files
- Uses git diff-based cache invalidation
- Only revalidates commands affected by recent changes
- Provides cache hit rate statistics
Example output:
β Discovered 23 unique commands
β Cache hit rate: 91.3% (21/23 from cache)
β Validated 2 new/changed commands
Force full command verification, bypassing the cache entirely.
What it does:
- Clears the validation cache
- Revalidates ALL commands from scratch
- Useful for debugging or after major changes
- Establishes fresh baseline
Use when:
- Cache may be corrupted or stale
- After bulk documentation updates
- Debugging cache invalidation issues
- Need to verify validation logic changes
Show detailed verification statistics and cache performance metrics.
What it provides:
- Cache Performance: Hit rates, last validation commit, cache size
- Command Distribution: Breakdown by category (safe/conditional/dangerous)
- System Availability: Which commands are installed vs unavailable
- Invalidation Analysis: Files changed, commands affected by changes
Example insights:
Cache Performance:
- 46 cached commands
- 95.7% hit rate
- Cache size: 42KB
Command Distribution:
- Safe: 32 (69.6%)
- Conditional: 10 (21.7%)
- Dangerous: 4 (8.7%)
The command-executor plugin can be installed and distributed through Claude Code's marketplace system.
If this repository is added as a marketplace, you can install the command-executor plugin:
# Add the marketplace (one-time setup)
/plugin marketplace add https://codeberg.org/d-oit/markdown-command-verifier
# Install the plugin
/plugin install command-executor
# List available plugins
/plugin marketplace listFor development or when working within this repository:
# The plugin is already available in ./command-executor/
# Claude Code will auto-detect it if the repository is trustedCopy the plugin directory to your Claude Code plugins location:
# Copy to personal plugins directory
cp -r command-executor ~/.claude/plugins/
# Or to project plugins
cp -r command-executor .claude/plugins/To automatically install for team members, add to .claude/settings.json:
{
"extraKnownMarketplaces": [
"https://codeberg.org/d-oit/markdown-command-verifier"
]
}When team members trust the repository folder, plugins from configured marketplaces will be available automatically.
Check if the plugin is loaded:
/plugin listYou should see command-executor in the list of installed plugins.
The skill includes an auto-updating knowledge base that learns from corrections and adapts to your project.
When you tell Claude about a mistake, it:
- Learns - Updates
.claude/knowledge.jsonwith the correction - Applies - Fixes all affected files automatically
- Remembers - Uses the correction in future verifications
You: "claude-code is wrong, it should just be claude"
Claude:
β Learned: CLI name is "claude" not "claude-code"
β Updated knowledge base
β Fixed 2 references in README.md
β Added to learning log
CLI Name Corrections:
- Wrong command names β Correct names
- Automatically applied to all documentation
Command Patterns:
- New command types discovered in your project
- Custom validation rules
- Project-specific safety categories
File Invalidation Rules:
- Which file changes should trigger revalidation
- Learned from patterns in your workflow
.claude/knowledge.json - A simple JSON file that stores:
- Corrections learned from user feedback
- Project-specific command patterns
- Custom validation rules
- Learning history with timestamps
This system works everywhere, not just in Claude Code:
- Plain JSON format (no proprietary formats)
- Can be copied to any project
- No external dependencies
- Auto-updates based on user corrections
- Human-readable and editable
You can also edit .claude/knowledge.json directly to teach the skill:
{
"corrections": {
"cliNames": {
"old-cli-name": {
"correct": "new-cli-name",
"reason": "Project renamed the CLI"
}
}
},
"patterns": {
"commandPrefixes": ["npm", "git", "your-custom-cli"]
},
"validationRules": {
"skip": {
"patterns": ["^/my-slash-command$"],
"reason": "Documentation examples that aren't real system commands"
},
"safe": {
"patterns": ["^my-cli run test$"],
"exactMatches": []
}
}
}The knowledge base is automatically loaded by the verification script:
- At startup: Loads
.claude/knowledge.json - During validation: Checks knowledge base BEFORE hardcoded patterns
- Priority: Knowledge base rules take precedence over defaults
- Merge strategy: Supplements hardcoded patterns, doesn't replace them
Categories:
safe- Commands that can be auto-executedconditional- Commands that need user confirmationdangerous- Commands that should never auto-executeskip- Documentation examples (not real commands)
Result:
π§ Loaded knowledge base from .claude/knowledge.json
π Command breakdown:
β 13 safe commands
β οΈ 11 conditional commands
β 3 dangerous commands
β 2 unknown commands
βοΈ 6 skipped (documentation examples)
Skipped commands (like /verify, claude-code, drop database) are recognized as documentation examples and excluded from "not available" warnings.
- Type: Project Skill (
.claude/skills/command-verify/SKILL.md) - Purpose: Core validation logic for discovering and validating commands
- Token Usage: 0 tokens
- Coverage: 90% of commands
- When to use: Always, for documentation verification
- Availability: Automatically available to all team members
- Type: Claude Code Plugin (
command-executor/.claude-plugin/plugin.json) - Purpose: Actually run safe commands and capture output
- Token Usage: 0 tokens
- Coverage: 100% (with confirmation)
- When to use: Before releases, to ensure commands work
- Distribution: Can be shared via marketplace or direct installation
- Components: Includes the
command-executorskill
- Type: Agent (
.claude/agents/command-analyzer.md) - Purpose: Deep analysis for ambiguous commands using LLM reasoning
- Token Usage: ~1,200 tokens per analysis
- Coverage: 99% of commands
- When to use: Invoked automatically by command-verify when deterministic rules aren't sufficient
- Model: Uses Haiku for cost-efficient analysis
User: "verify commands"
β
Skill discovers and validates (0 tokens)
β
90% commands: deterministic rules (0 tokens)
10% commands: might invoke sub-agent (~1200 tokens)
User: "verify and execute commands"
β
Skill + Plugin (0 tokens)
β
Safe commands executed with output capture
npm run verifyOutput:
π Universal Command Verifier
π PHASE 1: Command Discovery
π Found 5 markdown files
β Discovered 23 unique commands
π PHASE 2: Cache Analysis
βΉοΈ Changed files: 2
π Analyzing README.md...
β npm install - mentioned in changed file
β npm run dev - mentioned in changed file
π― 2 commands need revalidation
β
PHASE 3: Validation
β Validated 2 commands
π PHASE 4: Summary
Total: 23 commands
Cache hit rate: 91.3% (21/23 from cache)
Token usage: 0
Time: 1.2s
# This would invoke the command-executor plugin
claude "verify and execute safe commands"# This might invoke command-analyzer for ambiguous commands
claude "verify commands and explain any ambiguous ones"The system finds commands in multiple formats:
npm run build
npm run testUse npm run dev to start development.
npm install
npm run lint
| File Changed | Commands Revalidated |
|---|---|
*.md |
Commands in that file |
package.json |
All npm/yarn/pnpm commands |
tsconfig.json |
Build/test/typecheck commands |
Cargo.toml |
All cargo commands |
requirements.txt |
All pip/python commands |
src/** |
Test commands |
- First run: 0% (validates all)
- Typical runs: 90%+ (only changed commands)
- No changes: 100% (all from cache)
# .github/workflows/verify-docs.yml
name: Verify Documentation
on:
pull_request:
paths:
- '**.md'
- 'package.json'
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm run verify# Install husky
npm install -D husky
npx husky install
# Add hooks
npx husky add .husky/pre-commit "npm run verify"
npx husky add .husky/pre-push "npm run verify"{
"scripts": {
"verify": "node scripts/verify-commands.js",
"verify:force": "node scripts/verify-commands.js --force",
"verify:stats": "node scripts/verify-commands.js --stats",
"prerelease": "npm run verify",
"prepush": "npm run verify"
}
}Edit scripts/verify-commands.js:
// Add your command prefixes
const COMMAND_PREFIXES = [
'npm', 'yarn', 'pnpm', 'node', 'npx',
'python', 'pip', 'cargo', 'go', 'docker',
// Add yours:
'your-cli', 'custom-tool'
];// In analyzeImpact function
const invalidationRules = [
// ... existing rules ...
// Add your custom rules
{
pattern: /^Dockerfile$/,
action: (file, commands) => {
for (const cmd of commands) {
if (cmd.command.startsWith('docker ')) {
affectedCommands.add(cmd.command);
}
}
}
}
];Problem: Commands in code blocks without language hints
Solution: Add language hints
β Bad:npm run build
β
Good:
```bash
npm run build
### Issue: Too many false positives
**Problem:** Commands invalidated unnecessarily
**Solution:** Fine-tune invalidation rules or use `--force` occasionally
### Issue: Not a git repository
**Solution:** Works, but treats as first run (validates all)
### Issue: Cache corrupted
**Solution:** Clear cache
```bash
npm run clean:cache
npm run verify
project/
βββ .claude/
β βββ commands/ # Slash commands
β β βββ verify.md # /verify command
β β βββ verify-force.md # /verify-force command
β β βββ verify-stats.md # /verify-stats command
β βββ skills/ # Project skills
β β βββ command-verify/
β β β βββ SKILL.md # Core verification skill
β β βββ test-skill/
β β βββ SKILL.md # Test/demo skill
β βββ agents/ # Sub-agents
β β βββ command-analyzer.md # LLM-based command analyzer
β βββ plugins/ # Plugin references (if any)
β βββ knowledge.json # π§ Self-learning knowledge base
β βββ settings.local.json # Local settings & permissions
β
βββ .claude-plugin/ # Marketplace distribution
β βββ marketplace.json # Plugin marketplace catalog
β
βββ command-executor/ # Distributable plugin
β βββ .claude-plugin/
β β βββ plugin.json # Plugin manifest
β βββ skills/
β β βββ command-executor/
β β βββ SKILL.md # Execution skill
β βββ README.md # Plugin documentation
β
βββ scripts/
β βββ verify-commands.js # Main verification implementation
β
βββ .cache/
β βββ command-validations/
β βββ last-validation-commit.txt
β βββ commands/ # Per-command cache
β βββ npm-run-build.json
β βββ ...
β
βββ package.json # Dependencies & scripts
βββ README.md # This file
# Test discovery
npm run verify
# Test with force
npm run verify:force
# Check cache
ls -la .cache/command-validations/- Add to
COMMAND_PREFIXESinverify-commands.js - Add invalidation rules in
analyzeImpact - Test with
npm run verify
- The system is designed to be extensible
- Add new patterns to categorization rules
- Test thoroughly before committing
For issues:
- Check troubleshooting section
- Inspect cache in
.cache/command-validations/ - Review skill definitions in
.claude/ - Check git diff:
git diff $(cat .cache/command-validations/last-validation-commit.txt) HEAD
MIT - See package.json for details