super-opencode 1.1.0 → 1.1.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 (35) hide show
  1. package/.opencode/agents/architect.md +84 -84
  2. package/.opencode/agents/backend.md +124 -124
  3. package/.opencode/agents/frontend.md +137 -137
  4. package/.opencode/agents/optimizer.md +51 -51
  5. package/.opencode/agents/pm-agent.md +105 -105
  6. package/.opencode/agents/quality.md +107 -107
  7. package/.opencode/agents/researcher.md +105 -105
  8. package/.opencode/agents/reviewer.md +80 -80
  9. package/.opencode/agents/security.md +107 -107
  10. package/.opencode/agents/writer.md +136 -136
  11. package/.opencode/commands/soc-analyze.md +136 -137
  12. package/.opencode/commands/soc-brainstorm.md +109 -110
  13. package/.opencode/commands/soc-cleanup.md +107 -107
  14. package/.opencode/commands/soc-design.md +0 -1
  15. package/.opencode/commands/soc-explain.md +113 -113
  16. package/.opencode/commands/soc-git.md +104 -104
  17. package/.opencode/commands/soc-help.md +94 -94
  18. package/.opencode/commands/soc-implement.md +112 -112
  19. package/.opencode/commands/soc-improve.md +105 -105
  20. package/.opencode/commands/soc-pm.md +99 -99
  21. package/.opencode/commands/soc-research.md +105 -105
  22. package/.opencode/commands/soc-review.md +102 -102
  23. package/.opencode/commands/soc-test.md +109 -109
  24. package/.opencode/commands/soc-workflow.md +97 -97
  25. package/.opencode/settings.json +3 -3
  26. package/.opencode/skills/confidence-check/SKILL.md +97 -97
  27. package/.opencode/skills/debug-protocol/SKILL.md +83 -83
  28. package/.opencode/skills/reflexion/SKILL.md +108 -108
  29. package/.opencode/skills/security-audit/SKILL.md +90 -90
  30. package/.opencode/skills/self-check/SKILL.md +95 -95
  31. package/.opencode/skills/simplification/SKILL.md +92 -92
  32. package/AGENTS.md +175 -175
  33. package/LICENSE +21 -21
  34. package/dist/cli.js +2 -2
  35. package/package.json +45 -45
@@ -1,94 +1,94 @@
1
- ---
2
- description: Help and command reference
3
- ---
4
-
5
- # /soc-help
6
-
7
- ## 1. Command Overview
8
- The `/soc-help` command is the "Librarian." It serves as the primary documentation interface for the agent system. It explains *how* to use the other commands, details what each agent does, and lists available skills. It uses the `researcher` agent to find answers within the system's own documentation.
9
-
10
- ## 2. Triggers & Routing
11
- The command is self-contained but may use `researcher` for deep queries.
12
-
13
- | Trigger Scenario | Flag | Target Agent | Action |
14
- | :--- | :--- | :--- | :--- |
15
- | **Command Syntax** | `[command]` | `[System]` | Show usage and flags |
16
- | **Agent Roles** | `[agent]` | `[System]` | Show persona description |
17
- | **Workflow Guide** | `[topic]` | `[researcher]` | Summarize best practices |
18
-
19
- ## 3. Usage & Arguments
20
- ```bash
21
- /soc-help [target] [flags]
22
- ```
23
-
24
- ### Arguments
25
- - **`[target]`**: (Optional) Specific command (`implement`), agent (`backend`), or topic (`workflows`). Default: Shows index.
26
-
27
- ### Flags
28
- - **`--verbose`**: Show detailed descriptions and hidden flags.
29
-
30
- ## 4. Behavioral Flow (Orchestration)
31
-
32
- ### Phase 1: Lookup
33
- 1. **Index**: Check if target is a known Command, Agent, or Skill.
34
- 2. **Search**: If unknown, grep `.opencode/` documentation for keywords.
35
-
36
- ### Phase 2: Formatting
37
- - **Structure**: Group by Category (Workflow vs Skill).
38
- - **Clarity**: Show "Quick Start" snippets.
39
-
40
- ## 5. Output Guidelines (The Contract)
41
-
42
- ### Help Document
43
- ```markdown
44
- ## Help: [Target]
45
-
46
- ### Description
47
- [Brief summary]
48
-
49
- ### Usage
50
- `[Command Pattern]`
51
-
52
- ### Key Features
53
- - Feature 1
54
- - Feature 2
55
-
56
- ### Related Commands
57
- - `/related-command`
58
- ```
59
-
60
- ## 6. Examples
61
-
62
- ### A. Command Help
63
- ```bash
64
- /soc-help implement
65
- ```
66
- *Effect:* Displays usage for `/soc-implement`, including flags like `--agent` and `--test`.
67
-
68
- ### B. Agent Role
69
- ```bash
70
- /soc-help backend
71
- ```
72
- *Effect:* Shows the `backend` agent's persona, including "Prime Directives" and "Restrictions."
73
-
74
- ## 7. Dependencies & Capabilities
75
-
76
- ### Agents
77
- - **Researcher**: `@[.opencode/agents/researcher.md]` - For finding unstructured help.
78
-
79
- ### Skills
80
- - **None**: This is a read-only command.
81
-
82
- ### MCP Integration
83
- - **`filesystem`**: Reading documentation files.
84
-
85
- ## 8. Boundaries
86
-
87
- **Will:**
88
- - Explain system capabilities.
89
- - List available tools.
90
- - Provide syntax examples.
91
-
92
- **Will Not:**
93
- - **Execute Commands**: It only explains them.
94
- - **Hallucinate Features**: Only lists what exists in `.opencode/`.
1
+ ---
2
+ description: Help and command reference
3
+ ---
4
+
5
+ # /soc-help
6
+
7
+ ## 1. Command Overview
8
+ The `/soc-help` command is the "Librarian." It serves as the primary documentation interface for the agent system. It explains *how* to use the other commands, details what each agent does, and lists available skills. It uses the `researcher` agent to find answers within the system's own documentation.
9
+
10
+ ## 2. Triggers & Routing
11
+ The command is self-contained but may use `researcher` for deep queries.
12
+
13
+ | Trigger Scenario | Flag | Target Agent | Action |
14
+ | :--- | :--- | :--- | :--- |
15
+ | **Command Syntax** | `[command]` | `[System]` | Show usage and flags |
16
+ | **Agent Roles** | `[agent]` | `[System]` | Show persona description |
17
+ | **Workflow Guide** | `[topic]` | `[researcher]` | Summarize best practices |
18
+
19
+ ## 3. Usage & Arguments
20
+ ```bash
21
+ /soc-help [target] [flags]
22
+ ```
23
+
24
+ ### Arguments
25
+ - **`[target]`**: (Optional) Specific command (`implement`), agent (`backend`), or topic (`workflows`). Default: Shows index.
26
+
27
+ ### Flags
28
+ - **`--verbose`**: Show detailed descriptions and hidden flags.
29
+
30
+ ## 4. Behavioral Flow (Orchestration)
31
+
32
+ ### Phase 1: Lookup
33
+ 1. **Index**: Check if target is a known Command, Agent, or Skill.
34
+ 2. **Search**: If unknown, grep `.opencode/` documentation for keywords.
35
+
36
+ ### Phase 2: Formatting
37
+ - **Structure**: Group by Category (Workflow vs Skill).
38
+ - **Clarity**: Show "Quick Start" snippets.
39
+
40
+ ## 5. Output Guidelines (The Contract)
41
+
42
+ ### Help Document
43
+ ```markdown
44
+ ## Help: [Target]
45
+
46
+ ### Description
47
+ [Brief summary]
48
+
49
+ ### Usage
50
+ `[Command Pattern]`
51
+
52
+ ### Key Features
53
+ - Feature 1
54
+ - Feature 2
55
+
56
+ ### Related Commands
57
+ - `/related-command`
58
+ ```
59
+
60
+ ## 6. Examples
61
+
62
+ ### A. Command Help
63
+ ```bash
64
+ /soc-help implement
65
+ ```
66
+ *Effect:* Displays usage for `/soc-implement`, including flags like `--agent` and `--test`.
67
+
68
+ ### B. Agent Role
69
+ ```bash
70
+ /soc-help backend
71
+ ```
72
+ *Effect:* Shows the `backend` agent's persona, including "Prime Directives" and "Restrictions."
73
+
74
+ ## 7. Dependencies & Capabilities
75
+
76
+ ### Agents
77
+ - **Researcher**: `@[.opencode/agents/researcher.md]` - For finding unstructured help.
78
+
79
+ ### Skills
80
+ - **None**: This is a read-only command.
81
+
82
+ ### MCP Integration
83
+ - **`filesystem`**: Reading documentation files.
84
+
85
+ ## 8. Boundaries
86
+
87
+ **Will:**
88
+ - Explain system capabilities.
89
+ - List available tools.
90
+ - Provide syntax examples.
91
+
92
+ **Will Not:**
93
+ - **Execute Commands**: It only explains them.
94
+ - **Hallucinate Features**: Only lists what exists in `.opencode/`.
@@ -1,112 +1,112 @@
1
- ---
2
- description: Code implementation with best practices
3
- ---
4
-
5
- # /soc-implement
6
-
7
- ## 1. Command Overview
8
- The `/soc-implement` command is the execution engine of the agent system. It transforms approved designs and specifications into production-ready code. It enforces strict quality control, testing (TDD), and "self-correction" loops via the `reflexion` skill. It does not plan; it executes.
9
-
10
- ## 2. Triggers & Routing
11
- The command routes to specialized sub-agents based on the `--agent` flag or file context.
12
-
13
- | Trigger Scenario | Flag | Target Agent | Context Injected |
14
- | :--- | :--- | :--- | :--- |
15
- | **API/Database Logic** | `--agent backend` | `[backend]` | DB Schemas, Error Handling Middleware |
16
- | **UI/Components** | `--agent frontend` | `[frontend]` | Design System, A11y Rules, Hooks |
17
- | **Testing/QA** | `--agent quality` | `[quality]` | Test Runner Config, Coverage Reports |
18
- | **Refactoring** | `--agent fullstack` | `[backend]` + `[frontend]` | Cross-layer dependencies |
19
-
20
- ## 3. Usage & Arguments
21
- ```bash
22
- /soc-implement [target] [flags]
23
- ```
24
-
25
- ### Arguments
26
- - **`[target]`**: The feature or file to implement (e.g., "Login Flow", "src/components/Button.tsx").
27
-
28
- ### Flags
29
- - **`--agent [backend|frontend|quality]`**: **MANDATORY**. Specifies the executing persona.
30
- - **`--test`**: (Default: true) Run capabilities tests after implementation.
31
- - **`--document`**: (Default: true) Update associated documentation/comments.
32
-
33
- ## 4. Behavioral Flow (Orchestration)
34
-
35
- ### Phase 1: Pre-Flight (Confidence Check)
36
- 1. **Read**: Review existing code and referencing `design.md` or `requirements`.
37
- 2. **Verify**: Check for patterns (e.g., "How do existing controllers handle errors?").
38
- 3. **Gate**: If confidence < 80%, ask user/PM for clarification.
39
-
40
- ### Phase 2: Execution (The Loop)
41
- 1. **Test**: Write the test case first (TDD) if applicable.
42
- 2. **Edit**: Apply changes using `replace_file_content` or `write_to_file`.
43
- 3. **Verify**: Run the project's build/test command.
44
- * *If Fail*: Trigger `reflexion` skill (Why did it fail? -> Fix -> Retry).
45
- * *Limit*: Max 3 retries before asking for help.
46
-
47
- ### Phase 3: Post-Flight (Self Check)
48
- - Did I leave any `console.log`?
49
- - Are inputs sanitized?
50
- - Did I break the build?
51
-
52
- ## 5. Output Guidelines (The Contract)
53
-
54
- ### Standard Implementation Report
55
- ```markdown
56
- ## Implementation: [Feature Name]
57
-
58
- ### 1. Changes Summary
59
- - **Created:** `src/features/auth/login.ts`
60
- - **Modified:** `src/components/navbar.tsx`
61
-
62
- ### 2. Verification
63
- - ✅ **Build:** Passed
64
- - ✅ **Tests:** 3 new tests added, all passing.
65
- - ✅ **Lint:** 0 errors.
66
-
67
- ### 3. Key Decisions
68
- - Used `zod` for validation to match existing patterns.
69
- - Extracted `useAuth` hook for reusability.
70
- ```
71
-
72
- ## 6. Examples
73
-
74
- ### A. Backend Feature
75
- ```bash
76
- /soc-implement "User Registration API" --agent backend
77
- ```
78
- *Effect:* `backend` agent writes `POST /register`, adds `UserSchema` validation, inputs into Postgres, and returns a sanitized User DTO.
79
-
80
- ### B. Frontend Component
81
- ```bash
82
- /soc-implement "DarkMode Toggle" --agent frontend
83
- ```
84
- *Effect:* `frontend` agent checks `tailwind.config.js`, creates a toggle component using `Radix UI` primitives (if installed) and handles local storage state.
85
-
86
- ## 7. Dependencies & Capabilities
87
-
88
- ### Agents
89
- - **Backend**: `@[.opencode/agents/backend.md]`
90
- - **Frontend**: `@[.opencode/agents/frontend.md]`
91
- - **Quality**: `@[.opencode/agents/quality.md]` - For TDD and verification.
92
-
93
- ### Skills
94
- - **Confidence Check**: `@[.opencode/skills/confidence-check/SKILL.md]` - MANDATORY step before starting.
95
- - **Self Check**: `@[.opencode/skills/self-check/SKILL.md]` - Validation protocol after changes.
96
- - **Debug Protocol**: `@[.opencode/skills/debug-protocol/SKILL.md]` - If implementation hits errors.
97
-
98
- ### MCP Integration
99
- - **`context7`**: For looking up exact syntax and library API usage to prevent hallucinations.
100
- - **`filesystem`**: For determining current project structure and patterns.
101
-
102
- ## 8. Boundaries
103
-
104
- **Will:**
105
- - Write code modules, tests, and documentation.
106
- - Fix compilation errors it causes.
107
- - Respect existing linters and formatters.
108
-
109
- **Will Not:**
110
- - **Invent Designs**: If no design exists, it will fall back to simple best practices or ask for a design.
111
- - **Commit Violations**: Will not commit code with secrets or critical bugs.
112
- - **Touch Forbidden Files**: (e.g., `package-lock.json` manual edits, `.env` manual edits).
1
+ ---
2
+ description: Code implementation with best practices
3
+ ---
4
+
5
+ # /soc-implement
6
+
7
+ ## 1. Command Overview
8
+ The `/soc-implement` command is the execution engine of the agent system. It transforms approved designs and specifications into production-ready code. It enforces strict quality control, testing (TDD), and "self-correction" loops via the `reflexion` skill. It does not plan; it executes.
9
+
10
+ ## 2. Triggers & Routing
11
+ The command routes to specialized sub-agents based on the `--agent` flag or file context.
12
+
13
+ | Trigger Scenario | Flag | Target Agent | Context Injected |
14
+ | :--- | :--- | :--- | :--- |
15
+ | **API/Database Logic** | `--agent backend` | `[backend]` | DB Schemas, Error Handling Middleware |
16
+ | **UI/Components** | `--agent frontend` | `[frontend]` | Design System, A11y Rules, Hooks |
17
+ | **Testing/QA** | `--agent quality` | `[quality]` | Test Runner Config, Coverage Reports |
18
+ | **Refactoring** | `--agent fullstack` | `[backend]` + `[frontend]` | Cross-layer dependencies |
19
+
20
+ ## 3. Usage & Arguments
21
+ ```bash
22
+ /soc-implement [target] [flags]
23
+ ```
24
+
25
+ ### Arguments
26
+ - **`[target]`**: The feature or file to implement (e.g., "Login Flow", "src/components/Button.tsx").
27
+
28
+ ### Flags
29
+ - **`--agent [backend|frontend|quality]`**: **MANDATORY**. Specifies the executing persona.
30
+ - **`--test`**: (Default: true) Run capabilities tests after implementation.
31
+ - **`--document`**: (Default: true) Update associated documentation/comments.
32
+
33
+ ## 4. Behavioral Flow (Orchestration)
34
+
35
+ ### Phase 1: Pre-Flight (Confidence Check)
36
+ 1. **Read**: Review existing code and referencing `design.md` or `requirements`.
37
+ 2. **Verify**: Check for patterns (e.g., "How do existing controllers handle errors?").
38
+ 3. **Gate**: If confidence < 80%, ask user/PM for clarification.
39
+
40
+ ### Phase 2: Execution (The Loop)
41
+ 1. **Test**: Write the test case first (TDD) if applicable.
42
+ 2. **Edit**: Apply changes using `replace_file_content` or `write_to_file`.
43
+ 3. **Verify**: Run the project's build/test command.
44
+ * *If Fail*: Trigger `reflexion` skill (Why did it fail? -> Fix -> Retry).
45
+ * *Limit*: Max 3 retries before asking for help.
46
+
47
+ ### Phase 3: Post-Flight (Self Check)
48
+ - Did I leave any `console.log`?
49
+ - Are inputs sanitized?
50
+ - Did I break the build?
51
+
52
+ ## 5. Output Guidelines (The Contract)
53
+
54
+ ### Standard Implementation Report
55
+ ```markdown
56
+ ## Implementation: [Feature Name]
57
+
58
+ ### 1. Changes Summary
59
+ - **Created:** `src/features/auth/login.ts`
60
+ - **Modified:** `src/components/navbar.tsx`
61
+
62
+ ### 2. Verification
63
+ - ✅ **Build:** Passed
64
+ - ✅ **Tests:** 3 new tests added, all passing.
65
+ - ✅ **Lint:** 0 errors.
66
+
67
+ ### 3. Key Decisions
68
+ - Used `zod` for validation to match existing patterns.
69
+ - Extracted `useAuth` hook for reusability.
70
+ ```
71
+
72
+ ## 6. Examples
73
+
74
+ ### A. Backend Feature
75
+ ```bash
76
+ /soc-implement "User Registration API" --agent backend
77
+ ```
78
+ *Effect:* `backend` agent writes `POST /register`, adds `UserSchema` validation, inputs into Postgres, and returns a sanitized User DTO.
79
+
80
+ ### B. Frontend Component
81
+ ```bash
82
+ /soc-implement "DarkMode Toggle" --agent frontend
83
+ ```
84
+ *Effect:* `frontend` agent checks `tailwind.config.js`, creates a toggle component using `Radix UI` primitives (if installed) and handles local storage state.
85
+
86
+ ## 7. Dependencies & Capabilities
87
+
88
+ ### Agents
89
+ - **Backend**: `@[.opencode/agents/backend.md]`
90
+ - **Frontend**: `@[.opencode/agents/frontend.md]`
91
+ - **Quality**: `@[.opencode/agents/quality.md]` - For TDD and verification.
92
+
93
+ ### Skills
94
+ - **Confidence Check**: `@[.opencode/skills/confidence-check/SKILL.md]` - MANDATORY step before starting.
95
+ - **Self Check**: `@[.opencode/skills/self-check/SKILL.md]` - Validation protocol after changes.
96
+ - **Debug Protocol**: `@[.opencode/skills/debug-protocol/SKILL.md]` - If implementation hits errors.
97
+
98
+ ### MCP Integration
99
+ - **`context7`**: For looking up exact syntax and library API usage to prevent hallucinations.
100
+ - **`filesystem`**: For determining current project structure and patterns.
101
+
102
+ ## 8. Boundaries
103
+
104
+ **Will:**
105
+ - Write code modules, tests, and documentation.
106
+ - Fix compilation errors it causes.
107
+ - Respect existing linters and formatters.
108
+
109
+ **Will Not:**
110
+ - **Invent Designs**: If no design exists, it will fall back to simple best practices or ask for a design.
111
+ - **Commit Violations**: Will not commit code with secrets or critical bugs.
112
+ - **Touch Forbidden Files**: (e.g., `package-lock.json` manual edits, `.env` manual edits).
@@ -1,105 +1,105 @@
1
- ---
2
- description: Code improvement and optimization
3
- ---
4
-
5
- # /soc-improve
6
-
7
- ## 1. Command Overview
8
- The `/soc-improve` command is the "Optimizer." Unlike `implement` (which builds new things) or `cleanup` (which removes dead things), `improve` makes existing *working* code *better*. It focuses on performance, readability, security, and quality benchmarks.
9
-
10
- ## 2. Triggers & Routing
11
- The command routes to specialized agents based on the `--focus` flag.
12
-
13
- | Trigger Scenario | Flag | Target Agent | Goal |
14
- | :--- | :--- | :--- | :--- |
15
- | **Performance** | `--focus perf` | `[architect]` | Reduce latency/memory |
16
- | **Code Quality** | `--focus quality` | `[quality]` | Refactor/Clean Clean |
17
- | **Security Hardening** | `--focus security` | `[security]` | Patch vulnerabilities |
18
- | **UX Polish** | `--focus ux` | `[frontend]` | A11y, animations |
19
-
20
- ## 3. Usage & Arguments
21
- ```bash
22
- /soc-improve [target] [flags]
23
- ```
24
-
25
- ### Arguments
26
- - **`[target]`**: File or component to optimize.
27
-
28
- ### Flags
29
- - **`--focus [perf|quality|security|ux]`**: **MANDATORY**.
30
- - **`--metric [target]`**: Optional goal (e.g., `< 100ms`).
31
-
32
- ## 4. Behavioral Flow (Orchestration)
33
-
34
- ### Phase 1: Benchmark (The Baseline)
35
- 1. **Measure**: Analyze current state (LOC, Complexity, or approximate Perf).
36
- 2. **Identify**: Find bottlenecks or anti-patterns.
37
-
38
- ### Phase 2: Plan (The Upgrade)
39
- - Propose specific refactors.
40
- - Estimate impact (e.g., "Replacing nested loop will reduce O(n^2) to O(n)").
41
-
42
- ### Phase 3: Execute (The Refactor)
43
- 1. **Edit**: Apply changes safely.
44
- 2. **Verify**: Ensure tests still pass (Regression Check).
45
- 3. **Compare**: Show Before vs After stats.
46
-
47
- ## 5. Output Guidelines (The Contract)
48
-
49
- ### Improvement Report
50
- ```markdown
51
- ## Improvement: [Target]
52
-
53
- ### Focus: [Focus Area]
54
-
55
- ### Changes Applied
56
- 1. **Refactor**: Extracted `LargeComponent` into 3 sub-components.
57
- 2. **Performance**: Memoized calculation of expensive value.
58
-
59
- ### Metrics
60
- | Metric | Before | After | Delta |
61
- | :--- | :--- | :--- | :--- |
62
- | **Complexity** | 15 | 8 | -47% |
63
- | **Lines** | 200 | 120 | -40% |
64
-
65
- ### Verification
66
- ✅ Tests Passed
67
- ```
68
-
69
- ## 6. Examples
70
-
71
- ### A. Performance Tuning
72
- ```bash
73
- /soc-improve src/utils/sort.ts --focus perf
74
- ```
75
- *Effect:* Replaces bubble sort with quicksort or uses a native method.
76
-
77
- ### B. Security Hardening
78
- ```bash
79
- /soc-improve src/api/user.ts --focus security
80
- ```
81
- *Effect:* Adds input validation (Zod) and rate limiting to an existing endpoint.
82
-
83
- ## 7. Dependencies & Capabilities
84
-
85
- ### Agents
86
- - **Architect**: `@[.opencode/agents/architect.md]` - Performance strategy.
87
- - **Quality**: `@[.opencode/agents/quality.md]` - Code structure.
88
- - **Security**: `@[.opencode/agents/security.md]` - Hardening.
89
-
90
- ### Skills
91
- - **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - Ensuring improvements don't break logic.
92
-
93
- ### MCP Integration
94
- - **`context7`**: Checking for modern language features (e.g., utilizing new node.js APIs).
95
-
96
- ## 8. Boundaries
97
-
98
- **Will:**
99
- - Refactor code structure.
100
- - Optimize algorithms.
101
- - Add comments/documentation.
102
-
103
- **Will Not:**
104
- - **Change Behavior**: The external API/output must remain identical (unless fixing a bug).
105
- - **Delete Features**: Use `/soc-cleanup` for removal.
1
+ ---
2
+ description: Code improvement and optimization
3
+ ---
4
+
5
+ # /soc-improve
6
+
7
+ ## 1. Command Overview
8
+ The `/soc-improve` command is the "Optimizer." Unlike `implement` (which builds new things) or `cleanup` (which removes dead things), `improve` makes existing *working* code *better*. It focuses on performance, readability, security, and quality benchmarks.
9
+
10
+ ## 2. Triggers & Routing
11
+ The command routes to specialized agents based on the `--focus` flag.
12
+
13
+ | Trigger Scenario | Flag | Target Agent | Goal |
14
+ | :--- | :--- | :--- | :--- |
15
+ | **Performance** | `--focus perf` | `[architect]` | Reduce latency/memory |
16
+ | **Code Quality** | `--focus quality` | `[quality]` | Refactor/Clean Clean |
17
+ | **Security Hardening** | `--focus security` | `[security]` | Patch vulnerabilities |
18
+ | **UX Polish** | `--focus ux` | `[frontend]` | A11y, animations |
19
+
20
+ ## 3. Usage & Arguments
21
+ ```bash
22
+ /soc-improve [target] [flags]
23
+ ```
24
+
25
+ ### Arguments
26
+ - **`[target]`**: File or component to optimize.
27
+
28
+ ### Flags
29
+ - **`--focus [perf|quality|security|ux]`**: **MANDATORY**.
30
+ - **`--metric [target]`**: Optional goal (e.g., `< 100ms`).
31
+
32
+ ## 4. Behavioral Flow (Orchestration)
33
+
34
+ ### Phase 1: Benchmark (The Baseline)
35
+ 1. **Measure**: Analyze current state (LOC, Complexity, or approximate Perf).
36
+ 2. **Identify**: Find bottlenecks or anti-patterns.
37
+
38
+ ### Phase 2: Plan (The Upgrade)
39
+ - Propose specific refactors.
40
+ - Estimate impact (e.g., "Replacing nested loop will reduce O(n^2) to O(n)").
41
+
42
+ ### Phase 3: Execute (The Refactor)
43
+ 1. **Edit**: Apply changes safely.
44
+ 2. **Verify**: Ensure tests still pass (Regression Check).
45
+ 3. **Compare**: Show Before vs After stats.
46
+
47
+ ## 5. Output Guidelines (The Contract)
48
+
49
+ ### Improvement Report
50
+ ```markdown
51
+ ## Improvement: [Target]
52
+
53
+ ### Focus: [Focus Area]
54
+
55
+ ### Changes Applied
56
+ 1. **Refactor**: Extracted `LargeComponent` into 3 sub-components.
57
+ 2. **Performance**: Memoized calculation of expensive value.
58
+
59
+ ### Metrics
60
+ | Metric | Before | After | Delta |
61
+ | :--- | :--- | :--- | :--- |
62
+ | **Complexity** | 15 | 8 | -47% |
63
+ | **Lines** | 200 | 120 | -40% |
64
+
65
+ ### Verification
66
+ ✅ Tests Passed
67
+ ```
68
+
69
+ ## 6. Examples
70
+
71
+ ### A. Performance Tuning
72
+ ```bash
73
+ /soc-improve src/utils/sort.ts --focus perf
74
+ ```
75
+ *Effect:* Replaces bubble sort with quicksort or uses a native method.
76
+
77
+ ### B. Security Hardening
78
+ ```bash
79
+ /soc-improve src/api/user.ts --focus security
80
+ ```
81
+ *Effect:* Adds input validation (Zod) and rate limiting to an existing endpoint.
82
+
83
+ ## 7. Dependencies & Capabilities
84
+
85
+ ### Agents
86
+ - **Architect**: `@[.opencode/agents/architect.md]` - Performance strategy.
87
+ - **Quality**: `@[.opencode/agents/quality.md]` - Code structure.
88
+ - **Security**: `@[.opencode/agents/security.md]` - Hardening.
89
+
90
+ ### Skills
91
+ - **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - Ensuring improvements don't break logic.
92
+
93
+ ### MCP Integration
94
+ - **`context7`**: Checking for modern language features (e.g., utilizing new node.js APIs).
95
+
96
+ ## 8. Boundaries
97
+
98
+ **Will:**
99
+ - Refactor code structure.
100
+ - Optimize algorithms.
101
+ - Add comments/documentation.
102
+
103
+ **Will Not:**
104
+ - **Change Behavior**: The external API/output must remain identical (unless fixing a bug).
105
+ - **Delete Features**: Use `/soc-cleanup` for removal.