feat: search community extensions before creating custom models#777
feat: search community extensions before creating custom models#777
Conversation
Agents now see "search before you build" as Rule #1 in every swamp-managed CLAUDE.md, prompting them to check local types and community extensions before creating custom models. Previously this guidance only appeared in the swamp-extension-model skill, which agents loaded too late — after already deciding to build from scratch. Closes #757 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> fix: use correct command `swamp extension pull` instead of `resolve` Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
61c6bcb to
3d3c08e
Compare
There was a problem hiding this comment.
Review: Approved ✅
This PR cleanly implements the "search before you build" guidance with consistent updates across documentation, skills, and code.
What I Verified
Code Quality
- No
anytypes, TypeScript strict mode compliance - Template string change in
repo_service.tsis minimal and correct - Test follows existing patterns exactly (mirrors the skills section test at line 409)
CLAUDE.md Compliance
- Unit test lives next to source file ✓
- Named exports pattern ✓
DDD Principles
RepoServiceremains a well-structured Domain Service- No domain model changes - purely documentation/template updates
Test Coverage
- New test covers 3 key assertions for the extension search guidance
- Tests the generated CLAUDE.md content, not implementation details
Consistency
CLAUDE.mdandrepo_service.tstemplate are in sync- Skill updates are consistent across
swamp-modelandswamp-extension-model
No Blocking Issues
The changes are well-scoped, properly tested, and improve agent behavior by surfacing the search-first guidance earlier in Rule #1.
There was a problem hiding this comment.
Adversarial Review
Critical / High
None found.
Medium
None found.
Low
None found.
Analysis Summary
This PR consists of:
- Documentation changes (scenarios.md, SKILL.md, CLAUDE.md): Pure Markdown content additions/modifications
- Template string update (repo_service.ts:570): Changes Rule #1 text in
generateInstructionsBody()from "Extension models for service integrations" to "Search before you build" with expanded guidance - Test addition (repo_service_test.ts:426-440): Verifies the new template content
Security: No code injection vectors. The template string is static text that gets written to CLAUDE.md - it describes workflow guidance, not executable commands.
Logic: No branching logic, loops, or conditional paths affected. The change is a string literal substitution.
Error handling: Not applicable - no error paths in the changed code.
Edge cases: Template generation is deterministic. The test verifies substring presence which matches the pattern of existing tests.
API contracts: The public interface of RepoService.init() and RepoService.upgrade() is unchanged. Only the content of the generated CLAUDE.md changes.
Concurrency: Not applicable - no shared state or async coordination affected.
I verified the test assertions match the actual template content:
"extension search"✓ present in template"Search before you build"✓ present in template"swamp model type search"✓ present in template
Verdict
PASS - This is a low-risk documentation change with an appropriate test. No logic errors, security issues, or edge cases identified.
feat: search community extensions before creating custom models
Summary
swamp extension pull) → install if found → only then create customswamp-modelskill workflowswamp-extension-modelskill showing the happy path where a community extension existsUser Impact
Previously, agents only saw guidance to "create an extension model" in the CLAUDE.md Rules section. The
swamp-extension-modelskill documented the search-first flow, but agents only loaded that skill after deciding to create a model — too late. Now agents see the search-first guidance immediately in Rule #1, prompting them to runswamp extension searchbefore building anything custom.Test Plan
RepoService.init generates CLAUDE.md with extension search guidance— asserts generated CLAUDE.md containsextension search,Search before you build, andswamp model type searchdeno check,deno lint,deno fmtall passdeno run compile— binary recompiledswamp model type search "ec2"followed byswamp extension search "ec2 instance"before attempting to create anything, then found a community extension and usedswamp extension pullto install itCloses #757
🤖 Generated with Claude Code