Skip to content

feat(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access#462

Open
wkoutre wants to merge 3 commits intonextfrom
improve/tune-code-generator
Open

feat(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access#462
wkoutre wants to merge 3 commits intonextfrom
improve/tune-code-generator

Conversation

@wkoutre
Copy link
Copy Markdown
Contributor

@wkoutre wkoutre commented Apr 14, 2026

Summary

  • Add Edit and Glob to tools — the agent was limited to Read, 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.
  • Remove 600+ lines of inline code examples — TypeScript, Python, Go, React, and Express patterns were embedded as code blocks. These are training-data content the model already knows; they inflated the per-invocation token cost without adding behavioral value. Replaced with concise behavioral principles.
  • Remove misleading TypeScript I/O interfaces — the CodeGenerationRequest / GeneratedCode interfaces implied agents receive structured JSON input. They don't — orchestrators send natural-language task descriptions. These interfaces were confusing and unused.
  • Sharpen the description — differentiate this agent from refactorer-agent and test-writer-agent so the orchestrator picks the right specialist. Added concrete trigger verbs: "features, modules, API routes, React components, utilities".
  • Add self-review checklist and structured output section — gives the agent explicit quality gates before reporting completion.

Test plan

  • Plugin validation passes: npx nx run development-codebase-tools:validate
  • Markdownlint: 0 errors ✅
  • Pre-commit hooks: format, lint, markdown, tests all green ✅
AI-Generated Description

Summary

  • Expand tool list with Edit and Glob — the agent was limited to Read, 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.
  • Remove 600+ lines of inline code examples — TypeScript, Python, Go, React, and Express patterns were embedded as code blocks. These are training-data content the model already knows; they inflated per-invocation token cost without adding behavioral value. Replaced with concise behavioral principles.
  • Remove misleading TypeScript I/O interfaces — the CodeGenerationRequest / GeneratedCode interfaces implied agents receive structured JSON input. They don't — orchestrators send natural-language task descriptions. These interfaces were confusing and unused.
  • Sharpen the description — differentiate this agent from refactorer-agent and test-writer-agent so the orchestrator picks the right specialist. Added concrete trigger verbs: "features, modules, API routes, React components, utilities".
  • Add self-review checklist and structured output section — gives the agent explicit quality gates before reporting completion.

Changes

File Change
packages/plugins/development-codebase-tools/agents/code-generator.md Rewrite agent prompt: expand tool list (Edit, 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 section
packages/plugins/development-codebase-tools/.claude-plugin/plugin.json Bump version 2.1.1 → 2.2.0 (minor: new tool capabilities)
CLAUDE.md Update development-codebase-tools version in plugin version table (2.1.1 → 2.2.0)

Why 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 (Edit for modifying existing files, Glob for path discovery), and clearly scopes the agent's responsibility relative to refactorer-agent and test-writer-agent so the orchestrator routes tasks correctly.

Test plan

  • Plugin validation passes: npx nx run development-codebase-tools:validate
  • Markdownlint: 0 errors
  • Pre-commit hooks: format, lint, markdown, tests all green

- 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
@wkoutre wkoutre requested a review from a team as a code owner April 14, 2026 16:04
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-toolkit-slack-oauth-backend Ready Ready Preview, Comment Apr 15, 2026 8:08pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

🤖 Claude Code Review

Review complete

Review Summary

This PR rewrites the code-generator-agent prompt from ~674 lines of verbose example-heavy documentation down to ~76 lines of concise, actionable guidance. It also adds Edit and Glob tools to the agent's toolset and clarifies scope boundaries with other agents.

Changes Reviewed

  1. code-generator.md: Complete rewrite — removes extensive code examples (TypeScript, Python, Go, React, Express patterns) and replaces them with a focused workflow + quality principles format. The new prompt is significantly more effective as agent instructions.
  2. plugin.json: Version bump 2.1.1 → 2.2.0 (appropriate minor bump for enhanced capabilities).
  3. CLAUDE.md: Version table updated to match.

Assessment

The rewrite is a clear improvement:

  • Actionable workflow (discover → match → generate → self-review) replaces passive reference material
  • Scope boundaries are explicit, routing to refactorer-agent, test-writer-agent, etc.
  • Tool additions (Edit, Glob) align with the workflow — step 1 needs Glob for discovery, step 3 needs Edit for wiring into existing files
  • Quality principles are distilled to concrete rules rather than code samples the agent would rarely use verbatim
  • The description update ("and wiring it into existing callers") resolves the earlier feedback about the apparent tension between "net-new only" scope and using Edit

No bugs, security issues, or data corruption risks identified.


💡 Want a fresh review? Add a comment containing @request-claude-review to trigger a new review at any time.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

📚 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 Check

Changes Analyzed

  • CLAUDE.md (root): Version table updated 2.1.1 → 2.2.0 ✅
  • packages/plugins/development-codebase-tools/.claude-plugin/plugin.json: Version bumped 2.1.1 → 2.2.0 ✅
  • packages/plugins/development-codebase-tools/agents/code-generator.md: Agent prompt significantly refactored (674 → 76 lines)

Findings

Version 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 code-generator-agent description still reflects the old framing. The new agent prompt has a much more specific scope (features, modules, API routes, React components, utilities) and explicit boundaries (redirect to refactorer-agent, test-writer-agent, etc.). Minor update suggested.

README.md: The code-generator-agent description in the agents table could be updated to reflect the new, more precise scope. Minor update suggested. Also note: mermaid-diagram skill is missing from the README Skills table (pre-existing gap, not introduced by this PR).

Suggestions (2)

💡 Inline suggestions have been posted as review comments. Click "Commit suggestion" to apply each fix directly.

  • ℹ️ packages/plugins/development-codebase-tools/README.md: The agent's description was significantly updated in this PR to clarify scope boundaries. The README should reflect the new, more precise description.
  • ℹ️ packages/plugins/development-codebase-tools/CLAUDE.md: The agent prompt was refactored to add explicit scope boundaries. The CLAUDE.md agent description should reflect the updated purpose and delegation rules.

🤖 Generated by Claude Documentation Validator | Mode: suggest

github-actions[bot]
github-actions bot previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@wkoutre wkoutre changed the title improve(development-codebase-tools): tune code-generator-agent prompt feat(development-codebase-tools): tune code-generator-agent prompt Apr 14, 2026
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
@github-actions github-actions bot changed the title feat(development-codebase-tools): tune code-generator-agent prompt improve(development-codebase-tools): tune code-generator-agent prompt Apr 14, 2026
@github-actions github-actions bot dismissed their stale review April 14, 2026 16:21

Superseded by new review after PR update

github-actions[bot]
github-actions bot previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 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).
@github-actions github-actions bot changed the title improve(development-codebase-tools): tune code-generator-agent prompt improve(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access Apr 15, 2026
@github-actions github-actions bot dismissed their stale review April 15, 2026 20:09

Superseded by new review after PR update

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 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.

@wkoutre wkoutre changed the title improve(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access feat(development-codebase-tools): rewrite code-generator-agent prompt and expand tool access Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant