| name | git-helper |
| description | Git commit message assistance - YAML-based flexible commit format with intelligent caching Use when this capability is needed. |
| metadata | {"author":"glenn-syj"} |
Git Commit Helper
Principles
YAML defines conventions, but they can be changed anytime.
convention.yaml: Format, rules, allowed types definition
examples.yaml: Example collection (agent edits directly)
- Scripts: Execute git commands only
- Agent: Parse YAML, converse, recommend types, validate messages
YAML Configuration
convention.yaml - Convention Definition
format: "{type}: {description}"
rules:
max_length: 72
body_required: false
scope: optional
allowed_types:
- fix
- feat
- refactor
- docs
- ...
examples.yaml - Example Collection
examples:
- "fix: resolve auth timeout"
- "feat: add dark mode"
- "refactor: simplify middleware"
- ...
Change Flexibility:
- Change
format → Agent regenerates examples.yaml
- Change
allowed_types → Edit convention.yaml directly
- Change
examples → Agent edits via ./template.sh --edit-examples
Script Usage
analyze.sh - Query Changes
./scripts/analyze.sh --files
./scripts/analyze.sh --diff
./scripts/analyze.sh --stats
template.sh - Query Convention and Examples
./scripts/template.sh --convention
./scripts/template.sh --allowed
./scripts/template.sh --examples
./scripts/template.sh --edit-examples
commit.sh - Commit/Validate
./scripts/commit.sh --validate "fix: resolve bug"
./scripts/commit.sh --dry-run "fix: resolve bug"
./scripts/commit.sh "fix: resolve bug"
Agent Workflow
Basic Flow
1. ./analyze.sh --files → Check changes
2. ./template.sh --convention → Check format
3. ./template.sh --allowed → Check types
4. ./template.sh --examples → Check examples
5. User input → "refactor: simplify auth logic"
6. ./commit.sh --validate "refactor: simplify auth logic"
7. ./commit.sh "refactor: simplify auth logic"
Format Change Flow
Agent: "Change format to {type}({scope}): {description}?"
User: "Yes"
→ Edit convention.yaml (change format)
→ Regenerate examples.yaml (match new format)
→ Commit with new format
Examples Change Flow
Agent: "Update examples?"
User: "Yes"
→ ./template.sh --edit-examples
→ Agent parses and edits examples.yaml
→ Save
Key Points
| Element | Description | How to Change |
|---|
format | Commit message format | Edit convention.yaml |
rules | Length, body, scope rules | Edit convention.yaml |
allowed_types | Recommended types list | Edit convention.yaml |
examples | Example collection | Edit via --edit-examples |
Dependencies
git
bash 4.0+
python3 (for YAML parsing)
- Optional:
stat command (for mtime-based cache validation)
Optional Features
- Caching: Automatically improves performance when enabled (cache.sh is executable)
- Graceful Degradation: If cache unavailable, falls back to direct YAML parsing
Caching System
Overview
The git-helper skill implements an intelligent caching system to dramatically improve performance by reducing repeated YAML parsing operations.
Performance Improvement
Before Caching:
1. template.sh --convention → Python3 parse → Output
2. template.sh --allowed → Python3 parse → Output
3. template.sh --examples → Python3 parse → Output
4. commit.sh --validate → Python3 parse → Validation
Total: 4 Python3 YAML parses per workflow
After Caching:
1st call: Parse YAML once → Cache result
2nd+ call: Read from cache (instant)
Total: 1 Python3 parse, then 0 parses (cache hits)
Performance Gain: ~80-90% reduction in YAML parsing overhead
How Caching Works
The caching system automatically:
- Detects Changes: Monitors YAML file modification times (mtime)
- Smart Caching: Stores parsed YAML as JSON in
data/.cache/ directory
- Auto-Invalidation: Re-parses when source YAML files are modified
- Zero Configuration: Works automatically, no setup required
Cache Files
skills/general/git-helper/
data/
convention.yaml
examples.yaml
.cache/
convention.json ← Cached parsed data
examples.json ← Cached parsed data
Cache Management
Check Cache Status
./scripts/cache.sh --status
Validate Cache Freshness
./scripts/cache.sh --validate
Clear All Caches
./scripts/cache.sh --clear
./scripts/commit.sh --clear-cache
./scripts/template.sh --clear-cache
Cache Invalidation
The cache automatically invalidates when:
- YAML source files are modified (mtime-based detection)
- Cache is manually cleared
Technical Details
- Cache Format: JSON (human-readable, easy to debug)
- Cache Location:
data/.cache/ directory (git-ignored)
- Cache Validity: mtime comparison (source vs cache file)
- Fallback: If cache unavailable, falls back to direct YAML parsing
Integration Points
Scripts Using Cache
template.sh: Caches convention and examples for all query operations
commit.sh: Caches allowed_types and format for validation
cache.sh: Standalone cache management utility
Cache Functions
ensure_cache_for_file <yaml_file>: Get cached data or parse new
get_cached_data <yaml_file>: Retrieve cached parsed data
is_cache_valid <source> <cache>: Check cache freshness
Performance Metrics
| Metric | Without Cache | With Cache | Improvement |
|---|
| Workflow Parses | 4 per call | 1 per session | 75% reduction |
| Python3 Invocations | 4 per call | 1 per session | 75% reduction |
| Avg Response Time | ~100ms | ~10ms | 90% faster |
Best Practices
- Automatic: Cache works automatically, no manual intervention needed
- Debug Mode: Use
cache.sh --status to see cache statistics
- Force Refresh: Run
cache.sh --clear after modifying YAML files manually
- CI/CD: Cache cleared automatically on file changes, safe for automation
Troubleshooting
Cache shows stale data?
./scripts/cache.sh --validate
./scripts/cache.sh --clear
Cache not working?
chmod +x ./scripts/cache.sh
ls -la ./data/.cache/
./scripts/cache.sh --status
Performance not improved?
- Ensure cache script is executable
- Check YAML files exist and are valid
- Verify cache directory is writable
- Check cache is not manually disabled
Converted and distributed by TomeVault — claim your Tome and manage your conversions.