agentleFS
kbuleonkbuleon/agent-memory-powers/.agents/skills/create-work-item-from-jira/SKILL.md

create-work-item-from-jira

Skill1 starsChanged 34 days agoMITView on GitHub

Use when the user asks to import a Jira ticket into this project as a work item, or invokes /create-work-item-from-jira <key>. Reads the Jira issue, writes docs/10-work-items/<ID>-<slug>.md with its front matter and description, updates the folder index, and adds the label configured in docs/work-items-settings.json to the Jira issue.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep the printed value as label.

    line 23
  2. Very specific:

    Call getAccessibleAtlassianResources and keep the site's id as cloudId.

    line 30
  3. Distinctive:

    Exactly one site is expected: If several are returned, stop and ask which one rather than picking one: the wrong site would import a …

    line 32
  4. Very specific:

    Call getJiraIssue with the cloudId from block 2, the issue key, responseContentFormat: "markdown", and the fields summary, description, …

    line 37
  5. Distinctive:

    Only after block 4 has succeeded.

    line 83
  6. Very specific:

    Read the labels again with a getJiraIssue call using the cloudId from block 2 and the issue key, on the labels field only, rather than …

    line 86
  7. Distinctive:

    If Jira refuses, do not undo the local work.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Import a work item from Jira

Creates one work item in docs/10-work-items/ from a Jira issue. Renumbers nothing, overwrites nothing, updates no previous import. Creating is this skill's only verb.

The issue key is the command's argument — PROJ-1061. If it is missing, ask for it before anything else.

In this skill, <skill-dir> is the directory containing this SKILL.md. Its location depends on the agent (.agents/skills/, .claude/skills/…): never assume it.

1. Read the label

node -e "const s=JSON.parse(require('fs').readFileSync('docs/work-items-settings.json','utf8')); if(!/^\S+$/.test(s.jiraLabel||'')) throw new Error('jiraLabel empty or containing spaces'); process.stdout.write(s.jiraLabel)"

Keep the printed value as label. If the command fails — missing file, invalid JSON, jiraLabel missing, empty or containing spaces, which Jira labels cannot — stop and tell the user. Nothing has been read from or written to Jira at this point. Never fall back to a default label: the label is how the user tracks which issues were handed to the agent.

2. Resolve the Atlassian site

Call getAccessibleAtlassianResources and keep the site's id as cloudId.

Exactly one site is expected. If several are returned, stop and ask which one rather than picking one: the wrong site would import a homonymous issue from another project.

3. Read the issue

Call getJiraIssue with the cloudId from block 2, the issue key, responseContentFormat: "markdown", and the fields summary, description, parent.

Issue not found or not accessible: stop. Nothing is written, neither locally nor in Jira.

Keep:

ValueWhere to read it
summaryfields.summary
parentfields.parent.fields.summary, or nothing if there is no parent
descriptionfields.description
urlwebUrl

4. Write the file

compose.js does all the exact work — key validation, number padding to four digits, prefix guard, duplicate refusal, capped slug, YAML escaping, image substitution. Reimplement none of it here: this logic is the only tested part of the setup, and a second, untested copy would contradict it one day.

First write the payload to a temporary file outside the repository — for example in a directory created with mktemp -d, with no need to keep it afterwards — since the description may contain anything, including what would break an inline command-line argument:

{
  "key": "PROJ-1061",
  "summary": "<fields.summary>",
  "parent": "<parent summary, or null>",
  "description": "<fields.description, or null>",
  "url": "<webUrl>"
}

Then, from the repository root:

node "<skill-dir>/compose.js" < "<path-to-the-json>"

The command prints the path of the created file. If it exits with an error, stop and report its message verbatim. Nothing has been written to Jira at this point.

5. Add the label

Only after block 4 has succeeded. The order matters: an issue carrying the label always exists locally, never the other way around.

Read the labels again with a getJiraIssue call using the cloudId from block 2 and the issue key, on the labels field only, rather than reusing those from block 3: this narrows the window during which a concurrent change would be lost.

  • label (from block 1) already present: write nothing.
  • Otherwise, editJiraIssue with the cloudId from block 2, the issue key, and fields: { labels: [ ...the labels just read, label ] }. The full list, never [label] alone: this tool replaces the field, it does not append to it, and writing the single label would erase all the others.

If Jira refuses, do not undo the local work. The file stays, and the failure is reported in block 7.

6. Update the index

In docs/10-work-items/README.md, add an entry after the neighboring entries: the file name in backticks, an em dash, then a real description of the issue's content, written in the language of the project's documentation — never the Jira title copied as is. For example:

- `PROJ-1061-rc-name-inverted-in-the-menu.md` — imported Jira issue
  (epic "Apollo 2 - Support"): the names of the snap-to-neighbor and dynamic snap functions
  are swapped in the menu, while the tooltips remain correct.

7. Announce

State the path created, and the label status — added, already present, or refused with the reason. Nothing more.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.