/jig:postmortemfrom jig
Runs Jig's learning loop: classifies lessons from merged PRs, working sessions, or feedback, then applies improvements to skills and checklists.
Ships in jig. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
PURPOSE: Find the gaps in skills, specialists, and review checklists that a lesson exposes -- then fix those gaps. A merged PR's review comments are the usual input; every other input in Capture in framework/LEARNING_LOOP.md goes through the same steps. This skill runs Jig's learning loop, so every lesson makes the system better next time.
GIT HOST: Commands in this skill use GitHub (gh) as the default. If git-host in jig.config.md is not github, read framework/GIT_HOST.md for the platform-specific command equivalents.
CONFIGURATION: Reads jig.config.md for ticket-system (to offer ticket creation for improvements) and main-branch.
framework/LEARNING_LOOP.md (a working session, a retrospective, another harness's notes or skills, "Jig should do X", recurring fit-review findings)kickoff suggests this after the LEARN stage for features/postmortem invoked directlyDo NOT use when:
pr-respond instead)Interview (merged PR, or another input)
|
Gather: PR --> fetch PR data, analyze comments
other --> gather that input's evidence
|
Extract patterns (what was wrong, principle violated, how fixed)
|
Classify level (personal, harness, team, pack, core)
|
Cross-reference existing skills (is the pattern already documented?)
|
Route: pattern violation --> Specialist Diagnosis
correctness bug --> Logic Reviewer Diagnosis
|
Apply changes, drafted against the Fit Checklist
|
Fit review (Fit Review in framework/LEARNING_LOOP.md)
|
Report (patterns table, changes made, items needing judgment)
Detect the PR from the current branch only when the user asked for a PR postmortem or gave no input. A lesson stated directly ("Jig should do X", a session, a retrospective) skips detection: go to Other inputs below.
# Try to find a merged PR for the current branch
gh pr list --head "$(git branch --show-current)" --state merged --json number,title --jq '.[0]'
If found, confirm: "Found PR #XXXX -- is that the one you want to audit?"
If not found, ask:
Which PR would you like to run a postmortem on? Provide a PR number or URL -- or describe the lesson and where it came from.
Other inputs (see Capture in framework/LEARNING_LOOP.md): skip the PR fetch in Step 2 and the filter in Step 3. Gather the evidence that input calls for, keep lessons backed by a fix, failure, or correction, and fill Step 3's fields with the input in place of the reviewer. When the input is team memory, Search it here, per the memory skill. Then go to Step 4.
Run in parallel. Extract owner/repo from the git remote -- do not hardcode.
# PR metadata
gh pr view {number} --json title,body,state,mergedAt,headRefName,files,author
# All inline review comments (paginated)
gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate
# Review summaries (paginated)
gh api repos/{owner}/{repo}/pulls/{number}/reviews --paginate
With team memory on (the memory skill), write the merged PR's
shipped note in your own words from the diff and commits, never from the
PR body or comments, keyed <repo>-pr-<number>. Save it (Saving) only when
state is MERGED, mergedAt is set, and the PR's author is the
signed-in user ("Find the signed-in user" in framework/GIT_HOST.md),
never judged by the git author. An open or closed PR, someone else's PR,
or an author you could not confirm gets no note; say which in the summary.
Filter:
For each actionable comment, extract:
| Field | Example |
|---|---|
| What was wrong | Hardcoded color value instead of theme token |
| Principle violated | Use design system tokens for all visual properties |
| How it was fixed | Replaced hex value with token.colorPrimary |
| Who caught it | reviewer-username (human); for other inputs, who or what surfaced it |
Categorize into pattern groups -- discover from the data, do not force into preset buckets. Common categories from past postmortems:
First classify each pattern's level -- personal, harness, team, pack, or core -- per Classify in framework/LEARNING_LOOP.md. Personal lessons, and harness lessons not tied to this project, leave the repo: give them to the user for their own harness config, and stop there for them. With team memory on, Step 9 also saves a Personal lesson as a private note.
For the rest, scan the project's skills and specialists directories to find relevant files. For each pattern group:
team/skills/, packs/*/skills/, and core/skills/ for related skillsteam/specialists/, packs/*/specialists/, and core/specialists/ for related specialists| Classification | Meaning | Action |
|---|---|---|
| Already covered | Skill documents this but agent ignored it | Flag -- may need stronger wording or examples |
| Gap | Relevant skill exists but does not cover this pattern | Add to that skill |
| No home | No relevant skill covers this domain | Add to a specialist or project-level config |
With team memory on, Search for each kept lesson to see whether the team already saved it; Ask may help too. For the 3+ occurrence rule under Logic Reviewer Diagnosis, count the distinct PRs or inputs the notes link to, each checked against its source: never raw notes, and one author's notes once.
Before diving into diagnosis, determine which part of the review system should have caught the finding:
| Finding Type | Route to | Examples |
|---|---|---|
| Pattern violation | Swarm Specialist Diagnosis | Missing translations, raw throws, wrong imports, dead code, hardcoded tokens |
| Correctness bug | Logic Reviewer Diagnosis | Comparator mismatch, asymmetric paths, NULL handling, broken caller contract, state lifecycle |
How to tell the difference: Pattern findings can be caught by scanning the diff for a known anti-pattern. Correctness findings require reasoning -- tracing a value through function boundaries, checking if the inverse path handles the same cases, or reading files outside the diff to verify contracts.
When a missed finding should have been caught by the review swarm (review), walk through these failure modes in order to identify the root cause:
| # | Failure Mode | How to Diagnose | Fix |
|---|---|---|---|
| 1 | No specialist covers this concern | Search specialists/*.md in all three discovery directories -- none have this in "What to Check" | Create a new specialist file |
| 2 | Specialist exists but globs did not match | Check the specialist's globs against the file path that was missed | Update globs in frontmatter |
| 3 | Specialist ran but prompt did not cover this pattern | Read the specialist body -- the specific pattern is not mentioned | Add the pattern to the specialist's "What to Check" |
| 4 | Specialist ran, prompt covers it, model missed it | Pattern is documented but the model's capability is insufficient | Upgrade model in frontmatter (haiku -> sonnet -> opus) |
| 5 | Specialist ran, prompt covers it, model is capable | Prompt has too many concerns -- specialist needs splitting | Split into two specialist files |
| 6 | Specialist was skipped due to tier | Specialist is full-only but finding occurred during per-task review | Change tier to fast-pass in frontmatter |
Always diagnose before adding. If the specialist already covers the pattern (mode 4 or 5), adding more text to the prompt makes it worse, not better. Upgrade the model or split the specialist instead.
Verification step: After proposing a fix, check that it would have actually caught the finding:
When a missed finding is a correctness bug that the logic reviewer should have caught, walk through these failure modes:
| # | Failure Mode | How to Diagnose | Fix |
|---|---|---|---|
| 1 | Logic reviewer did not run | Was this a per-task review (fast-pass tier)? Logic reviewer only runs pre-PR. | If this class of bug needs to be caught per-task, consider promoting to a specialist |
| 2 | No reasoning pattern covers this | Read the reasoning patterns in the logic reviewer -- does any pattern's trigger match? | Add a new reasoning pattern (or refine an existing pattern's trigger/procedure) |
| 3 | Pattern exists but trigger did not fire | The pattern's "When" section does not describe this code shape | Broaden the trigger -- add the missed code shape to the "When" list |
| 4 | Pattern triggered but procedure missed it | The "How" steps did not lead to discovering the bug | Add a step to the procedure, or add a "What breaks" example |
| 5 | Procedure would find it, but exploration did not reach the file | The logic reviewer reads callers/types proactively, but this file was not in scope | Add the file pattern to the proactive exploration directives |
| 6 | Everything was in place but the model did not connect the dots | The pattern, trigger, procedure, and files were all correct -- model just missed it | Add a concrete "What breaks" example matching this exact scenario |
Key insight: The logic reviewer improves through examples, not rules. Unlike specialists (which improve by adding checklist items), the logic reviewer improves by adding concrete "What breaks" examples under each reasoning pattern. When the model sees a specific past failure, it is far more likely to catch the next similar mistake than if you just add an abstract rule.
How to add examples from postmortem findings:
core/skills/review/logic-reviewer.md){description of what went wrong} ({PR number or brief context})When to promote a logic finding to a specialist instead:
If the same correctness bug appears 3+ times across different PRs or other inputs, it has become a pattern, not a one-off logic issue. At that point:
For a core or pack lesson, do this in a Jig checkout; the PR goes to Jig.
PR input. The PR is already merged and the user is likely still on the old branch, so stash and branch from latest main:
git stash
git checkout {main-branch} && git pull origin {main-branch}
git checkout -b {username}/skill-improvements-from-pr-{number}
Any other input. Work may still be in flight (a team-dev or sdd run, uncommitted changes), so never stash or check out in the current tree. Create the branch {username}/skill-improvements-from-{topic} with the worktree skill, from latest {main-branch}, and do the remaining steps there.
Read main-branch from jig.config.md (default: main).
If a ticket should be created for the improvements, offer to do so using the project's configured ticket-system from jig.config.md. Use title format: "Skill improvements -- lessons from {PR #number or topic}".
Draft each change against the Fit Checklist in core/specialists/framework-fit.md, then edit skill and specialist files directly. Follow the existing style of each file:
| Problem | Solution |)-- Pattern X present?)Keep additions concise -- 1-3 lines per pattern. A pitfall row is better than a paragraph.
Files to check and update:
team/skills/ -- team-specific skills that should cover the patterncore/skills/ -- framework skills if no team skill covers the domainteam/specialists/ -- team-specific review specialistscore/specialists/ -- framework review specialistscore/skills/review/logic-reviewer.md -- for "What breaks" examplescore/skills/review/tiers.md -- should a specialist's tier or severity change?Keeping reviewers in sync: When adding a pattern to a skill, check whether it should also appear in any automated reviewer configurations the project uses. The skill is the authoritative source -- reviewer configs are concise summaries optimized for automated review context. Not every skill detail belongs in reviewer configs, but review-checkable rules (flag X, never do Y) should be represented.
Run the fit review (Fit Review in framework/LEARNING_LOOP.md) on the paths you changed.
If the merged work has a live PRD (> **PRD:** in its plan or spec), add one learn entry to its log naming the one or two lessons that changed a skill or specialist, in plain words. See framework/LIVE_PRD.md.
With team memory on, save each kept lesson as a trap or practice (scope
private for a Personal one) per the memory skill (Saving), keyed
<repo>-lesson-<slug>, where the slug names the lesson's pattern in a few
words, the same each time. When the input was someone else's PR, or Step 2
could not confirm its author, only suggest them. Skip a lesson whose input was team memory:
it is already there. Never save review comment bodies or reviewer names.
Present a structured summary:
## Postmortem: {PR #number -- "title", or the input}
### Input Analyzed
- PR: X comments from human reviewers, Y from bots (Z actionable), N led to code changes
- Other input: the evidence gathered, and N lessons kept
### Patterns Found
| Pattern | Count | Reviewer(s) | Skill | Status |
|---------|-------|-------------|-------|--------|
| Hardcoded tokens | 2 | reviewer-a | fe-styling | Gap -- added |
| Missing memoization | 1 | reviewer-b | fe-performance | Gap -- added |
| ... | ... | ... | ... | ... |
### Changes Made
- `team/skills/fe-styling/SKILL.md`: Added 2 anti-pattern examples
- `core/specialists/performance.md`: Added memoization check
- ...
### Fit Review
- framework-fit: rounds run, findings fixed, and any left standing with why
- security (if the artifact handles untrusted input): findings fixed, and any left standing with why
### Team memory (when on)
- memory: N notes read; saved: id, category, one line each; suggested: ...
### Items Needing Human Judgment
- [Anything ambiguous or subjective]
Then: "Ready to commit and push? Or want to review the diffs first?" With approval, ship through pr-create as a learning PR (PR in framework/LEARNING_LOOP.md); a core or pack change then waits for Release and Propagate.
When deciding where a pattern belongs, use the narrowest applicable scope. This table picks the home within the project; Classify in framework/LEARNING_LOOP.md decides first whether the lesson belongs in the project, a pack, Jig core, or the user's own harness config.
| Scope | Location | Example |
|---|---|---|
| One feature | Feature-tier skill | Negation logic in a specific filter system |
| One domain | Domain-tier skill | Objects inside memoization hooks |
| Cross-cutting | Specialist file | Dead code, async safety, security patterns |
| Reviewer gate | Review tiers config | Tier assignments, severity levels |
| Project-wide | Project config (CLAUDE.md or equivalent) | Never add indexes without asking |
Avoid duplication. A pattern belongs in ONE primary location (the skill or specialist). Automated reviewer configs are concise summaries -- not a second source of truth.
| Mistake | Fix |
|---|---|
| Adding text to a specialist that already covers the pattern | Diagnose first. If the pattern is documented and the model missed it, upgrade the model or split -- do not add more text |
| Creating a specialist for a one-off issue | Start as a logic reviewer example. Only promote to specialist after 3+ occurrences |
| Skipping bot comments entirely | Bot comments that led to real fixes are valuable signal |
| Including dismissed false positives | Only analyze comments that resulted in actual code changes |
| Adding broad, abstract rules | Keep additions concrete. "Check comparators" is useless. "buildFilterValue produces greaterThan but handler only accepts before/after" is useful |
| Not verifying the fix would work | After proposing a change, check that the new globs match, the new prompt covers it, or the example is specific enough |
| Hardcoding ticket system references | Read ticket-system from jig.config.md -- offer to create tickets using the configured system |
| Forgetting to update automated reviewer configs | When adding a review-checkable rule to a skill, propagate to reviewer configs if applicable |
| Duplicating patterns across skills and specialists | One primary location per pattern. Other locations reference it, not repeat it |
| Writing one person's or one harness's preference into a shared skill | Classify the level first. Personal and harness lessons go in the user's own harness config |
| Trusting the edit because each file reads well | Most misfits sit in files the diff did not touch. Run the fit review |
Called by:
kickoff during the LEARN stage (post-merge)Related skills:
review -- the review swarm whose specialists this skill improves, and whose framework-fit runs the fit review, and, for an artifact that handles untrusted input, securitypr-create -- the PR whose comments this skill analyzes, and the skill that ships the learning PRpr-respond -- for addressing feedback before the postmortemextend -- if the postmortem reveals the need for an entirely new skill or specialistworktree -- creates the branch for a lesson from any input other than a merged PR| Element | Rule |
|---|---|
| Input | Merged PR (auto-detect from branch), or any other input in framework/LEARNING_LOOP.md Capture |
| Output | Edited skill/specialist files + structured report |
| Branch | {username}/skill-improvements-from-pr-{number} (or -{topic}) |
| Fit | Draft against the Fit Checklist; run Fit Review in framework/LEARNING_LOOP.md |
| Ticket | Optional -- offer to create via configured ticket system |
| Scope | Only patterns that led to real code changes -- skip noise |
| Style | Match the existing style of each skill/specialist file |
| Diagnosis | Always diagnose before adding. Specialists: 6 failure modes. Logic reviewer: 6 failure modes |
| Promotion | One-off correctness bugs start as logic reviewer examples. Patterns (3+ occurrences) graduate to specialists |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub duronext/jig --plugin jig26 skills in this plugin
/brainstormUse when exploring ideas, comparing approaches, or refining an unclear problem — at any point in the workflow. A discovery-time tool, not a pipeline stage. Invokable directly via /brainstorm or offered by kickoff during DISCOVER. Produces understanding, not artifacts.
/buildUse when you have an implementation plan and want to execute it. Analyzes the plan's task graph, determines the best execution strategy (parallel via team-dev or serial via sdd), and orchestrates the full build with quality gates. The single entry point for plan execution — you don't need to choose between team-dev and sdd yourself.
/debugUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Enforces root cause investigation through four phases: investigation, pattern analysis, hypothesis testing, and implementation. Prevents guess-and-check thrashing.
/eng-copywritingUse when writing ANY user-facing text -- UI labels, button text, error messages, notifications, tooltips, placeholders, or application content./eng-loggingUse when implementing logging in application code. Covers log level selection, structured logging, error tracking integration, and avoiding noise./eng-testingUse when writing tests, designing test strategy, or reviewing test coverage. Covers test pyramid, naming, mocking, and flaky test policy.Other plugins' skills for the same job