agent/pkg/lib/task/code/simplifier/patterns.md
Snider 53482cb0c8 feat: workspace templates via Extract — Gosod pattern for agent dispatch
- Move pkg/prompts/lib → pkg/lib (prompt, task, flow, persona, workspace)
- New lib.go: unified package with ExtractWorkspace() using text/template
- Workspace templates: default, security, review — .tmpl files with data injection
- prep.go: uses lib.ExtractWorkspace() + detect helpers for language/build/test
- prompts.go: thin re-export wrapper for backwards compat

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-18 14:03:06 +00:00

568 B

Simplification Patterns

Consolidate

  • Three similar blocks → extract helper function
  • Duplicate error handling → shared handler
  • Repeated string → constant

Flatten

  • Nested if/else → early return
  • Deep indentation → guard clauses
  • Long switch → map lookup

Remove

  • Unused variables, imports, functions
  • Wrapper functions that just delegate
  • Dead branches (always true/false conditions)
  • Comments that restate the code

Tighten

  • Long function (>50 lines) → split
  • God struct → focused types
  • Mixed concerns → separate files