claude-autopm 2.11.1 → 2.12.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,222 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Pre-Action Agent Reminder Hook
5
+ *
6
+ * Reminds Claude to use specialized agents BEFORE performing tasks.
7
+ * This hook analyzes the user's request and suggests appropriate agents.
8
+ *
9
+ * IMPORTANT: This is a REMINDER, not a blocker. Claude can proceed,
10
+ * but should consider using agents for non-trivial tasks.
11
+ */
12
+
13
+ const patterns = {
14
+ // Code writing patterns
15
+ code: {
16
+ patterns: [
17
+ /writ(e|ing) code/i,
18
+ /creat(e|ing) (a |an )?(function|class|component|module|api|endpoint)/i,
19
+ /implement(ing)?/i,
20
+ /add (a |an )?(feature|functionality)/i,
21
+ /build (a |an )?/i,
22
+ /develop(ing)?/i
23
+ ],
24
+ agents: [
25
+ 'python-backend-engineer (Python)',
26
+ 'nodejs-backend-engineer (Node.js/JavaScript)',
27
+ 'react-frontend-engineer (React/Frontend)',
28
+ 'bash-scripting-expert (Bash scripts)'
29
+ ],
30
+ context7: [
31
+ 'Query Context7 for framework-specific best practices',
32
+ 'Check API patterns and conventions',
33
+ 'Verify current library versions and syntax'
34
+ ]
35
+ },
36
+
37
+ // Testing patterns
38
+ testing: {
39
+ patterns: [
40
+ /test(s|ing)?/i,
41
+ /unit test/i,
42
+ /integration test/i,
43
+ /e2e test/i,
44
+ /run.*(test|spec)/i,
45
+ /write.*test/i
46
+ ],
47
+ agents: [
48
+ 'test-runner (Run and analyze tests)',
49
+ 'frontend-testing-engineer (Frontend tests)',
50
+ 'e2e-test-engineer (E2E tests)'
51
+ ],
52
+ context7: [
53
+ 'mcp://context7/jest/best-practices',
54
+ 'mcp://context7/testing/tdd-patterns',
55
+ 'mcp://context7/<framework>/testing'
56
+ ]
57
+ },
58
+
59
+ // Database patterns
60
+ database: {
61
+ patterns: [
62
+ /database/i,
63
+ /schema/i,
64
+ /migration/i,
65
+ /query/i,
66
+ /sql/i,
67
+ /(postgres|mysql|mongodb|redis)/i
68
+ ],
69
+ agents: [
70
+ 'postgresql-expert (PostgreSQL)',
71
+ 'mongodb-expert (MongoDB)',
72
+ 'redis-expert (Redis)'
73
+ ],
74
+ context7: [
75
+ 'mcp://context7/<database>/schema-design',
76
+ 'mcp://context7/<database>/query-optimization',
77
+ 'mcp://context7/<database>/best-practices'
78
+ ]
79
+ },
80
+
81
+ // DevOps patterns
82
+ devops: {
83
+ patterns: [
84
+ /deploy(ing|ment)?/i,
85
+ /docker/i,
86
+ /kubernetes/i,
87
+ /k8s/i,
88
+ /container/i,
89
+ /ci\/cd/i,
90
+ /pipeline/i
91
+ ],
92
+ agents: [
93
+ 'kubernetes-orchestrator (Kubernetes)',
94
+ 'docker-containerization-expert (Docker)',
95
+ 'terraform-infrastructure-expert (Terraform)',
96
+ 'github-operations-specialist (GitHub Actions)'
97
+ ],
98
+ context7: [
99
+ 'mcp://context7/kubernetes/deployment-patterns',
100
+ 'mcp://context7/docker/best-practices',
101
+ 'mcp://context7/terraform/infrastructure-patterns'
102
+ ]
103
+ },
104
+
105
+ // Code analysis patterns
106
+ analysis: {
107
+ patterns: [
108
+ /review/i,
109
+ /analyze/i,
110
+ /check.*bug/i,
111
+ /find.*issue/i,
112
+ /security/i,
113
+ /optimize/i
114
+ ],
115
+ agents: [
116
+ 'code-analyzer (Bug detection, logic tracing)',
117
+ 'security-scanning-expert (Security analysis)'
118
+ ],
119
+ context7: [
120
+ 'mcp://context7/<language>/code-quality',
121
+ 'mcp://context7/security/best-practices'
122
+ ]
123
+ },
124
+
125
+ // Large file patterns
126
+ files: {
127
+ patterns: [
128
+ /log file/i,
129
+ /analyze.*file/i,
130
+ /summarize.*file/i,
131
+ /parse.*(log|output)/i
132
+ ],
133
+ agents: [
134
+ 'file-analyzer (File and log analysis)'
135
+ ],
136
+ context7: [
137
+ 'mcp://context7/logging/analysis-patterns'
138
+ ]
139
+ }
140
+ };
141
+
142
+ function analyzeRequest(userMessage) {
143
+ const matches = [];
144
+
145
+ for (const [category, config] of Object.entries(patterns)) {
146
+ for (const pattern of config.patterns) {
147
+ if (pattern.test(userMessage)) {
148
+ matches.push({
149
+ category,
150
+ agents: config.agents,
151
+ context7: config.context7
152
+ });
153
+ break;
154
+ }
155
+ }
156
+ }
157
+
158
+ return matches;
159
+ }
160
+
161
+ function generateReminder(matches) {
162
+ if (matches.length === 0) {
163
+ return null;
164
+ }
165
+
166
+ let reminder = '\n🤖 AGENT USAGE REMINDER\n';
167
+ reminder += '━'.repeat(80) + '\n\n';
168
+
169
+ reminder += '⚠️ This task may benefit from using specialized agents:\n\n';
170
+
171
+ for (const match of matches) {
172
+ reminder += `📋 ${match.category.toUpperCase()} TASK DETECTED\n\n`;
173
+
174
+ reminder += '**Recommended Agents:**\n';
175
+ for (const agent of match.agents) {
176
+ reminder += ` • ${agent}\n`;
177
+ }
178
+
179
+ reminder += '\n**Context7 Queries:**\n';
180
+ for (const query of match.context7) {
181
+ reminder += ` • ${query}\n`;
182
+ }
183
+
184
+ reminder += '\n';
185
+ }
186
+
187
+ reminder += '📖 See: .claude/rules/agent-mandatory.md for complete guidance\n';
188
+ reminder += '━'.repeat(80) + '\n\n';
189
+
190
+ reminder += '💡 You can proceed directly if this is simple, but consider:\n';
191
+ reminder += ' 1. Using agents for better quality and consistency\n';
192
+ reminder += ' 2. Querying Context7 for up-to-date best practices\n';
193
+ reminder += ' 3. Following TDD cycle (RED-GREEN-REFACTOR)\n\n';
194
+
195
+ return reminder;
196
+ }
197
+
198
+ function main() {
199
+ // Get user message from command line args or stdin
200
+ const args = process.argv.slice(2);
201
+ const userMessage = args.join(' ') || '';
202
+
203
+ if (!userMessage) {
204
+ // No message to analyze
205
+ process.exit(0);
206
+ }
207
+
208
+ const matches = analyzeRequest(userMessage);
209
+ const reminder = generateReminder(matches);
210
+
211
+ if (reminder) {
212
+ console.log(reminder);
213
+ }
214
+
215
+ process.exit(0);
216
+ }
217
+
218
+ if (require.main === module) {
219
+ main();
220
+ }
221
+
222
+ module.exports = { analyzeRequest, generateReminder };
@@ -0,0 +1,68 @@
1
+ #!/bin/bash
2
+
3
+ # Pre-Commit Clear Reminder Hook
4
+ #
5
+ # Detects when an issue is being closed and reminds to run /clear
6
+ # before starting the next issue.
7
+
8
+ # Get the commit message
9
+ COMMIT_MSG_FILE="$1"
10
+ COMMIT_MSG=$(cat "$COMMIT_MSG_FILE" 2>/dev/null || git log --format=%B -n 1 HEAD 2>/dev/null)
11
+
12
+ # Patterns that indicate issue closure
13
+ CLOSING_PATTERNS=(
14
+ "close #"
15
+ "closes #"
16
+ "closed #"
17
+ "fix #"
18
+ "fixes #"
19
+ "fixed #"
20
+ "resolve #"
21
+ "resolves #"
22
+ "resolved #"
23
+ "complete #"
24
+ "completes #"
25
+ "completed #"
26
+ )
27
+
28
+ # Check if commit message contains issue closing keywords
29
+ issue_closed=false
30
+ for pattern in "${CLOSING_PATTERNS[@]}"; do
31
+ if echo "$COMMIT_MSG" | grep -qi "$pattern"; then
32
+ issue_closed=true
33
+ break
34
+ fi
35
+ done
36
+
37
+ # If issue is being closed, show reminder
38
+ if [ "$issue_closed" = true ]; then
39
+ echo ""
40
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
41
+ echo "🧹 CONTEXT HYGIENE REMINDER"
42
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
43
+ echo ""
44
+ echo "⚠️ This commit closes an issue!"
45
+ echo ""
46
+ echo "📋 IMPORTANT: After this commit, run /clear before starting"
47
+ echo " the next issue to prevent context bleed."
48
+ echo ""
49
+ echo "Why this matters:"
50
+ echo " • Prevents mixing context from different issues"
51
+ echo " • Ensures Claude starts fresh for each task"
52
+ echo " • Reduces token usage"
53
+ echo " • Improves response quality"
54
+ echo ""
55
+ echo "Next steps:"
56
+ echo " 1. ✅ Complete this commit"
57
+ echo " 2. 🧹 Type: /clear"
58
+ echo " 3. 📝 Start next issue with clean context"
59
+ echo ""
60
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
61
+ echo ""
62
+
63
+ # Optional: Create a reminder file
64
+ echo "REMINDER: Run /clear before next issue" > .claude/.clear-reminder
65
+ fi
66
+
67
+ # Always allow commit to proceed
68
+ exit 0
@@ -2,12 +2,43 @@
2
2
 
3
3
  **🚨 CRITICAL: This rule has HIGHEST PRIORITY and MUST be followed for ALL tasks.**
4
4
 
5
+ ## ⚠️ BEFORE YOU START ANY TASK - READ THIS
6
+
7
+ **MANDATORY SELF-CHECK:**
8
+
9
+ Before doing ANYTHING complex, ask yourself:
10
+ 1. ❓ Is this writing code? → **USE AGENT**
11
+ 2. ❓ Is this testing code? → **USE test-runner**
12
+ 3. ❓ Is this analyzing code/files? → **USE code-analyzer or file-analyzer**
13
+ 4. ❓ Is this database work? → **USE database expert agent**
14
+ 5. ❓ Is this DevOps/infrastructure? → **USE DevOps agent**
15
+
16
+ **If YES to ANY → STOP and USE the appropriate agent!**
17
+
5
18
  ## Core Requirement
6
19
 
7
20
  **YOU MUST USE SPECIALIZED AGENTS FOR ALL NON-TRIVIAL TASKS.**
8
21
 
9
22
  Do NOT perform complex tasks yourself. Use the Task tool to delegate to appropriate agents.
10
23
 
24
+ ### Why This Rule Exists
25
+
26
+ 1. **Quality**: Specialized agents have deeper expertise
27
+ 2. **Consistency**: Agents follow established patterns
28
+ 3. **Context7**: Agents query live documentation (you should too!)
29
+ 4. **TDD**: Agents enforce RED-GREEN-REFACTOR cycle
30
+ 5. **Best Practices**: Agents apply industry standards
31
+
32
+ ### What Happens When You Don't Use Agents
33
+
34
+ ❌ **Common failures:**
35
+ - Code without tests (violates TDD)
36
+ - Missing Context7 queries (outdated patterns)
37
+ - Inconsistent code style
38
+ - Security vulnerabilities
39
+ - Performance issues
40
+ - Missing error handling
41
+
11
42
  ## When to Use Agents
12
43
 
13
44
  ### ✅ ALWAYS Use Agents For:
@@ -160,11 +191,59 @@ If you're unsure whether to use an agent:
160
191
  - When in doubt, delegate to specialist
161
192
  - Better to over-use agents than under-use them
162
193
 
194
+ ## Context7 Integration - ALSO MANDATORY
195
+
196
+ **In addition to using agents, you MUST query Context7 for up-to-date documentation.**
197
+
198
+ ### When to Query Context7
199
+
200
+ **BEFORE implementing ANY code:**
201
+ ```bash
202
+ # Query relevant documentation
203
+ mcp://context7/<framework>/<topic>
204
+ mcp://context7/<language>/best-practices
205
+ mcp://context7/<library>/api-reference
206
+ ```
207
+
208
+ ### Why Context7 is Required
209
+
210
+ 1. **Up-to-date info**: Your training data may be outdated
211
+ 2. **API changes**: Libraries evolve, APIs change
212
+ 3. **Best practices**: Current industry standards
213
+ 4. **Bug fixes**: Known issues and workarounds
214
+
215
+ ### Examples
216
+
217
+ **Writing Python FastAPI code:**
218
+ ```bash
219
+ # Query BEFORE implementation
220
+ mcp://context7/fastapi/routing
221
+ mcp://context7/fastapi/validation
222
+ mcp://context7/pydantic/models
223
+ ```
224
+
225
+ **Writing React components:**
226
+ ```bash
227
+ # Query BEFORE implementation
228
+ mcp://context7/react/hooks
229
+ mcp://context7/react/18.0/best-practices
230
+ mcp://context7/typescript/react-patterns
231
+ ```
232
+
233
+ **Database schema design:**
234
+ ```bash
235
+ # Query BEFORE implementation
236
+ mcp://context7/postgresql/schema-design
237
+ mcp://context7/postgresql/indexing
238
+ mcp://context7/postgresql/performance
239
+ ```
240
+
163
241
  ## Summary
164
242
 
165
243
  **Before doing ANY complex task, ask yourself:**
166
244
  1. Is there a specialized agent for this?
167
245
  2. Would an agent do this better/faster/more thoroughly?
168
246
  3. Am I trying to do something I should delegate?
247
+ 4. Should I query Context7 for current best practices?
169
248
 
170
- **If answer is YES to any → USE THE AGENT!**
249
+ **If answer is YES to any → USE THE AGENT! AND QUERY CONTEXT7!**
@@ -0,0 +1,270 @@
1
+ # Context Hygiene - MANDATORY
2
+
3
+ **🧹 CRITICAL: Run `/clear` between issues to prevent context bleed.**
4
+
5
+ ## Core Requirement
6
+
7
+ **YOU MUST CLEAR CONTEXT AFTER COMPLETING EACH ISSUE.**
8
+
9
+ Context from previous issues can:
10
+ - ❌ Cause incorrect assumptions
11
+ - ❌ Mix concerns from different tasks
12
+ - ❌ Waste tokens on irrelevant history
13
+ - ❌ Reduce response quality
14
+
15
+ ## When to Run /clear
16
+
17
+ ### ✅ ALWAYS Clear After:
18
+
19
+ 1. **Issue/Task Completion**
20
+ - After merging PR that closes an issue
21
+ - After marking task as complete
22
+ - Before starting new issue
23
+
24
+ 2. **Context Switches**
25
+ - Switching between different features
26
+ - Moving to different part of codebase
27
+ - Changing from bug fix to feature development
28
+
29
+ 3. **Long Conversations**
30
+ - After 20+ messages in one issue
31
+ - When context window getting full
32
+ - When conversation becomes unfocused
33
+
34
+ 4. **Daily Boundaries**
35
+ - At end of work day
36
+ - At start of new work session
37
+ - After long breaks
38
+
39
+ ### 🔴 NEVER Skip /clear When:
40
+
41
+ - Closing an issue (MOST IMPORTANT)
42
+ - Starting a new issue
43
+ - Switching work contexts
44
+ - After merge conflicts resolved
45
+ - After completing refactoring
46
+
47
+ ## How to Use /clear
48
+
49
+ ### Manual Trigger:
50
+
51
+ ```bash
52
+ # Type this in Claude Code CLI:
53
+ /clear
54
+ ```
55
+
56
+ ### Expected Behavior:
57
+
58
+ ```
59
+ Claude Code: "Context cleared. Ready for next task."
60
+ ```
61
+
62
+ ## Enforcement
63
+
64
+ ### Git Hook Reminder
65
+
66
+ Pre-commit hook detects issue closure and reminds:
67
+
68
+ ```
69
+ 🧹 CONTEXT HYGIENE REMINDER
70
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71
+
72
+ ⚠️ This commit closes an issue!
73
+
74
+ 📋 IMPORTANT: After this commit, run /clear before starting
75
+ the next issue to prevent context bleed.
76
+
77
+ Next steps:
78
+ 1. ✅ Complete this commit
79
+ 2. 🧹 Type: /clear
80
+ 3. 📝 Start next issue with clean context
81
+ ```
82
+
83
+ ### PM Command Integration
84
+
85
+ PM commands include `/clear` reminders:
86
+
87
+ ```bash
88
+ # After completing issue
89
+ /pm:issue-complete 123
90
+
91
+ # Output includes:
92
+ # ✅ Issue #123 marked as complete
93
+ # 🧹 REMINDER: Run /clear before starting next issue
94
+ ```
95
+
96
+ ## Workflow Integration
97
+
98
+ ### Standard Issue Workflow:
99
+
100
+ ```bash
101
+ # 1. Start issue
102
+ /pm:issue-start 123
103
+
104
+ # 2. Work on issue...
105
+ # ... implement, test, commit ...
106
+
107
+ # 3. Complete issue
108
+ git commit -m "fix: resolve issue #123"
109
+ git push
110
+
111
+ # 4. CLEAR CONTEXT (MANDATORY)
112
+ /clear
113
+
114
+ # 5. Start next issue with clean slate
115
+ /pm:issue-start 124
116
+ ```
117
+
118
+ ### Example Violation:
119
+
120
+ ❌ **WRONG - No /clear:**
121
+ ```bash
122
+ # Complete issue 123
123
+ git commit -m "fix: issue #123"
124
+
125
+ # Immediately start issue 124 (BAD!)
126
+ /pm:issue-start 124
127
+ # Context from #123 still present!
128
+ ```
129
+
130
+ ✅ **CORRECT - With /clear:**
131
+ ```bash
132
+ # Complete issue 123
133
+ git commit -m "fix: issue #123"
134
+
135
+ # Clear context (REQUIRED)
136
+ /clear
137
+
138
+ # Now start issue 124
139
+ /pm:issue-start 124
140
+ # Fresh context, no bleed from #123
141
+ ```
142
+
143
+ ## Why This Matters
144
+
145
+ ### Context Bleed Examples:
146
+
147
+ **Without /clear:**
148
+ ```
149
+ Issue #123: Add user authentication
150
+ Claude remembers: "We're working on auth..."
151
+
152
+ Issue #124: Fix database query bug
153
+ Claude thinks: "This must be related to auth system from #123"
154
+ # WRONG ASSUMPTION - wastes time debugging wrong area
155
+ ```
156
+
157
+ **With /clear:**
158
+ ```
159
+ Issue #123: Add user authentication
160
+ /clear
161
+
162
+ Issue #124: Fix database query bug
163
+ Claude thinks: "Fresh start, what's the actual issue?"
164
+ # CORRECT - focuses on actual problem
165
+ ```
166
+
167
+ ### Token Efficiency:
168
+
169
+ **Without /clear:**
170
+ - Context window: 50k+ tokens from previous issues
171
+ - Available for work: 150k tokens
172
+ - Efficiency: 75%
173
+
174
+ **With /clear:**
175
+ - Context window: 5k tokens (fresh start)
176
+ - Available for work: 195k tokens
177
+ - Efficiency: 97.5%
178
+
179
+ ## Best Practices
180
+
181
+ ### 1. Clear After Every PR Merge
182
+
183
+ ```bash
184
+ # Merge PR
185
+ gh pr merge 123 --squash
186
+
187
+ # Immediate clear
188
+ /clear
189
+
190
+ # Ready for next task
191
+ ```
192
+
193
+ ### 2. Clear Before Starting New Feature
194
+
195
+ ```bash
196
+ # Check what's next
197
+ /pm:backlog
198
+
199
+ # Pick issue
200
+ /pm:issue-start 125
201
+
202
+ # But first...
203
+ /clear
204
+
205
+ # Now start fresh
206
+ /pm:issue-start 125
207
+ ```
208
+
209
+ ### 3. Clear After Context Gets Large
210
+
211
+ Check context size with:
212
+ ```bash
213
+ # If conversation has 20+ messages
214
+ # Or if responses become slow
215
+ # Or if Claude seems confused
216
+
217
+ # CLEAR IT
218
+ /clear
219
+ ```
220
+
221
+ ## Automation Ideas
222
+
223
+ ### Option 1: Auto-Clear on Issue Close
224
+
225
+ **PM command auto-clears:**
226
+ ```bash
227
+ /pm:issue-complete 123
228
+ # Automatically runs /clear internally
229
+ ```
230
+
231
+ ### Option 2: Clear Reminder File
232
+
233
+ **Hook creates reminder:**
234
+ ```bash
235
+ # After commit that closes issue
236
+ # Creates: .claude/.clear-reminder
237
+
238
+ # Next Claude interaction checks:
239
+ if [ -f .claude/.clear-reminder ]; then
240
+ echo "⚠️ REMINDER: Run /clear before continuing"
241
+ fi
242
+ ```
243
+
244
+ ### Option 3: Session Start Check
245
+
246
+ **Check on session start:**
247
+ ```bash
248
+ # In CLAUDE.md:
249
+ ## Session Start Protocol
250
+ 1. Check for .clear-reminder file
251
+ 2. If exists, warn user
252
+ 3. Remove file after /clear
253
+ ```
254
+
255
+ ## Summary
256
+
257
+ **Context hygiene is as important as code hygiene.**
258
+
259
+ ### Remember:
260
+ - 🧹 **ALWAYS** `/clear` after issue completion
261
+ - 🧹 **ALWAYS** `/clear` before new issue
262
+ - 🧹 **ALWAYS** `/clear` on context switch
263
+
264
+ ### Benefits:
265
+ - ✅ No context bleed between issues
266
+ - ✅ Better response quality
267
+ - ✅ More efficient token usage
268
+ - ✅ Clearer thinking for each task
269
+
270
+ **Make `/clear` a habit, not an afterthought.**
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+
3
+ # Check for /clear reminder
4
+ #
5
+ # This script checks if there's a pending /clear reminder
6
+ # and displays it to the user.
7
+ #
8
+ # Should be run at session start or before new commands.
9
+
10
+ REMINDER_FILE=".claude/.clear-reminder"
11
+
12
+ if [ -f "$REMINDER_FILE" ]; then
13
+ echo ""
14
+ echo "╔════════════════════════════════════════════════════════════════╗"
15
+ echo "║ 🧹 PENDING /clear REMINDER ║"
16
+ echo "╚════════════════════════════════════════════════════════════════╝"
17
+ echo ""
18
+ echo "⚠️ You have a pending context clear reminder from:"
19
+ echo ""
20
+ cat "$REMINDER_FILE"
21
+ echo ""
22
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
23
+ echo ""
24
+ echo "Why this is important:"
25
+ echo " • Prevents context bleed from previous issue"
26
+ echo " • Ensures fresh start for new task"
27
+ echo " • Improves response quality"
28
+ echo " • Reduces token waste"
29
+ echo ""
30
+ echo "Action required:"
31
+ echo " 1. Type: /clear"
32
+ echo " 2. This reminder will be automatically removed"
33
+ echo " 3. Then proceed with your new task"
34
+ echo ""
35
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
36
+ echo ""
37
+
38
+ # Optional: Block until /clear is run
39
+ # Uncomment to enforce /clear before proceeding:
40
+ # read -p "Press Enter after running /clear to continue..."
41
+ # rm "$REMINDER_FILE"
42
+ fi
@@ -16,15 +16,9 @@
16
16
  └─────────────────────────────────────────────────────────────────────┘
17
17
  ```
18
18
 
19
- ### 📋 Overview
20
-
21
- Every task follows a structured workflow to ensure quality, traceability, and team coordination. This workflow applies to all development tasks: features, bugs, improvements, and technical debt.
22
-
23
- **MANDATORY**: All code development MUST follow TDD (Test-Driven Development) cycle. This is not optional.
24
-
25
19
  ### 🎯 Core Workflow Principles
26
20
 
27
- 1. **Follow TDD Religiously** - Test FIRST, code SECOND (see banner above)
21
+ 1. **Follow TDD Religiously** - Test FIRST, code SECOND
28
22
  2. **Work in Branches** - Never commit directly to main
29
23
  3. **Create Pull Requests** - All changes go through PR review
30
24
  4. **Resolve Conflicts** - Address merge conflicts immediately
@@ -32,134 +26,26 @@ Every task follows a structured workflow to ensure quality, traceability, and te
32
26
  6. **Merge When Ready** - Only merge after all checks pass
33
27
  7. **Mark Complete** - Update task status and move to next task
34
28
 
35
- ### 🚀 Standard Task Workflow
36
-
37
- #### 1. Pick a Task from Backlog
38
-
39
- ```bash
40
- # View available tasks (GitHub Issues, Azure DevOps, Jira, etc.)
41
- gh issue list --label="ready"
42
-
43
- # Or use project management commands
44
- /pm:backlog
45
- /azure:work-items --state=Ready
46
- ```
47
-
48
- **Task Selection Criteria:**
49
- - Task has clear **Acceptance Criteria**
50
- - Task has **Definition of Done** documented
51
- - Dependencies are resolved
52
- - Task is properly sized (not too large)
53
-
54
- #### 2. Create Feature Branch
55
-
56
- ```bash
57
- # Create branch from latest main
58
- git checkout main
59
- git pull origin main
60
- git checkout -b feature/TASK-ID-short-description
61
-
62
- # Examples:
63
- # git checkout -b feature/ISSUE-123-user-authentication
64
- # git checkout -b bugfix/ISSUE-456-fix-login-error
65
- # git checkout -b improvement/ISSUE-789-optimize-api
66
- ```
67
-
68
- **Branch Naming Convention:**
69
- - `feature/TASK-ID-description` - New features
70
- - `bugfix/TASK-ID-description` - Bug fixes
71
- - `improvement/TASK-ID-description` - Improvements
72
- - `docs/TASK-ID-description` - Documentation
73
- - `refactor/TASK-ID-description` - Refactoring
74
-
75
- #### 3. Implement Solution
76
-
77
- **🚨 CRITICAL: ALWAYS Follow TDD Cycle (RED-GREEN-REFACTOR)**
78
-
79
- See `.claude/rules/tdd.enforcement.md` for complete TDD enforcement rules.
80
-
81
- **Before Starting:**
82
- ```bash
83
- # Use specialized agents for implementation
84
- @python-backend-engineer implement user authentication API following TDD
85
- @react-frontend-engineer create login component following TDD
86
- @test-runner run existing tests to ensure baseline
87
- ```
88
-
89
- **🔴 TDD STEP 1: RED Phase (Write Failing Test First)**
90
-
91
- ```bash
92
- # ALWAYS write the test FIRST
93
- # Example for authentication endpoint:
94
-
95
- # 1. Create test file BEFORE implementation
96
- touch tests/test_authentication.py # Python
97
- touch __tests__/authentication.test.ts # TypeScript
98
-
99
- # 2. Write failing test that describes desired behavior
100
- # Example test:
101
- ```
102
-
103
- ```python
104
- # tests/test_authentication.py
105
- def test_user_registration_creates_user():
106
- """Test that user registration creates a new user in database"""
107
- response = client.post('/api/register', json={
108
- 'email': 'test@example.com',
109
- 'password': 'SecurePassword123!'
110
- })
111
-
112
- assert response.status_code == 201
113
- assert 'id' in response.json()
114
- assert 'token' in response.json()
115
- # Test MUST fail because endpoint doesn't exist yet
116
- ```
117
-
118
- ```bash
119
- # 3. Run test and CONFIRM it fails
120
- @test-runner run authentication tests # MUST SEE RED ❌
121
-
122
- # 4. Commit the failing test
123
- git add tests/test_authentication.py
124
- git commit -m "test: add failing test for user registration"
125
- ```
29
+ ### 🚀 Task Execution Steps
126
30
 
127
- **✅ TDD STEP 2: GREEN Phase (Minimum Code to Pass)**
31
+ #### 1. Pick Task → 2. Create Branch → 3. Implement (TDD) 4. Verify → 5. Create PR → 6. Address Feedback → 7. Merge → 8. Complete → 9. Next Task
128
32
 
33
+ **TDD Implementation (Step 3):**
129
34
  ```bash
130
- # 1. Write MINIMUM code to make test pass
131
- # Don't add extra features, don't over-engineer
132
- # Just make the test green
35
+ # 🔴 RED: Write failing test FIRST
36
+ touch tests/test_feature.py
37
+ @test-runner run tests/test_feature.py # MUST FAIL
38
+ git commit -m "test: add failing test for feature"
133
39
 
134
- # 2. Run test and CONFIRM it passes
135
- @test-runner run authentication tests # MUST SEE GREEN
136
-
137
- # 3. Commit the passing implementation
138
- git add src/routes/authentication.py
139
- git commit -m "feat: add user registration endpoint"
140
- ```
141
-
142
- **♻️ TDD STEP 3: REFACTOR Phase (Clean Up Code)**
143
-
144
- ```bash
145
- # 1. Improve code structure
146
- # 2. Remove duplication
147
- # 3. Enhance readability
148
- # 4. Run tests to ensure they STAY GREEN
149
- @test-runner run all tests # ALL must be GREEN ✅
40
+ # GREEN: Write MINIMUM code to pass
41
+ @test-runner run tests/test_feature.py # MUST PASS
42
+ git commit -m "feat: implement feature"
150
43
 
151
- # 5. Commit the refactored code
152
- git add .
153
- git commit -m "refactor: improve authentication code structure"
44
+ # ♻️ REFACTOR: Improve while tests stay green
45
+ @test-runner run all tests # ALL MUST PASS ✅
46
+ git commit -m "refactor: improve feature structure"
154
47
  ```
155
48
 
156
- **🔁 REPEAT TDD Cycle for Each Feature**
157
-
158
- For EVERY new function, class, or feature:
159
- 1. 🔴 Write failing test FIRST
160
- 2. ✅ Write minimum code to pass
161
- 3. ♻️ Refactor while keeping tests green
162
-
163
49
  **Integration with Context7:**
164
50
  ```bash
165
51
  # Query documentation BEFORE implementing
@@ -168,445 +54,62 @@ mcp://context7/<framework>/authentication-patterns
168
54
  mcp://context7/<language>/test-frameworks
169
55
  ```
170
56
 
171
- **TDD Commit Pattern (MANDATORY):**
172
- ```bash
173
- # For each feature, you MUST have this commit sequence:
174
- git commit -m "test: add failing test for [feature]" # RED ❌
175
- git commit -m "feat: implement [feature]" # GREEN ✅
176
- git commit -m "refactor: improve [feature] structure" # REFACTOR ♻️
177
- git commit -m "docs: document [feature]" # DOCS 📚
178
- ```
179
-
180
- **❌ PROHIBITED (Will be rejected):**
181
- ```bash
182
- # DON'T do this:
183
- git commit -m "feat: add feature without tests" # ❌ NO TESTS
184
- git commit -m "WIP: partial implementation" # ❌ PARTIAL CODE
185
- git commit -m "TODO: add tests later" # ❌ DELAYED TESTING
186
- ```
187
-
188
- **Commit Message Format:**
189
- - `test:` - Test additions/changes (ALWAYS FIRST)
190
- - `feat:` - New feature (AFTER test passes)
191
- - `refactor:` - Code refactoring (AFTER test stays green)
192
- - `fix:` - Bug fix (AFTER failing test reproduces bug)
193
- - `docs:` - Documentation
194
- - `perf:` - Performance improvements
195
- - `chore:` - Maintenance tasks
196
-
197
- #### 4. Verify Acceptance Criteria
198
-
199
- **Before Creating PR:**
200
-
201
- Check against task's **Acceptance Criteria:**
202
- ```markdown
203
- Example Acceptance Criteria:
204
- - [ ] User can register with email and password
205
- - [ ] Password is hashed and stored securely
206
- - [ ] Registration sends confirmation email
207
- - [ ] User receives JWT token after successful registration
208
- - [ ] All tests pass (unit, integration, e2e)
209
- - [ ] API documentation is updated
210
- ```
211
-
212
- **Run Quality Checks:**
213
- ```bash
214
- # Run tests
215
- npm test # JavaScript/TypeScript
216
- pytest # Python
217
- go test ./... # Go
218
-
219
- # Run linters
220
- npm run lint # JavaScript/TypeScript
221
- ruff check # Python
222
- golangci-lint run # Go
223
-
224
- # Check type safety
225
- npm run typecheck # TypeScript
226
- mypy src/ # Python
227
-
228
- # Run formatters
229
- npm run format # JavaScript/TypeScript
230
- black . # Python
231
- go fmt ./... # Go
232
- ```
233
-
234
- #### 5. Create Pull Request
235
-
236
- ```bash
237
- # Push branch to remote
238
- git push origin feature/TASK-ID-short-description
239
-
240
- # Create PR using GitHub CLI
241
- gh pr create \
242
- --title "Feature: TASK-ID Short Description" \
243
- --body "$(cat <<'EOF'
244
- ## Summary
245
- Brief description of changes
246
-
247
- ## Related Issue
248
- Closes #TASK-ID
249
-
250
- ## Acceptance Criteria
251
- - [x] Criterion 1
252
- - [x] Criterion 2
253
- - [x] Criterion 3
254
-
255
- ## Definition of Done
256
- - [x] Code implemented and tested
257
- - [x] All tests passing
258
- - [x] Documentation updated
259
- - [x] No breaking changes (or documented)
260
- - [x] Security considerations addressed
261
-
262
- ## Test Plan
263
- 1. Unit tests: `npm test`
264
- 2. Integration tests: `npm run test:integration`
265
- 3. Manual testing: [steps performed]
266
-
267
- ## Screenshots/Evidence
268
- [If applicable]
269
-
270
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
271
- EOF
272
- )"
273
- ```
274
-
275
- **PR Title Format:**
276
- - `Feature: TASK-ID Short description`
277
- - `Bugfix: TASK-ID Short description`
278
- - `Improvement: TASK-ID Short description`
279
-
280
- #### 6. Monitor and Address PR Feedback
281
-
282
- **Check PR Status:**
283
- ```bash
284
- # View PR status
285
- gh pr view --web
286
-
287
- # Check for CI/CD failures
288
- gh pr checks
289
-
290
- # View PR comments
291
- gh pr view
292
- ```
293
-
294
- **If CI/CD Fails:**
295
- ```bash
296
- # Analyze failures
297
- @test-runner analyze failed tests
298
- @code-analyzer review changes for issues
299
-
300
- # Fix issues
301
- git add .
302
- git commit -m "fix: address CI failures"
303
- git push origin feature/TASK-ID-short-description
304
- ```
305
-
306
- **If Merge Conflicts:**
307
- ```bash
308
- # Update branch with latest main
309
- git checkout main
310
- git pull origin main
311
- git checkout feature/TASK-ID-short-description
312
- git merge main
313
-
314
- # Resolve conflicts (use specialized agents)
315
- @code-analyzer help resolve merge conflicts in <file>
316
-
317
- # After resolving
318
- git add .
319
- git commit -m "chore: resolve merge conflicts with main"
320
- git push origin feature/TASK-ID-short-description
321
- ```
322
-
323
- **Address Review Comments:**
324
- ```bash
325
- # Interpret reviewer feedback
326
- # Make requested changes
327
- git add .
328
- git commit -m "refactor: address PR feedback - improve error handling"
329
- git push origin feature/TASK-ID-short-description
330
-
331
- # Respond to comments on GitHub
332
- gh pr comment <PR-NUMBER> --body "Fixed as requested"
333
- ```
334
-
335
- #### 7. Merge Pull Request
336
-
337
- **Pre-merge Checklist:**
338
- - [ ] All CI/CD checks passing
339
- - [ ] No merge conflicts
340
- - [ ] All review comments addressed
341
- - [ ] At least one approval (if required)
342
- - [ ] Definition of Done satisfied
343
- - [ ] Documentation updated
344
-
345
- **Merge:**
346
- ```bash
347
- # Merge PR (using GitHub CLI)
348
- gh pr merge --squash --delete-branch
349
-
350
- # Or via web interface
351
- # Click "Squash and merge" button
352
- # Delete branch after merge
353
- ```
354
-
355
- #### 8. Mark Task Complete
356
-
357
- **Update Task Status:**
358
- ```bash
359
- # GitHub Issues
360
- gh issue close TASK-ID --comment "Completed in PR #PR-NUMBER"
361
-
362
- # Azure DevOps
363
- /azure:update-work-item TASK-ID --state=Closed
364
-
365
- # Jira (via MCP)
366
- mcp://jira/update TASK-ID status:Done
367
- ```
368
-
369
- **Update Task Labels:**
370
- - Remove: `in-progress`, `ready`
371
- - Add: `completed`, `merged`
372
-
373
- **Verify Deployment:**
374
- ```bash
375
- # Check if changes are deployed
376
- # (depends on your CD pipeline)
377
- git checkout main
378
- git pull origin main
379
- git log --oneline -5 # Verify your commit is in main
380
- ```
381
-
382
- #### 9. Move to Next Task
383
-
384
- ```bash
385
- # Clean up local branches
386
- git branch -d feature/TASK-ID-short-description
387
-
388
- # Return to main
389
- git checkout main
390
- git pull origin main
391
-
392
- # Pick next task and repeat workflow
393
- /pm:backlog
394
- gh issue list --label="ready"
395
- ```
396
-
397
- ### 🎨 Workflow Variations
398
-
399
- #### Hotfix Workflow (Production Bugs)
400
-
57
+ **Quality Checks (Step 4):**
401
58
  ```bash
402
- # Create hotfix from main
403
- git checkout main
404
- git pull origin main
405
- git checkout -b hotfix/ISSUE-ID-critical-bug
406
-
407
- # Implement fix
408
- # ...
409
-
410
- # Create PR with HIGH PRIORITY label
411
- gh pr create --label="priority:high,type:hotfix"
412
-
413
- # After merge, ensure it's deployed immediately
414
- # Follow your emergency deployment process
59
+ npm test # or pytest, go test, etc.
60
+ npm run lint # or ruff check, golangci-lint, etc.
61
+ npm run typecheck # or mypy, go vet, etc.
415
62
  ```
416
63
 
417
- #### Feature Flag Workflow
418
-
64
+ **PR Creation (Step 5):**
419
65
  ```bash
420
- # For large features, use feature flags
421
- # Implement behind flag
422
- # Deploy to production (flag disabled)
423
- # Test in production environment
424
- # Gradually enable for users
425
-
426
- # Example:
427
- if (featureFlags.newAuthentication) {
428
- // New implementation
429
- } else {
430
- // Existing implementation
431
- }
432
- ```
433
-
434
- ### 📊 Definition of Done (Standard)
435
-
436
- Every task is **complete** when:
437
-
438
- - [ ] **Code Complete**
439
- - All Acceptance Criteria met
440
- - Code follows project conventions
441
- - No TODOs or FIXMEs left unresolved
442
-
443
- - [ ] **Tests Pass**
444
- - All unit tests passing
445
- - All integration tests passing
446
- - All e2e tests passing (if applicable)
447
- - Code coverage meets threshold
448
-
449
- - [ ] **Quality Checks**
450
- - Linters pass (no warnings)
451
- - Formatters applied
452
- - Type checking passes
453
- - Security scan passes
454
-
455
- - [ ] **Documentation**
456
- - Code comments added (why, not what)
457
- - API documentation updated
458
- - README updated (if needed)
459
- - CHANGELOG updated (if applicable)
460
-
461
- - [ ] **Review Complete**
462
- - PR created and approved
463
- - All comments addressed
464
- - No merge conflicts
465
- - CI/CD pipeline green
466
-
467
- - [ ] **Deployed**
468
- - Changes merged to main
469
- - Deployed to target environment
470
- - Verified in production/staging
471
-
472
- - [ ] **Task Closed**
473
- - Issue/ticket closed
474
- - Status updated to "completed"
475
- - Labels updated
476
-
477
- ### 🔍 Common Acceptance Criteria Patterns
478
-
479
- #### For Features
480
- ```markdown
481
- ## Acceptance Criteria
482
- - [ ] User can [action] with [constraints]
483
- - [ ] System responds with [expected output]
484
- - [ ] Error handling for [edge case]
485
- - [ ] Performance: [metric] under [threshold]
486
- - [ ] Security: [requirement] implemented
487
- - [ ] Accessibility: [WCAG level] compliance
488
- ```
489
-
490
- #### For Bug Fixes
491
- ```markdown
492
- ## Acceptance Criteria
493
- - [ ] Bug no longer reproducible
494
- - [ ] Root cause identified and documented
495
- - [ ] Regression test added
496
- - [ ] Related bugs checked (not introduced)
497
- - [ ] Error logging improved
66
+ git push origin feature/TASK-ID-description
67
+ gh pr create --title "Feature: TASK-ID Description" --body "..."
498
68
  ```
499
69
 
500
- #### For Improvements
501
- ```markdown
502
- ## Acceptance Criteria
503
- - [ ] Performance improved by [X%]
504
- - [ ] Code complexity reduced
505
- - [ ] Technical debt addressed
506
- - [ ] Backward compatibility maintained
507
- - [ ] Migration path documented (if breaking)
508
- ```
509
-
510
- ### 🛠️ Using Specialized Agents in Workflow
511
-
512
- #### Throughout Workflow:
513
- ```bash
514
- # Code Analysis
515
- @code-analyzer review my changes for potential issues
516
- @code-analyzer trace logic flow in authentication module
517
-
518
- # Testing
519
- @test-runner execute test suite and analyze failures
520
- @test-runner run only authentication-related tests
70
+ ### 📊 Definition of Done
521
71
 
522
- # File Analysis
523
- @file-analyzer summarize large log file
524
- @file-analyzer extract errors from CI output
72
+ - [ ] Code Complete (Acceptance Criteria met, no TODOs)
73
+ - [ ] Tests Pass (unit, integration, e2e, coverage threshold met)
74
+ - [ ] Quality Checks (linters pass, formatters applied, type checking)
75
+ - [ ] Documentation (code comments, API docs, README, CHANGELOG)
76
+ - [ ] Review Complete (PR approved, comments addressed, CI/CD green)
77
+ - [ ] Deployed (merged to main, deployed, verified in production)
78
+ - [ ] Task Closed (issue closed, status updated)
525
79
 
526
- # Documentation
527
- @agent-manager document this workflow pattern
528
-
529
- # Multi-stream Work (Advanced)
530
- @parallel-worker coordinate feature implementation across services
531
- ```
532
-
533
- ### ⚠️ Important Reminders
80
+ ### ⚠️ Critical Rules
534
81
 
535
82
  **🚨 HIGHEST PRIORITY:**
536
-
537
- 1. **FOLLOW TDD CYCLE (RED-GREEN-REFACTOR)** - This is MANDATORY, not optional
538
- - 🔴 Write failing test FIRST (ALWAYS!)
539
- - ✅ Write minimum code to pass (no more, no less)
540
- - ♻️ Refactor while keeping tests green (never skip)
541
- - See `.claude/rules/tdd.enforcement.md` for enforcement rules
542
- - **ZERO TOLERANCE**: No code without tests. No exceptions.
543
-
544
- **📋 Critical Workflow Rules:**
545
-
546
- 2. **ALWAYS query Context7** before implementing:
547
- ```bash
548
- mcp://context7/<framework>/<topic>
549
- ```
550
-
551
- 3. **NEVER commit code before tests**:
552
- - First commit: `test: add failing test`
553
- - Second commit: `feat: implement feature`
554
- - Third commit: `refactor: improve structure`
555
-
83
+ 1. **FOLLOW TDD CYCLE** - ZERO TOLERANCE for code without tests
84
+ 2. **ALWAYS query Context7** before implementing: `mcp://context7/<framework>/<topic>`
85
+ 3. **NEVER commit code before tests** - Test first, code second, refactor third
556
86
  4. **ALWAYS use specialized agents** for non-trivial tasks
557
87
 
558
- 5. **NEVER commit to main** - always work in branches
559
-
560
- 6. **ALWAYS address PR feedback** - don't merge until resolved
561
-
562
- 7. **REMEMBER Definition of Done** - not complete until all criteria met
563
-
564
- 8. **VERIFY in production** - deployment is part of completion
565
-
566
- **❌ PROHIBITED PATTERNS (Auto-Reject):**
88
+ **❌ PROHIBITED PATTERNS:**
567
89
  - Writing code before tests
568
90
  - Committing "WIP" or "TODO: add tests"
569
91
  - Partial implementations without test coverage
570
92
  - Skipping refactor phase
571
93
  - Mock services in tests (use real implementations)
572
94
 
573
- ### 📚 Additional Resources
574
-
575
- - `.claude/rules/development-workflow.md` - Complete development patterns
576
- - `.claude/rules/git-strategy.md` - Git branch and merge strategies
577
- - `.claude/rules/tdd.enforcement.md` - Test-Driven Development requirements
578
- - `.claude/rules/github-operations.md` - GitHub CLI and PR management
579
- - `.claude/commands/pm/` - Project management command reference
580
-
581
- ### 🎯 Quick Reference Commands
95
+ ### 🎯 Quick Commands
582
96
 
583
97
  ```bash
584
98
  # Start task
585
- /pm:backlog # View tasks
99
+ /pm:backlog
586
100
  git checkout -b feature/ID-desc
587
101
 
588
102
  # During work
589
- @<agent> <task> # Use specialized agents
590
- mcp://context7/<lib>/<topic> # Query documentation
103
+ @<agent> <task>
104
+ mcp://context7/<lib>/<topic>
591
105
  git commit -m "type: message"
592
106
 
593
107
  # Before PR
594
- npm test # Run tests
595
- npm run lint # Run linters
108
+ npm test && npm run lint
596
109
  git push origin <branch>
597
110
 
598
- # Create PR
111
+ # Create & merge PR
599
112
  gh pr create
600
-
601
- # After feedback
602
- git merge main # Update branch
603
- git push origin <branch>
604
-
605
- # Merge and complete
606
113
  gh pr merge --squash --delete-branch
607
114
  gh issue close ID
608
- git checkout main && git pull
609
-
610
- # Next task
611
- /pm:backlog
612
115
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-autopm",
3
- "version": "2.11.1",
3
+ "version": "2.12.0",
4
4
  "description": "Autonomous Project Management Framework for Claude Code - Advanced AI-powered development automation",
5
5
  "main": "bin/autopm.js",
6
6
  "workspaces": [