agent-bober 0.1.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 (212) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +495 -0
  4. package/agents/bober-evaluator.md +323 -0
  5. package/agents/bober-generator.md +245 -0
  6. package/agents/bober-planner.md +248 -0
  7. package/dist/cli/commands/eval.d.ts +6 -0
  8. package/dist/cli/commands/eval.d.ts.map +1 -0
  9. package/dist/cli/commands/eval.js +129 -0
  10. package/dist/cli/commands/eval.js.map +1 -0
  11. package/dist/cli/commands/init.d.ts +5 -0
  12. package/dist/cli/commands/init.d.ts.map +1 -0
  13. package/dist/cli/commands/init.js +547 -0
  14. package/dist/cli/commands/init.js.map +1 -0
  15. package/dist/cli/commands/plan.d.ts +5 -0
  16. package/dist/cli/commands/plan.d.ts.map +1 -0
  17. package/dist/cli/commands/plan.js +87 -0
  18. package/dist/cli/commands/plan.js.map +1 -0
  19. package/dist/cli/commands/run.d.ts +5 -0
  20. package/dist/cli/commands/run.d.ts.map +1 -0
  21. package/dist/cli/commands/run.js +120 -0
  22. package/dist/cli/commands/run.js.map +1 -0
  23. package/dist/cli/commands/sprint.d.ts +6 -0
  24. package/dist/cli/commands/sprint.d.ts.map +1 -0
  25. package/dist/cli/commands/sprint.js +206 -0
  26. package/dist/cli/commands/sprint.js.map +1 -0
  27. package/dist/cli/index.d.ts +3 -0
  28. package/dist/cli/index.d.ts.map +1 -0
  29. package/dist/cli/index.js +124 -0
  30. package/dist/cli/index.js.map +1 -0
  31. package/dist/config/defaults.d.ts +15 -0
  32. package/dist/config/defaults.d.ts.map +1 -0
  33. package/dist/config/defaults.js +226 -0
  34. package/dist/config/defaults.js.map +1 -0
  35. package/dist/config/index.d.ts +4 -0
  36. package/dist/config/index.d.ts.map +1 -0
  37. package/dist/config/index.js +8 -0
  38. package/dist/config/index.js.map +1 -0
  39. package/dist/config/loader.d.ts +18 -0
  40. package/dist/config/loader.d.ts.map +1 -0
  41. package/dist/config/loader.js +189 -0
  42. package/dist/config/loader.js.map +1 -0
  43. package/dist/config/schema.d.ts +904 -0
  44. package/dist/config/schema.d.ts.map +1 -0
  45. package/dist/config/schema.js +181 -0
  46. package/dist/config/schema.js.map +1 -0
  47. package/dist/contracts/eval-result.d.ts +205 -0
  48. package/dist/contracts/eval-result.d.ts.map +1 -0
  49. package/dist/contracts/eval-result.js +87 -0
  50. package/dist/contracts/eval-result.js.map +1 -0
  51. package/dist/contracts/index.d.ts +4 -0
  52. package/dist/contracts/index.d.ts.map +1 -0
  53. package/dist/contracts/index.js +16 -0
  54. package/dist/contracts/index.js.map +1 -0
  55. package/dist/contracts/spec.d.ts +101 -0
  56. package/dist/contracts/spec.d.ts.map +1 -0
  57. package/dist/contracts/spec.js +51 -0
  58. package/dist/contracts/spec.js.map +1 -0
  59. package/dist/contracts/sprint-contract.d.ts +141 -0
  60. package/dist/contracts/sprint-contract.d.ts.map +1 -0
  61. package/dist/contracts/sprint-contract.js +80 -0
  62. package/dist/contracts/sprint-contract.js.map +1 -0
  63. package/dist/evaluators/builtin/api-check.d.ts +13 -0
  64. package/dist/evaluators/builtin/api-check.d.ts.map +1 -0
  65. package/dist/evaluators/builtin/api-check.js +152 -0
  66. package/dist/evaluators/builtin/api-check.js.map +1 -0
  67. package/dist/evaluators/builtin/build-check.d.ts +17 -0
  68. package/dist/evaluators/builtin/build-check.d.ts.map +1 -0
  69. package/dist/evaluators/builtin/build-check.js +155 -0
  70. package/dist/evaluators/builtin/build-check.js.map +1 -0
  71. package/dist/evaluators/builtin/command-runner.d.ts +26 -0
  72. package/dist/evaluators/builtin/command-runner.d.ts.map +1 -0
  73. package/dist/evaluators/builtin/command-runner.js +114 -0
  74. package/dist/evaluators/builtin/command-runner.js.map +1 -0
  75. package/dist/evaluators/builtin/lint.d.ts +17 -0
  76. package/dist/evaluators/builtin/lint.d.ts.map +1 -0
  77. package/dist/evaluators/builtin/lint.js +264 -0
  78. package/dist/evaluators/builtin/lint.js.map +1 -0
  79. package/dist/evaluators/builtin/playwright.d.ts +16 -0
  80. package/dist/evaluators/builtin/playwright.d.ts.map +1 -0
  81. package/dist/evaluators/builtin/playwright.js +238 -0
  82. package/dist/evaluators/builtin/playwright.js.map +1 -0
  83. package/dist/evaluators/builtin/typescript-check.d.ts +12 -0
  84. package/dist/evaluators/builtin/typescript-check.d.ts.map +1 -0
  85. package/dist/evaluators/builtin/typescript-check.js +155 -0
  86. package/dist/evaluators/builtin/typescript-check.js.map +1 -0
  87. package/dist/evaluators/builtin/unit-test.d.ts +18 -0
  88. package/dist/evaluators/builtin/unit-test.d.ts.map +1 -0
  89. package/dist/evaluators/builtin/unit-test.js +279 -0
  90. package/dist/evaluators/builtin/unit-test.js.map +1 -0
  91. package/dist/evaluators/index.d.ts +11 -0
  92. package/dist/evaluators/index.d.ts.map +1 -0
  93. package/dist/evaluators/index.js +13 -0
  94. package/dist/evaluators/index.js.map +1 -0
  95. package/dist/evaluators/plugin-interface.d.ts +50 -0
  96. package/dist/evaluators/plugin-interface.d.ts.map +1 -0
  97. package/dist/evaluators/plugin-interface.js +2 -0
  98. package/dist/evaluators/plugin-interface.js.map +1 -0
  99. package/dist/evaluators/plugin-loader.d.ts +18 -0
  100. package/dist/evaluators/plugin-loader.d.ts.map +1 -0
  101. package/dist/evaluators/plugin-loader.js +107 -0
  102. package/dist/evaluators/plugin-loader.js.map +1 -0
  103. package/dist/evaluators/registry.d.ts +78 -0
  104. package/dist/evaluators/registry.d.ts.map +1 -0
  105. package/dist/evaluators/registry.js +238 -0
  106. package/dist/evaluators/registry.js.map +1 -0
  107. package/dist/index.d.ts +17 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +22 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/orchestrator/context-handoff.d.ts +543 -0
  112. package/dist/orchestrator/context-handoff.d.ts.map +1 -0
  113. package/dist/orchestrator/context-handoff.js +133 -0
  114. package/dist/orchestrator/context-handoff.js.map +1 -0
  115. package/dist/orchestrator/evaluator-agent.d.ts +15 -0
  116. package/dist/orchestrator/evaluator-agent.d.ts.map +1 -0
  117. package/dist/orchestrator/evaluator-agent.js +233 -0
  118. package/dist/orchestrator/evaluator-agent.js.map +1 -0
  119. package/dist/orchestrator/generator-agent.d.ts +16 -0
  120. package/dist/orchestrator/generator-agent.d.ts.map +1 -0
  121. package/dist/orchestrator/generator-agent.js +147 -0
  122. package/dist/orchestrator/generator-agent.js.map +1 -0
  123. package/dist/orchestrator/pipeline.d.ts +24 -0
  124. package/dist/orchestrator/pipeline.d.ts.map +1 -0
  125. package/dist/orchestrator/pipeline.js +290 -0
  126. package/dist/orchestrator/pipeline.js.map +1 -0
  127. package/dist/orchestrator/planner-agent.d.ts +10 -0
  128. package/dist/orchestrator/planner-agent.d.ts.map +1 -0
  129. package/dist/orchestrator/planner-agent.js +187 -0
  130. package/dist/orchestrator/planner-agent.js.map +1 -0
  131. package/dist/state/helpers.d.ts +5 -0
  132. package/dist/state/helpers.d.ts.map +1 -0
  133. package/dist/state/helpers.js +8 -0
  134. package/dist/state/helpers.js.map +1 -0
  135. package/dist/state/history.d.ts +39 -0
  136. package/dist/state/history.d.ts.map +1 -0
  137. package/dist/state/history.js +162 -0
  138. package/dist/state/history.js.map +1 -0
  139. package/dist/state/index.d.ts +8 -0
  140. package/dist/state/index.d.ts.map +1 -0
  141. package/dist/state/index.js +22 -0
  142. package/dist/state/index.js.map +1 -0
  143. package/dist/state/plan-state.d.ts +21 -0
  144. package/dist/state/plan-state.d.ts.map +1 -0
  145. package/dist/state/plan-state.js +108 -0
  146. package/dist/state/plan-state.js.map +1 -0
  147. package/dist/state/sprint-state.d.ts +20 -0
  148. package/dist/state/sprint-state.d.ts.map +1 -0
  149. package/dist/state/sprint-state.js +98 -0
  150. package/dist/state/sprint-state.js.map +1 -0
  151. package/dist/utils/fs.d.ts +31 -0
  152. package/dist/utils/fs.d.ts.map +1 -0
  153. package/dist/utils/fs.js +67 -0
  154. package/dist/utils/fs.js.map +1 -0
  155. package/dist/utils/git.d.ts +35 -0
  156. package/dist/utils/git.d.ts.map +1 -0
  157. package/dist/utils/git.js +84 -0
  158. package/dist/utils/git.js.map +1 -0
  159. package/dist/utils/index.d.ts +4 -0
  160. package/dist/utils/index.d.ts.map +1 -0
  161. package/dist/utils/index.js +4 -0
  162. package/dist/utils/index.js.map +1 -0
  163. package/dist/utils/logger.d.ts +45 -0
  164. package/dist/utils/logger.d.ts.map +1 -0
  165. package/dist/utils/logger.js +73 -0
  166. package/dist/utils/logger.js.map +1 -0
  167. package/hooks/hooks.json +10 -0
  168. package/package.json +67 -0
  169. package/scripts/detect-stack.sh +287 -0
  170. package/scripts/init-project.sh +206 -0
  171. package/scripts/run-eval.sh +175 -0
  172. package/skills/bober.anchor/SKILL.md +365 -0
  173. package/skills/bober.anchor/references/anchor-guide.md +567 -0
  174. package/skills/bober.brownfield/SKILL.md +422 -0
  175. package/skills/bober.brownfield/references/codebase-analysis.md +304 -0
  176. package/skills/bober.eval/SKILL.md +235 -0
  177. package/skills/bober.eval/references/eval-strategies.md +407 -0
  178. package/skills/bober.eval/references/feedback-format.md +182 -0
  179. package/skills/bober.plan/SKILL.md +244 -0
  180. package/skills/bober.plan/references/clarification-guide.md +124 -0
  181. package/skills/bober.plan/references/spec-schema.md +253 -0
  182. package/skills/bober.react/SKILL.md +330 -0
  183. package/skills/bober.react/references/react-scaffold.md +344 -0
  184. package/skills/bober.run/SKILL.md +303 -0
  185. package/skills/bober.solidity/SKILL.md +416 -0
  186. package/skills/bober.solidity/references/solidity-guide.md +487 -0
  187. package/skills/bober.sprint/SKILL.md +280 -0
  188. package/skills/bober.sprint/references/contract-schema.md +251 -0
  189. package/templates/base/CLAUDE.md +20 -0
  190. package/templates/base/bober.config.json +35 -0
  191. package/templates/brownfield/CLAUDE.md +34 -0
  192. package/templates/brownfield/bober.config.json +37 -0
  193. package/templates/presets/anchor/CLAUDE.md +163 -0
  194. package/templates/presets/anchor/bober.config.json +9 -0
  195. package/templates/presets/api-node/CLAUDE.md +153 -0
  196. package/templates/presets/api-node/bober.config.json +10 -0
  197. package/templates/presets/nextjs/CLAUDE.md +82 -0
  198. package/templates/presets/nextjs/bober.config.json +14 -0
  199. package/templates/presets/python-api/CLAUDE.md +202 -0
  200. package/templates/presets/python-api/bober.config.json +9 -0
  201. package/templates/presets/react-vite/CLAUDE.md +71 -0
  202. package/templates/presets/react-vite/bober.config.json +53 -0
  203. package/templates/presets/react-vite/scaffold/package.json +45 -0
  204. package/templates/presets/react-vite/scaffold/server/index.ts +38 -0
  205. package/templates/presets/react-vite/scaffold/server/tsconfig.json +24 -0
  206. package/templates/presets/react-vite/scaffold/src/App.tsx +37 -0
  207. package/templates/presets/react-vite/scaffold/src/index.html +12 -0
  208. package/templates/presets/react-vite/scaffold/src/main.tsx +12 -0
  209. package/templates/presets/react-vite/scaffold/tsconfig.json +27 -0
  210. package/templates/presets/react-vite/scaffold/vite.config.ts +34 -0
  211. package/templates/presets/solidity/CLAUDE.md +106 -0
  212. package/templates/presets/solidity/bober.config.json +9 -0
@@ -0,0 +1,416 @@
1
+ ---
2
+ name: bober.solidity
3
+ description: "EVM smart contract development workflow. Scaffolds Hardhat or Foundry projects, plans contract architecture, implements with security best practices, and evaluates with compilation, linting, and test coverage. Use when building Solidity smart contracts, DeFi protocols, NFT projects, or DAOs."
4
+ argument-hint: <contract-description>
5
+ ---
6
+
7
+ # bober.solidity — EVM Smart Contract Workflow
8
+
9
+ You are running the **bober.solidity** skill. This is a specialized workflow for building Solidity smart contracts targeting the Ethereum Virtual Machine (EVM). It covers project scaffolding, contract architecture planning, implementation with security best practices, and evaluation using compilation, linting, testing, and gas analysis.
10
+
11
+ ## When to Use This Skill
12
+
13
+ Use `bober.solidity` when:
14
+ - Building new EVM smart contracts from scratch (greenfield)
15
+ - Adding contracts or features to an existing Hardhat/Foundry project
16
+ - The project involves: Solidity contracts, DeFi protocols, NFT collections, DAOs, token launches, or any EVM-compatible chain deployment
17
+
18
+ For non-Solidity blockchain work (e.g., Solana/Anchor), use `bober.anchor`. For general projects, use `bober.run`.
19
+
20
+ ## Stack Assumptions
21
+
22
+ This skill is optimized for:
23
+ - **Language:** Solidity 0.8.x+
24
+ - **Frameworks:** Hardhat (TypeScript) or Foundry (Rust tooling)
25
+ - **Libraries:** OpenZeppelin Contracts, Solmate, or custom implementations
26
+ - **Testing:** Hardhat tests (Mocha/Chai + ethers.js) or Foundry tests (Solidity-based with forge)
27
+ - **Linting:** solhint
28
+ - **Deployment:** Hardhat Ignition, Foundry scripts, or custom deploy scripts
29
+ - **Verification:** Etherscan/Sourcify verification
30
+
31
+ If the user's stack differs, adapt accordingly. These are defaults, not requirements.
32
+
33
+ ## Step 1: Project Assessment
34
+
35
+ ### Greenfield (New Project)
36
+
37
+ If there is no `hardhat.config.ts`, `hardhat.config.js`, or `foundry.toml` in the project:
38
+
39
+ 1. Ask the user to describe their contract/protocol
40
+ 2. Ask clarifying questions specific to Solidity projects:
41
+
42
+ ```
43
+ **Q1: Development Framework**
44
+ A) Hardhat (TypeScript, most popular, large plugin ecosystem)
45
+ B) Foundry (Rust tooling, Solidity-native tests, faster compilation)
46
+ C) Both (Hardhat for deployment/scripts, Foundry for testing)
47
+
48
+ **Q2: Contract Type**
49
+ A) Token (ERC-20, ERC-721, ERC-1155)
50
+ B) DeFi protocol (AMM, lending, staking, vault)
51
+ C) Governance (Governor, Timelock, multisig)
52
+ D) Custom application logic
53
+ E) Upgradeable contracts (proxy pattern)
54
+
55
+ **Q3: Security Libraries**
56
+ A) OpenZeppelin Contracts (battle-tested, most audited)
57
+ B) Solmate (gas-optimized, minimal)
58
+ C) Custom implementations (for advanced use cases)
59
+ D) Mix of the above
60
+
61
+ **Q4: Target Chain**
62
+ A) Ethereum mainnet
63
+ B) L2 (Optimism, Arbitrum, Base, zkSync)
64
+ C) EVM-compatible L1 (Polygon, Avalanche, BSC)
65
+ D) Multi-chain deployment
66
+ E) Testnet only for now
67
+
68
+ **Q5: Upgradeability**
69
+ A) Immutable contracts (simpler, more trustless)
70
+ B) Transparent Proxy (OpenZeppelin)
71
+ C) UUPS Proxy (OpenZeppelin)
72
+ D) Diamond/EIP-2535 (multi-facet proxy)
73
+ E) Not sure yet
74
+ ```
75
+
76
+ 3. After answers, scaffold the project using the appropriate framework
77
+
78
+ ### Brownfield (Existing Solidity Project)
79
+
80
+ If `hardhat.config.ts`, `hardhat.config.js`, or `foundry.toml` exists:
81
+
82
+ 1. Analyze the existing setup:
83
+ - Read the framework config file
84
+ - Check `package.json` (Hardhat) or `foundry.toml` (Foundry) for dependencies
85
+ - Read `contracts/` or `src/` directory for existing contracts
86
+ - Check for OpenZeppelin imports, Solmate imports, or custom base contracts
87
+ - Check for existing tests in `test/` or `test/` directories
88
+ - Check for deployment scripts in `scripts/`, `deploy/`, or `script/`
89
+ - Read any existing `.sol` interfaces for contract architecture
90
+
91
+ 2. Survey the contract architecture:
92
+ - Map contract inheritance hierarchies
93
+ - Identify access control patterns (Ownable, AccessControl, custom)
94
+ - Check for proxy/upgrade patterns
95
+ - List external contract integrations (oracles, DEXs, lending protocols)
96
+
97
+ 3. Skip scaffolding -- proceed directly to planning
98
+
99
+ ## Step 2: Initialize Configuration
100
+
101
+ Create or update `bober.config.json` with Solidity-optimized defaults:
102
+
103
+ ```json
104
+ {
105
+ "project": {
106
+ "name": "<project-name>",
107
+ "mode": "greenfield",
108
+ "preset": "solidity",
109
+ "description": "<user's contract description>"
110
+ },
111
+ "planner": {
112
+ "maxClarifications": 5,
113
+ "model": "opus",
114
+ "contextFiles": [
115
+ "hardhat.config.ts",
116
+ "foundry.toml",
117
+ "contracts/",
118
+ "src/"
119
+ ]
120
+ },
121
+ "generator": {
122
+ "model": "sonnet",
123
+ "maxTurnsPerSprint": 50,
124
+ "autoCommit": true,
125
+ "branchPattern": "bober/{feature-name}"
126
+ },
127
+ "evaluator": {
128
+ "model": "sonnet",
129
+ "strategies": [
130
+ { "type": "build", "required": true },
131
+ { "type": "lint", "required": true },
132
+ { "type": "unit-test", "required": true }
133
+ ],
134
+ "maxIterations": 3
135
+ },
136
+ "sprint": {
137
+ "maxSprints": 10,
138
+ "requireContracts": true,
139
+ "sprintSize": "medium"
140
+ },
141
+ "pipeline": {
142
+ "maxIterations": 20,
143
+ "requireApproval": false,
144
+ "contextReset": "always"
145
+ },
146
+ "commands": {
147
+ "install": "npm install",
148
+ "build": "npx hardhat compile",
149
+ "test": "npx hardhat test",
150
+ "lint": "npx solhint 'contracts/**/*.sol'",
151
+ "dev": ""
152
+ }
153
+ }
154
+ ```
155
+
156
+ For Foundry projects, adjust commands:
157
+ ```json
158
+ {
159
+ "commands": {
160
+ "install": "forge install",
161
+ "build": "forge build",
162
+ "test": "forge test -vvv",
163
+ "lint": "npx solhint 'src/**/*.sol'",
164
+ "dev": ""
165
+ }
166
+ }
167
+ ```
168
+
169
+ Adjust based on what actually exists in the project.
170
+
171
+ ## Step 3: Scaffold (Greenfield Only)
172
+
173
+ For new projects, create the initial project structure.
174
+
175
+ ### Hardhat Scaffolding
176
+
177
+ ```bash
178
+ npx hardhat init # Select TypeScript project
179
+ npm install --save-dev @openzeppelin/contracts solhint
180
+ npm install --save-dev @nomicfoundation/hardhat-toolbox
181
+ ```
182
+
183
+ Create project structure:
184
+ ```
185
+ contracts/
186
+ interfaces/
187
+ libraries/
188
+ mocks/
189
+ test/
190
+ unit/
191
+ integration/
192
+ scripts/
193
+ deploy/
194
+ .solhint.json
195
+ hardhat.config.ts
196
+ ```
197
+
198
+ Create `.solhint.json`:
199
+ ```json
200
+ {
201
+ "extends": "solhint:recommended",
202
+ "rules": {
203
+ "compiler-version": ["error", "^0.8.20"],
204
+ "func-visibility": ["warn", { "ignoreConstructors": true }],
205
+ "not-rely-on-time": "warn",
206
+ "reason-string": ["warn", { "maxLength": 64 }]
207
+ }
208
+ }
209
+ ```
210
+
211
+ ### Foundry Scaffolding
212
+
213
+ ```bash
214
+ forge init . --no-commit
215
+ forge install OpenZeppelin/openzeppelin-contracts
216
+ ```
217
+
218
+ Create project structure:
219
+ ```
220
+ src/
221
+ interfaces/
222
+ libraries/
223
+ test/
224
+ unit/
225
+ integration/
226
+ mocks/
227
+ script/
228
+ foundry.toml
229
+ ```
230
+
231
+ ### Common Setup
232
+
233
+ 1. Configure Solidity compiler version in the framework config
234
+ 2. Set up remappings for imports (Foundry: `remappings.txt`, Hardhat: paths in config)
235
+ 3. Create an initial `.gitignore` with `node_modules/`, `artifacts/`, `cache/`, `out/`, `lib/` (as appropriate)
236
+ 4. Create initial git commit:
237
+ ```bash
238
+ git init
239
+ git add -A
240
+ git commit -m "chore: initial scaffold from bober.solidity"
241
+ ```
242
+ 5. Verify the scaffold compiles:
243
+ ```bash
244
+ npx hardhat compile # or: forge build
245
+ ```
246
+
247
+ ## Step 4: Plan the Feature
248
+
249
+ Run the full planning workflow with Solidity-specific enhancements:
250
+
251
+ ### Contract Architecture Planning
252
+
253
+ When planning a smart contract feature, consider:
254
+
255
+ 1. **State variables:** What data does the contract store? What are the types? Storage layout matters for upgradeable contracts.
256
+ 2. **Functions:** What are the external/public functions? What are the access control requirements for each?
257
+ 3. **Events:** What events should be emitted for off-chain indexing?
258
+ 4. **Errors:** Custom errors (gas-efficient) vs require strings?
259
+ 5. **Modifiers:** What reusable checks are needed?
260
+ 6. **Inheritance:** What base contracts to inherit from (OpenZeppelin, custom)?
261
+ 7. **Interfaces:** Define interfaces first for clean architecture and testing.
262
+ 8. **Upgrade patterns:** If upgradeable, plan storage layout carefully (no storage collisions).
263
+
264
+ ### Solidity-Specific Sprint Ordering
265
+
266
+ For a typical smart contract feature:
267
+
268
+ 1. **Interface and type definitions first:** Define the contract interface (`.sol` interface file), custom errors, events, and structs. This establishes the contract's API before implementation.
269
+ 2. **Core contract logic:** Implement the main contract with state variables, constructor, and core functions. Inherit from base contracts (OpenZeppelin).
270
+ 3. **Access control and modifiers:** Implement role-based access, pausability, and custom modifiers.
271
+ 4. **Integration points:** Cross-contract calls (CPI), oracle integrations, DEX interactions.
272
+ 5. **Testing:** Unit tests for every function, edge case tests, access control tests, gas benchmarks.
273
+ 6. **Deployment and verification:** Deploy scripts, constructor argument encoding, Etherscan verification.
274
+
275
+ ### Solidity-Specific Success Criteria
276
+
277
+ Include these for every contract sprint:
278
+
279
+ - "The contract compiles without errors or warnings using solc"
280
+ - "All functions have correct visibility modifiers (no unintended public functions)"
281
+ - "All state-changing functions emit appropriate events"
282
+ - "Access control is enforced: only authorized roles can call restricted functions"
283
+ - "Custom errors are used instead of require strings for gas efficiency"
284
+ - "All external/public functions have NatSpec documentation (@dev, @param, @return)"
285
+ - "Tests achieve 100% line coverage for new contract code"
286
+ - "No reentrancy vulnerabilities: state changes happen before external calls, or ReentrancyGuard is used"
287
+
288
+ ### Solidity-Specific Evaluator Notes
289
+
290
+ - For compilation criteria, run the configured build command and check for zero errors and zero warnings
291
+ - For linting criteria, run solhint and check for zero errors
292
+ - For test criteria, run the test suite and verify all tests pass with expected coverage
293
+ - For security criteria, check for common vulnerability patterns (see Security Checklist below)
294
+ - For gas criteria, check that gas usage for key functions is within reasonable bounds
295
+
296
+ ## Step 5: Execute the Pipeline
297
+
298
+ Run the full sprint execution loop with Solidity-specific evaluation:
299
+
300
+ ### Solidity-Specific Evaluation Enhancements
301
+
302
+ When evaluating Solidity sprints, the evaluator should additionally check:
303
+
304
+ 1. **Compilation:**
305
+ - Zero compiler errors
306
+ - Zero compiler warnings (treat warnings as errors)
307
+ - Correct Solidity version pragma
308
+
309
+ 2. **Security patterns:**
310
+ - **Reentrancy:** State changes before external calls, or `ReentrancyGuard` used on functions that make external calls
311
+ - **Access control:** No unprotected admin functions, proper role checks
312
+ - **Integer safety:** Solidity 0.8+ has built-in overflow protection, but check for unchecked blocks
313
+ - **Front-running:** Identify functions vulnerable to front-running (approve/transferFrom, DEX swaps)
314
+ - **Oracle manipulation:** If using oracles, check for TWAP vs spot price, staleness checks
315
+ - **Denial of service:** No unbounded loops over user-controlled arrays
316
+ - **Flash loan attacks:** If DeFi, check for single-transaction price manipulation vectors
317
+ - **Signature replay:** If using signatures, check for nonce/deadline/chainId protection
318
+
319
+ 3. **Gas optimization:**
320
+ - Use `uint256` instead of smaller types when storage packing is not achieved
321
+ - Use `calldata` instead of `memory` for read-only function parameters
322
+ - Pack storage variables (variables less than 32 bytes adjacent in storage)
323
+ - Use custom errors instead of require strings
324
+ - Mark functions as `view`/`pure` where applicable
325
+ - Avoid redundant SLOAD operations (cache storage reads in memory)
326
+
327
+ 4. **Code quality:**
328
+ - NatSpec documentation on all external/public functions
329
+ - Consistent naming: `_internalFunctions`, `CONSTANTS`, `storageVariables`
330
+ - Events emitted for all state changes
331
+ - Interface defined for cross-contract interactions
332
+ - Proper use of `immutable` and `constant` keywords
333
+
334
+ 5. **Test quality:**
335
+ - Unit tests for every external/public function
336
+ - Tests for access control (verify unauthorized calls revert)
337
+ - Tests for edge cases (zero values, max values, empty arrays)
338
+ - Tests for event emissions
339
+ - Fuzz tests for arithmetic-heavy functions (Foundry)
340
+
341
+ ## Step 6: Post-Pipeline Verification
342
+
343
+ After all sprints pass, run a final comprehensive check:
344
+
345
+ 1. **Full compilation:**
346
+ ```bash
347
+ npx hardhat compile # or: forge build
348
+ ```
349
+
350
+ 2. **Full test suite with coverage:**
351
+ ```bash
352
+ npx hardhat coverage # or: forge coverage
353
+ ```
354
+
355
+ 3. **Linting:**
356
+ ```bash
357
+ npx solhint 'contracts/**/*.sol' # or: npx solhint 'src/**/*.sol'
358
+ ```
359
+
360
+ 4. **Gas report:**
361
+ ```bash
362
+ REPORT_GAS=true npx hardhat test # or: forge test --gas-report
363
+ ```
364
+
365
+ 5. **Report to user:**
366
+ ```
367
+ ## Smart Contracts Complete
368
+
369
+ Your contracts are ready for review.
370
+
371
+ ### How to Build & Test
372
+ npx hardhat compile # Compile contracts
373
+ npx hardhat test # Run tests
374
+ npx hardhat coverage # Coverage report
375
+
376
+ ### What Was Built
377
+ <Summary of contracts implemented>
378
+
379
+ ### Contract Architecture
380
+ <Inheritance diagram, key contracts and their roles>
381
+
382
+ ### Security Notes
383
+ <Key security decisions made, patterns applied>
384
+
385
+ ### Deployment
386
+ <Instructions for deploying to testnet/mainnet>
387
+
388
+ ### Next Steps
389
+ - Review the contracts on branch: bober/<feature-slug>
390
+ - Run a professional audit before mainnet deployment
391
+ - Deploy to testnet first: npx hardhat run scripts/deploy.ts --network sepolia
392
+ - Verify on Etherscan after deployment
393
+ ```
394
+
395
+ ## Security Checklist
396
+
397
+ The evaluator MUST check for these common vulnerability patterns:
398
+
399
+ 1. **Reentrancy:** External calls made before state updates. Mitigate with checks-effects-interactions pattern or `ReentrancyGuard`.
400
+ 2. **Front-running:** Transactions that can be profitably front-run (approve, swaps). Mitigate with commit-reveal, deadlines, or slippage protection.
401
+ 3. **Oracle manipulation:** Single-block price reads. Mitigate with TWAP, multiple oracle sources, or circuit breakers.
402
+ 4. **Integer overflow/underflow:** Unchecked arithmetic blocks. Mitigate by avoiding `unchecked` unless gas-critical and mathematically proven safe.
403
+ 5. **Access control:** Missing or incorrect role checks. Mitigate with OpenZeppelin AccessControl or Ownable.
404
+ 6. **Denial of service:** Unbounded loops, block gas limit issues. Mitigate with pagination, pull-over-push patterns.
405
+ 7. **Signature replay:** Missing nonce, deadline, or chain ID in signed messages. Mitigate with EIP-712 typed data.
406
+ 8. **Centralization risks:** Single admin key controlling critical functions. Mitigate with multisig, timelock, or governance.
407
+ 9. **Storage collisions:** In upgradeable contracts, storage layout changes between versions. Mitigate with storage gaps, ERC-7201 namespaced storage.
408
+ 10. **Unchecked return values:** Not checking return values of `transfer`, `approve`, or low-level calls. Mitigate with SafeERC20 or explicit checks.
409
+
410
+ ## Error Handling
411
+
412
+ - **Compilation failures:** Read the compiler output carefully. Common issues: import path errors, version mismatches, missing dependencies. Run `forge install` or `npm install` first.
413
+ - **Test failures in Hardhat:** Check that the local Hardhat node is not already running on the same port. Check that test fixtures deploy contracts correctly.
414
+ - **Test failures in Foundry:** Check that `setUp()` deploys all required contracts. Check that fork tests have the correct RPC URL configured.
415
+ - **Solhint errors:** If solhint is not installed, install it as a dev dependency. If rules are too strict, adjust `.solhint.json` but document the reason.
416
+ - **Gas report issues:** If gas reports show unexpectedly high usage, flag specific functions for optimization in a follow-up sprint.