duplicate-epic

Clone a Jira epic from another project into the PF Jira space with back-links and feature attachment. Use when duplicating COST or cross-project epics into PF for tracking.

8 stars

Best use case

duplicate-epic is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Clone a Jira epic from another project into the PF Jira space with back-links and feature attachment. Use when duplicating COST or cross-project epics into PF for tracking.

Teams using duplicate-epic should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/duplicate-epic/SKILL.md --create-dirs "https://raw.githubusercontent.com/patternfly/ai-helpers/main/plugins/pf-workshop/skills/duplicate-epic/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/duplicate-epic/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How duplicate-epic Compares

Feature / Agentduplicate-epicStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Clone a Jira epic from another project into the PF Jira space with back-links and feature attachment. Use when duplicating COST or cross-project epics into PF for tracking.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Duplicate Epic

Clones a Jira epic (e.g., from the `COST` project) into the PatternFly (`PF`) Jira space, ensures it carries an "is duplicated by" link referencing the original, and sets it as a child of the given feature.

## Requirements

| Tool | Purpose | Install |
|---|---|---|
| `curl` | Jira REST API calls | pre-installed on macOS; `brew install curl` |
| `jq` | JSON parsing and payload construction | `brew install jq` |

The script checks for both tools at startup and exits with a helpful message if either is missing.

## Input Parsing

The command takes exactly two positional arguments:

| Position | Name | Description |
|---|---|---|
| `$1` | `issue` | Any Jira issue key or full URL — Epic, Story, Bug, etc. |
| `$2` | `feature` | The PF feature key or full URL to assign the new epic to |

Both bare keys and full URLs are accepted:

| Input | Parsed key |
|---|---|
| `COST-7355` | `COST-7355` |
| `https://redhat.atlassian.net/browse/COST-7355` | `COST-7355` |
| `PF-3868` | `PF-3868` |
| `https://redhat.atlassian.net/browse/PF-3868` | `PF-3868` |

Pass `$1` and `$2` directly to the script — no further parsing required.

## Prerequisites

The script requires two environment variables:

| Variable | Description |
|---|---|
| `JIRA_USER_EMAIL` | Atlassian account email |
| `JIRA_API_TOKEN` | API token from [id.atlassian.com/manage/api-tokens](https://id.atlassian.com/manage/api-tokens) |

If either is missing, ask the user for their email and direct them to create an API token, then set the variables inline when running the script.

## Workflow

Run the script from the skill directory:

```bash
cd $CLAUDE_SKILL_DIR
bash scripts/duplicate_epic.sh <issue> <feature>
```

The first argument (`issue`) may be an Epic, Story, Bug, or any other issue type. If it is not an Epic, the script automatically resolves its parent epic before cloning.

**Examples:**

```bash
bash scripts/duplicate_epic.sh COST-7355 PF-3868
bash scripts/duplicate_epic.sh COST-7309 PF-3868   # story/bug — script walks up to parent epic automatically
```

With inline credentials:

```bash
JIRA_USER_EMAIL="you@example.com" JIRA_API_TOKEN="your-token" \
  bash scripts/duplicate_epic.sh COST-7170 PF-3406
```

## What the Script Does

1. **Resolve current user** — looks up the account ID for the authenticated user (used for the assignee field).
2. **Resolve to an epic** — fetches the given issue. If it is not an `Epic` (e.g., it is a Story or Bug), the script walks up to its parent epic using `fields.parent` (next-gen projects) or `fields.customfield_10014` (classic epic link). Exits with an error if no parent epic can be found.
3. **Find existing clone** — checks the resolved epic's `Duplicate` issue links for any `PF-` issue; skips creation if found.
4. **Clone** — if no clone exists, creates a new Epic in the `PF` project copying the summary and labels. The description is sanitized before cloning: `mediaSingle` and `media` nodes (embedded attachments) are stripped, so embedded images and file attachments will not appear in the PF copy.
5. **Ensure "is duplicated by" link** — adds a `Duplicate` link so the new epic displays "is duplicated by {ORIGINAL EPIC}" in its linked work items; skips if already present.
6. **Set parent and assignee** — assigns the new epic as a child of the given feature and assigns it to the current user (resolved automatically via the API token).
7. **Display results** — prints clickable URLs for the feature, new epic, and original epic.

## Output

After a successful run, display these URLs to the user:

```
Feature:       https://redhat.atlassian.net/browse/PF-3406
New Epic:      https://redhat.atlassian.net/browse/PF-XXXX
Original Epic: https://redhat.atlassian.net/browse/COST-7170
Input Issue:   https://redhat.atlassian.net/browse/COST-7309   ← only shown when input was not itself an epic
```

Related Skills

pf-unit-test-generator

8
from patternfly/ai-helpers

Generate a unit test file for a React component using Testing Library. Use when adding test coverage to new or existing components.

pf-prototype-mode

8
from patternfly/ai-helpers

Enable prototype mode for React apps with grayscale styling and a banner overlay. Use when demoing early concepts, presenting wireframes, or preventing stakeholders from fixating on visual polish.

pf-project-scaffolder

8
from patternfly/ai-helpers

Scaffolds PatternFly React projects with PF6-safe dependencies, imports, and starter layout. Use when creating a new PatternFly app or bootstrapping a migration sandbox.

pf-import-checker

8
from patternfly/ai-helpers

Audit and fix invalid PatternFly import paths across packages. Use when imports fail, modules are unresolved, or after upgrading PatternFly versions.

pf-component-structure

8
from patternfly/ai-helpers

Audit PatternFly React component nesting, wrapper hierarchies, and layout structure. Use when scanning for hierarchy violations or debugging spacing caused by missing wrapper components.

write-example-description

8
from patternfly/ai-helpers

Write and refine example descriptions for PatternFly.org component and demo pages. Use when authoring or updating the prose in PatternFly example markdown files.

summarize-jira-issues

8
from patternfly/ai-helpers

Summarize your current sprint workload from Jira — assigned issues, contributor roles, and priorities. Use when checking what's left in the sprint or deciding what to work on next.

semantic-release-troubleshooting

8
from patternfly/ai-helpers

Diagnose and fix semantic-release issues when a specific version is not being released. Use when semantic-release skips a version, fails to release, or when troubleshooting after git push --force, squashed commits, permission errors, or reference already exists.

quarterly-initiative-report

8
from patternfly/ai-helpers

Generate quarterly Jira status reports with RAG assessment, blocker tracking, and next-quarter recommendations. Use when preparing quarterly initiative reviews or tracking epic progress.

pf-tokens

8
from patternfly/ai-helpers

Build CSS design tokens for PatternFly core and copy them to the PatternFly repository. Use when regenerating tokens after design changes or during release preparation.

pf-org-version-update

8
from patternfly/ai-helpers

Update patternfly-org for a new PatternFly release — resolve versions, update package.json and versions.json, and provide build steps. Use when cutting a PF release or release candidate.

pf-create-issue

8
from patternfly/ai-helpers

Create well-structured GitHub issues for PatternFly repositories with templates, follow-up tracking, and duplicate detection. Use when filing bugs, feature requests, or cross-repo follow-ups.