@uluops/setup 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +56 -53
  2. package/assets/agents/anxiety-reader-agent.md +464 -0
  3. package/assets/commands/agents/anxiety-reader.md +160 -0
  4. package/assets/commands/agents/api-contract.md +1 -0
  5. package/assets/commands/agents/architect.md +1 -0
  6. package/assets/commands/agents/aristotle-analyst.md +1 -0
  7. package/assets/commands/agents/aristotle-explorer.md +1 -0
  8. package/assets/commands/agents/aristotle-forecaster.md +1 -0
  9. package/assets/commands/agents/aristotle-validator.md +1 -0
  10. package/assets/commands/agents/assumption-excavator.md +1 -0
  11. package/assets/commands/agents/audit.md +1 -0
  12. package/assets/commands/agents/{validate.md → code-validate.md} +6 -5
  13. package/assets/commands/agents/docs-validate.md +1 -0
  14. package/assets/commands/agents/frontend.md +1 -0
  15. package/assets/commands/agents/mcp-validate.md +1 -0
  16. package/assets/commands/agents/optimize.md +1 -0
  17. package/assets/commands/agents/pattern-analyzer.md +1 -0
  18. package/assets/commands/agents/prompt-quality.md +1 -0
  19. package/assets/commands/agents/prompt-validate.md +1 -0
  20. package/assets/commands/agents/public-interface.md +1 -0
  21. package/assets/commands/agents/release.md +1 -0
  22. package/assets/commands/agents/security.md +1 -0
  23. package/assets/commands/agents/test-review.md +1 -0
  24. package/assets/commands/agents/type-safety.md +1 -0
  25. package/assets/commands/agents/workflow-synthesis.md +1 -0
  26. package/assets/commands/pipelines/aristotle.md +143 -0
  27. package/assets/commands/pipelines/ship.md +188 -0
  28. package/assets/commands/workflows/prompt-audit.md +37 -747
  29. package/dist/cli.js +251 -207
  30. package/dist/harnesses/claude-code.d.ts +8 -0
  31. package/dist/harnesses/claude-code.js +72 -0
  32. package/dist/harnesses/codex.d.ts +15 -0
  33. package/dist/harnesses/codex.js +53 -0
  34. package/dist/harnesses/gemini-cli.d.ts +16 -0
  35. package/dist/harnesses/gemini-cli.js +54 -0
  36. package/dist/harnesses/index.d.ts +18 -0
  37. package/dist/harnesses/index.js +45 -0
  38. package/dist/harnesses/opencode.d.ts +14 -0
  39. package/dist/harnesses/opencode.js +130 -0
  40. package/dist/harnesses/types.d.ts +87 -0
  41. package/dist/harnesses/types.js +24 -0
  42. package/dist/lib/agent-transform.d.ts +12 -0
  43. package/dist/lib/agent-transform.js +129 -0
  44. package/dist/lib/asset-catalog.d.ts +9 -0
  45. package/dist/lib/asset-catalog.js +56 -0
  46. package/dist/lib/atomic-write.d.ts +11 -0
  47. package/dist/lib/atomic-write.js +28 -0
  48. package/dist/lib/config-merger.d.ts +7 -1
  49. package/dist/lib/config-merger.js +34 -5
  50. package/dist/lib/display.d.ts +14 -0
  51. package/dist/lib/display.js +66 -0
  52. package/dist/lib/file-ops.d.ts +6 -0
  53. package/dist/lib/file-ops.js +22 -1
  54. package/dist/lib/hash.d.ts +1 -0
  55. package/dist/lib/hash.js +1 -0
  56. package/dist/lib/health.d.ts +2 -0
  57. package/dist/lib/health.js +10 -0
  58. package/dist/lib/manifest.d.ts +22 -5
  59. package/dist/lib/manifest.js +148 -13
  60. package/dist/lib/paths.d.ts +15 -3
  61. package/dist/lib/paths.js +71 -13
  62. package/dist/lib/settings-merger.d.ts +9 -1
  63. package/dist/lib/settings-merger.js +45 -17
  64. package/dist/steps/agents.d.ts +5 -1
  65. package/dist/steps/agents.js +59 -9
  66. package/dist/steps/auth.js +26 -10
  67. package/dist/steps/commands.d.ts +6 -1
  68. package/dist/steps/commands.js +87 -9
  69. package/dist/steps/detect.d.ts +3 -0
  70. package/dist/steps/detect.js +7 -0
  71. package/dist/steps/mcp.d.ts +6 -2
  72. package/dist/steps/mcp.js +46 -21
  73. package/dist/steps/metrics.d.ts +14 -10
  74. package/dist/steps/metrics.js +59 -89
  75. package/dist/steps/shell.d.ts +2 -0
  76. package/dist/steps/shell.js +16 -9
  77. package/dist/steps/signup.d.ts +6 -3
  78. package/dist/steps/signup.js +26 -14
  79. package/dist/steps/verify.d.ts +2 -2
  80. package/dist/steps/verify.js +84 -117
  81. package/package.json +32 -7
  82. package/assets/commands/workflows/aristotle.md +0 -543
  83. package/assets/commands/workflows/ship.md +0 -721
  84. package/dist/test/auth.test.d.ts +0 -1
  85. package/dist/test/auth.test.js +0 -43
  86. package/dist/test/config-io.test.d.ts +0 -1
  87. package/dist/test/config-io.test.js +0 -56
  88. package/dist/test/config-merger.test.d.ts +0 -1
  89. package/dist/test/config-merger.test.js +0 -94
  90. package/dist/test/detect.test.d.ts +0 -1
  91. package/dist/test/detect.test.js +0 -25
  92. package/dist/test/file-ops.test.d.ts +0 -1
  93. package/dist/test/file-ops.test.js +0 -100
  94. package/dist/test/hash.test.d.ts +0 -1
  95. package/dist/test/hash.test.js +0 -14
  96. package/dist/test/manifest.test.d.ts +0 -1
  97. package/dist/test/manifest.test.js +0 -78
  98. package/dist/test/paths.test.d.ts +0 -1
  99. package/dist/test/paths.test.js +0 -30
  100. package/dist/test/settings-merger.test.d.ts +0 -1
  101. package/dist/test/settings-merger.test.js +0 -167
  102. package/dist/test/shell-profile.test.d.ts +0 -1
  103. package/dist/test/shell-profile.test.js +0 -40
  104. package/dist/test/shell.test.d.ts +0 -1
  105. package/dist/test/shell.test.js +0 -71
  106. package/dist/test/signup.test.d.ts +0 -1
  107. package/dist/test/signup.test.js +0 -83
@@ -1,754 +1,44 @@
1
- ---
2
- name: prompt-audit
3
- description: Comprehensive audit of agent definitions, commands, or workflows. Uses prompt-pattern-analyzer for ecosystem context, prompt-engineer for validation, and prompt-quality-validator for best practices analysis. Use when reviewing existing prompts or before significant changes.
4
- tools: Read, Grep, Glob, Bash
5
- model: sonnet
6
- ---
7
-
8
- # Prompt Audit
9
-
10
- Comprehensive audit of agent definitions, commands, or workflows. Uses prompt-pattern-analyzer for ecosystem context, prompt-engineer for validation, and prompt-quality-validator for best practices analysis. Use when reviewing existing prompts or before significant changes.
11
-
12
-
13
- **Philosophy**: Context-aware auditing. Understand ecosystem conventions first, then validate and improve with that context.
14
- ### Prompt Audit vs prompt-validate
15
-
16
- | Aspect | Prompt Audit | prompt-validate |
17
- |--------|------|------|
18
- | Focus | Full audit with ecosystem context | Quick validation only |
19
- | Duration | 6-15 minutes | 2-5 minutes |
20
- | Agents Used | pattern-analyzer + prompt-engineer + prompt-quality | prompt-engineer only |
21
- | Output | Features list + conditional refactored draft | Pass/fail with suggestions |
22
-
23
- ---
24
-
25
- ## Workflow Overview
26
-
27
- ```
28
- ┌──────────────────┐
29
- │ pattern-analyzer │ ◄── Ecosystem context
30
- └────────┬─────────┘
31
-
32
- ┌────────▼─────────┐
33
- │ prompt-engineer │ ◄── Validate with context (gate)
34
- │ + type-specific │ Includes inline structural checks
35
- │ checks │ based on artifact type
36
- └────────┬─────────┘
37
-
38
- ┌────────▼─────────┐
39
- │ prompt-quality │ ◄── Best practices review
40
- │ validator │
41
- └────────┬─────────┘
42
-
43
- ═════════▼══════════
44
- PERSIST TO TRACKER
45
- + Conditional draft
46
- (if score < 75)
47
- ════════════════════
48
-
49
- ```
50
-
51
- Phase 0 establishes ecosystem conventions that inform all subsequent phases
52
- Type-specific structural checks are performed inline by the orchestrator between prompt-engineer and prompt-quality phases
53
- Refactored draft is a conditional output artifact generated only if prompt-engineer score < 75
54
-
55
- Duration: 6-15 minutes (includes ecosystem analysis)
56
- ### Token Estimation
57
-
58
- | Scope | Input Tokens | Output Tokens |
59
- |-------|-------------|---------------|
60
- | Single agent prompt | ~35,000 | ~4,000 |
61
- | Workflow command | ~45,000 | ~6,000 |
62
- | Large workflow (500+ lines) | ~60,000 | ~8,000 |
63
- **Cost Drivers**:
64
- - Ecosystem size: more agents = more pattern analysis tokens
65
- - Prompt length: longer prompts = more validation tokens
66
- - Issue count: more findings = more detailed output
67
- Prompt audit is always sequential—each phase depends on prior context.
68
- Phase 0 ecosystem context informs Phase 1 scoring benchmarks.
69
- Phase 2 type checks depend on Phase 1 results.
70
-
71
- ---
72
-
73
- ## Agent Handoff Formats
74
-
75
- Each agent passes structured data to the next in the pipeline:
76
-
77
- | From | To | Passes | Expects |
78
- |------|-----|--------|---------|
79
- | Pattern Analyzer | Prompt Engineer | Ecosystem conventions, threshold benchmarks, decision pair standards, expected sections | Context-aware validation scoring using ecosystem baselines |
80
- | Prompt Engineer | Prompt Quality Validator | Score, category breakdown, identified issues, structural compliance results | Best practice improvements with specific rewrite suggestions |
81
-
82
- **Handoff Contract:**
83
- - Pattern Analyzer provides context that informs all subsequent scoring
84
- - Each phase builds on prior findings rather than re-checking
85
- - Critical failures from Prompt Engineer block the pipeline
86
- - All findings feed into tracker persistence regardless of outcome
87
-
88
- ---
89
-
90
- ## Pre-Flight: Target Detection and Configuration
91
-
92
- Before running agents, determine the target path and which optional validators should run.
93
-
94
- ### Context Detection
95
-
96
- **Detection criteria**: A detector returns TRUE if its command exits with code 0.
97
-
98
- | Detector ID | Description |
99
- |-------------|-------------|
100
- | `is_agent_definition` | Run command: echo "{{ file }}" | grep -qE "agents/.*-agent\.md$" |
101
- | `is_agent_command` | Run command: echo "{{ file }}" | grep -qE "commands/agents/" |
102
- | `is_workflow_command` | Run command: echo "{{ file }}" | grep -qE "commands/workflows/" |
103
- | `is_general_command` | Run command: echo "{{ file }}" | grep -qE "commands/" | grep -vE "commands/(agents|workflows)/" |
104
-
105
- **is_agent_definition**:
106
- ```bash
107
- echo "{{ file }}" | grep -qE "agents/.*-agent\.md$" && echo "DETECTED" || echo "NOT DETECTED"
108
- ```
109
-
110
- **is_agent_command**:
111
- ```bash
112
- echo "{{ file }}" | grep -qE "commands/agents/" && echo "DETECTED" || echo "NOT DETECTED"
113
- ```
114
-
115
- **is_workflow_command**:
116
- ```bash
117
- echo "{{ file }}" | grep -qE "commands/workflows/" && echo "DETECTED" || echo "NOT DETECTED"
118
- ```
119
-
120
- **is_general_command**:
121
- ```bash
122
- echo "{{ file }}" | grep -qE "commands/" | grep -vE "commands/(agents|workflows)/" && echo "DETECTED" || echo "NOT DETECTED"
123
- ```
124
-
125
- ### Metadata Extraction
126
-
127
- Before running phases, extract the following metadata from the target:
128
-
129
- | Step | Type | Description |
130
- |------|------|-------------|
131
- | `frontmatter_metadata` | frontmatter | Extract name, description, model, and tools from target file frontmatter |
132
- | `section_count` | command | Count ## headings in the target file |
133
- | `file_size` | command | Count lines in the target file |
134
-
135
- **frontmatter_metadata**: Extract name, description, model, tools from `{{ file }}`
136
- **section_count**:
137
- ```bash
138
- grep -c '^## ' {{ file }}
139
- ```
140
-
141
- **file_size**:
142
- ```bash
143
- wc -l < {{ file }}
144
- ```
145
-
146
-
147
- ---
148
-
149
- ## Arguments
150
-
151
- ### Positional Arguments
152
-
153
- | Argument | Required | Description |
154
- |----------|----------|-------------|
155
- | file | Yes | Path to the prompt artifact to audit (agent, command, or workflow file) |
156
-
157
-
158
- ### Usage Examples
159
-
160
- | Command | Behavior |
161
- |---------|----------|
162
- | `/workflows:prompt-audit agents/security-analyst-agent.md` | Audits agent definition with ecosystem context |
163
- | `/workflows:prompt-audit commands/agents/validate.md` | Audits agent invocation command |
164
- | `/workflows:prompt-audit commands/workflows/ship.md` | Audits workflow command |
165
-
166
- ---
167
-
168
- ## Execution Mode Selection
169
-
170
-
171
- | Mode | Description | Best For |
172
- |------|-------------|----------|
173
- | Sequential | - | - |
174
- | Parallel | - | - |
175
-
176
-
177
- Prompt audit is always sequential—each phase depends on prior context.
178
- Phase 0 ecosystem context informs Phase 1 scoring benchmarks.
179
- Phase 2 type checks depend on Phase 1 results.
180
-
181
- ---
182
-
183
- ## Execution
184
-
185
- Run each agent in sequence (or parallel groups if selected). Stop and fix if any agent fails. **Collect all recommendations for tracker persistence.**
186
-
187
- ### Phase 1: Ecosystem Pattern Analysis
188
- **Commands**: pattern-analyzer@1.0.0
189
-
190
- **Invoke via Task tool:**
191
- ```
192
- Task(
193
- subagent_type: "pattern-analyzer",
194
- prompt: "[validator:pattern-analyzer] Validate {TARGET_DIRECTORY}. Return structured JSON OUTPUT.",
195
- description: "Pattern Analyzer"
196
- )
197
- ```
198
-
199
- **Gate**: threshold >= 50, on fail: warn
200
-
201
- **Focus**:
202
- - Discover all prompt artifacts (agents, commands, workflows)
203
- - Extract scoring patterns and point allocations
204
- - Identify decision vocabulary conventions
205
- - Analyze threshold standards by agent type
206
- - Detect structural patterns and inconsistencies
207
-
208
- **Capture for tracker**: Ecosystem context (conventions, thresholds, patterns) for downstream phases.
209
-
210
- **If failing**: Ecosystem data is limited (<5 agents). Proceed with generic conventions.
211
-
212
- **Decision criteria**:
213
- - INSIGHTFUL (✅): Score ≥75 AND ≥50% ecosystem coverage
214
- - INCOMPLETE (⚠️): Score <75 OR <5 agents in ecosystem
215
-
216
- **Alternatives**:
217
- - `strategy-analyst@1.0.0` — Must override model to sonnet — default is opus. Use when deeper strategic analysis is needed.
218
-
219
- **Key Outputs**:
220
-
221
- | Output | Downstream Usage |
222
- |--------|-----------------|
223
- | threshold_convention | Benchmark for Phase 1 scoring — e.g., expected >=75 for validators |
224
- | decision_pair_convention | Consistency check in Phase 1 — e.g., PASS/FAIL, DEPLOY/REVISE pairs |
225
- | expected_sections | Type-specific validation — e.g., Mission, Output Format, Decision for agents |
226
- | common_failure_modes | Focus areas for Phase 2 improvement suggestions |
227
-
228
- ---
229
-
230
- ### Phase 2: Prompt Engineer Validation
231
- **Commands**: prompt-validate@1.0.0
232
-
233
- **Invoke via Task tool:**
234
- ```
235
- Task(
236
- subagent_type: "prompt-validate",
237
- prompt: "[validator:prompt-validate] Validate {TARGET_DIRECTORY}. Return structured JSON OUTPUT.",
238
- description: "Prompt Validator"
239
- )
240
- ```
241
-
242
- **Gate**: threshold >= 75, on fail: stop
243
-
244
- **Why this threshold?** Prompts below 75 produce inconsistent agent behavior. The threshold ensures minimum deployment quality.
245
-
246
- **Focus**:
247
- - Clarity & Specificity (25 pts)
248
- - Structure & Organization (20 pts)
249
- - Completeness (25 pts)
250
- - Effectiveness (20 pts)
251
- - Consistency (10 pts)
252
- - Type-specific structural compliance (inline checks per artifact type)
253
-
254
- **Capture for tracker**: Overall score, category breakdown, vague language instances with line numbers, missing sections, improvement suggestions, and type-specific structural compliance.
255
-
256
- **If failing**: Apply critical fixes from the improvement suggestions. Prompt does not meet deployment quality.
257
-
258
- **Decision criteria**:
259
- - DEPLOY (✅): Score ≥75 AND no critical issues AND structural checks pass
260
- - REVISE (❌): Score <75 OR critical issues present OR structural elements missing
261
-
262
- ### For Agent Definitions
263
-
264
- **Runs when**: `is_agent_definition`
265
-
266
- Check for required elements:
267
-
268
- | Check | What to Look For | Report |
269
- |-------|------------------|--------|
270
- | Required sections | "Mission", "Output Format", "Decision" | [OK]/[X] for each |
271
- | Scoring framework | Contains "points", "pts", or "/100" | Show first 5 matches |
272
- | Auto-fail conditions | Contains "auto.*fail", "critical.*issue", "must.*fix" | List if found |
273
- | Quality gate | Contains checklist or gate criteria | List if found |
274
- | Edge case handling | Has subsections (### headings) | Count found |
275
-
276
- ### For Agent Commands
277
-
278
- **Runs when**: `is_agent_command`
279
-
280
- Check for required elements:
281
-
282
- | Check | What to Look For | Report |
283
- |-------|------------------|--------|
284
- | Agent reference | Contains "agents:" or "agent-" | [OK]/[X] |
285
- | Argument handling | Contains "ARGUMENTS", "<directory>", "<path>" | [OK]/[X] |
286
- | Threshold mention | Contains ">=[0-9]+", "Threshold", or "Score" | [OK]/[X] |
287
-
288
- ### For Workflows
289
-
290
- **Runs when**: `is_workflow_command`
291
-
292
- Check for required elements:
293
-
294
- | Check | What to Look For | Report |
295
- |-------|------------------|--------|
296
- | Phase structure | Contains "### Phase" or "Phase [0-9]" | List phases found |
297
- | Agent invocations | Contains "/agents:" or "agent" references | List agents used |
298
- | Decision gates | Contains "PASS", "FAIL", "STOP", "Continue", "proceed" | [OK]/[X] |
299
- | Summary format | Contains "Summary", "Report", or "Result" | [OK]/[X] |
300
-
301
- **Depends on**: pattern-analyzer
302
-
303
- ---
304
-
305
- ### Phase 3: Prompt Quality Best Practices
306
- **Commands**: prompt-quality@1.0.0
307
-
308
- **Invoke via Task tool:**
309
- ```
310
- Task(
311
- subagent_type: "prompt-quality",
312
- prompt: "[validator:prompt-quality] Validate {TARGET_DIRECTORY}. Return structured JSON OUTPUT.",
313
- description: "Prompt Quality Validator"
314
- )
315
- ```
316
-
317
- **Gate**: threshold >= 70, on fail: warn
318
-
319
- **Focus**:
320
- - Clarity: Vague language → specific alternatives
321
- - Structure: Missing sections → template additions
322
- - Completeness: Missing edge cases → defined behaviors
323
- - Effectiveness: Subjective criteria → objective measures
324
-
325
- **Capture for tracker**: Best practices analysis with specific rewrite suggestions.
326
-
327
- **If failing**: Review improvement suggestions. Prompt is functional but could be more effective.
328
-
329
- **Decision criteria**:
330
- - STRONG (✅): Score ≥75 AND no high-priority findings
331
- - ADEQUATE (⚠️): Score 60-74
332
- - WEAK (❌): Score <60
333
-
334
- **Depends on**: prompt-engineer
335
-
336
- ---
337
-
338
-
339
- ---
340
-
341
- ## Summary Report
342
-
343
- After all phases complete, summarize:
344
-
345
- ```
346
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
347
- SUMMARY
348
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
349
-
350
- Target: [path]
351
- Run: [N]
352
-
353
- ┌─────────────────────┬────────┬────────────┐
354
- │ Agent │ Score │ Status │
355
- ├─────────────────────┼────────┼────────────┤
356
- │ ... │ [X]/100│ ✅/❌/⏭️ │
357
- └─────────────────────┴────────┴────────────┘
358
-
359
- ```
360
-
361
-
362
- ### Scoring
363
-
364
- **Method**: weighted_average
365
-
366
- | Phase | Weight |
367
- |-------|--------|
368
- | pattern-analyzer | 15% |
369
- | prompt-engineer | 55% |
370
- | prompt-quality | 30% |
371
-
372
-
373
- ## Output: Consolidated Report
374
-
375
- ```
376
- +=============================================================================+
377
- | PROMPT AUDIT REPORT |
378
- +=============================================================================+
1
+ ---
2
+ name: prompt-audit
3
+ description: Comprehensive prompt audit with ecosystem context. Pattern analyzer provides ecosystem baseline, prompt engineer validates structure and scoring, prompt quality validates clarity and effectiveness. Sequential with gating.
4
+ tools: Read, Grep, Glob, Bash
5
+ model: opus
6
+ ---
379
7
 
380
- File: $ARGUMENTS
381
- Type: {agent | command | workflow}
382
- Name: {extracted name}
8
+ # Prompt Audit
383
9
 
384
- ==============================================================================
10
+ > Comprehensive prompt audit with ecosystem context. Pattern analyzer provides ecosystem baseline, prompt engineer validates structure and scoring, prompt quality validates clarity and effectiveness. Sequential with gating.
385
11
 
386
- PHASE 0: ECOSYSTEM PATTERN ANALYSIS
12
+ Duration: 6-15 minutes
13
+ **Arguments**: `file` (required)
14
+ ## Pre-Flight Detection
387
15
 
388
- Ecosystem Inventory:
389
- - Agents: [N]
390
- - Commands: [N]
391
- - Workflows: [N]
16
+ - **is_agent_definition**: `grep -rqE --include='{{ file }}' '^(name|description|type):' . 2>/dev/null`
17
+ - **is_agent_command**: `grep -rqE --include='{{ file }}' 'subagent_type|\[validator:' . 2>/dev/null`
18
+ ## Execution
392
19
 
393
- Ecosystem Conventions:
394
- - Threshold standard: >=[X] ([N]% of agents)
395
- - Decision pair: [KEYWORD_A]/[KEYWORD_B]
396
- - Required sections: [list]
397
- - Point distribution: [pattern]
398
-
399
- Consistency Check:
400
- {If target diverges from conventions:}
401
- - Target uses [X] but ecosystem standard is [Y]
402
- - Consider aligning for consistency
403
-
404
- {If target follows conventions:}
405
- - [OK] Target aligns with ecosystem conventions
406
-
407
- Status: [OK INSIGHTFUL | WARNING INCOMPLETE]
408
-
409
- -------------------------------------------------------------------------------
410
-
411
- PHASE 1: PROMPT ENGINEER VALIDATION
412
-
413
- Score: [X]/100
414
-
415
- Clarity & Specificity: [X]/25
416
- Structure: [X]/20
417
- Completeness: [X]/25
418
- Effectiveness: [X]/20
419
- Consistency: [X]/10
420
-
421
- Status: [DEPLOY | REVISE]
422
-
423
- -------------------------------------------------------------------------------
424
-
425
- PHASE 2: TYPE-SPECIFIC CHECKS
426
-
427
- Type: {artifact_type}
428
-
429
- Required Elements:
430
- [OK] {present element}
431
- [OK] {present element}
432
- [X] {missing element}
433
-
434
- Convention Compliance:
435
- | Element | Found | Expected | Status |
436
- |---------|-------|----------|--------|
437
- | Decision keywords | X | Y | OK/X |
438
- | Threshold format | X | Y | OK/X |
439
- | Scoring format | X | Y | OK/X |
440
-
441
- -------------------------------------------------------------------------------
442
-
443
- PHASE 3: IMPROVEMENT ANALYSIS
444
-
445
- CRITICAL (Must Fix):
446
- 1. [Issue]: Line [N]
447
- Problem: {why it matters}
448
- Fix: {specific rewrite}
449
-
450
- RECOMMENDED (Should Fix):
451
- 1. [Issue]: Line [N]
452
- Problem: {impact}
453
- Fix: {suggestion}
454
-
455
- SUGGESTIONS (Consider):
456
- 1. [Enhancement]: {description}
457
-
458
- -------------------------------------------------------------------------------
459
-
460
- IMPROVEMENT EXAMPLES
461
-
462
- ### Example 1: {issue type}
463
-
464
- **Location:** Line [N]
465
-
466
- **Current:**
467
- {current text}
468
-
469
- **Improved:**
470
- {better text}
471
-
472
- **Why better:** {explanation}
473
-
474
- -------------------------------------------------------------------------------
475
-
476
- PHASE 4: REFACTORED DRAFT
477
-
478
- {If score < 75, include full refactored prompt}
479
- {If score >= 75, show "Not required - prompt passes validation"}
480
-
481
- ===============================================================================
482
-
483
- AUDIT DECISION
484
-
485
- [APPROVED - Ready for use]
486
- No changes required. Prompt meets project standards.
487
-
488
- OR
489
-
490
- [IMPROVEMENTS AVAILABLE - Optional enhancements]
491
- Prompt is functional but could be improved.
492
- See SUGGESTIONS section above.
493
-
494
- OR
495
-
496
- [REVISION REQUIRED - Must fix before deployment]
497
- Critical issues found. See CRITICAL section.
498
- Refactored draft provided in Phase 4.
499
-
500
- ===============================================================================
501
-
502
- NEXT STEPS
503
-
504
- {If APPROVED}
505
- - No action required
506
- - Consider suggestions for future iterations
507
-
508
- {If IMPROVEMENTS AVAILABLE}
509
- - Review suggestions
510
- - Apply changes that add value
511
- - Re-run audit to verify (optional)
512
-
513
- {If REVISION REQUIRED}
514
- 1. Apply critical fixes from Phase 3
515
- 2. OR use refactored draft from Phase 4
516
- 3. Re-run: /workflows:prompt-audit $ARGUMENTS
517
- 4. Iterate until APPROVED
518
-
519
- +=============================================================================+
520
-
521
- ```
522
-
523
- ### Decision Criteria
524
-
525
- | Score | Issues | Decision |
526
- |-------|--------|----------|
527
- | >=85 | None critical | [OK] APPROVED |
528
- | 75-84 | None critical | [FIX] IMPROVEMENTS AVAILABLE |
529
- | <75 OR critical issues | Any | [LOOP] REVISION REQUIRED |
530
-
531
- **[LOOP] REVISION REQUIRED Auto-Triggers:**
532
- - Undefined or vague mission statement
533
- - No output format specification
534
- - Conflicting instructions
535
- - Missing scoring/threshold for validation agents
536
- - Decision criteria are purely subjective
537
-
538
-
539
- ---
540
-
541
- ## Final Phase: Outputs (MANDATORY)
542
-
543
- **This phase runs regardless of pass/fail status.** All agent recommendations must be captured.
544
-
545
- ### Artifacts
546
-
547
- **features-list** (markdown):
548
- Consolidated recommendations from all phases with scoring breakdown, category analysis, and actionable improvement items for tracker persistence.
549
-
550
- Generate a timestamp for the filename:
551
-
552
- ```bash
553
- TIMESTAMP=$(date +%Y-%m-%dT%H-%M-%S)
554
- echo "Timestamp: $TIMESTAMP"
555
20
  ```
556
-
557
- Write file to: `docs/{{ features_file }}`
558
-
559
- **Content template:**
560
-
561
- # Prompt Audit: {{ file_name }}
562
-
563
- **Date**: {{ timestamp }}
564
- **Target**: {{ file_path }}
565
- **Type**: {{ artifact_type }}
566
-
567
- ## Scores
568
-
569
- | Phase | Score | Status |
570
- |-------|-------|--------|
571
- | Pattern Analyzer | {score}/100 | {PASS/WARN} |
572
- | Prompt Engineer | {score}/100 | {PASS/FAIL} |
573
- | Prompt Quality | {score}/100 | {PASS/WARN} |
574
- | **Weighted Average** | **{score}/100** | |
575
-
576
- ## Recommendations
577
-
578
- ### Critical (fix before deployment)
579
- - [ ] {recommendation with file:line reference}
580
-
581
- ### Suggested (review before deployment)
582
- - [ ] {recommendation with file:line reference}
583
-
584
- ### Backlog (post-deployment)
585
- - [ ] {recommendation}
586
-
587
-
588
- **refactored-draft** (markdown):
589
- A refactored version of the target prompt with all critical fixes applied from Phases 0-2. Generated only when prompt-engineer score is below deployment threshold.
590
- **Condition**: Generated only when `phases.prompt-engineer.score < 75`
591
-
592
- Generate a timestamp for the filename:
593
-
594
- ```bash
595
- TIMESTAMP=$(date +%Y-%m-%dT%H-%M-%S)
596
- echo "Timestamp: $TIMESTAMP"
21
+ Group 1 (sequential): pattern-analyzer
22
+ Group 2 (sequential): prompt-engineer
23
+ Group 3 (sequential): prompt-quality
597
24
  ```
598
-
599
- Write file to: `docs/{{ file_name }}-refactored.md`
600
-
601
- #### Granularity Rules
602
-
603
- **DO NOT consolidate multiple findings into single entries.** The tracker handles deduplication via fingerprinting. Save ALL raw findings:
604
-
605
- | Agent Reports | You Save |
606
- |---------------|----------|
607
- | "N+1 pattern in 14 locations" | 14 separate recommendations, one per file:line |
608
- | "Missing null checks on 8 .find() calls" | 8 separate recommendations |
609
- | "6 endpoints missing from docs" | 6 separate recommendations |
610
-
611
- **Rule:** If validator output has a file:line reference, it becomes a separate recommendation entry.
612
-
613
- ### Save to Tracker (MANDATORY — Always Save First)
614
-
615
- **CRITICAL: Always save to the tracker. Never skip this step.**
616
-
617
- After writing the markdown file, save results via `mcp__uluops-tracker__save_features_list`:
618
-
619
- ```
620
- mcp__uluops-tracker__save_features_list({
621
- project: claude-agent-workflows,
622
- workflow_type: "prompt-audit",
623
- timestamp: {ISO8601 timestamp},
624
- validators: [
625
- {
626
- "name": "{Agent Name}",
627
- "score": {numeric},
628
- "status": "{PASS|FAIL|SKIP}",
629
- "model": "{haiku|sonnet|opus}"
630
- }
631
- // ... one entry per agent
632
- ],
633
- recommendations: [
634
- {
635
- "validator": "{agent-name}",
636
- "title": "{short title}",
637
- "priority": "{critical|suggested|backlog}",
638
- "severity": "{critical|high|medium|low|info}",
639
- "description": "{details}",
640
- "file_path": "{path}",
641
- "line_number": {number}
642
- }
643
- // ... one entry per recommendation
644
- ]
645
- })
646
- ```
647
-
648
- **Priority mapping:**
649
- - Blocking (fix before ship) → `"critical"`
650
- - Warnings (review before ship) → `"suggested"`
651
- - Post-ship/backlog items → `"backlog"`
652
-
653
- ### Post-Save Verification
654
-
655
- After saving, verify the data was persisted correctly. **These are warnings, not blockers.**
656
-
657
- **Query validation-tracker and compare to tracker_payload_length**
658
-
659
- - On mismatch: **warn** (do NOT block or re-attempt)
660
- - Saved count differs from payload - some recommendations may not have persisted.
661
-
662
- **Verification procedure:**
663
-
664
- 1. Query the tracker for the saved run
665
- 2. Compare saved recommendation count against your payload count
666
- 3. If counts differ, log the discrepancy as a note — cross-phase deduplication is expected when multiple validators flag the same issue
667
- 4. **Proceed regardless** — the save already succeeded
668
-
669
-
670
- ---
671
-
672
-
673
-
674
-
675
-
676
- ---
677
-
678
- ## Iteration Pattern
679
-
680
- ```
681
- Existing Prompt
682
-
683
-
684
- /workflows:prompt-audit
685
-
686
- ├── APPROVED ──────▶ Done (optional improvements noted)
687
-
688
- ├── IMPROVEMENTS ──▶ Apply suggestions ──▶ (optional re-audit)
689
-
690
- └── REVISION ──────▶ Apply fixes OR use refactored draft
691
-
692
- └──▶ /workflows:prompt-audit (repeat)
693
-
694
- ```
695
-
696
- **Typical iterations**:
697
- - Well-written prompt: 1 run (APPROVED or IMPROVEMENTS)
698
- - Prompt with issues: 2-3 runs
699
- - Legacy or undocumented prompt: 2-4 runs
700
-
701
- **Report behavior across iterations**:
702
- - Each run creates a features list documenting current state and recommendations
703
- - Previous runs are preserved for audit trail
704
- - Resolved items from previous runs will not appear if agents no longer flag them
705
- - Tracker detects regressions when previously fixed issues reappear
706
-
707
- ---
708
-
709
- ## Quick Reference
710
-
711
- | Agent | Threshold | Group |
712
- |-------|-----------|-------|
713
- | Ecosystem Pattern Analysis | threshold >= 50, on fail: warn | 1 |
714
- | Prompt Engineer Validation | threshold >= 75, on fail: stop | 2 |
715
- | Prompt Quality Best Practices | threshold >= 70, on fail: warn | 3 |
716
-
717
-
718
- ---
719
-
720
- ## Troubleshooting
721
-
722
- ### Phase 3 suggestions conflict with each other
723
-
724
- The prompt-quality-validator generates suggestions independently. If suggestions conflict:
725
- 1. Prioritize CRITICAL over RECOMMENDED over SUGGESTIONS
726
- 2. When two suggestions target the same section, choose the more specific one
727
- 3. Use your judgment on which improves clarity most
728
-
729
-
730
- ### Refactored draft is too different from original
731
-
732
- The refactored draft prioritizes correctness over minimal changes. If you prefer incremental updates:
733
- 1. Apply only the CRITICAL fixes manually
734
- 2. Re-audit to verify those fixes
735
- 3. Then consider RECOMMENDED items one by one
736
-
737
-
738
- ### Type detection is wrong
739
-
740
- Override by specifying in your prompt:
741
- "Treat this as an agent definition and audit accordingly."
742
- /workflows:prompt-audit agents/my-prompt.md
743
-
744
-
745
- ### Score seems too low for a working prompt
746
-
747
- The audit is strict because prompts compound errors. A 65-score prompt may work but produces inconsistent results. The refactored draft shows what a higher-scoring version looks like.
748
-
749
-
750
- ### Pattern analyzer shows INCOMPLETE
751
-
752
- This happens when the ecosystem has fewer than 5 agents. The audit proceeds with generic conventions instead of project-specific patterns. Results are still valid but less context-aware.
753
-
754
-
25
+ ## Phases
26
+
27
+ | # | Agent | Threshold | Gate | Condition |
28
+ |---|-------|-----------|------|-----------|
29
+ | 1 | pattern-analyzer@latest | threshold >= 50, on fail: warn | stop | — |
30
+ | 2 | prompt-validate@latest | threshold >= 75, on fail: stop | stop | |
31
+ | 3 | prompt-quality@latest | threshold >= 70, on fail: warn | stop | — |
32
+
33
+ **Ecosystem Pattern Analysis**: Ecosystem scoring patterns and conventions; Decision vocabulary and threshold standards
34
+ **Prompt Engineering Validation** (after pattern-analyzer): Clarity, structure, and completeness; Scoring framework and effectiveness
35
+ **Prompt Quality Validation** (after prompt-engineer): Clarity and specificity; Objective effectiveness criteria
36
+ ## Scoring
37
+
38
+ **Method**: weighted_average
39
+ — pattern-analyzer: 15%, prompt-engineer: 55%, prompt-quality: 30%
40
+ ## Results Submission
41
+
42
+ Write markdown report to: `{{ target_path }}/{{ report_file }}`
43
+ Save ALL findings to tracker via `mcp__uluops-tracker__save_features_list` with project=`{{ target_name }}`, workflow_type=`prompt-audit`, definition_type=`workflow`, definition_name=`prompt-audit`, definition_version=`2.0.0`. Include validators array (name, score, status, model) and recommendations array (validator, title, priority, severity, description, file_path, line_number). Each file:line reference becomes a separate recommendation. Priority: blocking=critical, warnings=suggested, post-ship=backlog.
44
+ After saving, query tracker and compare counts. Mismatches from cross-phase deduplication are expected — warn only, do not re-attempt.