@phuc1403/musketeer 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +49 -49
  2. package/manifest.json +333 -301
  3. package/package.json +1 -1
  4. package/template/.claude/agents/code-reviewer.md +182 -166
  5. package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
  6. package/template/.claude/hooks/lib/colors.cjs +180 -122
  7. package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
  8. package/template/.claude/skills/code-review/SKILL.md +201 -54
  9. package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
  10. package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
  11. package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
  12. package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
  13. package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
  14. package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
  15. package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
  16. package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
  17. package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
  18. package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
  19. package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
  20. package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
  21. package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
  22. package/template/.claude/skills/git/SKILL.md +131 -115
  23. package/template/.claude/skills/git/references/branch-management.md +88 -88
  24. package/template/.claude/skills/git/references/commit-standards.md +46 -46
  25. package/template/.claude/skills/git/references/context-efficiency.md +54 -0
  26. package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
  27. package/template/.claude/skills/git/references/safety-protocols.md +69 -69
  28. package/template/.claude/skills/git/references/workflow-commit.md +58 -58
  29. package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
  30. package/template/.claude/skills/git/references/workflow-merge.md +48 -48
  31. package/template/.claude/skills/git/references/workflow-pr.md +58 -58
  32. package/template/.claude/skills/git/references/workflow-push.md +52 -52
  33. package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
  34. package/template/.claude/skills/skill-creator/SKILL.md +154 -149
  35. package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
  36. package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
  37. package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
  38. package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
  39. package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
  40. package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
  41. package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
  42. package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
  43. package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
  44. package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
  45. package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
  46. package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
  47. package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
  48. package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
  49. package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
  50. package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
  51. package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
  52. package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
  53. package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
  54. package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
  55. package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
  56. package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
  57. package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
  58. package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
  59. package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
  60. package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
  61. package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
  62. package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
  63. package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
  64. package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
  65. package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
  66. package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
  67. package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
  68. package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
  69. package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
  70. package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
  71. package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
  72. package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
  73. package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
  74. package/template/.claude/statusline.cjs +0 -0
  75. package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
  76. /package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +0 -0
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: spec-compliance-review
3
+ description: First-pass review checking implementation matches spec/plan requirements before quality review
4
+ ---
5
+
6
+ # Spec Compliance Review
7
+
8
+ ## Purpose
9
+
10
+ Verify implementation matches what was requested BEFORE evaluating code quality.
11
+ Well-written code that doesn't match requirements is still wrong.
12
+
13
+ ## When to Use
14
+
15
+ - After implementing features from a plan
16
+ - Before code quality review pass
17
+ - When plan/spec exists for the work being reviewed
18
+
19
+ ## Process
20
+
21
+ 1. **Load spec/plan** — Read the plan.md or phase file that defined this work
22
+ 2. **List requirements** — Extract every requirement, acceptance criterion
23
+ 3. **Check each requirement** against actual implementation:
24
+ - Present? → PASS
25
+ - Missing? → MISSING (must fix before quality review)
26
+ - Extra (not in spec)? → EXTRA (flag for removal unless justified)
27
+ 4. **Verdict:**
28
+ - All requirements met, no unjustified extras → PASS → proceed to quality review
29
+ - Missing requirements → FAIL → implementer fixes → re-review
30
+ - Unjustified extras → WARN → discuss with user
31
+
32
+ ## Checklist Template
33
+
34
+ | # | Requirement | Status | Notes |
35
+ |---|-------------|--------|-------|
36
+ | 1 | [from spec] | PASS/MISSING/EXTRA | [evidence] |
37
+
38
+ ## Red Flags
39
+
40
+ - Skipping spec review because "code looks good"
41
+ - Accepting extra features without spec justification
42
+ - Treating spec review as optional
43
+ - Reviewing code quality before confirming spec compliance
@@ -0,0 +1,140 @@
1
+ # Review Task Management Patterns
2
+
3
+ Track review pipeline execution via Claude Native Tasks (TaskCreate, TaskUpdate, TaskList).
4
+
5
+ ## When to Create Tasks
6
+
7
+ | Review Scope | Tasks? | Rationale |
8
+ |--------------|--------|-----------|
9
+ | Single-file fix | No | Scout + review + done, overhead not worth it |
10
+ | Multi-file feature (3+ files) | Yes | Track scout → review → fix → verify chain |
11
+ | Parallel reviewers (2+ scopes) | Yes | Coordinate independent reviews |
12
+ | Review cycle with Critical fixes | Yes | Dependencies between fix → re-verify |
13
+
14
+ **3-Task Rule:** Skip task creation when review pipeline has <3 meaningful steps.
15
+
16
+ ## Review Pipeline as Tasks
17
+
18
+ ```
19
+ TaskCreate: "Scout edge cases" → pending
20
+ TaskCreate: "Review implementation" → pending, blockedBy: [scout]
21
+ TaskCreate: "Fix critical issues" → pending, blockedBy: [review]
22
+ TaskCreate: "Verify fixes pass" → pending, blockedBy: [fix]
23
+ ```
24
+
25
+ Dependency chain auto-unblocks: scout → review → fix → verify.
26
+
27
+ ## Task Schemas
28
+
29
+ ### Scout Task
30
+
31
+ ```
32
+ TaskCreate(
33
+ subject: "Scout edge cases for {feature}",
34
+ activeForm: "Scouting edge cases",
35
+ description: "Identify affected files, data flows, boundary conditions. Changed: {files}",
36
+ metadata: { reviewStage: "scout", feature: "{feature}",
37
+ changedFiles: "src/auth.ts,src/middleware.ts",
38
+ priority: "P2", effort: "3m" }
39
+ )
40
+ ```
41
+
42
+ ### Review Task
43
+
44
+ ```
45
+ TaskCreate(
46
+ subject: "Review {feature} implementation",
47
+ activeForm: "Reviewing {feature}",
48
+ description: "Code-reviewer subagent reviews {BASE_SHA}..{HEAD_SHA}. Plan: {plan_ref}",
49
+ metadata: { reviewStage: "review", feature: "{feature}",
50
+ baseSha: "{BASE_SHA}", headSha: "{HEAD_SHA}",
51
+ priority: "P1", effort: "10m" },
52
+ addBlockedBy: ["{scout-task-id}"]
53
+ )
54
+ ```
55
+
56
+ ### Fix Task (created after review finds issues)
57
+
58
+ ```
59
+ TaskCreate(
60
+ subject: "Fix {severity} issues from review",
61
+ activeForm: "Fixing {severity} review issues",
62
+ description: "Address: {issue_list}",
63
+ metadata: { reviewStage: "fix", severity: "critical",
64
+ issueCount: 3, priority: "P1", effort: "15m" },
65
+ addBlockedBy: ["{review-task-id}"]
66
+ )
67
+ ```
68
+
69
+ ### Verify Task
70
+
71
+ ```
72
+ TaskCreate(
73
+ subject: "Verify fixes pass tests and build",
74
+ activeForm: "Verifying fixes",
75
+ description: "Run test suite, build, confirm 0 failures. Evidence before claims.",
76
+ metadata: { reviewStage: "verify", priority: "P1", effort: "5m" },
77
+ addBlockedBy: ["{fix-task-id}"]
78
+ )
79
+ ```
80
+
81
+ ## Parallel Review Coordination
82
+
83
+ For multi-scope reviews (e.g., backend + frontend changed independently):
84
+
85
+ ```
86
+ // Create scoped review tasks — no blockedBy between them
87
+ TaskCreate(subject: "Review backend auth changes",
88
+ metadata: { reviewStage: "review", scope: "src/api/,src/middleware/",
89
+ agentIndex: 1, totalAgents: 2, priority: "P1" })
90
+
91
+ TaskCreate(subject: "Review frontend auth UI",
92
+ metadata: { reviewStage: "review", scope: "src/components/auth/",
93
+ agentIndex: 2, totalAgents: 2, priority: "P1" })
94
+
95
+ // Both run simultaneously via separate code-reviewer subagents
96
+ // Fix task blocks on BOTH completing:
97
+ TaskCreate(subject: "Fix all review issues",
98
+ addBlockedBy: ["{backend-review-id}", "{frontend-review-id}"])
99
+ ```
100
+
101
+ ## Task Lifecycle
102
+
103
+ ```
104
+ Scout: pending → in_progress → completed (scout report returned)
105
+ Review: pending → in_progress → completed (reviewer findings returned)
106
+ Fix: pending → in_progress → completed (all Critical/Important fixed)
107
+ Verify: pending → in_progress → completed (tests pass, build clean)
108
+ ```
109
+
110
+ ### Handling Re-Reviews
111
+
112
+ When fixes introduce new issues → create new review cycle:
113
+
114
+ ```
115
+ TaskCreate(subject: "Re-review after fixes",
116
+ addBlockedBy: ["{fix-task-id}"],
117
+ metadata: { reviewStage: "review", cycle: 2, priority: "P1" })
118
+ ```
119
+
120
+ Limit to 3 cycles. If still failing after cycle 3 → escalate to user.
121
+
122
+ ## Integration with Planning Tasks
123
+
124
+ Review tasks are **separate from** cook/planning phase tasks.
125
+
126
+ **When cook spawns review:**
127
+ 1. Cook completes implementation phase → creates review pipeline tasks
128
+ 2. Review pipeline executes (scout → review → fix → verify)
129
+ 3. All review tasks complete → cook marks phase as reviewed
130
+ 4. Cook proceeds to next phase
131
+
132
+ Review tasks reference the phase but don't block it directly — the orchestrator manages handoff.
133
+
134
+ ## Quality Check
135
+
136
+ After pipeline registration: `Registered [N] review tasks (scout → review → fix → verify chain)`
137
+
138
+ ## Error Handling
139
+
140
+ If `TaskCreate` fails: log warning, fall back to sequential review without task tracking. Review pipeline functions identically — tasks add visibility, not functionality.
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: verification-before-completion
3
+ description: Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
4
+ ---
5
+
6
+ # Verification Before Completion
7
+
8
+ ## Overview
9
+
10
+ Claiming work is complete without verification is dishonesty, not efficiency.
11
+
12
+ **Core principle:** Evidence before claims, always.
13
+
14
+ **Violating the letter of this rule is violating the spirit of this rule.**
15
+
16
+ ## The Iron Law
17
+
18
+ ```
19
+ NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
20
+ ```
21
+
22
+ If you haven't run the verification command in this message, you cannot claim it passes.
23
+
24
+ ## The Gate Function
25
+
26
+ ```
27
+ BEFORE claiming any status or expressing satisfaction:
28
+
29
+ 1. IDENTIFY: What command proves this claim?
30
+ 2. RUN: Execute the FULL command (fresh, complete)
31
+ 3. READ: Full output, check exit code, count failures
32
+ 4. VERIFY: Does output confirm the claim?
33
+ - If NO: State actual status with evidence
34
+ - If YES: State claim WITH evidence
35
+ 5. ONLY THEN: Make the claim
36
+
37
+ Skip any step = lying, not verifying
38
+ ```
39
+
40
+ ## Common Failures
41
+
42
+ | Claim | Requires | Not Sufficient |
43
+ |-------|----------|----------------|
44
+ | Tests pass | Test command output: 0 failures | Previous run, "should pass" |
45
+ | Linter clean | Linter output: 0 errors | Partial check, extrapolation |
46
+ | Build succeeds | Build command: exit 0 | Linter passing, logs look good |
47
+ | Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
48
+ | Regression test works | Red-green cycle verified | Test passes once |
49
+ | Agent completed | VCS diff shows changes | Agent reports "success" |
50
+ | Requirements met | Line-by-line checklist | Tests passing |
51
+
52
+ ## Red Flags - STOP
53
+
54
+ - Using "should", "probably", "seems to"
55
+ - Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
56
+ - About to commit/push/PR without verification
57
+ - Trusting agent success reports
58
+ - Relying on partial verification
59
+ - Thinking "just this once"
60
+ - Tired and wanting work over
61
+ - **ANY wording implying success without having run verification**
62
+
63
+ ## Rationalization Prevention
64
+
65
+ | Excuse | Reality |
66
+ |--------|---------|
67
+ | "Should work now" | RUN the verification |
68
+ | "I'm confident" | Confidence ≠ evidence |
69
+ | "Just this once" | No exceptions |
70
+ | "Linter passed" | Linter ≠ compiler |
71
+ | "Agent said success" | Verify independently |
72
+ | "I'm tired" | Exhaustion ≠ excuse |
73
+ | "Partial check is enough" | Partial proves nothing |
74
+ | "Different words so rule doesn't apply" | Spirit over letter |
75
+
76
+ ## Key Patterns
77
+
78
+ **Tests:**
79
+ ```
80
+ ✅ [Run test command] [See: 34/34 pass] "All tests pass"
81
+ ❌ "Should pass now" / "Looks correct"
82
+ ```
83
+
84
+ **Regression tests (TDD Red-Green):**
85
+ ```
86
+ ✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
87
+ ❌ "I've written a regression test" (without red-green verification)
88
+ ```
89
+
90
+ **Build:**
91
+ ```
92
+ ✅ [Run build] [See: exit 0] "Build passes"
93
+ ❌ "Linter passed" (linter doesn't check compilation)
94
+ ```
95
+
96
+ **Requirements:**
97
+ ```
98
+ ✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
99
+ ❌ "Tests pass, phase complete"
100
+ ```
101
+
102
+ **Agent delegation:**
103
+ ```
104
+ ✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
105
+ ❌ Trust agent report
106
+ ```
107
+
108
+ ## Why This Matters
109
+
110
+ From 24 failure memories:
111
+ - your human partner said "I don't believe you" - trust broken
112
+ - Undefined functions shipped - would crash
113
+ - Missing requirements shipped - incomplete features
114
+ - Time wasted on false completion → redirect → rework
115
+ - Violates: "Honesty is a core value. If you lie, you'll be replaced."
116
+
117
+ ## When To Apply
118
+
119
+ **ALWAYS before:**
120
+ - ANY variation of success/completion claims
121
+ - ANY expression of satisfaction
122
+ - ANY positive statement about work state
123
+ - Committing, PR creation, task completion
124
+ - Moving to next task
125
+ - Delegating to agents
126
+
127
+ **Rule applies to:**
128
+ - Exact phrases
129
+ - Paraphrases and synonyms
130
+ - Implications of success
131
+ - ANY communication suggesting completion/correctness
132
+
133
+ ## The Bottom Line
134
+
135
+ **No shortcuts for verification.**
136
+
137
+ Run the command. Read the output. THEN claim the result.
138
+
139
+ This is non-negotiable.
@@ -1,115 +1,131 @@
1
- ---
2
- name: ck:git
3
- description: "Git operations with conventional commits. Use for staging, committing, pushing, PRs, merges. Auto-splits commits by type/scope. Security scans for secrets."
4
- argument-hint: "cm|cp|pr|merge [args]"
5
- metadata:
6
- author: claudekit
7
- version: "1.0.0"
8
- ---
9
-
10
- # Git Operations
11
-
12
- ## Default (No Arguments)
13
-
14
- If invoked without arguments, use `AskUserQuestion` to present available git operations:
15
-
16
- | Operation | Description |
17
- |-----------|-------------|
18
- | `cm` | Stage files & create commits |
19
- | `cp` | Stage files, create commits and push |
20
- | `pr` | Create Pull Request |
21
- | `merge` | Merge branches |
22
-
23
- Present as options via `AskUserQuestion` with header "Git Operation", question "What would you like to do?".
24
-
25
- Execute git workflows via `git-manager` subagent to isolate verbose output.
26
-
27
- **IMPORTANT:**
28
- - Sacrifice grammar for the sake of concision.
29
- - Ensure token efficiency while maintaining high quality.
30
- - Pass these rules to subagents.
31
-
32
- ## Arguments
33
- - `cm`: Stage files & create commits
34
- - `cp`: Stage files, create commits and push
35
- - `pr`: Create Pull Request [to-branch] [from-branch]
36
- - `to-branch`: Target branch (default: main)
37
- - `from-branch`: Source branch (default: current branch)
38
- - `merge`: Merge [to-branch] [from-branch]
39
- - `to-branch`: Target branch (default: main)
40
- - `from-branch`: Source branch (default: current branch)
41
-
42
- ## Quick Reference
43
-
44
- | Task | Reference |
45
- |------|-----------|
46
- | Commit | `references/workflow-commit.md` |
47
- | Push | `references/workflow-push.md` |
48
- | Pull Request | `references/workflow-pr.md` |
49
- | Merge | `references/workflow-merge.md` |
50
- | Standards | `references/commit-standards.md` |
51
- | Safety | `references/safety-protocols.md` |
52
- | Branches | `references/branch-management.md` |
53
- | GitHub CLI | `references/gh-cli-guide.md` |
54
-
55
- ## Core Workflow
56
-
57
- ### Step 1: Stage + Analyze
58
- ```bash
59
- git add -A && git diff --cached --stat && git diff --cached --name-only
60
- ```
61
-
62
- ### Step 2: Security Check
63
- Scan for secrets before commit:
64
- ```bash
65
- git diff --cached | grep -iE "(api[_-]?key|token|password|secret|credential)"
66
- ```
67
- **If secrets found:** STOP, warn user, suggest `.gitignore`.
68
-
69
- ### Step 3: Split Decision
70
-
71
- **NOTE:**
72
- - Search for related issues on GitHub and add to body.
73
- - Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
74
-
75
- **Split commits if:**
76
- - Different types mixed (feat + fix, code + docs)
77
- - Multiple scopes (auth + payments)
78
- - Config/deps + code mixed
79
- - FILES > 10 unrelated
80
-
81
- **Single commit if:**
82
- - Same type/scope, FILES ≤ 3, LINES ≤ 50
83
-
84
- ### Step 4: Commit
85
- ```bash
86
- git commit -m "type(scope): description"
87
- ```
88
-
89
- ## Output Format
90
- ```
91
- ✓ staged: N files (+X/-Y lines)
92
- ✓ security: passed
93
- ✓ commit: HASH type(scope): description
94
- ✓ pushed: yes/no
95
- ```
96
-
97
- ## Error Handling
98
-
99
- | Error | Action |
100
- |-------|--------|
101
- | Secrets detected | Block commit, show files |
102
- | No changes | Exit cleanly |
103
- | Push rejected | Suggest `git pull --rebase` |
104
- | Merge conflicts | Suggest manual resolution |
105
-
106
- ## References
107
-
108
- - `references/workflow-commit.md` - Commit workflow with split logic
109
- - `references/workflow-push.md` - Push workflow with error handling
110
- - `references/workflow-pr.md` - PR creation with remote diff analysis
111
- - `references/workflow-merge.md` - Branch merge workflow
112
- - `references/commit-standards.md` - Conventional commit format rules
113
- - `references/safety-protocols.md` - Secret detection, branch protection
114
- - `references/branch-management.md` - Naming, lifecycle, strategies
115
- - `references/gh-cli-guide.md` - GitHub CLI commands reference
1
+ ---
2
+ name: ck:git
3
+ description: "Manage git commits, pushes, PRs, branch merges, and PR review-and-merge automation. Use for commit, push, PR creation, PR merge, CI follow-up, and secret scanning."
4
+ user-invocable: true
5
+ when_to_use: "Invoke for commits, PRs, branch hygiene, or release git steps."
6
+ category: dev-tools
7
+ keywords: [git, commits, staging, PR, merge, merge-pr, ci]
8
+ argument-hint: "cm|cp|pr|merge|merge-pr [args]"
9
+ metadata:
10
+ author: claudekit
11
+ version: "1.0.0"
12
+ ---
13
+
14
+ # Git Operations
15
+
16
+ ## Default (No Arguments)
17
+
18
+ If invoked without arguments, use `AskUserQuestion` to present available git operations:
19
+
20
+ | Operation | Description |
21
+ |-----------|-------------|
22
+ | `cm` | Stage files & create commits |
23
+ | `cp` | Stage files, create commits and push |
24
+ | `pr` | Create Pull Request |
25
+ | `merge` | Merge branches |
26
+ | `merge-pr` | Review, label, merge PRs, then watch/fix CI |
27
+
28
+ Present as options via `AskUserQuestion` with header "Git Operation", question "What would you like to do?".
29
+
30
+ Execute git workflows via `git-manager` subagent to isolate verbose output.
31
+ Keep verbose git/gh output out of the main context: `references/context-efficiency.md`.
32
+
33
+ **IMPORTANT:**
34
+ - Sacrifice grammar for the sake of concision.
35
+ - Ensure token efficiency while maintaining high quality.
36
+ - Pass these rules to subagents.
37
+
38
+ ## Arguments
39
+ - `cm`: Stage files & create commits
40
+ - `cp`: Stage files, create commits and push
41
+ - `pr`: Create Pull Request [to-branch] [from-branch]
42
+ - `to-branch`: Target branch (default: main)
43
+ - `from-branch`: Source branch (default: current branch)
44
+ - `merge`: Merge [to-branch] [from-branch]
45
+ - `to-branch`: Target branch (default: main)
46
+ - `from-branch`: Source branch (default: current branch)
47
+ - `merge-pr`: Review, label, merge, and post-merge verify PRs
48
+ - Usage: `/ck:git merge-pr <PR numbers or URLs>`
49
+ - Accepts one or more PR numbers or GitHub PR URLs
50
+ - Runs `/code-review <PR>` before any label or merge (findings only — no auto-fix, no GitHub replies)
51
+ - Adds label `ready to ship` only once the review is clean and checks are green
52
+ - Merges only reviewed-and-ready PRs, then watches target-branch CI to success
53
+
54
+ ## Quick Reference
55
+
56
+ | Task | Reference |
57
+ |------|-----------|
58
+ | Commit | `references/workflow-commit.md` |
59
+ | Push | `references/workflow-push.md` |
60
+ | Pull Request | `references/workflow-pr.md` |
61
+ | Merge | `references/workflow-merge.md` |
62
+ | Merge PRs | `references/workflow-merge-pr.md` |
63
+ | Standards | `references/commit-standards.md` |
64
+ | Safety | `references/safety-protocols.md` |
65
+ | Branches | `references/branch-management.md` |
66
+ | GitHub CLI | `references/gh-cli-guide.md` |
67
+ | Context efficiency | `references/context-efficiency.md` |
68
+
69
+ ## Core Workflow
70
+
71
+ ### Step 1: Stage + Analyze
72
+ ```bash
73
+ git add -A && git diff --cached --stat && git diff --cached --name-only
74
+ ```
75
+
76
+ ### Step 2: Security Check
77
+ Scan for secrets before commit:
78
+ ```bash
79
+ git diff --cached | grep -iE "(api[_-]?key|token|password|secret|credential)"
80
+ ```
81
+ **If secrets found:** STOP, warn user, suggest `.gitignore`.
82
+
83
+ ### Step 3: Split Decision
84
+
85
+ **NOTE:**
86
+ - Search for related issues on GitHub and add to body.
87
+ - Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
88
+
89
+ **Split commits if:**
90
+ - Different types mixed (feat + fix, code + docs)
91
+ - Multiple scopes (auth + payments)
92
+ - Config/deps + code mixed
93
+ - FILES > 10 unrelated
94
+
95
+ **Single commit if:**
96
+ - Same type/scope, FILES ≤ 3, LINES ≤ 50
97
+
98
+ ### Step 4: Commit
99
+ ```bash
100
+ git commit -m "type(scope): description"
101
+ ```
102
+
103
+ ## Output Format
104
+ ```
105
+ ✓ staged: N files (+X/-Y lines)
106
+ ✓ security: passed
107
+ ✓ commit: HASH type(scope): description
108
+ ✓ pushed: yes/no
109
+ ```
110
+
111
+ ## Error Handling
112
+
113
+ | Error | Action |
114
+ |-------|--------|
115
+ | Secrets detected | Block commit, show files |
116
+ | No changes | Exit cleanly |
117
+ | Push rejected | Suggest `git pull --rebase` |
118
+ | Merge conflicts | Suggest manual resolution |
119
+
120
+ ## References
121
+
122
+ - `references/workflow-commit.md` - Commit workflow with split logic
123
+ - `references/workflow-push.md` - Push workflow with error handling
124
+ - `references/workflow-pr.md` - PR creation with remote diff analysis
125
+ - `references/workflow-merge.md` - Branch merge workflow
126
+ - `references/workflow-merge-pr.md` - PR review, ready label, merge, and CI convergence workflow
127
+ - `references/commit-standards.md` - Conventional commit format rules
128
+ - `references/safety-protocols.md` - Secret detection, branch protection
129
+ - `references/branch-management.md` - Naming, lifecycle, strategies
130
+ - `references/gh-cli-guide.md` - GitHub CLI commands reference
131
+ - `references/context-efficiency.md` - Keeping verbose git/gh output out of context