@zcy2nn/agent-forge 1.1.4 → 1.1.5

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.
@@ -1,138 +0,0 @@
1
- ---
2
- name: simplify
3
- description: Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.
4
- ---
5
-
6
- # Code Simplification
7
-
8
- ## Overview
9
-
10
- Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines — it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
11
-
12
- ## When to Use
13
-
14
- - After a feature is working and tests pass, but the implementation feels heavier than it needs to be
15
- - During code review when readability or complexity issues are flagged
16
- - When you encounter deeply nested logic, long functions, or unclear names
17
- - When refactoring code written under time pressure
18
- - When consolidating related logic scattered across files
19
- - After merging changes that introduced duplication or inconsistency
20
-
21
- **When NOT to use:**
22
-
23
- - Code is already clean and readable — don't simplify for the sake of it
24
- - You don't understand what the code does yet — comprehend before you simplify
25
- - The code is performance-critical and the "simpler" version would be measurably slower
26
- - You're about to rewrite the module entirely — simplifying throwaway code wastes effort
27
-
28
- ## The Five Principles
29
-
30
- ### 1. Preserve Behavior Exactly
31
-
32
- Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
33
-
34
- Before every change, ask:
35
-
36
- - Does this produce the same output for every input?
37
- - Does this maintain the same error behavior?
38
- - Does this preserve the same side effects and ordering?
39
- - Do all existing tests still pass without modification?
40
-
41
- ### 2. Follow Project Conventions
42
-
43
- Simplification means making code more consistent with the codebase, not imposing external preferences.
44
-
45
- Before simplifying:
46
-
47
- 1. Read `AGENTS.md` / project conventions
48
- 2. Study how neighboring code handles similar patterns
49
- 3. Match the project's style for imports, naming, function style, error handling, and type annotations
50
-
51
- Simplification that breaks project consistency is not simplification — it's churn.
52
-
53
- ### 3. Prefer Clarity Over Cleverness
54
-
55
- Explicit code is better than compact code when the compact version requires a mental pause to parse.
56
-
57
- - Replace nested ternaries with readable control flow
58
- - Replace dense inline transforms with named intermediate steps when they clarify intent
59
- - Keep helpful names even if they cost a few extra lines
60
-
61
- ### 4. Maintain Balance
62
-
63
- Watch for over-simplification:
64
-
65
- - Don't inline away names that carry meaning
66
- - Don't merge unrelated logic into one larger function
67
- - Don't remove abstractions that serve testability or extensibility
68
- - Don't optimize for line count over comprehension
69
-
70
- ### 5. Scope to What Changed
71
-
72
- Default to simplifying recently modified code. Avoid unrelated drive-by refactors unless explicitly asked.
73
-
74
- ## Process
75
-
76
- ### Step 1: Understand Before Touching
77
-
78
- Before changing or removing anything, understand why it exists.
79
-
80
- Answer:
81
-
82
- - What is this code's responsibility?
83
- - What calls it? What does it call?
84
- - What are the edge cases and error paths?
85
- - Are there tests that define expected behavior?
86
- - Why might it have been written this way?
87
-
88
- If you can't answer these, read more context first.
89
-
90
- ### Step 2: Look for Simplification Opportunities
91
-
92
- Signals:
93
-
94
- - Deep nesting
95
- - Long functions with mixed responsibilities
96
- - Nested ternaries
97
- - Boolean flag arguments
98
- - Repeated conditionals
99
- - Generic or misleading names
100
- - Duplicated logic
101
- - Dead code
102
- - Wrappers or abstractions that add no value
103
-
104
- ### Step 3: Apply Changes Incrementally
105
-
106
- Make one simplification at a time.
107
-
108
- For each simplification:
109
-
110
- 1. Make the change
111
- 2. Run relevant tests
112
- 3. Keep it only if behavior is preserved
113
-
114
- Separate refactoring from feature work whenever possible.
115
-
116
- ### Step 4: Verify the Result
117
-
118
- After simplifying, confirm:
119
-
120
- - The code is genuinely easier to understand
121
- - The diff is clean and reviewable
122
- - Project conventions still match
123
- - No behavior, error handling, or side effects changed
124
-
125
- ## Guidance for This Repository
126
-
127
- - Prefer straightforward TypeScript over clever compression
128
- - Preserve existing runtime behavior, tests, and hooks
129
- - Favor explicit names and smaller focused helpers when they improve readability
130
- - Keep refactors tightly scoped to the task or review feedback
131
-
132
- ## Verification Checklist
133
-
134
- - [ ] Existing tests pass without modification
135
- - [ ] Build/typecheck/lint still pass
136
- - [ ] No unrelated files were refactored
137
- - [ ] No error handling was weakened or removed
138
- - [ ] The result is simpler to review than the original
@@ -1,36 +0,0 @@
1
- # src/skills/simplify/
2
-
3
- ## Responsibility
4
-
5
- - Provide a behavior-preserving refactoring skill contract that constrains code cleanup to clarity-focused,
6
- low-risk changes.
7
- - Define explicit quality gates (understand-before-edit, behavior parity, incremental simplification, rollback-friendly diffs)
8
- for any simplification task.
9
- - Ship only metadata; no local runtime state machine is kept in this directory.
10
-
11
- ## Design
12
-
13
- - Contract layer: `SKILL.md` is the executable prompt specification with explicit phases:
14
- - pre-change understanding
15
- - simplification candidate selection
16
- - incremental transformation and verification
17
- - final review checklist.
18
- - Documentation layer: `README.md` explains intent, source provenance, and plugin install behavior.
19
- - Policy model is declarative (`description`, allowed usage, checklist) consumed by the OpenCode skill executor,
20
- without helper scripts or plugin code dependencies.
21
-
22
- ## Flow
23
-
24
- - Agent discovery resolves `src/skills/simplify` as a custom skill entrypoint, then reads `SKILL.md` at runtime.
25
- - Runtime behavior is gated by `src/cli/custom-skills.ts` (`allowedAgents: ['reviewer']`) and by skill permissions
26
- computed in `getSkillPermissionsForAgent()`.
27
- - In practice the workflow is read-only and context-driven: simplify instructions require understanding of callers,
28
- edge cases, and tests before mutation, then apply local, scoped refactors with validation.
29
- - Consumers (Implementer/Reviewer tasks) rely on this contract as operational constraints, not as executable TypeScript.
30
-
31
- ## Integration
32
-
33
- - Installed by plugin installer (`installCustomSkills`) using `src/cli/install.ts` via `installCustomSkill()`.
34
- - Permission surface is enforced by hook layer in `src/hooks/filter-available-skills/index.ts` (`permissionRules`).
35
- - Release integrity: `scripts/verify-release-artifact.ts` checks for `src/skills/simplify/SKILL.md` in package tarballs.
36
- - Operationally paired with codemap/implementer flows in `src/index.ts` orchestrations for post-feature readability hardening.