Skip to content

feat(dx): agent orchestra for frontend issue-to-PR workflow#34843

Draft
zJaaal wants to merge 16 commits intomainfrom
feat/dx-agent-orchestra
Draft

feat(dx): agent orchestra for frontend issue-to-PR workflow#34843
zJaaal wants to merge 16 commits intomainfrom
feat/dx-agent-orchestra

Conversation

@zJaaal
Copy link
Copy Markdown
Member

@zJaaal zJaaal commented Mar 3, 2026

Summary

This PR introduces an AI agent orchestra for the dotCMS frontend development workflow. It wires together a set of specialized Claude Code subagents, a skill (slash command), and a shell hook to automate the full journey from a GitHub issue to a reviewed, QA-verified draft PR — all from within a Claude Code session.

The system is frontend-only (scoped to core-web/ — Angular, TypeScript, SCSS) and is invoked with a single command: /issue-to-pr <issue-number>.


Files

.claude/skills/issue-to-pr/SKILL.md

A Claude Code skill — the slash command /issue-to-pr. It is the orchestration script for the entire pipeline.

Why it exists: Without this skill, working a GitHub issue from end-to-end requires many manual steps: reading the issue, researching the codebase, designing pseudocode, writing code, reviewing it, running QA, and creating a PR. This skill coordinates specialized subagents to handle each concern in the right order, keeping the developer focused on decisions rather than plumbing.

8-stage pipeline:

Stage 1 — Resolve issue number
  Parse /issue-to-pr argument. Fall back to branch name (issue-NNNNN-*).

Stage 2 — Fetch issue + run parallel agents
  gh issue view → feeds two agents simultaneously:
    • dotcms-issue-validator   → checks completeness (SUFFICIENT / NEEDS_INFO)
    • dotcms-product-analyst   → product research: pseudocode, AC, edge cases, coder brief

Stage 3 — Interactive product Q&A
  Present product analysis. Ask open questions. Gather answers.
  Confirm final Coder Brief before coding begins.

Stage 4 — Create feature branch
  git checkout -b issue-<number>-<slug>  (if not already on one)

Stage 5 — Implementation
  Present Coder Brief + file list. Implement using pseudocode as spec.

Stage 6 — Review changed files
  git diff HEAD → filter core-web/ frontend files
  dotcms-file-classifier → review buckets
  Parallel reviewers: TypeScript / Angular / Tests / SCSS+HTML
  Consolidate by severity: 🔴 Critical → 🟡 Important → 🔵 Quality
  Stage 6d: fix → re-run tests → re-run QA → reply + resolve threads

Stage 7 — QA
  Derive positive / negative / edge-case scenarios from product analysis.
  Ask developer for real test data (host, API key, site ID, content types).
  Execute based on what changed:
    • SDK libraries  → build → npm pack → Node.js qa-test.mjs
    • Angular UI     → dev server + browser inspection
    • Services       → Jest tests + manual API calls
    • SCSS only      → visual screenshot comparison
  Block PR creation on any failure. Re-run after every review fix.

Stage 8 — Create draft PR + move issue
  github-workflow-manager creates draft PR (Closes #N, summary, AC checklist, QA results).
  If PR is not draft → move linked issue to "In Review" on project board.

Review comment protocol (Stage 6d): Reply to each comment before resolving it. End replies with — 🤖 Claude signature so the reviewer knows who responded and can continue the conversation from a clean spot.


.claude/agents/dotcms-product-analyst.md

A Claude Code custom subagent — the "Product Analyst" role in Stage 2.

Why it exists: Generic AI tends to jump to solutions. This agent is constrained to a 5-phase research process: understand the issue → research existing behavior → map acceptance criteria → write pseudocode in real Angular/NgRx patterns → identify edge cases. It only asks questions that are genuinely blocking.

Configuration:

model: sonnet       # Cost-balanced: good reasoning, lower latency than opus
color: purple
allowed-tools: [Grep, Glob, Read]
maxTurns: 20        # Enough for 5-phase research without runaway loops

Research constraints: max 3 Grep/Glob, max 4 Read calls — focused, not exhaustive. Pseudocode must use real patterns from the codebase (actual signal names, store methods, API endpoints). Open Questions must be genuinely blocking — if answerable from code or common sense, answer it directly in the Coder Brief.


.claude/hooks/post-commit-review.sh

A shell script wired as a PostToolUse Claude Code hook. Fires after every Bash tool call.

Why it exists: Developers often commit without remembering to run the appropriate reviewers. This hook passively watches for successful frontend commits and nudges the developer — no pipeline invocation required.

How it works:

  1. Receives Claude Code hook JSON on stdin (tool_input + tool_response)
  2. Extracts bash command and output via Python JSON parsing
  3. Guards: only acts on git commit commands with a successful commit in output ([branch abc1234])
  4. Gets frontend files from last commit via git diff --name-only HEAD~1 HEAD
  5. If no frontend files → exits silently (no noise for backend-only commits)
  6. Builds recommended reviewer list based on file types:
    • .tsdotcms-typescript-reviewer
    • .ts/.htmldotcms-angular-reviewer
    • .spec.tsdotcms-test-reviewer
    • .scss/.css/.htmldotcms-scss-html-style-reviewer
  7. Outputs a one-line nudge to Claude's context

The hook is informational only — it does not auto-trigger reviewers. The developer decides whether to act.

Why PostToolUse on Bash instead of a git hook: Claude Code runs git via the Bash tool. Claude Code's hook system provides the full tool input + output in JSON, letting us inspect whether the commit actually succeeded without a separate git call.


.claude/settings.json (modified)

Added PostToolUse hook registration:

"hooks": {
  "PostToolUse": [
    { "matcher": "Bash", "hooks": [{ "type": "command", "command": ".claude/hooks/post-commit-review.sh" }] }
  ]
}

Agents used in the pipeline

Agent Role When
dotcms-issue-validator Checks issue completeness Stage 2 (parallel)
dotcms-product-analyst Deep product research + pseudocode Stage 2 (parallel) — new
dotcms-file-classifier Sorts changed files into review buckets Stage 6a
dotcms-typescript-reviewer TypeScript type safety Stage 6b
dotcms-angular-reviewer Angular patterns Stage 6b
dotcms-test-reviewer Test quality Stage 6b
dotcms-scss-html-style-reviewer Styling standards Stage 6b
github-workflow-manager Creates the draft PR Stage 8

All reviewer agents and dotcms-issue-validator / dotcms-file-classifier / github-workflow-manager are existing agents. dotcms-product-analyst is new.


Test plan

  • Run /issue-to-pr <number> on a real frontend issue end-to-end
  • Verify Stage 2 agents run in parallel
  • Verify Stage 3 Q&A waits for user answers before proceeding
  • Verify Stage 6 launches only reviewers matching the changed file types
  • Verify Stage 7 asks for test data and blocks on QA failure
  • Commit a frontend file → verify post-commit hook fires with correct reviewer recommendation
  • Commit a backend-only file → verify hook stays silent
  • Verify Stage 8 moves the issue to "In Review" (requires project GitHub token scope: gh auth refresh -s project)

🤖 Generated with Claude Code

Closes #34909

Introduces a coordinated multi-agent development pipeline for the
core-web Angular monorepo. Includes the /issue-to-pr skill, a new
product analyst subagent, a post-commit review hook, and settings wiring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

❌ Issue Linking Required

This PR could not be linked to an issue. All PRs must be linked to an issue for tracking purposes.

How to fix this:

Option 1: Add keyword to PR body (Recommended - auto-removes this comment)
Edit this PR description and add one of these lines:

  • This PR fixes #123 or Fixes: #123

  • This PR closes #123 or Closes: #123

  • This PR resolves #123 or Resolves: #123

  • Other supported keywords: fix, fixed, close, closed, resolve, resolved
    Option 2: Link via GitHub UI (Note: won't clear the failed check)

  1. Go to the PR → Development section (right sidebar)

  2. Click "Link issue" and select an existing issue

  3. Push a new commit or re-run the workflow to clear the failed check
    Option 3: Use branch naming
    Create a new branch with one of these patterns:

  • 123-feature-description (number at start)

  • issue-123-feature-description (issue-number at start)

  • feature-issue-123 (issue-number anywhere)

Why is this required?

Issue linking ensures proper tracking, documentation, and helps maintain project history. It connects your code changes to the problem they solve.---

This comment was automatically generated by the issue linking workflow

@oidacra
Copy link
Copy Markdown
Member

oidacra commented Mar 3, 2026

Let's merge this one with what I created.

@zJaaal zJaaal marked this pull request as ready for review March 4, 2026 19:39
@github-actions github-actions bot added the Area : Frontend PR changes Angular/TypeScript frontend code label Mar 4, 2026
Copy link
Copy Markdown
Contributor

@spbolton spbolton left a comment

Choose a reason for hiding this comment

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

PR Requires a Linked Issue

This PR breaks our rule requiring all PRs to have an associated issue — there's even a failing check because of it. That said, this is a separate concern from the main review.

If you don't already have an issue, you can create one easily using Claude with the new skill or by running /create-issue. I'm happy to share a doc explaining why all PRs should have linked issues, even for unplanned work outside a sprint.

On the friction of creating issues

Yes, it can feel like extra overhead to create an issue just to open a PR — but with AI tooling, this becomes a non-issue. Claude can enforce the rule and create both the PR and the issue together.

On skill design

For this PR, I think we can merge it and see how it goes. However, I'd like us to think about skills as covering an area of responsibility rather than mapping one-to-one with commands. A single skill should support multiple commands and options — otherwise we end up with duplication and fragmentation.

With that in mind:

If this gets merged, the follow-up would be a refactor to consolidate the core rules and flow — similar to how I refactored create-issue into dotcms-github-issues while keeping /issue-to-pr working as a command within it.

- Added a new skill to automate the development cycle from a GitHub issue number for the dotCMS/core repository.
- Implemented a structured workflow including pre-flight checks, issue resolution, AC refinement, implementation, testing, review, and PR creation.
- Created supporting documentation and command references to guide users through the process.
- Included scripts for slugifying branch names based on issue titles.

This enhancement streamlines the process of addressing GitHub issues, ensuring clarity and efficiency in development tasks.
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 4, 2026

Claude finished @zJaaal's task in 3m 34s —— View job


Review

  • Gather context
  • Read changed files
  • Analyze for bugs, risks, design issues
  • Post review findings

🔴 Critical

create-pr/SKILL.md:17git commit --no-verify bypasses pre-commit hooks

git commit --no-verify -m "<type>(<scope>): <description>

This is an explicit violation of CLAUDE.md: "Never skip hooks (--no-verify) unless the user explicitly requests it." Pre-commit hooks exist for a reason (lint gates, secret scanning, etc.). Drop the --no-verify flag. Fix this →


solve-issue/SKILL.md — Step 7 references /review which doesn't exist

Run /review on the changed files.

No skill named review or issue-to-pr exists in this PR or in the repo. This step will either silently no-op or error. If the intent is dotcms-frontend-review, use Agent(subagent_type: dotcms-frontend-review) directly or reference the correct skill path. Fix this →


PR description is materially inaccurate

The description claims two files that do not appear in the changed files list:

  • .claude/hooks/post-commit-review.sh
  • .claude/settings.json (PostToolUse hook registration)

The settings.json diff shows no changes. The hooks file doesn't exist. Either these were removed before merge and the description not updated, or they were never committed. Either way, reviewers are reading a description that describes code that isn't here.


🟡 Important

fetch-issue/SKILL.md — branch pattern #3 is too broad

Digits after / or -

Pattern: feat/fix-404-error → extracts 404. chore/update-10-items → extracts 10. Any branch with a number anywhere will match, giving wrong issue numbers with no feedback. Make the final fallback require the full issue-\d+ format or drop it entirely and just ask the user.


dotcms-product-analyst.md — research caps are too tight for real portlets

Max 3 Grep/Glob calls, max 4 Read calls.

A standard Angular portlet read requires: component .ts, component .html, NgRx store, service, and the .spec.ts — that's already 5 reads before touching any referenced utilities. The agent will be forced to produce pseudocode with gaps, defeating the point of the research phase.


qa/SKILL.md — no iteration limit on the fix → re-run loop

On failure: fix implementation, re-run from Step 3. Do NOT proceed with failing QA.

There's no escape hatch. If QA keeps failing (e.g., flaky environment, blocked network, wrong test data), the pipeline loops forever. Add a max of 3 iterations with an explicit ⚠ QA UNRESOLVED exit path after the limit.


solve-issue/SKILL.md--review and --qa flags don't skip preflight

Flags skip to Step 7/8, but Step 1 (preflight) still runs first — and it requires a clean working tree. If you have uncommitted implementation work and run /solve-issue --review, preflight fails immediately. Preflight should be skipped (or the clean-tree check relaxed) when jumping into mid-pipeline stages.


🔵 Quality

commands.md — GraphQL board mutation requires undiscoverable IDs

The commands.md mutation placeholders (<in-review-option-id>, <status-field-id>) change per organization/project. The discovery query is there, but there's no instruction on how to parse its output to get those IDs. Add a step that extracts the field and option IDs from the fieldValues query before constructing the mutation.

build-verify/SKILL.md — writes tests without reading existing spec file first

Step 1 writes new tests then runs. If the spec file already exists with tests for the same ACs, this creates duplicates or conflicts. Add a read of the existing .spec.ts before writing so new cases are additive.

branch/SKILL.md — worktree path fetches but doesn't reset local main

In the worktree branch, git fetch origin main updates the remote ref, and git worktree add ... origin/main is correct. But if there's an existing local main that the user switches to later, it stays stale. Minor, but worth noting for teams where worktree and main checkout are used in parallel.


@github-actions github-actions bot added the Area : Documentation PR changes documentation files label Mar 5, 2026
@@ -0,0 +1,50 @@
---
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.

should we be using the dotcms-github-issues skill for interacting with the issues rather than creating a new skill.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good question — the separation is intentional. dotcms-github-issues is a user-facing conversational skill (mode detection, label inference, template selection, Q&A flows). fetch-issue is a silent pipeline utility: resolve a number from context, fetch JSON, check for existing branches/PRs, pass structured output to the next step. Pulling a 600-line conversational skill into the middle of an automated pipeline would reintroduce the context-bloat problem this decomposition was designed to avoid. Same principle as the class/method analogy @spbolton raised — dotcms-github-issues is the user-facing API, fetch-issue is the internal plumbing. — 🤖 Claude

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.

Good point. To be clear, the multi-mode design in dotcms-github-issues was intentional — the goal was to capture the full
behavior of "interacting with issues" as a single area of responsibility, with shared rules for label inference, team caching,
and refinement that stay consistent across operations. That's a different priority than context optimization.

That said, looking at how you've structured the decomposition here — scoped allowed-tools per skill, thin orchestrator, shared
reference files — there are real benefits we could apply back to dotcms-github-issues. The modes map naturally to separate
skills with shared references, giving you both the context efficiency and the single source of truth for the rules.

The key thing to protect as we go in this direction is the shared-references pattern you're already using with
issue-refinement.md. That's what keeps decomposed skills from drifting apart.

Comment thread .claude/skills/branch/SKILL.md
Add explicit uncommitted-change detection before any branch switch or
creation. Users are now offered three choices when WIP exists:

  1. Move to new branch — stash on current, checkout main, create
     branch, pop stash
  2. Branch from current state — create branch at current HEAD,
     preserving WIP commits and changes
  3. Leave here and start clean — stash on source, create clean
     branch from main

Also updates allowed-tools to include git status, stash, diff,
fetch, worktree, and rev-parse as required by the new steps.

Addresses review comment from @spbolton on PR #34843.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zJaaal zJaaal requested a review from spbolton March 9, 2026 14:04
Comment thread core-web/yarn.lock
@@ -11646,9 +13279,9 @@ domhandler@^5.0.2, domhandler@^5.0.3:
domelementtype "^2.3.0"

dompurify@^3.2.5:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Legal Risk

dompurify 3.3.1 was released under the MPL-2.0 license, a license that
has been flagged by your organization for consideration.

Recommendation

While merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue.

spbolton
spbolton previously approved these changes Mar 9, 2026
@zJaaal zJaaal marked this pull request as draft March 9, 2026 15:35
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 2, 2026

Rollback Safety Analysis

  • Read rollback-unsafe categories reference
  • Get full PR diff
  • Analyze diff against all unsafe categories
  • Apply label

Result: ✅ Safe To Rollback

All 19 changed files are Claude Code AI tooling configuration (.claude/agents/, .claude/skills/), markdown documentation, .gitignore, .mcp.json, and core-web/CLAUDE.md. No application code is touched.

Category check:

Category Match?
C-1 Structural Data Model Change ✅ No
C-2 Elasticsearch Mapping Change ✅ No
C-3 Content JSON Model Version Bump ✅ No
C-4 DROP TABLE / DROP Column ✅ No
H-1 One-Way Data Migration ✅ No
H-2 RENAME TABLE / COLUMN ✅ No
H-3 PK / Unique Constraint Restructuring ✅ No
H-4 New ContentType Field Type ✅ No
H-5 Binary Storage Provider Change ✅ No
H-6 DROP PROCEDURE / FUNCTION ✅ No
H-7 NOT NULL Column Without Default ✅ No
M-1 Non-Broadening Column Type Change ✅ No
M-2 Push Publishing Bundle Format Change ✅ No
M-3 REST / GraphQL API Contract Change ✅ No
M-4 OSGi Plugin API Breakage ✅ No

No database migrations, no Elasticsearch changes, no Java source changes. Label AI: Safe To Rollback has been applied.

View job run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Documentation PR changes documentation files Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

feat(dx): AI agent orchestra for frontend issue-to-PR workflow

3 participants