ima-claude 2.20.0 → 2.25.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.
- package/README.md +48 -9
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/plugins/ima-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/ima-claude/agents/explorer.md +29 -15
- package/plugins/ima-claude/agents/implementer.md +58 -13
- package/plugins/ima-claude/agents/memory.md +19 -19
- package/plugins/ima-claude/agents/reviewer.md +56 -34
- package/plugins/ima-claude/agents/tester.md +59 -16
- package/plugins/ima-claude/agents/wp-developer.md +66 -21
- package/plugins/ima-claude/hooks/bootstrap.sh +42 -44
- package/plugins/ima-claude/hooks/prompt_coach_digest.md +14 -17
- package/plugins/ima-claude/hooks/prompt_coach_system.md +10 -12
- package/plugins/ima-claude/personalities/README.md +17 -6
- package/plugins/ima-claude/personalities/enable-efficient.md +61 -0
- package/plugins/ima-claude/personalities/enable-terse.md +71 -0
- package/plugins/ima-claude/skills/agentic-workflows/SKILL.md +35 -71
- package/plugins/ima-claude/skills/architect/SKILL.md +54 -168
- package/plugins/ima-claude/skills/compound-bridge/SKILL.md +41 -94
- package/plugins/ima-claude/skills/design-to-code/SKILL.md +43 -78
- package/plugins/ima-claude/skills/discourse/SKILL.md +79 -194
- package/plugins/ima-claude/skills/discourse-admin/SKILL.md +41 -103
- package/plugins/ima-claude/skills/docs-organize/SKILL.md +63 -203
- package/plugins/ima-claude/skills/ember-discourse/SKILL.md +90 -200
- package/plugins/ima-claude/skills/espocrm/SKILL.md +14 -23
- package/plugins/ima-claude/skills/espocrm-api/SKILL.md +79 -192
- package/plugins/ima-claude/skills/functional-programmer/SKILL.md +33 -237
- package/plugins/ima-claude/skills/gh-cli/SKILL.md +26 -65
- package/plugins/ima-claude/skills/ima-bootstrap/SKILL.md +71 -104
- package/plugins/ima-claude/skills/ima-bootstrap/references/ima-brand.md +32 -22
- package/plugins/ima-claude/skills/ima-brand/SKILL.md +18 -23
- package/plugins/ima-claude/skills/ima-copywriting/SKILL.md +68 -179
- package/plugins/ima-claude/skills/ima-doc2pdf/SKILL.md +32 -102
- package/plugins/ima-claude/skills/ima-editorial-scorecard/SKILL.md +38 -63
- package/plugins/ima-claude/skills/ima-editorial-workflow/SKILL.md +69 -114
- package/plugins/ima-claude/skills/ima-email-creator/SKILL.md +16 -22
- package/plugins/ima-claude/skills/ima-forms-expert/SKILL.md +21 -37
- package/plugins/ima-claude/skills/jira-checkpoint/SKILL.md +39 -120
- package/plugins/ima-claude/skills/jquery/SKILL.md +107 -233
- package/plugins/ima-claude/skills/js-fp/SKILL.md +75 -296
- package/plugins/ima-claude/skills/js-fp-api/SKILL.md +52 -162
- package/plugins/ima-claude/skills/js-fp-react/SKILL.md +47 -270
- package/plugins/ima-claude/skills/js-fp-vue/SKILL.md +55 -209
- package/plugins/ima-claude/skills/js-fp-wordpress/SKILL.md +59 -204
- package/plugins/ima-claude/skills/livecanvas/SKILL.md +19 -32
- package/plugins/ima-claude/skills/mcp-atlassian/SKILL.md +92 -162
- package/plugins/ima-claude/skills/mcp-context7/SKILL.md +32 -64
- package/plugins/ima-claude/skills/mcp-gitea/SKILL.md +98 -188
- package/plugins/ima-claude/skills/mcp-github/SKILL.md +60 -124
- package/plugins/ima-claude/skills/mcp-memory/SKILL.md +1 -177
- package/plugins/ima-claude/skills/mcp-qdrant/SKILL.md +58 -115
- package/plugins/ima-claude/skills/mcp-sequential/SKILL.md +32 -87
- package/plugins/ima-claude/skills/mcp-serena/SKILL.md +54 -80
- package/plugins/ima-claude/skills/mcp-tavily/SKILL.md +40 -63
- package/plugins/ima-claude/skills/mcp-vestige/SKILL.md +75 -116
- package/plugins/ima-claude/skills/php-authnet/SKILL.md +32 -65
- package/plugins/ima-claude/skills/php-fp/SKILL.md +50 -129
- package/plugins/ima-claude/skills/php-fp-wordpress/SKILL.md +25 -73
- package/plugins/ima-claude/skills/phpunit-wp/SKILL.md +103 -463
- package/plugins/ima-claude/skills/playwright/SKILL.md +69 -220
- package/plugins/ima-claude/skills/prompt-starter/SKILL.md +33 -83
- package/plugins/ima-claude/skills/prompt-starter/references/code-review.md +38 -0
- package/plugins/ima-claude/skills/py-fp/SKILL.md +78 -384
- package/plugins/ima-claude/skills/quasar-fp/SKILL.md +54 -255
- package/plugins/ima-claude/skills/quickstart/SKILL.md +7 -11
- package/plugins/ima-claude/skills/rails/SKILL.md +63 -184
- package/plugins/ima-claude/skills/resume-session/SKILL.md +14 -35
- package/plugins/ima-claude/skills/rg/SKILL.md +61 -146
- package/plugins/ima-claude/skills/ruby-fp/SKILL.md +66 -163
- package/plugins/ima-claude/skills/save-session/SKILL.md +10 -39
- package/plugins/ima-claude/skills/scorecard/SKILL.md +24 -38
- package/plugins/ima-claude/skills/skill-analyzer/SKILL.md +42 -71
- package/plugins/ima-claude/skills/skill-creator/SKILL.md +79 -250
- package/plugins/ima-claude/skills/task-master/SKILL.md +11 -31
- package/plugins/ima-claude/skills/task-planner/SKILL.md +44 -153
- package/plugins/ima-claude/skills/task-runner/SKILL.md +61 -143
- package/plugins/ima-claude/skills/unit-testing/SKILL.md +59 -134
- package/plugins/ima-claude/skills/wp-ddev/SKILL.md +38 -120
- package/plugins/ima-claude/skills/wp-local/SKILL.md +26 -108
|
@@ -3,271 +3,67 @@ name: "functional-programmer"
|
|
|
3
3
|
description: "Functional programming principles and philosophy - pure functions, immutability, composition, side effect isolation, declarative style. Trigger when: discussing FP concepts, transitioning from OOP, explaining why FP matters, architectural mindset shifts. This skill covers principles ONLY - see js-fp, php-fp, etc. for implementation patterns."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# FP Principles
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- **js-fp** - JavaScript FP patterns
|
|
10
|
-
- **php-fp** - PHP FP patterns
|
|
11
|
-
- **js-fp-react**, **js-fp-vue** - Framework-specific FP patterns
|
|
8
|
+
FP is a mindset, not an API signature. Not `pipe()`, `compose()`, or `curry()`.
|
|
12
9
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
Functional programming is not a set of utility functions. It's not `pipe()`, `compose()`, or `curry()`. It's a way of thinking about problems that makes code predictable, testable, and maintainable.
|
|
16
|
-
|
|
17
|
-
**FP is a mindset, not an API signature.**
|
|
18
|
-
|
|
19
|
-
## The Seven Pillars
|
|
10
|
+
## Seven Pillars
|
|
20
11
|
|
|
21
12
|
### 1. Pure Functions
|
|
22
|
-
|
|
23
|
-
**Principle**: A function should return the same output for the same input, every time, with no side effects.
|
|
24
|
-
|
|
25
|
-
**Why it matters:**
|
|
26
|
-
- Predictability: No surprises, no hidden state changes
|
|
27
|
-
- Testability: Test any function with any input, no mocking required
|
|
28
|
-
- Parallelization: Pure functions can run concurrently without coordination
|
|
29
|
-
- Debugging: When something breaks, you know exactly where to look
|
|
30
|
-
|
|
31
|
-
**The litmus test:** Can you call this function 1000 times with the same arguments and always get the same result without affecting anything else? If yes, it's pure.
|
|
13
|
+
Same input → same output, no side effects. Enables testing without mocks, safe parallelization, predictable debugging.
|
|
32
14
|
|
|
33
15
|
### 2. Immutability
|
|
34
|
-
|
|
35
|
-
**Principle**: Data, once created, never changes. To "modify" data, create new data.
|
|
36
|
-
|
|
37
|
-
**Why it matters:**
|
|
38
|
-
- No aliasing bugs: When two variables point to the same data, neither can corrupt the other
|
|
39
|
-
- Time-travel debugging: Every state is preserved, you can inspect any point in time
|
|
40
|
-
- Concurrency safety: No locks needed when data can't change
|
|
41
|
-
- Predictable state: You always know what data looks like at any point
|
|
42
|
-
|
|
43
|
-
**The key insight:** Mutation is the source of countless bugs. Race conditions, stale references, unexpected side effects - all stem from shared mutable state. Immutability eliminates these entire categories of bugs.
|
|
16
|
+
Never mutate data. Create new data instead. Eliminates aliasing bugs, race conditions, stale references.
|
|
44
17
|
|
|
45
18
|
### 3. Function Composition
|
|
46
|
-
|
|
47
|
-
**Principle**: Complex behavior emerges from combining simple functions.
|
|
48
|
-
|
|
49
|
-
**Why it matters:**
|
|
50
|
-
- Reusability: Small functions combine in countless ways
|
|
51
|
-
- Testability: Test each piece independently, trust the composition
|
|
52
|
-
- Readability: The code structure matches the mental model
|
|
53
|
-
- Maintainability: Change one piece without affecting others
|
|
54
|
-
|
|
55
|
-
**The mental model:** Think of functions as LEGO bricks. Each brick is simple and does one thing. Complex structures come from how you connect them, not from making bigger bricks.
|
|
19
|
+
Build complex behavior by combining simple functions. Small composable pieces > monolithic functions.
|
|
56
20
|
|
|
57
21
|
### 4. First-Class Functions
|
|
58
|
-
|
|
59
|
-
**Principle**: Functions are values. Pass them around, return them, store them.
|
|
60
|
-
|
|
61
|
-
**Why it matters:**
|
|
62
|
-
- Abstraction power: Higher-order functions enable powerful patterns
|
|
63
|
-
- Flexibility: Behavior becomes data you can manipulate
|
|
64
|
-
- DRY: Common patterns extracted into reusable higher-order functions
|
|
65
|
-
- Customization: Inject behavior without inheritance hierarchies
|
|
66
|
-
|
|
67
|
-
**The unlock:** When functions become values, you can write functions that operate on functions. This is where FP's real power emerges - abstracting over behavior, not just data.
|
|
22
|
+
Functions are values — pass, return, store them. Enables higher-order patterns and behavior injection without inheritance.
|
|
68
23
|
|
|
69
24
|
### 5. Referential Transparency
|
|
70
|
-
|
|
71
|
-
**Principle**: An expression can be replaced with its value without changing program behavior.
|
|
72
|
-
|
|
73
|
-
**Why it matters:**
|
|
74
|
-
- Reasoning: You can understand code by substituting values
|
|
75
|
-
- Refactoring: Move code freely, confident behavior won't change
|
|
76
|
-
- Caching: Memoize any referentially transparent computation
|
|
77
|
-
- Optimization: Compilers can reorder and optimize freely
|
|
78
|
-
|
|
79
|
-
**The test:** If you can replace a function call with its return value everywhere in your code and nothing changes, the function is referentially transparent.
|
|
25
|
+
Expression replaceable with its value without behavior change. Enables safe refactoring, memoization, compiler optimization.
|
|
80
26
|
|
|
81
27
|
### 6. Side Effect Isolation
|
|
28
|
+
Pure core (business logic) + impure shell (I/O). Shell calls core, never vice versa. Target: 80% pure, 20% shell.
|
|
82
29
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
**Why it matters:**
|
|
86
|
-
- The bulk of your code becomes testable without mocks
|
|
87
|
-
- Side effects are explicit and contained
|
|
88
|
-
- Business logic stays decoupled from infrastructure
|
|
89
|
-
- Easier to swap implementations (databases, APIs, etc.)
|
|
90
|
-
|
|
91
|
-
**The architecture:** Your system has an impure shell that handles I/O (databases, APIs, user input, logging) and a pure core that handles all business logic. The shell calls the core, never vice versa.
|
|
92
|
-
|
|
93
|
-
**The ratio to aim for:** 80% pure core, 20% impure shell. If your ratio is inverted, you're spreading side effects throughout your code.
|
|
30
|
+
Pure core: calculations, transformations, validations, business rules.
|
|
31
|
+
Impure shell: database, API calls, user I/O, logging, filesystem.
|
|
94
32
|
|
|
95
33
|
### 7. Declarative Style
|
|
34
|
+
Describe WHAT, not HOW. Express business logic, not mechanics.
|
|
96
35
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
**Why it matters:**
|
|
100
|
-
- Intent clarity: Code expresses business logic, not mechanics
|
|
101
|
-
- Less boilerplate: The runtime handles the implementation details
|
|
102
|
-
- Optimization freedom: Declarative code can be optimized freely
|
|
103
|
-
- Reduced bugs: Fewer moving parts means fewer places for bugs to hide
|
|
104
|
-
|
|
105
|
-
**The shift:** Imperative code is a sequence of instructions. Declarative code is a description of the desired outcome. The runtime figures out the steps.
|
|
106
|
-
|
|
107
|
-
## The Journey from OOP
|
|
108
|
-
|
|
109
|
-
### Why Classical Inheritance Fails
|
|
110
|
-
|
|
111
|
-
**The fragile base class problem:** Change a base class, break all descendants in unpredictable ways.
|
|
112
|
-
|
|
113
|
-
**The gorilla-banana problem:** You want a banana, but you get a gorilla holding the banana and the entire jungle. Class hierarchies bring unwanted dependencies.
|
|
114
|
-
|
|
115
|
-
**The diamond problem:** Multiple inheritance creates ambiguity. Single inheritance creates awkward hierarchies where things don't quite fit.
|
|
116
|
-
|
|
117
|
-
**Deep hierarchies:** Every level of inheritance is another level of complexity to understand. Five levels deep, and nobody knows what's actually happening.
|
|
118
|
-
|
|
119
|
-
### Composition Over Inheritance
|
|
120
|
-
|
|
121
|
-
Instead of "is-a" relationships (inheritance), use "has-a" relationships (composition).
|
|
122
|
-
|
|
123
|
-
Instead of extending behavior through class hierarchies, compose behavior through functions.
|
|
124
|
-
|
|
125
|
-
**The key difference:**
|
|
126
|
-
- Inheritance: Behavior locked in at definition time, tightly coupled
|
|
127
|
-
- Composition: Behavior assembled at runtime, loosely coupled
|
|
128
|
-
|
|
129
|
-
### What OOP Got Right
|
|
130
|
-
|
|
131
|
-
Object-oriented programming contributed valuable ideas:
|
|
132
|
-
- Encapsulation (hiding implementation details)
|
|
133
|
-
- Polymorphism (same interface, different behavior)
|
|
134
|
-
|
|
135
|
-
FP embraces these - through closures for encapsulation and first-class functions for polymorphism. The mistake was coupling these ideas to class hierarchies and inheritance.
|
|
136
|
-
|
|
137
|
-
## Anti-Over-Engineering
|
|
138
|
-
|
|
139
|
-
### Don't Create Custom FP Utilities
|
|
140
|
-
|
|
141
|
-
The biggest trap for newcomers to FP: building a personal utility library of `pipe()`, `compose()`, `curry()`, and custom monads.
|
|
142
|
-
|
|
143
|
-
**Why it's harmful:**
|
|
144
|
-
- Every team member must learn your utilities
|
|
145
|
-
- Debugging through abstraction layers
|
|
146
|
-
- Maintenance burden for no business value
|
|
147
|
-
- Makes code less portable
|
|
148
|
-
|
|
149
|
-
**The right approach:** Use established libraries (lodash, Ramda, etc.) when appropriate, or just use the language's native patterns. FP principles work without special utilities.
|
|
150
|
-
|
|
151
|
-
### The Abstraction Cost
|
|
152
|
-
|
|
153
|
-
Every abstraction has a cost:
|
|
154
|
-
- Learning curve for new team members
|
|
155
|
-
- Debugging complexity
|
|
156
|
-
- Maintenance burden
|
|
157
|
-
- Mental overhead when reading code
|
|
158
|
-
|
|
159
|
-
**The question to ask:** Does this abstraction pay for itself? Will I use it enough to justify the cost? Would a junior developer understand it?
|
|
160
|
-
|
|
161
|
-
### File Size as a Smell
|
|
162
|
-
|
|
163
|
-
Keep files under 500 lines. This isn't an arbitrary limit — it's a smell detector. A file approaching 500 lines almost certainly has multiple responsibilities that should be separated.
|
|
164
|
-
|
|
165
|
-
**When a file grows too large:**
|
|
166
|
-
- Split by responsibility, not by arbitrary line count
|
|
167
|
-
- A 300-line file with two unrelated concerns is worse than a 480-line file with one
|
|
168
|
-
- The goal is cohesion: each file should have a single, clear reason to exist
|
|
169
|
-
|
|
170
|
-
**Why this matters:**
|
|
171
|
-
- Readability: Developers can hold one file's purpose in their head
|
|
172
|
-
- Testability: Smaller, focused files are easier to test in isolation
|
|
173
|
-
- Navigation: Finding what you need is faster in a well-structured codebase
|
|
174
|
-
- Review: Code review quality drops sharply beyond 500 lines
|
|
175
|
-
|
|
176
|
-
### Context-Appropriate Complexity
|
|
177
|
-
|
|
178
|
-
A CLI script has different needs than a production API.
|
|
179
|
-
|
|
180
|
-
A weekend project has different needs than enterprise software.
|
|
181
|
-
|
|
182
|
-
**Match complexity to context:**
|
|
183
|
-
- Simple problem? Simple solution.
|
|
184
|
-
- Complex problem? Complex solution.
|
|
185
|
-
- Simple problem + complex solution = over-engineering.
|
|
186
|
-
|
|
187
|
-
## The Practical Application
|
|
188
|
-
|
|
189
|
-
### Pure Core, Impure Shell
|
|
190
|
-
|
|
191
|
-
Structure your code in two layers:
|
|
192
|
-
|
|
193
|
-
**The Pure Core (business logic):**
|
|
194
|
-
- All calculations
|
|
195
|
-
- All transformations
|
|
196
|
-
- All validations
|
|
197
|
-
- All business rules
|
|
198
|
-
|
|
199
|
-
**The Impure Shell (I/O):**
|
|
200
|
-
- Database operations
|
|
201
|
-
- API calls
|
|
202
|
-
- User input/output
|
|
203
|
-
- Logging
|
|
204
|
-
- File system access
|
|
205
|
-
|
|
206
|
-
The shell calls the core, passes data in, gets results out. The core never reaches out to the shell.
|
|
207
|
-
|
|
208
|
-
### Explicit Dependencies
|
|
209
|
-
|
|
210
|
-
Functions should receive everything they need as parameters.
|
|
211
|
-
|
|
212
|
-
No reaching into global state. No hidden dependencies. Everything visible in the function signature.
|
|
213
|
-
|
|
214
|
-
**Why this matters:** You can understand what a function does by reading its signature. You can test it by passing in test data. You can reuse it in any context.
|
|
215
|
-
|
|
216
|
-
### Result Types Over Exceptions
|
|
217
|
-
|
|
218
|
-
Return structured results instead of throwing exceptions.
|
|
219
|
-
|
|
220
|
-
**Why this is better:**
|
|
221
|
-
- Error handling is explicit in the type system
|
|
222
|
-
- No hidden control flow
|
|
223
|
-
- Caller must acknowledge potential failure
|
|
224
|
-
- Easier to test error paths
|
|
225
|
-
|
|
226
|
-
## The Mindset Shift
|
|
227
|
-
|
|
228
|
-
### Think in Transformations
|
|
229
|
-
|
|
230
|
-
Stop thinking: "How do I modify this data?"
|
|
231
|
-
Start thinking: "What new data do I create from this data?"
|
|
36
|
+
## Composition Over Inheritance
|
|
232
37
|
|
|
233
|
-
|
|
38
|
+
Inheritance problems: fragile base class, gorilla-banana (unwanted dependencies), diamond ambiguity, deep hierarchy opacity.
|
|
234
39
|
|
|
235
|
-
|
|
236
|
-
Start thinking: "What transformations does this data flow through?"
|
|
40
|
+
Use "has-a" (composition) not "is-a" (inheritance). Behavior assembled at runtime, loosely coupled.
|
|
237
41
|
|
|
238
|
-
|
|
42
|
+
OOP's valid contributions — encapsulation and polymorphism — achieved through closures and first-class functions.
|
|
239
43
|
|
|
240
|
-
|
|
241
|
-
Start thinking: "What is the relationship between input and output?"
|
|
44
|
+
## Anti-Over-Engineering (PRIMARY)
|
|
242
45
|
|
|
243
|
-
|
|
46
|
+
**Never create custom FP utilities** (`pipe`, `compose`, `curry`, custom monads). Use established libraries or native language patterns.
|
|
244
47
|
|
|
245
|
-
|
|
246
|
-
|
|
48
|
+
Every abstraction costs: learning curve, debugging complexity, maintenance burden, mental overhead.
|
|
49
|
+
Test: Does this abstraction pay for itself? Would a junior dev understand it?
|
|
247
50
|
|
|
248
|
-
|
|
51
|
+
**File size smell**: >500 lines = likely multiple responsibilities. Split by cohesion, not line count.
|
|
249
52
|
|
|
250
|
-
|
|
53
|
+
**Match complexity to context**: CLI script ≠ production API ≠ weekend project. Simple problem + complex solution = over-engineering.
|
|
251
54
|
|
|
252
|
-
|
|
253
|
-
|-----------|---------------------|
|
|
254
|
-
| Pure functions in JavaScript | js-fp |
|
|
255
|
-
| Immutability in React | js-fp-react |
|
|
256
|
-
| Composition in Vue | js-fp-vue |
|
|
257
|
-
| Side effect isolation in Node | js-fp-api |
|
|
258
|
-
| FP patterns in PHP | php-fp |
|
|
259
|
-
| FP in WordPress | php-fp-wordpress |
|
|
55
|
+
## Architecture
|
|
260
56
|
|
|
261
|
-
|
|
57
|
+
**Explicit dependencies**: Functions receive everything as parameters. No globals, no hidden state. Signature tells the full story.
|
|
262
58
|
|
|
263
|
-
|
|
264
|
-
2. **Data flows, it doesn't change** - Transform, don't mutate
|
|
265
|
-
3. **Side effects are dangerous** - Isolate and control them
|
|
266
|
-
4. **Composition beats inheritance** - Small pieces combined > large hierarchies
|
|
267
|
-
5. **Explicit beats implicit** - Dependencies, data flow, error handling
|
|
268
|
-
6. **Simple beats clever** - Boring, readable code wins
|
|
269
|
-
7. **Evidence beats assumptions** - Add complexity only when needed
|
|
59
|
+
**Result types over exceptions**: Return `{ success, data, error }`. Makes error handling explicit, no hidden control flow, testable error paths.
|
|
270
60
|
|
|
271
|
-
##
|
|
61
|
+
## Core Directives
|
|
272
62
|
|
|
273
|
-
|
|
63
|
+
1. Functions are the unit of abstraction — not classes, not modules
|
|
64
|
+
2. Data flows, never changes — transform, don't mutate
|
|
65
|
+
3. Side effects are dangerous — isolate and control them
|
|
66
|
+
4. Composition beats inheritance — small pieces > large hierarchies
|
|
67
|
+
5. Explicit beats implicit — dependencies, data flow, error handling
|
|
68
|
+
6. Simple beats clever — boring, readable code wins
|
|
69
|
+
7. Evidence beats assumptions — add complexity only when needed
|
|
@@ -9,19 +9,14 @@ description: >-
|
|
|
9
9
|
NOT for Gitea — use mcp-gitea for internal repos.
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
# GitHub CLI (`gh`)
|
|
13
|
-
|
|
14
|
-
The `gh` CLI is the primary tool for all GitHub operations. It's authenticated, reliable, and covers the full GitHub API surface.
|
|
12
|
+
# GitHub CLI (`gh`)
|
|
15
13
|
|
|
16
14
|
## Prerequisites
|
|
17
15
|
|
|
18
16
|
```bash
|
|
19
|
-
#
|
|
20
|
-
gh auth status
|
|
17
|
+
gh auth status # must pass before any operations
|
|
21
18
|
```
|
|
22
19
|
|
|
23
|
-
The CLI must be authenticated (`gh auth login`) before use. Verify scopes with `gh auth status`.
|
|
24
|
-
|
|
25
20
|
## Command Reference
|
|
26
21
|
|
|
27
22
|
### Pull Requests
|
|
@@ -110,7 +105,7 @@ The CLI must be authenticated (`gh auth login`) before use. Verify scopes with `
|
|
|
110
105
|
| Delete release | `gh release delete v1.0.0` |
|
|
111
106
|
| Edit release | `gh release edit v1.0.0 --title "..." --notes "..."` |
|
|
112
107
|
|
|
113
|
-
### GitHub Actions
|
|
108
|
+
### GitHub Actions
|
|
114
109
|
|
|
115
110
|
| Operation | Command |
|
|
116
111
|
|-----------|---------|
|
|
@@ -129,7 +124,7 @@ The CLI must be authenticated (`gh auth login`) before use. Verify scopes with `
|
|
|
129
124
|
| Rerun failed jobs | `gh run rerun 12345 --failed` |
|
|
130
125
|
| Cancel run | `gh run cancel 12345` |
|
|
131
126
|
|
|
132
|
-
### Search
|
|
127
|
+
### Search
|
|
133
128
|
|
|
134
129
|
| Operation | Command |
|
|
135
130
|
|-----------|---------|
|
|
@@ -151,56 +146,46 @@ The CLI must be authenticated (`gh auth login`) before use. Verify scopes with `
|
|
|
151
146
|
|
|
152
147
|
### Raw API Access
|
|
153
148
|
|
|
154
|
-
For operations not covered by built-in commands:
|
|
155
|
-
|
|
156
149
|
```bash
|
|
157
|
-
# GET
|
|
150
|
+
# GET
|
|
158
151
|
gh api repos/{owner}/{repo}/topics
|
|
159
152
|
|
|
160
|
-
# POST
|
|
153
|
+
# POST
|
|
161
154
|
gh api repos/{owner}/{repo}/labels -f name="priority" -f color="ff0000"
|
|
162
155
|
|
|
163
|
-
#
|
|
156
|
+
# Paginated
|
|
164
157
|
gh api repos/{owner}/{repo}/issues --paginate
|
|
165
158
|
|
|
166
159
|
# GraphQL
|
|
167
160
|
gh api graphql -f query='{ viewer { login } }'
|
|
168
161
|
|
|
169
|
-
# JSON
|
|
162
|
+
# JSON + jq
|
|
170
163
|
gh api repos/{owner}/{repo}/pulls --jq '.[].title'
|
|
171
164
|
```
|
|
172
165
|
|
|
173
166
|
## Decision Logic
|
|
174
167
|
|
|
175
168
|
```
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Operation routing:
|
|
187
|
-
PRs (create, review, merge, list) → gh pr ...
|
|
188
|
-
Issues (create, comment, close) → gh issue ...
|
|
189
|
-
Releases (create, upload, list) → gh release ...
|
|
190
|
-
CI/CD status, rerun, logs → gh run ... / gh workflow ...
|
|
191
|
-
Search across GitHub → gh search ...
|
|
192
|
-
Anything not in built-in commands → gh api ...
|
|
169
|
+
github.com remote? → use gh (this skill)
|
|
170
|
+
Gitea remote? → use mcp-gitea
|
|
171
|
+
Local git ops → use git CLI directly
|
|
172
|
+
|
|
173
|
+
PRs → gh pr ...
|
|
174
|
+
Issues → gh issue ...
|
|
175
|
+
Releases → gh release ...
|
|
176
|
+
CI/CD → gh run ... / gh workflow ...
|
|
177
|
+
Search → gh search ...
|
|
178
|
+
Anything else → gh api ...
|
|
193
179
|
```
|
|
194
180
|
|
|
195
181
|
## Common Workflows
|
|
196
182
|
|
|
197
|
-
###
|
|
183
|
+
### PR with HEREDOC body
|
|
198
184
|
|
|
199
185
|
```bash
|
|
200
186
|
gh pr create --title "feat: add gh-cli skill" --body "$(cat <<'EOF'
|
|
201
187
|
## Summary
|
|
202
188
|
- Added gh-cli skill for GitHub CLI operations
|
|
203
|
-
- Replaces unreliable MCP GitHub integration
|
|
204
189
|
|
|
205
190
|
## Test plan
|
|
206
191
|
- [ ] Verify gh auth status
|
|
@@ -209,17 +194,14 @@ EOF
|
|
|
209
194
|
)"
|
|
210
195
|
```
|
|
211
196
|
|
|
212
|
-
### Check CI
|
|
197
|
+
### Check CI then merge
|
|
213
198
|
|
|
214
199
|
```bash
|
|
215
|
-
# Check CI status
|
|
216
200
|
gh pr checks 123
|
|
217
|
-
|
|
218
|
-
# If all checks pass, merge
|
|
219
201
|
gh pr merge 123 --squash --delete-branch
|
|
220
202
|
```
|
|
221
203
|
|
|
222
|
-
###
|
|
204
|
+
### Release with auto-changelog
|
|
223
205
|
|
|
224
206
|
```bash
|
|
225
207
|
gh release create v2.12.0 \
|
|
@@ -228,49 +210,28 @@ gh release create v2.12.0 \
|
|
|
228
210
|
--latest
|
|
229
211
|
```
|
|
230
212
|
|
|
231
|
-
### Cross-
|
|
213
|
+
### Cross-repo issue search
|
|
232
214
|
|
|
233
215
|
```bash
|
|
234
|
-
# Find all open bugs assigned to me across repos
|
|
235
216
|
gh search issues "is:open assignee:@me label:bug" --limit 20
|
|
236
|
-
|
|
237
|
-
# Find PRs awaiting my review
|
|
238
217
|
gh search prs "is:open review-requested:@me" --limit 20
|
|
239
218
|
```
|
|
240
219
|
|
|
241
|
-
###
|
|
220
|
+
### PR comments via API
|
|
242
221
|
|
|
243
222
|
```bash
|
|
244
|
-
# List PR review comments
|
|
245
223
|
gh api repos/{owner}/{repo}/pulls/123/comments --jq '.[].body'
|
|
246
|
-
|
|
247
|
-
# List issue/PR timeline comments
|
|
248
224
|
gh api repos/{owner}/{repo}/issues/123/comments --jq '.[] | "\(.user.login): \(.body)"'
|
|
249
225
|
```
|
|
250
226
|
|
|
251
|
-
## Output
|
|
252
|
-
|
|
253
|
-
The `gh` CLI supports structured output:
|
|
227
|
+
## Output & Targeting
|
|
254
228
|
|
|
255
229
|
```bash
|
|
256
|
-
#
|
|
230
|
+
# Structured output
|
|
257
231
|
gh pr list --json number,title,state
|
|
258
|
-
|
|
259
|
-
# JSON + jq filter
|
|
260
232
|
gh pr list --json number,title --jq '.[] | "\(.number): \(.title)"'
|
|
261
233
|
|
|
262
|
-
#
|
|
263
|
-
gh issue list
|
|
264
|
-
|
|
265
|
-
# Web browser
|
|
266
|
-
gh pr view 123 --web
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Cross-Repository Operations
|
|
270
|
-
|
|
271
|
-
Use `--repo` or `-R` to target any GitHub repo:
|
|
272
|
-
|
|
273
|
-
```bash
|
|
234
|
+
# Target any repo
|
|
274
235
|
gh pr list -R owner/other-repo
|
|
275
236
|
gh issue create -R owner/other-repo --title "..."
|
|
276
237
|
gh run list -R owner/other-repo
|