@php-workx/skill-tk 0.1.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.
@@ -0,0 +1,219 @@
1
+ # Common Usage Patterns
2
+
3
+ Practical patterns for using tk effectively across different scenarios.
4
+
5
+ ## Contents
6
+
7
+ - [Knowledge Work Session](#knowledge-work-session)
8
+ - [Broad Parent Narrowing](#broad-parent-narrowing)
9
+ - [Side Quest Handling](#side-quest-handling)
10
+ - [Multi-Session Project Resume](#multi-session-project-resume)
11
+ - [Status Transitions](#status-transitions)
12
+ - [Compaction Recovery](#compaction-recovery)
13
+ - [Ticket Closure](#ticket-closure)
14
+ - [Reading Tickets Directly](#reading-directly)
15
+
16
+ ---
17
+
18
+ ## Knowledge Work Session
19
+
20
+ **Scenario**: User asks "Help me write a proposal for expanding the analytics platform"
21
+
22
+ **What you see**:
23
+ ```bash
24
+ $ tk ready
25
+ mp-42 [P2][in_progress] - Research analytics platform expansion proposal
26
+
27
+ $ tk show mp-42
28
+ # Full ticket markdown with notes:
29
+ # COMPLETED: Reviewed current stack (Mixpanel, Amplitude)
30
+ # IN PROGRESS: Drafting cost-benefit analysis section
31
+ # NEXT: Need user input on budget constraints
32
+ ```
33
+
34
+ **What you do**:
35
+ 1. Read ticket notes to understand current state
36
+ 2. Create Task tools for immediate work
37
+ 3. Work on tasks, mark completed as you go
38
+ 4. At milestone, update ticket notes:
39
+ ```bash
40
+ tk add-note mp-42 "COMPLETED: Cost-benefit analysis drafted.
41
+ KEY DECISION: User confirmed $50k budget cap - ruled out enterprise options.
42
+ IN PROGRESS: Finalizing recommendations (Posthog + custom ETL).
43
+ NEXT: Get user review of draft before closing."
44
+ ```
45
+
46
+ **Key insight**: Notes field captures the "why" and context; Task tools track the "doing" right now.
47
+
48
+ ---
49
+
50
+ ## Broad Parent Narrowing
51
+
52
+ **Scenario**: `tk ready` surfaces a parent ticket that is still open but only a narrow gap remains.
53
+
54
+ **Pattern**:
55
+ 1. Read the parent with `tk show <parent-id>`
56
+ 2. Assess: what specific work is left?
57
+ 3. Create a focused child ticket for the remaining gap
58
+ 4. Implement the child
59
+ 5. Close child, then close parent if fully resolved
60
+
61
+ ```bash
62
+ $ tk show mp-epic1
63
+ # Title: "API Overhaul"
64
+ # Children: mp-c1 [closed], mp-c2 [closed], mp-c3 [open]
65
+ # Notes say: "All endpoints migrated except /api/legacy/export"
66
+
67
+ # Create precise child for remaining work
68
+ tk create "Migrate /api/legacy/export to v2 format" --parent mp-epic1 -p 2
69
+
70
+ # After implementing and closing the new child:
71
+ tk close mp-epic1
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Side Quest Handling
77
+
78
+ **Scenario**: While implementing a feature, you discover an unrelated bug.
79
+
80
+ ### Assess
81
+
82
+ ```
83
+ Is this bug blocking my current work?
84
+ YES → Create ticket with dep, switch context
85
+ NO → Create ticket, link, continue current work
86
+ ```
87
+
88
+ ### Non-blocking Side Quest
89
+
90
+ ```bash
91
+ # Capture without losing context
92
+ tk create "Bug: cache returns stale data after TTL" -t bug -p 2 --tags cache
93
+ tk link mp-current mp-new-bug
94
+ # Continue with current work
95
+ ```
96
+
97
+ ### Blocking Side Quest
98
+
99
+ ```bash
100
+ # Create and mark as blocker
101
+ tk create "Fix: database timeout on large queries" -t bug -p 0 --tags db
102
+ # Output: mp-fix1
103
+ tk dep mp-current mp-fix1
104
+ tk start mp-fix1
105
+ # Fix the bug, then:
106
+ tk close mp-fix1
107
+ tk start mp-current # Resume original work
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Multi-Session Project Resume
113
+
114
+ **Scenario**: Returning to a project after days or weeks.
115
+
116
+ ```bash
117
+ # Step 1: Active work
118
+ $ tk ls --status=in_progress
119
+ mp-a3x9 [in_progress] - Implement search indexing
120
+
121
+ # Step 2: Read context
122
+ $ tk show mp-a3x9
123
+ # Notes reveal: "COMPLETED: Elasticsearch client configured.
124
+ # IN PROGRESS: Building index mappings for products table.
125
+ # BLOCKER: Need to decide between nested vs. flattened schema."
126
+
127
+ # Step 3: Ready queue
128
+ $ tk ready
129
+ mp-b2y7 [P1][open] - Add product search API endpoint
130
+ mp-c4z1 [P2][open] - Search results pagination
131
+
132
+ # Step 4: Blocked queue
133
+ $ tk blocked
134
+ mp-d6w3 [P1][open] - Deploy search to staging <- [mp-a3x9, mp-b2y7]
135
+ ```
136
+
137
+ Now you have full context without any prior conversation history.
138
+
139
+ ---
140
+
141
+ ## Status Transitions
142
+
143
+ ### When to Change Status
144
+
145
+ | Event | Action |
146
+ |-------|--------|
147
+ | Picking up a ticket to work on | `tk start <id>` |
148
+ | Work completed, acceptance met | `tk close <id>` |
149
+ | Closed ticket needs more work | `tk reopen <id>` |
150
+ | Pausing work (session end) | Keep `in_progress`, update notes |
151
+ | Discovered ticket is invalid | `tk close <id>` with note explaining why |
152
+
153
+ ### Status Hygiene
154
+
155
+ - Don't leave tickets `in_progress` across sessions without notes explaining state
156
+ - `tk ready` only surfaces `open` and `in_progress` tickets — `closed` are excluded
157
+ - Review `in_progress` tickets at session start: are they still active?
158
+
159
+ ---
160
+
161
+ ## Compaction Recovery
162
+
163
+ **After conversation compaction**, you lose all chat context but tickets persist.
164
+
165
+ ```bash
166
+ # What was I doing?
167
+ tk ls --status=in_progress
168
+
169
+ # What's the full context?
170
+ tk show <each-in-progress-id>
171
+
172
+ # What can I work on next?
173
+ tk ready
174
+ ```
175
+
176
+ Tickets with good notes are self-documenting. The notes section is your compaction-proof memory.
177
+
178
+ ---
179
+
180
+ ## Ticket Closure
181
+
182
+ ### Document Completion
183
+
184
+ ```bash
185
+ # Add completion context before closing
186
+ tk add-note mp-a3x9 "COMPLETED: Search indexing fully implemented.
187
+ Chose nested schema for products (better query flexibility).
188
+ Tests added: unit (12), integration (4). All passing."
189
+
190
+ tk close mp-a3x9
191
+ ```
192
+
193
+ ### Reconcile Parent
194
+
195
+ ```bash
196
+ # After closing a child, check parent
197
+ tk show mp-parent
198
+ # If all children closed → tk close mp-parent
199
+ # If work remains → update parent notes
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Reading Tickets Directly {#reading-directly}
205
+
206
+ Since tickets are plain markdown files, you can read them directly when `tk` is unavailable or for batch processing:
207
+
208
+ ```bash
209
+ # Read a specific ticket
210
+ cat .tickets/mp-a3x9.md
211
+
212
+ # Search across all tickets
213
+ grep -l "OAuth" .tickets/*.md
214
+
215
+ # Find all open tickets (checking frontmatter)
216
+ grep -l "status: open" .tickets/*.md
217
+ ```
218
+
219
+ **Prefer `tk show`** when available — it adds computed sections (Blockers, Blocking, Children, Linked) that raw file reads miss. But direct file access is always an option.
@@ -0,0 +1,178 @@
1
+ # Plugin System
2
+
3
+ How to discover, use, and create tk plugins.
4
+
5
+ ## Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Bundled Plugins](#bundled-plugins)
9
+ - [Plugin Discovery](#plugin-discovery)
10
+ - [Using Plugins](#using-plugins)
11
+ - [Creating Plugins](#creating-plugins)
12
+ - [Package Distribution](#package-distribution)
13
+
14
+ ---
15
+
16
+ ## Overview {#overview}
17
+
18
+ tk has a plugin system based on executable naming conventions. Any executable named `tk-<cmd>` or `ticket-<cmd>` in `$PATH` is automatically discovered as a plugin.
19
+
20
+ **Plugin precedence**:
21
+ 1. `tk-<cmd>` prefix takes precedence over `ticket-<cmd>`
22
+ 2. Plugin lookup happens **before** built-in command dispatch
23
+ 3. Use `tk super <cmd>` to bypass plugins and run built-in commands
24
+
25
+ ---
26
+
27
+ ## Bundled Plugins {#bundled-plugins}
28
+
29
+ These ship with the `ticket-extras` package:
30
+
31
+ ### `tk edit <id>`
32
+
33
+ Opens a ticket file in `$EDITOR` (falls back to `vi`).
34
+
35
+ **For humans only** — agents should read/modify ticket files directly or use `tk add-note`.
36
+
37
+ ### `tk ls` / `tk list`
38
+
39
+ List tickets with optional filters:
40
+
41
+ ```bash
42
+ tk ls # All tickets
43
+ tk ls --status=open # Filter by status
44
+ tk ls -a "Jane Doe" # Filter by assignee
45
+ tk ls -T backend # Filter by tag
46
+ ```
47
+
48
+ Output format: `<id> [<status>] - <title> <- [dep1, dep2]`
49
+
50
+ ### `tk query [jq-filter]`
51
+
52
+ Output tickets as JSONL, optionally filtered with jq:
53
+
54
+ ```bash
55
+ # All tickets as JSONL
56
+ tk query
57
+
58
+ # Filter with jq
59
+ tk query '.status == "open" and .priority <= 1'
60
+ ```
61
+
62
+ **Requires**: `jq` installed
63
+
64
+ ### `tk migrate-beads`
65
+
66
+ Import tickets from a `.beads/issues.jsonl` file:
67
+
68
+ ```bash
69
+ tk migrate-beads
70
+ ```
71
+
72
+ Converts beads issues to tk markdown format. **Requires**: `jq` installed
73
+
74
+ ---
75
+
76
+ ## Plugin Discovery {#plugin-discovery}
77
+
78
+ tk discovers plugins by:
79
+ 1. Searching `$PATH` for executables named `tk-*` or `ticket-*`
80
+ 2. Reading plugin metadata from the script
81
+
82
+ ### Listing Installed Plugins
83
+
84
+ ```bash
85
+ tk help
86
+ ```
87
+
88
+ The help output shows all built-in commands plus discovered plugins with descriptions.
89
+
90
+ ### Plugin Metadata
91
+
92
+ Plugins expose metadata via comments in the first 10 lines:
93
+
94
+ ```bash
95
+ #!/bin/bash
96
+ # tk-plugin: Brief description of what this plugin does
97
+ # tk-plugin-version: 1.0.0
98
+ ```
99
+
100
+ For compiled binaries, support the `--tk-describe` flag:
101
+
102
+ ```bash
103
+ $ tk-myplugin --tk-describe
104
+ Brief description of what this plugin does
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Using Plugins {#using-plugins}
110
+
111
+ Plugins are invoked transparently — just use the command name:
112
+
113
+ ```bash
114
+ tk ls --status=open # Runs tk-ls or ticket-ls plugin
115
+ tk query '.priority == 0' # Runs tk-query or ticket-query plugin
116
+ ```
117
+
118
+ ### Bypassing Plugins
119
+
120
+ If a plugin shadows a built-in command:
121
+
122
+ ```bash
123
+ tk super <cmd> [args] # Always runs the built-in
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Creating Plugins {#creating-plugins}
129
+
130
+ ### Minimum Requirements
131
+
132
+ 1. Executable file named `tk-<cmd>` or `ticket-<cmd>`
133
+ 2. In `$PATH`
134
+ 3. Plugin metadata comment in first 10 lines (optional but recommended)
135
+
136
+ ### Environment Variables Available to Plugins
137
+
138
+ | Variable | Description |
139
+ |----------|-------------|
140
+ | `TICKETS_DIR` | Absolute path to the `.tickets/` directory |
141
+ | `TK_SCRIPT` | Absolute path to the main tk script |
142
+
143
+ ### Example Plugin
144
+
145
+ ```bash
146
+ #!/bin/bash
147
+ # tk-plugin: Show ticket statistics
148
+ # tk-plugin-version: 1.0.0
149
+
150
+ total=$(ls "$TICKETS_DIR"/*.md 2>/dev/null | wc -l)
151
+ open=$(grep -l "status: open" "$TICKETS_DIR"/*.md 2>/dev/null | wc -l)
152
+ in_progress=$(grep -l "status: in_progress" "$TICKETS_DIR"/*.md 2>/dev/null | wc -l)
153
+ closed=$(grep -l "status: closed" "$TICKETS_DIR"/*.md 2>/dev/null | wc -l)
154
+
155
+ echo "Total: $total | Open: $open | In Progress: $in_progress | Closed: $closed"
156
+ ```
157
+
158
+ Save as `tk-stats`, make executable, place in `$PATH`.
159
+
160
+ ---
161
+
162
+ ## Package Distribution {#package-distribution}
163
+
164
+ tk is distributed as multiple packages:
165
+
166
+ | Package | Contents |
167
+ |---------|----------|
168
+ | `ticket` | Meta-package (depends on ticket-core + ticket-extras) |
169
+ | `ticket-core` | Core `ticket` script only |
170
+ | `ticket-extras` | Curated plugins (edit, ls, query, migrate-beads) |
171
+ | `ticket-<plugin>` | Individual plugin packages (e.g., `ticket-query`) |
172
+
173
+ Install via Homebrew:
174
+
175
+ ```bash
176
+ brew install ticket # Full install
177
+ brew install ticket-core # Core only
178
+ ```
@@ -0,0 +1,153 @@
1
+ # Ticket Creation Guidelines
2
+
3
+ Guidance on when and how to create tk tickets for maximum effectiveness.
4
+
5
+ ## Contents
6
+
7
+ - [When to Ask First vs Create Directly](#when-to-ask)
8
+ - [Ticket Quality](#quality)
9
+ - [Making Tickets Resumable](#resumable)
10
+ - [Design vs Acceptance Criteria](#design-vs-acceptance)
11
+ - [Ticket File Format](#file-format)
12
+
13
+ ## When to Ask First vs Create Directly {#when-to-ask}
14
+
15
+ ### Ask the user before creating when:
16
+ - Knowledge work with fuzzy boundaries
17
+ - Task scope is unclear
18
+ - Multiple valid approaches exist
19
+ - User's intent needs clarification
20
+
21
+ ### Create directly when:
22
+ - Clear bug discovered during implementation
23
+ - Obvious follow-up work identified
24
+ - Technical debt with clear scope
25
+ - Dependency or blocker found
26
+
27
+ **Why ask first for knowledge work?** Task boundaries in strategic/research work are often unclear until discussed. Technical implementation tasks are usually well-defined. Discussion prevents poorly-scoped tickets that need immediate revision.
28
+
29
+ ## Ticket Quality {#quality}
30
+
31
+ Use clear, specific titles and include sufficient context in descriptions to resume work later.
32
+
33
+ ### Field Usage
34
+
35
+ **Use --design flag for:**
36
+ - Implementation approach decisions
37
+ - Architecture notes
38
+ - Trade-offs considered
39
+
40
+ **Use --acceptance flag for:**
41
+ - Definition of done
42
+ - Testing requirements
43
+ - Success metrics
44
+
45
+ ### Good vs Bad Titles
46
+
47
+ ```bash
48
+ # BAD - vague
49
+ tk create "Fix the bug"
50
+ tk create "Update stuff"
51
+
52
+ # GOOD - specific and actionable
53
+ tk create "Fix redirect loop on OAuth callback when session expired" -t bug -p 1
54
+ tk create "Add rate limiting to /api/upload endpoint" -t feature -p 2
55
+ ```
56
+
57
+ ## Making Tickets Resumable {#resumable}
58
+
59
+ For complex technical features spanning multiple sessions, use notes to capture implementation state.
60
+
61
+ ### Valuable note content for technical work:
62
+ - Working code snippets (tested, with response format)
63
+ - Sample API responses showing actual data
64
+ - Desired output format examples (show, don't describe)
65
+ - Research context (why this approach, what was discovered)
66
+
67
+ ### Example pattern:
68
+
69
+ ```bash
70
+ tk add-note mp-a3x9 "IMPLEMENTATION GUIDE:
71
+ WORKING CODE: service.about().get(fields='importFormats')
72
+ Returns: dict with 49 entries like {'text/markdown': [...]}
73
+ OUTPUT FORMAT: # Drive Import Formats (markdown with categorized list)
74
+ CONTEXT: text/markdown support added July 2024, not in static docs"
75
+ ```
76
+
77
+ **When to add:** Multi-session technical features with APIs or specific formats. Skip for simple tasks.
78
+
79
+ ## Design vs Acceptance Criteria {#design-vs-acceptance}
80
+
81
+ Common mistake: Putting implementation details in acceptance criteria.
82
+
83
+ ### DESIGN field (HOW to build it):
84
+ - "Use two-phase approach: validate input first, then process"
85
+ - "Parse with regex to find markers"
86
+ - "Use JWT tokens with 1-hour expiry"
87
+ - Trade-offs: "Chose batch API over streaming for atomicity"
88
+
89
+ ### ACCEPTANCE CRITERIA (WHAT SUCCESS LOOKS LIKE):
90
+ - "Users can log in with Google OAuth"
91
+ - "Rate limiter returns 429 after 100 req/min"
92
+ - "All existing tests continue to pass"
93
+ - "Response time under 200ms at p95"
94
+
95
+ ## Ticket File Format {#file-format}
96
+
97
+ Tickets are stored as markdown files in `.tickets/` with YAML frontmatter:
98
+
99
+ ```markdown
100
+ ---
101
+ id: mp-a3x9
102
+ status: open
103
+ deps: []
104
+ links: []
105
+ created: 2026-01-15T10:30:00Z
106
+ type: task
107
+ priority: 2
108
+ assignee: Jane Doe
109
+ external-ref: gh-456
110
+ parent: mp-b2y7
111
+ tags: [ui, backend, urgent]
112
+ ---
113
+ # Implement OAuth Flow
114
+
115
+ Add Google and GitHub OAuth providers using passport.js strategy pattern.
116
+
117
+ ## Design
118
+
119
+ Use passport.js strategy pattern. Google strategy first, then GitHub.
120
+ Token refresh handled via middleware.
121
+
122
+ ## Acceptance Criteria
123
+
124
+ - Users can log in with Google
125
+ - Users can log in with GitHub
126
+ - Session persists across page refreshes
127
+
128
+ ## Notes
129
+
130
+ **2026-01-15T12:00:00Z**
131
+
132
+ Discovered that passport-google-oauth20 requires specific callback URL format.
133
+
134
+ **2026-01-16T09:00:00Z**
135
+
136
+ GitHub strategy working. Google needs additional scope for email access.
137
+ ```
138
+
139
+ ### Frontmatter Fields
140
+
141
+ | Field | Type | Values/Default |
142
+ |-------|------|----------------|
143
+ | `id` | string | Auto-generated `<prefix>-<4chars>` |
144
+ | `status` | string | `open`, `in_progress`, `closed` |
145
+ | `deps` | array | Ticket IDs this depends on |
146
+ | `links` | array | Symmetrically linked ticket IDs |
147
+ | `created` | string | ISO 8601 UTC `YYYY-MM-DDTHH:MM:SSZ` |
148
+ | `type` | string | `bug`, `feature`, `task`, `epic`, `chore` (default: `task`) |
149
+ | `priority` | integer | 0-4, 0=highest (default: 2) |
150
+ | `assignee` | string | Defaults to `git config user.name` |
151
+ | `external-ref` | string | External reference (e.g., `gh-123`) |
152
+ | `parent` | string | Parent ticket ID |
153
+ | `tags` | array | Tags (e.g., `[ui, backend]`) |