official-tisao/leantime-tickets

Pull all open tickets from a Leantime project, fetch each ticket's full details (description, comments, subtasks, attached/embedded files, GitHub repo/branch links), and group related tickets together in a local state file. When working a ticket, move it to In Progress; when done, comment the PR/branch link on every ticket it covers and move them to Waiting for Approval. Use when the user wants to see, triage, review, or work on tickets/tasks in a Leantime project or gives a Leantime project URL.

Qu'est-ce que leantime-tickets ?

leantime-tickets is a Claude Code agent skill that pull all open tickets from a Leantime project, fetch each ticket's full details (description, comments, subtasks, attached/embedded files, GitHub repo/branch links), and group related tickets together in a local state file. When working a ticket, move it to In Progress; when done, comment the PR/branch link on every ticket it covers and move them to Waiting for Approval. Use when the user wants to see, triage, review, or work on tickets/tasks in a Leantime project or gives a Leantime project URL.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/official-tisao/AI-agents-skills/tree/HEAD/leantime-tickets

Installed? Explore more Productivité et collaboration skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Leantime Tickets

Fetches the open tickets of one Leantime project through Leantime's JSON-RPC API. It saves them, with full details, to a local state file and groups related tickets.

SECURITY RULES (mandatory, never skip)

  1. Never ask the user to paste their token into the chat, and never accept one if they do. If a user pastes a token anyway, do NOT use it, do NOT repeat it, and tell them to revoke it in Leantime (Profile → API / Personal Access Tokens) and create a new one.
  2. The token is read only from the environment variable leantime_personal_access_token. Refer to it only by that name, e.g. $env:leantime_personal_access_token / $leantime_personal_access_token.
  3. Never print, echo, log, write to a file, commit, upload, or send the raw token value anywhere: not in chat, code, state files, commit messages, URLs, or tool arguments. Don't run echo $env:leantime_personal_access_token or similar. To check whether it is set, only test whether it exists (the script does this for you).
  4. Send the token only in the x-api-key HTTP header, and only to the Leantime host the user gave you.

Step 1: Ask for the project (or ticket) URL

Always ask the user first:

"Please give me the URL of the Leantime project you want to work on (e.g. https://<your-leantime-host>/projects/showProject/<id>). If you already know the ticket, you can give me the ticket link instead (e.g. https://<your-leantime-host>/tickets/showTicket/<id>)."

Don't guess URLs or ids. The script handles both link types:

  • Project link only (no ticket given): load every open ticket in that project, group them, then ask which ticket to work on (Step 5, case A).
  • Direct ticket link: the script finds the ticket's project, still loads all of that project's open tickets for context, and marks the linked ticket as focus_ticket_id (Step 5, case B). A link with both showProject/<id> and showTicket/<id> works too.

Step 2: Make sure the token env variable is set

Check with the script (it only reports set or not set). If it isn't set, tell the user to create a Personal Access Token in Leantime and set it themselves in their own terminal:

PowerShell (current session only):

$env:leantime_personal_access_token = Read-Host "Leantime token" -MaskInput

PowerShell (persist for the user; open a new terminal afterwards):

[Environment]::SetEnvironmentVariable("leantime_personal_access_token", (Read-Host "Leantime token" -MaskInput), "User")

bash / zsh (macOS / Linux):

read -rs -p "Leantime token: " leantime_personal_access_token && export leantime_personal_access_token

(Add the export to ~/.bashrc / ~/.zshrc to keep it.) Then wait for them to confirm. Never offer to set it for them with the value.

Step 3: Fetch the tickets

Run the bundled script (Python 3, standard library only):

python "<this-skill-dir>/scripts/leantime_tickets.py" --url "<project URL>" --out ".leantime/project-<id>.json"

What the script does:

  • Calls leantime.rpc.Tickets.Tickets.getStatusLabels to learn which statuses count as "done".
  • Calls leantime.rpc.Tickets.Tickets.getAll with searchCriteria.currentProject = <id> and keeps the tickets whose status isn't of type DONE (open).
  • For each open ticket, calls leantime.rpc.Tickets.Tickets.getTicket (full details) and leantime.rpc.Comments.Comments.getComments (module: "ticket").
  • Groups related tickets (see below) and writes everything to the --out JSON file.
  • Prints a short summary to stdout. It never prints the token.

Options: --include-done keeps closed tickets too. --no-details skips the per-ticket calls (faster).

Step 4: How tickets are grouped

Each ticket goes into one group, in this order of priority:

  1. Parent/subtask: tickets sharing a dependingTicketId (parent) are grouped under that parent.
  2. Milestone: tickets with the same milestoneid.
  3. Shared tags: tickets sharing at least one tag.
  4. Title similarity: tickets whose titles share 2 or more meaningful keywords.
  5. Anything left goes into ungrouped.

After the script runs, read the state file, check the groups, and tell the user about them. You may refine them with your own judgment, e.g. merging groups that are clearly the same feature. If you do, update the state file's groups and set "refined_by_agent": true.

Step 5: Report and confirm the ticket (mandatory)

Case B: the user gave a ticket link (focus_ticket_id is set in the state file):

✅ Leantime project loaded ( open tickets). You linked ticket # (<status_label>). It's in group with: #.., #...

<short summary: description, subtasks, latest comments>

Shall I work on #, or would you like a different ticket?

Wait for confirmation before you start.

Case A: the user gave only a project link. Tell the user the tickets have been loaded, then ask which ticket they want to work on. Use this format:

✅ Leantime project loaded: open tickets in groups, saved to <state file>.

Group: <reason/key>

  • # (<status_label>, , assigned: )
  • ...

Ungrouped

  • #

Which ticket would you like to work on? (reply with the ticket # or a group name)

Then wait for the user to answer. Don't start working on any ticket until they pick one. When they pick one, show its full details from the state file (description, subtasks, comments) before you continue.

Step 6: Working on a ticket

All write actions use scripts/leantime_actions.py. Pass the same project or ticket URL the user gave you, because the Leantime host is taken from it.

6a. Move the ticket to "In Progress" as soon as you start

python "<this-skill-dir>/scripts/leantime_actions.py" status --url "<URL>" --ticket <id> --to in-progress

⚠️ MANDATORY, IMMEDIATELY: as soon as a ticket is moved to In Progress (once the branch is known, see 6c), you must add a one-line comment to that ticket with the branch tree link. Do it before you write any code:

python "<this-skill-dir>/scripts/leantime_actions.py" comment --url "<URL>" --ticket <id> --text "In progress on https://github.com/<owner>/<repo>/tree/<branch>"

Do this for every ticket you move to In Progress. Never skip it. Status names are matched against the project's own labels. If no label matches, run leantime_actions.py labels --url "<URL>" --project <pid> and choose the right one with the user.

6b. Pull every file related to the ticket

python "<this-skill-dir>/scripts/leantime_actions.py" files --url "<URL>" --ticket <id>

This downloads the images and file links embedded in the description and comments, plus files attached to the ticket, into .leantime/files/ticket-<id>/ (with a manifest.json). Open and look at every downloaded image or screenshot: they often show the bug or the expected design. Tell the user about any file that failed to download (e.g. it needed a browser login).

6c. Find the GitHub repo and branch the fix belongs in

Before you change any code, check the ticket's description and all comments for GitHub links or branch names. The fetch script already collects them in tickets[<id>].github_refs in the state file:

  • links[].repo: owner/repo
  • links[].branch: taken from /tree/<branch> links, e.g. https://github.com/<owner>/<repo>/tree/tisao-changes means repo <owner>/<repo>, branch tisao-changes
  • links[].pr: an existing PR number
  • branch_mentions: plain-text mentions such as "branch: develop"

Rules:

  • If a branch is given, do the work on that branch (check it out or base your branch on it, and open the PR against it). Never assume main.
  • If the ticket mentions several repos or branches, or none, ask the user which one to use.
  • Also read the parent ticket and the related tickets in the same group for links.

6c-bis. Commit and push continuously (MANDATORY)

  • Commit and push as soon as a change makes sense as a complete unit. Don't wait for unit tests or for the whole ticket to be finished. Example: you search-and-replace to add a data-uri attribute to every <a> tag. The moment the replacement is in place, before testing it, commit and push:
    git add -A && git commit -m "Add data-uri attribute to all a tags" && git push
    
  • Every commit message is a single line, short and in the imperative (no body, no bullet lists).
  • Push to the ticket's branch from 6c, so progress is always visible at the .../tree/<branch> link.
  • Keep units small: one logical change per commit. Fixes found while testing later get their own commits.
  • Never commit secrets, .env files, or the .leantime/ folder.

6d. When the work is done (e.g. you opened a PR or pushed a branch)

  1. Add a comment to every ticket the work covers (the main ticket, plus any related or grouped tickets the same change fixes). The comment must be ONE short sentence on a single line. No summaries, no bullet lists, no multi-line text:
    python "<this-skill-dir>/scripts/leantime_actions.py" comment --url "<URL>" --ticket <id> --text "Done in PR <PR link> on https://github.com/<owner>/<repo>/tree/<branch>"
    
    If there's no PR: "Done on https://github.com/<owner>/<repo>/tree/<branch>". Never put the token or any secret in a comment.
  2. Move each of those tickets to "Waiting for Approval":
    python "<this-skill-dir>/scripts/leantime_actions.py" status --url "<URL>" --ticket <id> --to waiting-for-approval
    
  3. Tell the user which tickets were commented on and moved, with the links.

Only comment on and move tickets you actually worked on. Before you post comments or move tickets you weren't explicitly asked to touch (e.g. related tickets), list them and get the user's OK.

Step 7: Working from local state

  • Use the local state file as your source of truth for the session. Don't refetch for every question.
  • Re-run the script when the user asks to refresh, or before acting on stale data (check fetched_at).
  • Add .leantime/ to .gitignore. Ticket data may be private.
  • The only ticket writes this skill allows are the ones in Step 6: status moves to In Progress or Waiting for Approval, and "worked on" comments. Never close or delete tickets, and never edit their content, unless the user explicitly asks.

Troubleshooting

  • 401 / "Not authorized": the token is wrong or expired. Ask the user to create a new one and re-set the env var.
  • Method not found: the Leantime version may name methods differently. Report the exact error to the user.
  • Empty result: check the project id and that the token's user has access to that project.

Skills associés