agentsys 5.3.0 → 5.3.1

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 (136) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor/commands/audit-project-agents.md +454 -0
  4. package/.cursor/commands/audit-project-github.md +141 -0
  5. package/.cursor/commands/audit-project.md +330 -0
  6. package/.cursor/commands/consult.md +417 -0
  7. package/.cursor/commands/debate.md +381 -0
  8. package/.cursor/commands/delivery-approval.md +334 -0
  9. package/.cursor/commands/deslop.md +142 -0
  10. package/.cursor/commands/drift-detect.md +259 -0
  11. package/.cursor/commands/enhance.md +172 -0
  12. package/.cursor/commands/learn.md +165 -0
  13. package/.cursor/commands/next-task.md +519 -0
  14. package/.cursor/commands/perf.md +464 -0
  15. package/.cursor/commands/repo-map.md +124 -0
  16. package/.cursor/commands/ship-ci-review-loop.md +468 -0
  17. package/.cursor/commands/ship-deployment.md +348 -0
  18. package/.cursor/commands/ship-error-handling.md +265 -0
  19. package/.cursor/commands/ship.md +517 -0
  20. package/.cursor/commands/sync-docs.md +171 -0
  21. package/.cursor/commands/web-ctl.md +101 -0
  22. package/.cursor/skills/consult/SKILL.md +425 -0
  23. package/.cursor/skills/debate/SKILL.md +316 -0
  24. package/.cursor/skills/deslop/SKILL.md +204 -0
  25. package/.cursor/skills/discover-tasks/SKILL.md +297 -0
  26. package/.cursor/skills/drift-analysis/SKILL.md +324 -0
  27. package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
  28. package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
  29. package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
  30. package/.cursor/skills/enhance-docs/SKILL.md +298 -0
  31. package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
  32. package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
  33. package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
  34. package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
  35. package/.cursor/skills/enhance-skills/SKILL.md +436 -0
  36. package/.cursor/skills/learn/SKILL.md +349 -0
  37. package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
  38. package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
  39. package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
  40. package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
  41. package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
  42. package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
  43. package/.cursor/skills/perf-profiler/SKILL.md +42 -0
  44. package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
  45. package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
  46. package/.cursor/skills/repo-mapping/SKILL.md +83 -0
  47. package/.cursor/skills/sync-docs/SKILL.md +351 -0
  48. package/.cursor/skills/validate-delivery/SKILL.md +186 -0
  49. package/.cursor/skills/web-auth/SKILL.md +177 -0
  50. package/.cursor/skills/web-browse/SKILL.md +516 -0
  51. package/.kiro/agents/agent-enhancer.json +12 -0
  52. package/.kiro/agents/ci-fixer.json +13 -0
  53. package/.kiro/agents/ci-monitor.json +12 -0
  54. package/.kiro/agents/claudemd-enhancer.json +12 -0
  55. package/.kiro/agents/consult-agent.json +13 -0
  56. package/.kiro/agents/cross-file-enhancer.json +12 -0
  57. package/.kiro/agents/debate-orchestrator.json +13 -0
  58. package/.kiro/agents/delivery-validator.json +12 -0
  59. package/.kiro/agents/deslop-agent.json +12 -0
  60. package/.kiro/agents/docs-enhancer.json +12 -0
  61. package/.kiro/agents/exploration-agent.json +12 -0
  62. package/.kiro/agents/hooks-enhancer.json +11 -0
  63. package/.kiro/agents/implementation-agent.json +13 -0
  64. package/.kiro/agents/learn-agent.json +12 -0
  65. package/.kiro/agents/map-validator.json +11 -0
  66. package/.kiro/agents/perf-analyzer.json +12 -0
  67. package/.kiro/agents/perf-code-paths.json +11 -0
  68. package/.kiro/agents/perf-investigation-logger.json +12 -0
  69. package/.kiro/agents/perf-orchestrator.json +13 -0
  70. package/.kiro/agents/perf-theory-gatherer.json +12 -0
  71. package/.kiro/agents/perf-theory-tester.json +13 -0
  72. package/.kiro/agents/plan-synthesizer.json +12 -0
  73. package/.kiro/agents/planning-agent.json +12 -0
  74. package/.kiro/agents/plugin-enhancer.json +12 -0
  75. package/.kiro/agents/prompt-enhancer.json +12 -0
  76. package/.kiro/agents/reviewer-perf-test.json +11 -0
  77. package/.kiro/agents/reviewer-quality-security.json +11 -0
  78. package/.kiro/agents/simple-fixer.json +13 -0
  79. package/.kiro/agents/skills-enhancer.json +11 -0
  80. package/.kiro/agents/sync-docs-agent.json +13 -0
  81. package/.kiro/agents/task-discoverer.json +12 -0
  82. package/.kiro/agents/test-coverage-checker.json +12 -0
  83. package/.kiro/agents/web-session.json +12 -0
  84. package/.kiro/agents/worktree-manager.json +13 -0
  85. package/.kiro/skills/consult/SKILL.md +425 -0
  86. package/.kiro/skills/debate/SKILL.md +316 -0
  87. package/.kiro/skills/deslop/SKILL.md +204 -0
  88. package/.kiro/skills/discover-tasks/SKILL.md +297 -0
  89. package/.kiro/skills/drift-analysis/SKILL.md +324 -0
  90. package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
  91. package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
  92. package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
  93. package/.kiro/skills/enhance-docs/SKILL.md +298 -0
  94. package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
  95. package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
  96. package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
  97. package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
  98. package/.kiro/skills/enhance-skills/SKILL.md +436 -0
  99. package/.kiro/skills/learn/SKILL.md +349 -0
  100. package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
  101. package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
  102. package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
  103. package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
  104. package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
  105. package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
  106. package/.kiro/skills/perf-profiler/SKILL.md +42 -0
  107. package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
  108. package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
  109. package/.kiro/skills/repo-mapping/SKILL.md +83 -0
  110. package/.kiro/skills/sync-docs/SKILL.md +351 -0
  111. package/.kiro/skills/validate-delivery/SKILL.md +186 -0
  112. package/.kiro/skills/web-auth/SKILL.md +177 -0
  113. package/.kiro/skills/web-browse/SKILL.md +516 -0
  114. package/.kiro/steering/audit-project-agents.md +459 -0
  115. package/.kiro/steering/audit-project-github.md +146 -0
  116. package/.kiro/steering/audit-project.md +330 -0
  117. package/.kiro/steering/consult.md +422 -0
  118. package/.kiro/steering/debate.md +386 -0
  119. package/.kiro/steering/delivery-approval.md +339 -0
  120. package/.kiro/steering/deslop.md +149 -0
  121. package/.kiro/steering/drift-detect.md +264 -0
  122. package/.kiro/steering/enhance.md +177 -0
  123. package/.kiro/steering/learn.md +166 -0
  124. package/.kiro/steering/next-task.md +481 -0
  125. package/.kiro/steering/perf.md +469 -0
  126. package/.kiro/steering/repo-map.md +126 -0
  127. package/.kiro/steering/ship-ci-review-loop.md +473 -0
  128. package/.kiro/steering/ship-deployment.md +353 -0
  129. package/.kiro/steering/ship-error-handling.md +270 -0
  130. package/.kiro/steering/ship.md +522 -0
  131. package/.kiro/steering/sync-docs.md +178 -0
  132. package/.kiro/steering/web-ctl.md +106 -0
  133. package/CHANGELOG.md +6 -0
  134. package/lib/adapter-transforms.js +28 -0
  135. package/package.json +1 -1
  136. package/site/content.json +1 -1
@@ -0,0 +1,255 @@
1
+ ---
2
+ name: enhance-orchestrator
3
+ description: "Use when coordinating multiple enhancers for /enhance command. Runs analyzers in parallel and produces unified report."
4
+ version: 5.1.0
5
+ argument-hint: "[path] [--apply] [--focus=TYPE]"
6
+ ---
7
+
8
+ # enhance-orchestrator
9
+
10
+ Coordinate all enhancement analyzers in parallel and produce a unified report.
11
+
12
+ ## Critical Rules
13
+
14
+ 1. **MUST run enhancers in parallel** - Use Promise.all for efficiency
15
+ 2. **MUST only run enhancers for existing content** - Skip if no files found
16
+ 3. **MUST report HIGH certainty first** - Priority order: HIGH → MEDIUM → LOW
17
+ 4. **NEVER auto-fix without --apply flag** - Explicit consent required
18
+ 5. **NEVER auto-fix MEDIUM or LOW issues** - Only HIGH certainty
19
+
20
+ ## Workflow
21
+
22
+ ### Phase 1: Parse Arguments
23
+
24
+ ```javascript
25
+ const args = '$ARGUMENTS'.split(' ').filter(Boolean);
26
+ const targetPath = args.find(a => !a.startsWith('--')) || '.';
27
+
28
+ const flags = {
29
+ apply: args.includes('--apply'),
30
+ focus: args.find(a => a.startsWith('--focus='))?.split('=')[1],
31
+ verbose: args.includes('--verbose'),
32
+ showSuppressed: args.includes('--show-suppressed'),
33
+ resetLearned: args.includes('--reset-learned'),
34
+ noLearn: args.includes('--no-learn'),
35
+ exportLearned: args.includes('--export-learned')
36
+ };
37
+
38
+ // Validate focus type
39
+ const VALID_FOCUS = ['plugin', 'agent', 'claudemd', 'claude-memory', 'docs', 'prompt', 'hooks', 'skills', 'cross-file'];
40
+ if (flags.focus && !VALID_FOCUS.includes(flags.focus)) {
41
+ console.error(`Invalid --focus: "${flags.focus}". Valid: ${VALID_FOCUS.join(', ')}`);
42
+ return;
43
+ }
44
+ ```
45
+
46
+ ### Phase 2: Discovery
47
+
48
+ Detect what exists in target path:
49
+
50
+ ```javascript
51
+ const discovery = {
52
+ plugins: await Glob({ pattern: 'plugins/*/.claude-plugin/plugin.json', path: targetPath }),
53
+ agents: await Glob({ pattern: '**/agents/*.md', path: targetPath }),
54
+ claudemd: await Glob({ pattern: '**/CLAUDE.md', path: targetPath }) ||
55
+ await Glob({ pattern: '**/AGENTS.md', path: targetPath }),
56
+ docs: await Glob({ pattern: 'docs/**/*.md', path: targetPath }),
57
+ prompts: await Glob({ pattern: '**/prompts/**/*.md', path: targetPath }) ||
58
+ await Glob({ pattern: '**/commands/**/*.md', path: targetPath }),
59
+ hooks: await Glob({ pattern: '**/hooks/**/*.md', path: targetPath }),
60
+ skills: await Glob({ pattern: '**/skills/**/SKILL.md', path: targetPath }),
61
+ // Cross-file runs if agents OR skills exist (analyzes relationships)
62
+ 'cross-file': discovery.agents?.length || discovery.skills?.length ? ['enabled'] : []
63
+ };
64
+ ```
65
+
66
+ ### Phase 3: Load Suppressions
67
+
68
+ ```javascript
69
+ // Use relative path from skill directory to plugin lib
70
+ // Path: skills/enhance-orchestrator/ -> ../../lib/
71
+ const { getSuppressionPath } = require('../../lib/cross-platform');
72
+ const { loadAutoSuppressions, getProjectId, clearAutoSuppressions } = require('../../lib/enhance/auto-suppression');
73
+
74
+ const suppressionPath = getSuppressionPath();
75
+ const projectId = getProjectId(targetPath);
76
+
77
+ if (flags.resetLearned) {
78
+ clearAutoSuppressions(suppressionPath, projectId);
79
+ console.log(`Cleared suppressions for project: ${projectId}`);
80
+ }
81
+
82
+ const autoLearned = loadAutoSuppressions(suppressionPath, projectId);
83
+ ```
84
+
85
+ ### Phase 4: Launch Enhancers in Parallel
86
+
87
+ **CRITICAL**: MUST spawn these EXACT agents using Task(). Do NOT use Explore or other agents.
88
+
89
+ | Focus Type | Agent to Spawn | Model | JS Analyzer |
90
+ |------------|----------------|-------|-------------|
91
+ | `plugin` | `plugin-enhancer` | sonnet | `lib/enhance/plugin-analyzer.js` |
92
+ | `agent` | `agent-enhancer` | opus | `lib/enhance/agent-analyzer.js` |
93
+ | `claudemd` | `claudemd-enhancer` | opus | `lib/enhance/projectmemory-analyzer.js` |
94
+ | `docs` | `docs-enhancer` | opus | `lib/enhance/docs-analyzer.js` |
95
+ | `prompt` | `prompt-enhancer` | opus | `lib/enhance/prompt-analyzer.js` |
96
+ | `hooks` | `hooks-enhancer` | opus | `lib/enhance/hook-analyzer.js` |
97
+ | `skills` | `skills-enhancer` | opus | `lib/enhance/skill-analyzer.js` |
98
+ | `cross-file` | `cross-file-enhancer` | sonnet | `lib/enhance/cross-file-analyzer.js` |
99
+
100
+ Each agent has `Bash(node:*)` to run its JS analyzer. Do NOT substitute with Explore agents.
101
+
102
+ ```javascript
103
+ // EXACT agent mapping - do not change
104
+ const ENHANCER_AGENTS = {
105
+ plugin: 'plugin-enhancer',
106
+ agent: 'agent-enhancer',
107
+ claudemd: 'claudemd-enhancer',
108
+ docs: 'docs-enhancer',
109
+ prompt: 'prompt-enhancer',
110
+ hooks: 'hooks-enhancer',
111
+ skills: 'skills-enhancer',
112
+ 'cross-file': 'cross-file-enhancer'
113
+ };
114
+
115
+ const promises = [];
116
+
117
+ for (const [type, agentType] of Object.entries(ENHANCER_AGENTS)) {
118
+ if (focus && focus !== type) continue;
119
+ if (!discovery[type]?.length) continue;
120
+
121
+ // MUST use exact subagent_type - these agents have Bash(node:*) to run JS analyzers
122
+ promises.push(Task({
123
+ subagent_type: agentType,
124
+ prompt: `Analyze ${type} in ${targetPath}.
125
+ MUST use Skill tool to invoke your enhance-* skill.
126
+ The skill runs the JavaScript analyzer and returns structured findings.
127
+ verbose: ${flags.verbose}
128
+ Return JSON: { "enhancerType": "${type}", "findings": [...], "summary": { high, medium, low } }`
129
+ }));
130
+ }
131
+
132
+ // MUST use Promise.all for parallel execution
133
+ const results = await Promise.all(promises);
134
+ ```
135
+
136
+ ### Phase 5: Aggregate Results
137
+
138
+ ```javascript
139
+ function aggregateResults(enhancerResults) {
140
+ const findings = [];
141
+ const byEnhancer = {};
142
+
143
+ for (const result of enhancerResults) {
144
+ if (!result?.findings) continue;
145
+ for (const finding of result.findings) {
146
+ findings.push({ ...finding, source: result.enhancerType });
147
+ }
148
+ byEnhancer[result.enhancerType] = result.summary;
149
+ }
150
+
151
+ return {
152
+ findings,
153
+ byEnhancer,
154
+ totals: {
155
+ high: findings.filter(f => f.certainty === 'HIGH').length,
156
+ medium: findings.filter(f => f.certainty === 'MEDIUM').length,
157
+ low: findings.filter(f => f.certainty === 'LOW').length
158
+ }
159
+ };
160
+ }
161
+ ```
162
+
163
+ ### Phase 6: Generate Report
164
+
165
+ Generate report directly from aggregated findings:
166
+
167
+ ```javascript
168
+ const { generateReport } = require('../../lib/enhance/reporter');
169
+
170
+ const report = generateReport(aggregated, {
171
+ verbose: flags.verbose,
172
+ showAutoFixable: flags.apply
173
+ });
174
+
175
+ console.log(report);
176
+ ```
177
+
178
+ ### Phase 7: Auto-Learning
179
+
180
+ ```javascript
181
+ if (!flags.noLearn) {
182
+ const { analyzeForAutoSuppression, saveAutoSuppressions } = require('../../lib/enhance/auto-suppression');
183
+
184
+ const newSuppressions = analyzeForAutoSuppression(aggregated.findings, fileContents, { projectRoot: targetPath });
185
+
186
+ if (newSuppressions.length > 0) {
187
+ saveAutoSuppressions(suppressionPath, projectId, newSuppressions);
188
+ console.log(`\nLearned ${newSuppressions.length} new suppressions.`);
189
+ }
190
+ }
191
+ ```
192
+
193
+ ### Phase 8: Apply Fixes
194
+
195
+ ```javascript
196
+ if (flags.apply) {
197
+ const autoFixable = aggregated.findings.filter(f => f.certainty === 'HIGH' && f.autoFixable);
198
+
199
+ if (autoFixable.length > 0) {
200
+ console.log(`\n## Applying ${autoFixable.length} Auto-Fixes\n`);
201
+
202
+ const byEnhancer = {};
203
+ for (const fix of autoFixable) {
204
+ const type = fix.source;
205
+ if (!byEnhancer[type]) byEnhancer[type] = [];
206
+ byEnhancer[type].push(fix);
207
+ }
208
+
209
+ for (const [type, fixes] of Object.entries(byEnhancer)) {
210
+ await Task({
211
+ subagent_type: enhancerAgents[type],
212
+ prompt: `Apply HIGH certainty fixes: ${JSON.stringify(fixes, null, 2)}`
213
+ });
214
+ }
215
+
216
+ console.log(`Applied ${autoFixable.length} fixes.`);
217
+ }
218
+ }
219
+ ```
220
+
221
+ ## Output Format
222
+
223
+ ```markdown
224
+ # Enhancement Analysis Report
225
+
226
+ **Target**: {targetPath}
227
+ **Date**: {timestamp}
228
+ **Enhancers Run**: {list}
229
+
230
+ ## Executive Summary
231
+
232
+ | Enhancer | HIGH | MEDIUM | LOW | Auto-Fixable |
233
+ |----------|------|--------|-----|--------------|
234
+ | plugin | 2 | 3 | 1 | 1 |
235
+ | agent | 1 | 2 | 0 | 1 |
236
+ | **Total**| **3**| **5** | **1**| **2** |
237
+
238
+ ## HIGH Certainty Issues
239
+ [Grouped by enhancer, then file]
240
+
241
+ ## MEDIUM Certainty Issues
242
+ [...]
243
+
244
+ ## Auto-Fix Summary
245
+ {n} issues can be fixed with `--apply` flag.
246
+ ```
247
+
248
+ ## Constraints
249
+
250
+ - MUST run enhancers in parallel (Promise.all)
251
+ - MUST skip enhancers for missing content types
252
+ - MUST report HIGH certainty issues first
253
+ - MUST deduplicate findings across enhancers
254
+ - NEVER auto-fix without explicit --apply flag
255
+ - NEVER auto-fix MEDIUM or LOW certainty issues
@@ -0,0 +1,319 @@
1
+ ---
2
+ name: enhance-plugins
3
+ description: "Use when analyzing plugin structures, MCP tools, and plugin security patterns."
4
+ version: 5.1.0
5
+ argument-hint: "[path] [--fix]"
6
+ ---
7
+
8
+ # enhance-plugins
9
+
10
+ Analyze plugin structures, MCP tools, and security patterns against best practices.
11
+
12
+ ## Parse Arguments
13
+
14
+ ```javascript
15
+ const args = '$ARGUMENTS'.split(' ').filter(Boolean);
16
+ const targetPath = args.find(a => !a.startsWith('--')) || '.';
17
+ const fix = args.includes('--fix');
18
+ ```
19
+
20
+ ## Plugin Locations
21
+
22
+ | Platform | Location |
23
+ |----------|----------|
24
+ | Claude Code | `plugins/*/`, `.claude-plugin/plugin.json` |
25
+ | OpenCode | `.opencode/plugins/`, MCP in `opencode.json` |
26
+ | Codex | MCP in `~/.codex/config.toml` |
27
+
28
+ ## Workflow
29
+
30
+ 1. **Discover** - Find plugins in `plugins/` directory
31
+ 2. **Load** - Read `plugin.json`, agents, commands, skills
32
+ 3. **Analyze** - Run pattern checks by certainty level
33
+ 4. **Report** - Generate markdown output
34
+ 5. **Fix** - Apply auto-fixes if `--fix` (HIGH certainty only)
35
+
36
+ ## Detection Patterns
37
+
38
+ ### 1. Tool Schema Design (HIGH)
39
+
40
+ Based on function calling best practices:
41
+
42
+ **Required elements:**
43
+ ```json
44
+ {
45
+ "name": "verb_noun",
46
+ "description": "What it does. When to use. What it returns.",
47
+ "input_schema": {
48
+ "type": "object",
49
+ "properties": {
50
+ "param": {
51
+ "type": "string",
52
+ "description": "Format and example"
53
+ }
54
+ },
55
+ "required": ["param"],
56
+ "additionalProperties": false
57
+ }
58
+ }
59
+ ```
60
+
61
+ **The "Intern Test"** - Can someone use this tool given only the description?
62
+
63
+ | Issue | Certainty | Auto-Fix |
64
+ |-------|-----------|----------|
65
+ | Missing `additionalProperties: false` | HIGH | Yes |
66
+ | Missing `required` array | HIGH | Yes |
67
+ | Missing tool description | HIGH | No |
68
+ | Missing param descriptions | MEDIUM | No |
69
+ | Vague names (`search`, `process`) | MEDIUM | No |
70
+
71
+ ### 2. Description Quality (HIGH)
72
+
73
+ **Tool descriptions must include:**
74
+ - What the function does
75
+ - When to use it (trigger context)
76
+ - What it returns
77
+
78
+ ```json
79
+ // Bad - vague
80
+ "description": "Search for things"
81
+
82
+ // Good - complete
83
+ "description": "Search product catalog by keyword. Use for inventory queries or price checks. Returns matching products with prices."
84
+ ```
85
+
86
+ **Parameter descriptions must include:**
87
+ - Format expectations
88
+ - Example values
89
+ - Relationships to other params
90
+
91
+ ```json
92
+ // Bad
93
+ "query": { "type": "string" }
94
+
95
+ // Good
96
+ "query": {
97
+ "type": "string",
98
+ "description": "Search keywords. Supports AND/OR. Example: 'laptop AND gaming'"
99
+ }
100
+ ```
101
+
102
+ ### 3. Schema Structure (MEDIUM)
103
+
104
+ | Issue | Why It Matters |
105
+ |-------|----------------|
106
+ | Deep nesting (>2 levels) | Reduces generation quality |
107
+ | Missing enums for constrained values | Allows invalid states |
108
+ | No min/max on numbers | Unbounded inputs |
109
+ | >20 tools per plugin | Increases error rates |
110
+
111
+ **Prefer flat structures:**
112
+ ```json
113
+ // Bad - nested
114
+ { "config": { "settings": { "timeout": 30 } } }
115
+
116
+ // Good - flat
117
+ { "timeout_seconds": 30 }
118
+ ```
119
+
120
+ ### 4. Plugin Structure (HIGH)
121
+
122
+ **Required files:**
123
+ ```
124
+ plugin-name/
125
+ ├── .claude-plugin/
126
+ │ └── plugin.json # name, version, description
127
+ ├── commands/ # User-invokable commands
128
+ ├── agents/ # Subagent definitions
129
+ ├── skills/ # Reusable skill implementations
130
+ └── package.json # Optional, for npm plugins
131
+ ```
132
+
133
+ **plugin.json validation:**
134
+ - `name`: lowercase, kebab-case
135
+ - `version`: semver format (`^\d+\.\d+\.\d+$`)
136
+ - `description`: explains what plugin provides
137
+
138
+ **Version sync:** plugin.json version must match package.json if present.
139
+
140
+ ### 5. MCP Server Patterns (MEDIUM)
141
+
142
+ For plugins exposing MCP tools:
143
+
144
+ **Transport types:**
145
+ - `stdio` - Standard I/O (most common)
146
+ - `http` - HTTP/SSE transport
147
+
148
+ **Configuration:**
149
+ ```json
150
+ {
151
+ "mcp": {
152
+ "server-name": {
153
+ "type": "local",
154
+ "command": ["node", "path/to/server.js"],
155
+ "environment": { "KEY": "value" },
156
+ "enabled": true
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ **Security principles:**
163
+ - User consent for data access
164
+ - No transmission without approval
165
+ - Tool descriptions are untrusted input
166
+
167
+ ### 6. Security Patterns (HIGH)
168
+
169
+ **HIGH Certainty issues:**
170
+ | Pattern | Risk | Detection |
171
+ |---------|------|-----------|
172
+ | Unrestricted `Bash` | Command execution | `tools:.*Bash[^(]` |
173
+ | Command injection | Shell escape | `\${.*}` in commands |
174
+ | Path traversal | File access | `\.\.\/` in paths |
175
+ | Hardcoded secrets | Credential leak | API keys, passwords |
176
+
177
+ **MEDIUM Certainty issues:**
178
+ | Pattern | Risk |
179
+ |---------|------|
180
+ | Broad file access | Data exfiltration |
181
+ | Missing input validation | Injection attacks |
182
+ | No timeout on tools | Resource exhaustion |
183
+
184
+ **Input validation required:**
185
+ ```javascript
186
+ // Validate before execution
187
+ function validateToolInput(params, schema) {
188
+ // Type validation
189
+ // Range validation (min/max)
190
+ // Enum validation
191
+ // Format validation (regex patterns)
192
+ }
193
+ ```
194
+
195
+ ### 7. Error Handling (MEDIUM)
196
+
197
+ Tools should return structured errors:
198
+ ```json
199
+ {
200
+ "type": "tool_result",
201
+ "tool_use_id": "id",
202
+ "content": "Error: [TYPE]. [WHAT]. [SUGGESTION].",
203
+ "is_error": true
204
+ }
205
+ ```
206
+
207
+ **Retry guidance:**
208
+ - Transient (429, 503): exponential backoff
209
+ - Validation (400): no retry, return error
210
+ - Timeout: configurable, default 30s
211
+
212
+ ### 8. Tool Count (LOW)
213
+
214
+ **"Less-is-More" approach:**
215
+ - Research shows reducing tools improves accuracy by up to 89%
216
+ - Limit to 3-5 relevant tools per task context
217
+ - Consider dynamic tool loading for large toolsets
218
+
219
+ ## Auto-Fixes
220
+
221
+ | Issue | Fix |
222
+ |-------|-----|
223
+ | Missing `additionalProperties` | Add `"additionalProperties": false` |
224
+ | Missing `required` | Add all properties to required array |
225
+ | Version mismatch | Sync plugin.json with package.json |
226
+
227
+ ## Output Format
228
+
229
+ ```markdown
230
+ ## Plugin Analysis: {name}
231
+
232
+ **Files scanned**: {count}
233
+
234
+ | Certainty | Count |
235
+ |-----------|-------|
236
+ | HIGH | {n} |
237
+ | MEDIUM | {n} |
238
+
239
+ ### Tool Schema Issues
240
+ | Tool | Issue | Fix | Certainty |
241
+
242
+ ### Structure Issues
243
+ | File | Issue | Certainty |
244
+
245
+ ### Security Issues
246
+ | File | Line | Issue | Certainty |
247
+ ```
248
+
249
+ ## Pattern Statistics
250
+
251
+ | Category | Patterns | Certainty |
252
+ |----------|----------|-----------|
253
+ | Tool Schema | 5 | HIGH |
254
+ | Descriptions | 2 | HIGH |
255
+ | Schema Structure | 4 | MEDIUM |
256
+ | Plugin Structure | 3 | HIGH |
257
+ | MCP Patterns | 2 | MEDIUM |
258
+ | Security | 6 | HIGH/MEDIUM |
259
+ | Error Handling | 2 | MEDIUM |
260
+ | Tool Count | 1 | LOW |
261
+ | **Total** | **25** | - |
262
+
263
+ <examples>
264
+ ### Schema Strictness
265
+ <bad_example>
266
+ ```json
267
+ {
268
+ "properties": { "path": { "type": "string" } }
269
+ }
270
+ ```
271
+ </bad_example>
272
+ <good_example>
273
+ ```json
274
+ {
275
+ "properties": { "path": { "type": "string", "description": "File path" } },
276
+ "required": ["path"],
277
+ "additionalProperties": false
278
+ }
279
+ ```
280
+ </good_example>
281
+
282
+ ### Tool Description
283
+ <bad_example>
284
+ ```json
285
+ "description": "Search for things"
286
+ ```
287
+ </bad_example>
288
+ <good_example>
289
+ ```json
290
+ "description": "Search product catalog by keyword. Use for inventory or price queries. Returns products with prices."
291
+ ```
292
+ </good_example>
293
+
294
+ ### Security
295
+ <bad_example>
296
+ ```yaml
297
+ tools: Read, Bash # Unrestricted
298
+ ```
299
+ </bad_example>
300
+ <good_example>
301
+ ```yaml
302
+ tools: Read, Bash(git:*) # Scoped
303
+ ```
304
+ </good_example>
305
+ </examples>
306
+
307
+ ## References
308
+
309
+ - `agent-docs/FUNCTION-CALLING-TOOL-USE-REFERENCE.md` - Tool schema, descriptions, security
310
+ - `agent-docs/CLAUDE-CODE-REFERENCE.md` - Plugin structure, MCP config
311
+ - `agent-docs/OPENCODE-REFERENCE.md` - OpenCode MCP integration
312
+ - `agent-docs/CODEX-REFERENCE.md` - Codex MCP config
313
+
314
+ ## Constraints
315
+
316
+ - Auto-fix only HIGH certainty issues
317
+ - Security warnings are advisory - do not auto-fix
318
+ - Preserve existing plugin.json fields
319
+ - Never modify tool behavior, only schema definitions