feat(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access#462
feat(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access#462
Conversation
- Add Edit and Glob to tools (was: Read, Write, Grep only) so the agent can edit existing files and discover paths before writing - Remove 600+ lines of inline code examples (TypeScript/Python/Go/React) that bloated the prompt with training-data content; replace with concise behavioral principles - Remove misleading TypeScript I/O interfaces that implied structured JSON input; agents receive natural-language task descriptions - Sharpen description to distinguish this agent from refactorer-agent and test-writer-agent for better orchestrator selection - Add explicit self-review checklist and structured output section
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🤖 Claude Code Review
Review SummaryThis PR rewrites the Changes Reviewed
AssessmentThe rewrite is a clear improvement:
No bugs, security issues, or data corruption risks identified. 💡 Want a fresh review? Add a comment containing |
📚 Documentation Check ✅Verdict: Passed Plugin version was correctly bumped from 2.1.1 to 2.2.0 in plugin.json, and the root CLAUDE.md version table was updated accordingly. No blocking issues found. PR #462 Documentation CheckChanges Analyzed
FindingsVersion Bump: Required and done correctly. The plugin was modified and the version was bumped to 2.2.0 (minor bump, appropriate for a non-breaking improvement). Root CLAUDE.md: Updated to reflect new version ✅ Package CLAUDE.md: The README.md: The Suggestions (2)
🤖 Generated by Claude Documentation Validator | Mode: |
There was a problem hiding this comment.
📋 Review verdict: APPROVE
👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.
This formal review submission is for the verdict only. 1 inline comment(s) are attached below.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27859378de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| name: code-generator-agent | ||
| description: Comprehensive code generation specialist that creates production-ready code following best practices and existing patterns | ||
| tools: Read, Write, Grep | ||
| description: Generates new production-ready implementation code for features, modules, API routes, React components, and utilities — following existing codebase patterns. Use for net-new code; for changing existing code use refactorer-agent; for tests use test-writer-agent. |
There was a problem hiding this comment.
Relax net-new-only scope for code-generator-agent
The new description says this agent should only handle “net-new code” and pushes any existing-file changes to refactorer-agent, but the same prompt later requires editing existing files for integration (Edit in step 3). In practice, most feature tasks need both new files and changes to existing modules (exports, routing, wiring), so this scope restriction can misroute or block normal implementation work and regress code-generation workflows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch on the apparent tension. The description is intentionally guiding routing decisions (i.e., "reach for code-generator-agent when the primary goal is net-new code"), not a hard capability restriction. Step 3 uses Edit for wiring-in purposes — connecting a new module to existing callers — which is inherently part of implementing any new feature. The refactorer-agent distinction is for tasks where the primary goal is restructuring or modifying existing logic rather than generating new code. The description could be clearer; a future pass could add "and wires it into existing callers" to the scope line.
There was a problem hiding this comment.
The author's clarification makes sense — the description guides routing ("reach for code-generator-agent when the primary goal is net-new code") while step 3 explicitly uses Edit for integration wiring, which is a natural part of implementing new features. The distinction between "primary goal is new code" vs "primary goal is restructuring existing code" is clear enough in practice. The suggestion to add "and wires it into existing callers" to the scope line would be a nice future clarification but isn't blocking.
There was a problem hiding this comment.
Good catch. Updated the description to read: "Use when the primary goal is net-new code (and wiring it into existing callers); for restructuring or modifying existing logic use refactorer-agent; for tests use test-writer-agent."
This makes the routing intent explicit and removes the apparent contradiction with step 3's use of Edit for integration wiring.
There was a problem hiding this comment.
The description has been updated to explicitly include "(and wiring it into existing callers)", which resolves the ambiguity. The scope line now clearly communicates that code-generator-agent handles both net-new code and the integration wiring that naturally accompanies it, while refactorer-agent is for restructuring existing logic. This matches the workflow's use of Edit in step 3.
New tools (Edit, Glob) were added to code-generator-agent — minor version bump per project semver guidelines. Update version table in CLAUDE.md to match. PR: #462
Superseded by new review after PR update
There was a problem hiding this comment.
📋 Review verdict: APPROVE
👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.
This formal review submission is for the verdict only.
…pe in description The description previously said "for changing existing code use refactorer-agent" which contradicted step 3 using Edit for integration wiring. Clarify that this agent handles net-new code *and* wires it into existing callers, while refactorer- agent is for restructuring or modifying existing logic (different primary goal). Resolves reviewer feedback from wkoutre (PR #462).
Superseded by new review after PR update
There was a problem hiding this comment.
📋 Review verdict: APPROVE
👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.
This formal review submission is for the verdict only.
Summary
EditandGlobto tools — the agent was limited toRead, Write, Grep, meaning it couldn't edit existing files or discover paths. This caused integration failures when generating code that needed to be inserted into existing modules.CodeGenerationRequest/GeneratedCodeinterfaces implied agents receive structured JSON input. They don't — orchestrators send natural-language task descriptions. These interfaces were confusing and unused.refactorer-agentandtest-writer-agentso the orchestrator picks the right specialist. Added concrete trigger verbs: "features, modules, API routes, React components, utilities".Test plan
npx nx run development-codebase-tools:validate✅AI-Generated Description
Summary
EditandGlob— the agent was limited toRead, Write, Grep, meaning it couldn't edit existing files or discover paths by pattern. This caused failures when generating code that needed to be inserted into existing modules.CodeGenerationRequest/GeneratedCodeinterfaces implied agents receive structured JSON input. They don't — orchestrators send natural-language task descriptions. These interfaces were confusing and unused.refactorer-agentandtest-writer-agentso the orchestrator picks the right specialist. Added concrete trigger verbs: "features, modules, API routes, React components, utilities".Changes
packages/plugins/development-codebase-tools/agents/code-generator.mdEdit,Glob), replace 600+ lines of inline code examples with concise behavioral principles, remove unused TypeScript I/O interfaces, add scope boundaries, self-review checklist, and structured output sectionpackages/plugins/development-codebase-tools/.claude-plugin/plugin.jsonCLAUDE.mdWhy this approach
The original prompt was 674 lines — mostly code examples the model already knows from training data. This bloated every invocation's token budget without measurably improving output quality. The rewrite compresses the prompt to ~76 lines of actionable behavioral instructions, adds missing tools (
Editfor modifying existing files,Globfor path discovery), and clearly scopes the agent's responsibility relative torefactorer-agentandtest-writer-agentso the orchestrator routes tasks correctly.Test plan
npx nx run development-codebase-tools:validate