Git Workflow
This skill enforces standardized git practices for the MIRA project's dual-repository workflow, requiring explicit user permission before any commit and providing a structured commit message format with mandatory sections (CONTEXT, APPROACH, CHANGES). Use it whenever preparing git operations in MIRA to ensure proper staging procedures, prevent accidental commits, and maintain consistent documentation while managing synchronization between the private origin repository and public OSS fork.
git clone --depth 1 https://github.com/taylorsatula/mira-OSS /tmp/git-workflow && cp -r /tmp/git-workflow/.claude/skills/git-workflow ~/.claude/skills/git-workflowSKILL.md
# Git Workflow - MIRA Standards Expert guidance for git operations in the MIRA project, emphasizing clear commit messages and proper staging practices. ## 🎯 Purpose This skill provides git workflow standards for the MIRA project: - Streamlined commit message format (CONTEXT → INSIGHT → APPROACH → CHANGES) - Safe staging practices to prevent accidental commits - Post-commit summary requirements ## 🔀 OSS Sync Workflow ### MANDATORY: Ask Before Every Commit MIRA maintains two repositories (`origin` = private, `oss` = public OSS). **Before EVERY commit, you MUST ask:** > "Sync to **OSS** after this commit?" The repos have divergent codebases, so syncing requires running makeoss.sh: - **Yes** → After commit: `./makeoss.sh` (auto-commits to OSS with same message) - **No** → Just push to origin as normal ## ⚙️ Git Staging Rules ### Critical Staging Protocol - **DO NOT attempt to commit unless the user explicitly tells you to** - **NEVER use `git add -A` or `git add .` without explicit permission** - Always review changes before staging - Stage specific files intentionally - Verify what you're committing with `git status` and `git diff` ### Safe Staging Pattern ```bash # Review what changed git status git diff # Stage specific files only git add path/to/file1.py path/to/file2.py # Verify staged changes git diff --cached ``` ## 📝 Git Commit Format ### CRITICAL: Syntax Rules **Use literal newlines in quotes, NEVER HEREDOC** ```bash # ✅ CORRECT - Use literal newlines git commit -m "prefix: summary CONTEXT: What triggered this work" # ❌ WRONG - NEVER use HEREDOC (causes shell EOF errors) git commit -m "$(cat <<'EOF' Message here EOF )" ``` ### Commit Template ```bash git commit -m "prefix: summary (50 chars max) CONTEXT: [What situation triggered this work - symptom, user report, or need] INSIGHT: (optional - skip if obvious) [The key realization: root cause for bugs, design decision for features] APPROACH: [Why this solution over alternatives, trade-offs considered] CHANGES: - Specific modifications with file names IMPACT: (only when notable - skip if none) - Breaking/Security/Performance notes PRESERVES: (for refactors only) - What behavior is unchanged 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>" ``` ### Section Guide | Section | Required? | When to Use | |---------|-----------|-------------| | CONTEXT | Always | The trigger - what situation led to this commit | | INSIGHT | Optional | The "aha" moment - root cause for bugs, key design decision for features. **Skip if obvious.** | | APPROACH | Always | Why this solution, what alternatives considered | | CHANGES | Always | Specific file/method modifications | | IMPACT | Optional | Only when there's actual impact (breaking, security, perf metrics) | | PRESERVES | Refactors | What existing behavior remains unchanged | ### Semantic Prefixes - `feat:` - New feature or functionality - `fix:` - Bug fix or error correction - `refactor:` - Code restructuring without functional changes - `perf:` - Performance improvements - `security:` - Security-related changes - `test:` - Adding or modifying tests - `docs:` - Documentation updates - `chore:` - Maintenance tasks, dependency updates - `style:` - Code formatting, whitespace fixes - `revert:` - Reverting previous commits **Remember**: Commit messages are permanent documentation. Write for developers searching git history months from now. ## 📊 Post-Commit Summary (Required) After **every commit**, provide a detailed summary: ``` ✅ Commit Successfully Created Commit Hash: abc123def Files Changed: 3 files (+45, -12) Key Accomplishments: - [Specific achievement 1] - [Specific achievement 2] - [Specific achievement 3] Benefits: - [How this improves the codebase] - [What problems this solves] Next Steps: - [What the human should consider next] - [Any follow-up work needed] ``` ## 🚫 Critical Anti-Patterns ### Git Commit HEREDOC (Recurring Issue) This is a **persistent mistake** that causes shell EOF errors: ```bash # ❌ NEVER DO THIS git commit -m "$(cat <<'EOF' Message here EOF )" # ✅ ALWAYS DO THIS git commit -m "Summary Details with literal newlines" ``` **Why this matters**: HEREDOC syntax in git commits causes shell parsing errors and breaks the commit flow. Always use literal newlines within quotes. ## 🔍 Example Commits ### Bug Fix (with INSIGHT) ```bash git commit -m "fix: preload Vault secrets at startup CONTEXT: Users reported Gemini/OpenRouter failing while Anthropic worked. After ~1hr uptime, requests for uncached secrets returned 403 Forbidden. INSIGHT: AppRole token has 1-hour TTL. Secrets cached on first access work forever. Keys first accessed after expiry trigger calls with dead token - Anthropic was cached early, OpenRouter wasn't. APPROACH: Preload ALL secrets at startup while token is fresh. Security-equivalent since secrets end up in memory anyway. Simpler than token refresh, no race conditions, no failure modes. CHANGES: - Added preload_secrets() to vault_client.py - Called in main.py lifespan startup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>" ``` ### Simple Feature (no INSIGHT needed) ```bash git commit -m "feat: add root endpoint with service status CONTEXT: User curling localhost:1993 during install got 404, thought install failed. APPROACH: Informational endpoint confirming service is running with pointers to /v0/api/chat and /v0/api/health. No auth - just service discovery. CHANGES: - Added GET / endpoint in create_app() 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>" ``` ### Refactor (with PRESERVES) ```bash git commit -m "refactor: split monolithic deploy.sh into modules CONTEXT: deploy.sh grew to 2,416 lines / 17 steps - cognitive overload, merge conflicts, impossible to debug individual steps. APPROACH: Library files (shared functions) + step sc
Use this agent when you need to rename classes, methods, functions, or variables in code files to align with specific naming requirements or conventions. Examples: <example>Context: User wants to clean up function names by removing a specific prefix. user: 'Please remove the prefix get_ from all function names in this file' assistant: 'I'll use the code-renamer agent to systematically rename all functions by removing the get_ prefix' <commentary>The user wants systematic renaming of functions, which is exactly what the code-renamer agent is designed for.</commentary></example> <example>Context: User wants to standardize method naming conventions. user: 'Can you rename all the camelCase methods to snake_case in this class?' assistant: 'I'll use the code-renamer agent to convert all camelCase method names to snake_case convention' <commentary>This is a systematic renaming task that requires careful attention to naming conventions.</commentary></example>
Use this agent when the user makes offhanded comments, rhetorical questions, or expresses wishes about understanding something better. Trigger on patterns like:\n\n<example>\nContext: User is reviewing code and sees an assistant's explanation about how a function works.\nuser: "Can you believe this? Is this even right?"\nassistant: "Let me use the investigative-sidekick agent to verify if that explanation is accurate."\n<task tool_call to investigative-sidekick with context about what needs verification>\n</example>\n\n<example>\nContext: User is debugging and expresses frustration.\nuser: "I wish I could figure out what's causing this memory leak in the session handler"\nassistant: "I'll use the investigative-sidekick agent to investigate the root cause of that memory leak."\n<task tool_call to investigative-sidekick with the specific problem to investigate>\n</example>\n\n<example>\nContext: User reads a commit message claiming a performance improvement.\nuser: "Did this actually make things faster though?"\nassistant: "Let me launch the investigative-sidekick agent to verify that performance claim."\n<task tool_call to investigative-sidekick to fact-check the performance assertion>\n</example>\n\n<example>\nContext: User is reviewing documentation that seems questionable.\nuser: "This doesn't seem right - are we really supposed to use sync calls in async contexts?"\nassistant: "I'm going to use the investigative-sidekick agent to investigate whether that's actually correct."\n<task tool_call to investigative-sidekick to verify the technical claim>\n</example>\n\nActivate proactively when the user:\n- Questions accuracy or truthfulness ("Can you believe...", "Is this right?", "Really?")\n- Expresses wishes about understanding ("I wish I could figure out...", "I'd love to know...")\n- Shows skepticism ("Did this actually...", "Does this really...")\n- Makes rhetorical questions that imply investigation ("What's causing...", "Why is this...")\n- Doubts explanations or documentation they're reading
Control thinking token limits via environment variable
Run complete two-agent validation on module+tests (contract extraction + test validation). Binary pass/fail with specific issues.
Check Python logging levels and patterns for correctness. Focus on identifying wrong severity levels and missing exception handling. Use when reviewing code quality.
Detect explicit user_id parameters in functions to identify potential opportunities for using ambient context. This is an investigation tool that flags instances for human review, not a prescriptive analyzer.
Eliminate component hedging anti-patterns that mask infrastructure failures. Build systems that fail loudly when broken instead of limping along in degraded states. Critical for production reliability and operational visibility.