@torka/claude-workflows 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,51 @@
1
+ {
2
+ "name": "@torka/claude-workflows",
3
+ "version": "0.1.0",
4
+ "description": "Epic automation, git cleanup, code review agents, and workflow helpers for Claude Code",
5
+ "commands": [
6
+ {
7
+ "name": "implement-epic-with-subagents",
8
+ "description": "Automate entire epic execution by orchestrating sub-agents to execute all stories sequentially"
9
+ },
10
+ {
11
+ "name": "plan-parallelization",
12
+ "description": "Analyze epic files to identify which epics can run in parallel using Git worktrees"
13
+ },
14
+ {
15
+ "name": "git-cleanup-and-merge",
16
+ "description": "Analyze git branches, cleanup merged branches, push changes, create PRs, wait for CI, and merge"
17
+ }
18
+ ],
19
+ "agents": [
20
+ {
21
+ "name": "principal-code-reviewer",
22
+ "description": "Expert-level code review after completing coding tasks or stories"
23
+ },
24
+ {
25
+ "name": "story-prep-master",
26
+ "description": "Create, refine, or prepare user stories for development"
27
+ }
28
+ ],
29
+ "skills": [
30
+ {
31
+ "name": "agent-creator",
32
+ "description": "Creates custom Claude Code sub-agents for project tasks"
33
+ }
34
+ ],
35
+ "hooks": {
36
+ "PreToolUse": [
37
+ {
38
+ "name": "auto_approve_safe",
39
+ "description": "Auto-approve safe tool usage for solo dev workflows",
40
+ "script": "auto_approve_safe.py"
41
+ }
42
+ ]
43
+ },
44
+ "scripts": {
45
+ "statusLine": {
46
+ "name": "context-monitor",
47
+ "description": "Real-time context usage monitoring with visual indicators",
48
+ "script": "context-monitor.py"
49
+ }
50
+ }
51
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Varun Torka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,299 @@
1
+ # @torka/claude-workflows
2
+
3
+ Claude Code workflow helpers for epic automation, git management, and developer productivity.
4
+
5
+ ## Features
6
+
7
+ | Feature | Description | Standalone |
8
+ |---------|-------------|------------|
9
+ | **Git Cleanup & Merge** | Intelligent branch management, PR creation, CI monitoring | Yes |
10
+ | **Parallelization Analysis** | Identify which epics can run in parallel with Git worktrees | Yes |
11
+ | **Agent Creator** | Design and deploy custom Claude Code agents | Yes |
12
+ | **Auto-Approve Hook** | Safe command auto-approval for solo dev workflows | Yes |
13
+ | **Context Monitor** | Real-time context usage status line | Yes |
14
+ | **Epic Orchestration** | Automate multi-story epic execution with sub-agents | Requires BMAD |
15
+ | **Code Review Agent** | Principal-level code review automation | Requires BMM |
16
+ | **Story Prep Agent** | Convert requirements to developer-ready specs | Requires BMM |
17
+
18
+ ## Installation
19
+
20
+ ### Project-level (recommended)
21
+
22
+ ```bash
23
+ npm install --save-dev @torka/claude-workflows
24
+ ```
25
+
26
+ ### Global
27
+
28
+ ```bash
29
+ npm install -g @torka/claude-workflows
30
+ ```
31
+
32
+ The installer automatically copies files to your `.claude/` directory:
33
+ - **Project-level**: Files go to `<project>/.claude/`
34
+ - **Global**: Files go to `~/.claude/`
35
+
36
+ ## Post-Installation Setup
37
+
38
+ ### 1. Configure Hooks (recommended)
39
+
40
+ Copy the hooks configuration from `examples/settings.local.example.json` to your `.claude/settings.local.json`.
41
+
42
+ **Auto-approve hook** (auto-approves safe commands):
43
+
44
+ ```json
45
+ {
46
+ "hooks": {
47
+ "PreToolUse": [
48
+ {
49
+ "matcher": "Bash|Read|Grep|Glob|Write|Edit|MultiEdit",
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "python3 .claude/scripts/auto_approve_safe.py"
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### 2. Configure Status Line (optional)
63
+
64
+ Add to your `.claude/settings.local.json`:
65
+
66
+ ```json
67
+ {
68
+ "statusLine": {
69
+ "type": "command",
70
+ "command": "python3 .claude/scripts/context-monitor.py"
71
+ }
72
+ }
73
+ ```
74
+
75
+ This shows a real-time context usage bar with percentage and warnings.
76
+
77
+ ## Usage
78
+
79
+ ### Commands
80
+
81
+ #### `/git-cleanup-and-merge`
82
+
83
+ Comprehensive git branch management workflow:
84
+ - Analyzes all branches (merged, diverged, orphaned)
85
+ - Handles Git worktrees correctly
86
+ - Pushes unpushed commits
87
+ - Creates PRs for unpushed branches
88
+ - Waits for CI to pass
89
+ - Merges approved PRs
90
+ - Cleans up merged branches
91
+
92
+ ```
93
+ /git-cleanup-and-merge
94
+ ```
95
+
96
+ #### `/plan-parallelization`
97
+
98
+ Analyzes epic files to identify parallelization opportunities:
99
+ - Detects epic-to-epic dependencies
100
+ - Groups epics into execution phases
101
+ - Generates worktree commands for parallel execution
102
+ - Tracks progress against sprint status
103
+
104
+ ```
105
+ /plan-parallelization
106
+ ```
107
+
108
+ #### `/implement-epic-with-subagents`
109
+
110
+ > **Requires BMAD Method**
111
+
112
+ Orchestrates sub-agents to execute all stories in an epic sequentially with minimal intervention.
113
+
114
+ ```
115
+ /implement-epic-with-subagents
116
+ ```
117
+
118
+ ### Agents
119
+
120
+ #### `principal-code-reviewer`
121
+
122
+ > **Requires BMM `/code-review` workflow**
123
+
124
+ Expert-level code review agent. Launch after completing code to validate:
125
+ - Code quality and correctness
126
+ - Test coverage
127
+ - Architecture compliance
128
+ - Security and performance
129
+
130
+ #### `story-prep-master`
131
+
132
+ > **Requires BMM `/create-story` workflow**
133
+
134
+ Converts product requirements into developer-ready specifications:
135
+ - Breaks down epics into actionable stories
136
+ - Ensures completeness with acceptance criteria
137
+ - Creates story files ready for development
138
+
139
+ ### Skills
140
+
141
+ #### `/agent-creator`
142
+
143
+ Design and deploy custom Claude Code agents:
144
+ - Step-by-step agent creation workflow
145
+ - Templates for story-based and non-story agents
146
+ - Registry system for tracking created agents
147
+ - Community repository research guidance
148
+
149
+ ```
150
+ /agent-creator
151
+ ```
152
+
153
+ ### Hooks
154
+
155
+ #### `auto_approve_safe.py`
156
+
157
+ PreToolUse hook that auto-approves safe commands:
158
+ - **Allowed**: Read-only commands, tests, linting, git status/diff/log
159
+ - **Denied**: Dangerous commands (sudo, rm -rf, etc.)
160
+ - **Prompted**: Everything else defers to normal permissions
161
+
162
+ Customize rules in `.claude/scripts/auto_approve_safe.rules.json`:
163
+
164
+ ```json
165
+ {
166
+ "allow_patterns": [
167
+ "^npm test",
168
+ "^git status"
169
+ ],
170
+ "deny_patterns": [
171
+ "^sudo",
172
+ "rm.*-rf"
173
+ ],
174
+ "sensitive_paths": [
175
+ "\\.env$",
176
+ "credentials"
177
+ ]
178
+ }
179
+ ```
180
+
181
+ ### Scripts
182
+
183
+ #### `context-monitor.py`
184
+
185
+ Status line script showing:
186
+ - Current model name
187
+ - Working directory
188
+ - Git branch
189
+ - Context usage bar with percentage
190
+ - Warnings at 75%, 90%, 95% usage
191
+
192
+ ## Dependencies
193
+
194
+ Some components require the [BMAD Method](https://github.com/bmad-method) workflows:
195
+
196
+ | Component | Dependency |
197
+ |-----------|------------|
198
+ | `implement-epic-with-subagents` | `@_bmad/bmm/workflows/` |
199
+ | `principal-code-reviewer` | BMM `/code-review` workflow |
200
+ | `story-prep-master` | BMM `/create-story` workflow |
201
+
202
+ **Standalone components** (no external dependencies):
203
+ - `/git-cleanup-and-merge`
204
+ - `/plan-parallelization`
205
+ - `/agent-creator` skill
206
+ - `auto_approve_safe` hook
207
+ - `context-monitor` status line
208
+
209
+ ## File Structure
210
+
211
+ After installation, files are placed in:
212
+
213
+ ```
214
+ .claude/
215
+ ├── commands/
216
+ │ ├── implement-epic-with-subagents.md
217
+ │ ├── plan-parallelization.md
218
+ │ └── git-cleanup-and-merge.md
219
+ ├── agents/
220
+ │ ├── principal-code-reviewer.md
221
+ │ └── story-prep-master.md
222
+ ├── skills/
223
+ │ └── agent-creator/
224
+ │ ├── SKILL.md
225
+ │ ├── REGISTRY.yaml
226
+ │ ├── STORY-AGENT-TEMPLATE.md
227
+ │ ├── NON-STORY-AGENT-TEMPLATE.md
228
+ │ └── COMMUNITY-REPOS.md
229
+ └── scripts/
230
+ ├── auto_approve_safe.py
231
+ ├── auto_approve_safe.rules.json
232
+ └── context-monitor.py
233
+ ```
234
+
235
+ ## Uninstallation
236
+
237
+ ```bash
238
+ npm uninstall @torka/claude-workflows
239
+ ```
240
+
241
+ **Manual cleanup** (if files remain after uninstall):
242
+
243
+ ```bash
244
+ # Remove installed files
245
+ rm -rf .claude/commands/implement-epic-with-subagents.md \
246
+ .claude/commands/plan-parallelization.md \
247
+ .claude/commands/git-cleanup-and-merge.md \
248
+ .claude/agents/principal-code-reviewer.md \
249
+ .claude/agents/story-prep-master.md \
250
+ .claude/skills/agent-creator \
251
+ .claude/scripts/auto_approve_safe.py \
252
+ .claude/scripts/auto_approve_safe.rules.json \
253
+ .claude/scripts/context-monitor.py
254
+ ```
255
+
256
+ **Note**: Your `settings.local.json` is not modified—you may want to manually remove hook/statusLine configurations.
257
+
258
+ ## Customization
259
+
260
+ ### Extending Auto-Approve Rules
261
+
262
+ Edit `.claude/scripts/auto_approve_safe.rules.json`:
263
+
264
+ ```json
265
+ {
266
+ "allow_patterns": [
267
+ "^your-custom-command"
268
+ ]
269
+ }
270
+ ```
271
+
272
+ ### Creating Custom Agents
273
+
274
+ Use the `/agent-creator` skill to create project-specific agents:
275
+
276
+ 1. Run `/agent-creator`
277
+ 2. Follow the 5-step workflow
278
+ 3. Agents are saved to `.claude/agents/`
279
+
280
+ ## Contributing
281
+
282
+ 1. Fork the repository
283
+ 2. Create a feature branch
284
+ 3. Make your changes
285
+ 4. Submit a pull request
286
+
287
+ ## License
288
+
289
+ MIT License - see [LICENSE](LICENSE) for details.
290
+
291
+ ## Author
292
+
293
+ Varun Torka
294
+
295
+ ## Links
296
+
297
+ - [GitHub Repository](https://github.com/varuntorka/vt-claude-workflows)
298
+ - [Issue Tracker](https://github.com/varuntorka/vt-claude-workflows/issues)
299
+ - [Claude Code Documentation](https://code.claude.com/docs)
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: principal-code-reviewer
3
+ description: Use this agent when you need a thorough, expert-level code review after completing a coding task or story. This agent should be launched immediately after finishing a logical chunk of code, implementing a feature, or completing a story to validate quality, correctness, and adherence to best practices.
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a Principal Software Engineer with 15+ years of experience across multiple domains including distributed systems, frontend architecture, security, performance optimization, and developer experience. You have an exceptional eye for detail and take pride in maintaining the highest code quality standards.
8
+
9
+ Your expertise spans:
10
+ - Full-stack development with deep knowledge of React, Next.js, TypeScript, and Node.js
11
+ - Database design and ORM patterns (particularly Drizzle, Prisma, PostgreSQL)
12
+ - Authentication and security best practices (OAuth, JWT, session management)
13
+ - API design (REST, GraphQL, streaming/SSE)
14
+ - Testing strategies (unit, integration, E2E)
15
+ - Performance optimization and scalability
16
+ - Code architecture and design patterns
17
+
18
+ ## Your Immediate Action
19
+
20
+ Upon activation, you MUST immediately execute the `/code-review` task. Do not engage in conversation, ask questions, or perform any other action first. Your sole purpose is to trigger this code review.
21
+
22
+ ## Execution Instructions
23
+
24
+ 1. Immediately run the `/code-review` slash command
25
+ 2. Do not ask for clarification or additional context before running the review
26
+ 3. Do not greet the user or provide preamble
27
+ 4. Simply execute the code review task as your first and only action
28
+
29
+ ## Review Philosophy
30
+
31
+ When the code review executes, approach it with these principles:
32
+ - Assume the code was recently written and focus on recent changes
33
+ - Look for both correctness issues and opportunities for improvement
34
+ - Consider the project's established patterns from CLAUDE.md
35
+ - Balance thoroughness with pragmatism
36
+ - Provide actionable, specific feedback
37
+ - Acknowledge good practices when you see them
38
+
39
+ ## Handoff Format (Required for Orchestrator)
40
+
41
+ After `/code-review` completes, you MUST output this structured handoff:
42
+
43
+ ```
44
+ === CODE REVIEW HANDOFF ===
45
+ agent: principal-code-reviewer
46
+ story: [story number being reviewed, e.g., "2.3"]
47
+ review_status: approved | changes_requested | rejected
48
+ findings:
49
+ critical: [count or list of critical issues]
50
+ major: [count or list of major issues]
51
+ minor: [count or list of minor issues]
52
+ suggestions: [count or list of suggestions]
53
+ summary: "[1-2 sentence review summary]"
54
+ next_action: proceed | fix_required | escalate
55
+ === END HANDOFF ===
56
+ ```
57
+
58
+ **Review Status Definitions:**
59
+ - `approved`: Code meets quality standards, ready for merge
60
+ - `changes_requested`: Issues found that dev agent should fix (auto-retry)
61
+ - `rejected`: Fundamental problems requiring human intervention
62
+
63
+ **Finding Severity:**
64
+ - `critical`: Security vulnerabilities, data loss risks, broken functionality
65
+ - `major`: Significant bugs, missing tests, architectural issues
66
+ - `minor`: Code style, documentation gaps, non-blocking improvements
67
+ - `suggestions`: Optional enhancements, nice-to-haves
68
+
69
+ **Next Action:**
70
+ - `proceed`: Move to git commit (if approved)
71
+ - `fix_required`: Return to dev agent with feedback (if changes_requested)
72
+ - `escalate`: Requires human intervention (if rejected)
73
+
74
+ ## Execution Flow
75
+
76
+ 1. Run `/code-review` as your first action
77
+ 2. Collect all findings from the review
78
+ 3. Categorize findings by severity
79
+ 4. Output structured handoff with categorized findings
80
+ 5. Set `review_status` based on severity of findings
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: story-prep-master
3
+ description: Use this agent when you need to create, refine, or prepare user stories for development. This includes converting product requirements into developer-ready specifications, breaking down epics into actionable stories, ensuring story completeness with acceptance criteria.
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a Senior Product Manager, Technical Scrum Master, and Story Preparation Specialist combined into one elite practitioner. You hold CSM/CSPO certifications and have a deep technical background that allows you to bridge the gap between product vision and technical execution.
8
+
9
+ ## Your Identity
10
+
11
+ You are the gatekeeper of story quality. Every story that passes through you emerges crystal clear, actionable, and developer-ready. You have zero tolerance for ambiguity, incomplete acceptance criteria, or stories that could be interpreted multiple ways.
12
+
13
+ ## Core Principles
14
+
15
+ 1. **Strict Boundaries**: Story preparation and implementation are separate concerns. You prepare, developers implement.
16
+ 2. **Single Source of Truth**: The story IS the contract. Everything needed is IN the story.
17
+ 3. **Perfect Alignment**: PRD → Story → Implementation must be traceable and consistent.
18
+ 4. **Sprint Enablement**: Your stories enable efficient sprints with minimal clarification needed.
19
+ 5. **Developer-Ready Specs**: Handoffs include everything: context, criteria, edge cases, and technical hints.
20
+
21
+ ## Your Immediate Action
22
+
23
+ Upon activation, you MUST immediately execute the `/create-story` workflow to create a developer-ready story file. Do not engage in conversation, ask questions, or perform any other action first.
24
+
25
+ ## Execution Instructions
26
+
27
+ 1. Run `/create-story` with the provided epic and story number
28
+ 2. Wait for workflow completion
29
+ 3. Output the structured handoff message below with results
30
+
31
+ ## Handoff Format (Required for Orchestrator)
32
+
33
+ After `/create-story` completes, you MUST output this structured handoff:
34
+
35
+ ```
36
+ === AGENT HANDOFF ===
37
+ agent: story-prep-master
38
+ story: [story number from epic, e.g., "2.3"]
39
+ status: completed | failed | blocked
40
+ story_file: [path to created story file]
41
+ blockers: none | [list any blockers that prevented completion]
42
+ next_action: proceed | escalate
43
+ === END HANDOFF ===
44
+ ```
45
+
46
+ **Status Definitions:**
47
+ - `completed`: Story file created successfully, ready for development
48
+ - `failed`: Could not create story (missing epic, invalid format, etc.)
49
+ - `blocked`: External dependency prevents completion
50
+
51
+ **Next Action:**
52
+ - `proceed`: Move to next phase (development)
53
+ - `escalate`: Requires human intervention