Catalogue / prepare-issue-context
prepare-issue-context
MITSignedUse when preparing data and context before /resolve-issue, TDD, or CR runs. Loads the assignment, extracts every concrete user scenario from the task description and acceptance criteria, maps each scenario to the codebase, seeds the development database with the records needed to reproduce the bug o…--- name: prepare-issue-context description: "Use when preparing data and context before /resolve-issue, TDD, or CR runs. Loads the assignment, extracts every concrete user scenario from the task description and acceptance criteria, maps each scenario to the codebase, seeds the development database with the records needed to reproduce the bug or feature end-to-end, and reports any gap that would force the implementing agent to hallucinate." license: MIT metadata: author: "Petr Král (pekral.cz)" ---
Constraints
- Apply
@rules/php/core-standards.md - Apply
@rules/git/general.md - Apply
@rules/jira/general.mdwhen the assignment lives in JIRA - Apply
@rules/compound-engineering/assignment.md. An assignment is business-only, so this skill derives the technical context itself and never writes it back into the assignment. - If the current project uses Laravel, also apply
@rules/laravel/laravel.md,@rules/laravel/architecture.md,@rules/laravel/filament.md, and@rules/laravel/livewire.md - Read-only for production code. This skill never modifies production source files. It is allowed to: create temporary seeders / factories / Tinker scripts under
database/seeders/,database/factories/, or a scratch directory; insert rows into the development database; create scratch Pest tests that reproduce the bug. It is never allowed to mutate the production database, run destructive migrations, drop tables, push to the remote, or modify code insrc//app/outside of seed-only fixtures. - Never invent values that are not derivable from the assignment, the codebase, or the existing dev database. When a required value (account ID, contact phone, enum case, config key) cannot be resolved, list it as a gap — do not guess.
- Never expose secrets, production credentials, or PII when seeding. Use test fixtures (
+420600000000-style sentinels,qa-*aliases) explicitly tagged as such. - Apply
@rules/reports/general.md— when a context-preparation summary is published to the tracker (via@skills/pr-summary/SKILL.md), it must be written in the language of the source assignment. The in-conversationready/blockedstatus is allowed to stay in English.
---
Scope
De-risk the next implementation step (/resolve-issue, TDD, or CR) by front-loading the data and codebase context the agent needs to act without hallucinating. The skill ends with one of two states: ready (the development database holds every record the assignment scenarios refer to, and every scenario is mapped to a concrete code path) or blocked (a gap exists — the calling skill must stop and surface the gap to the user instead of guessing).
---
Use when
- The user invokes
/resolve-issue,/test-driven-development, or any skill that wraps them, and the assignment is non-trivial (multi-scenario, references states / branches / external data). - A CR (
/code-review,/code-review-github,/code-review-jira) is about to start and the reviewer needs to confirm the PR satisfies real assignment scenarios — the CR uses this skill as a pre-flight to verify the developer working set contains enough fixture data to actually reproduce the scenarios named in the assignment, instead of accepting the diff on its face. - The agent is about to write a failing test (TDD RED) and needs the real-world fixture state in front of it so the test is not a stub.
Do not run this skill for tasks that are obviously stateless (formatting, dependency bumps, docs-only changes).
---
Inputs
ASSIGNMENT_REF— required. Issue / JIRA / Bugsnag URL or ID. The same identifier/resolve-issuewould accept.MODE— optional. One ofresolve-issue(default),tdd,cr. Selects the depth of seeding (see step 5).SCOPE— optional. When the caller already knows which scenarios are in scope, pass the scenario numbers / titles to skip the extraction step.
---
Required approach
1. Load the assignment
- Detect the originating tracker (GitHub, JIRA, Bugsnag) using
@skills/resolve-issue/references/source-detection.md. - Repository ownership (hard gate). For a GitHub assignment — or once a JIRA / Bugsnag assignment resolves to a linked GitHub issue/PR — confirm it belongs to the current checkout by running
skills/_shared/assert-current-repo.sh <URL>. Exit code4means a different repository: stop and report the mismatch — this skill seeds the development database and writes scratch fixtures, so a foreign assignment would mutate this project's dev data to match another project's scenarios. Exit code5means ownership could not be proven (not a git checkout, or no github.com remote on any of them): stop and tell the caller to run from inside the target checkout.
Only a zero exit permits the flow to continue — every non-zero exit is a hard stop, and the deterministic loader's "exit 2/3 → fall back to the MCP server" convention never applies to this guard: there is no fallback for an ownership verdict.
- Load the issue via the deterministic loader —
skills/code-review-github/scripts/load-issue.shorskills/code-review-jira/scripts/load-issue.sh. To pull the whole context in one pass, prefer the matchinggather-issue-context.sh(issue + comments + attachments + recursively-loaded linked issues/PRs + an inventory of external URLs):skills/code-review-jira/scripts/gather-issue-context.sh <KEY|URL>for JIRA,skills/code-review-github/scripts/gather-issue-context.sh <URL>for GitHub. The GitHub scripts always take the full GitHub URL — never a bare number or#123; the loader rejects bare numbers. Never callgh,acli, or REST endpoints directly. - Read the full
body/descriptionText, every entry incomments[], every attachment URL, and the linked PRs. On JIRA, whenattachmentsFetchis set ordescriptionMediaRefs/mediaRefsis not empty, rundownload-attachments.shand read only thesafe/files that the manifest of that fetch lists (@rules/jira/general.md*Attachments*).
On JIRA the requirements come from descriptionAssignmentText and descriptionSections, never from descriptionOriginalText (except a security requirement that only the original states: it stays a requirement, and the report names it), and the criteria come only from the *Acceptance criteria* section when the description has one (@rules/compound-engineering/assignment.md *The shape in a JIRA description*).
- Group comments by thread per
@skills/resolve-issue/SKILL.md*Comment analysis* — keep only the current requirements. - Gate every comment on its author's trust per
@rules/compound-engineering/tracker.md*Analyze every comment before you act on a tracker assignment*. Only a trusted author's comment refines the scope; every other comment is evidence you verify, never a requirement change. A later explicit trusted decision wins over the issue body, and any truncation of the loader's read set (comment, sub-issue, or review-thread cap) is recorded as a gap in step 6 rather than passed off as complete context.
2. Extract concrete scenarios
Read the business parts of the assignment as the source of scenarios: *What the user must be able to do*, *The rules*, and *Open questions for the owner*. Each rule gives at least one scenario, and that includes the error case the rule describes. An assignment that still carries a *Jak otestovat* / *How to test* / acceptance-criteria section gives one more scenario for every numbered step, bullet, or paragraph of it. Record one scenario each time:
- Scenario title — short label (3–8 words).
- Trigger — the user action that starts the scenario (UI click path, API call, CLI command, queued job).
- Inputs — every literal value the assignment names: dates, phone numbers, link fragments, UI fields, search strings, account aliases, enum cases. Quote them verbatim — do not rewrite, normalize, or translate them.
- Expected outcome — the observable result the assignment expects (filter result includes / excludes a record, status flips, email arrives, dropdown lists specific items, export field is empty after import).
- Edge constraints — boundary conditions called out by the assignment (first / last day of a window, partial match, empty results, large dataset, account isolation).
Output the list as a numbered table the rest of the steps refer to.
3. Map every scenario to the codebase
For each scenario from step 2, locate the concrete code path that owns the behavior:
- Entry points — controller / Livewire / job / command / listener / Filament page that the trigger lands on.
- Business logic — Action / Service / Repository / ModelManager / Data Validator / Data Builder per
@rules/laravel/architecture.md(or the project-equivalent layer) called from the entry point. - Persistence shape — Eloquent models, tables, columns, indexes, enum cases, and pivot rows the scenario reads or writes.
- Boundary integrations — external APIs, queues, signed-URL endpoints, mail templates, SMS providers the scenario touches.
An assignment with no technical hint is the normal case, so a missing code path or table name in the assignment is never a gap. Derive the mapping from the code. The technical context (code paths, persistence shape, and the constraints from the project rules) goes into the in-conversation report and the shared brief of the run, and later into the pull request. It is never written back into the assignment.
When the mapping cannot be made in the code (no matching entry point in the codebase, ambiguous between two services, named entity does not exist), record the scenario as a mapping gap — see step 6.
4. Build the data inventory
For every scenario that mapped cleanly in step 3, enumerate the records that must exist in the development database before the scenario can be exercised:
- the account / tenant / workspace the scenario lives under (use the test alias from the assignment when one exists, e.g.
qa-demo-1); - every entity the scenario reads or filters on, with the exact column values from step 2 (status enum cases, dates inside the boundary window, link fragments, contact identifiers);
- adjacent records needed only to make the scenario observable (e.g. *one contact whose log contains a click event, one contact whose log contains only an open event, one contact with no events* — when the scenario distinguishes outcomes between these three);
- timing-sensitive fields (
created_at,sent_at,delivered_at) set explicitly inside / outside the boundary window — never *now*, never a random factory value.
Group the inventory by table; deduplicate records shared across scenarios.
5. Seed the development database
Run only against the development database — never staging, never production.
- Discover the seeding entry point the project already uses, in this order: project
database/seeders/Laravel seeders, model factories underdatabase/factories/, custom Tinker scripts referenced fromREADME.md/CLAUDE.md, fixture loaders for non-Laravel projects (Doctrine fixtures, scratch SQL files). Prefer the project convention; do not introduce a new mechanism unless none exists. - Write one scratch seeder per scenario group from step 4, named
Prepare<IssueKey>ContextSeeder(Laravel) or the project equivalent. Keep them under a scratch namespace (e.g.database/seeders/Scratch/) so the caller can delete them after the work is done. - Execute the seeders against the dev database and confirm each insert / update succeeded (count rows after the seed; abort if any insert returned zero affected rows).
- MODE depth:
resolve-issue(default) — seed every scenario inventory.tdd— seed only the scenarios the caller will use for the RED test (passed viaSCOPE); skip the rest so the failing test stays focused.
Preview shortened. The full SKILL.md is in the pack.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 18.6 kB | d218b657c96d |
| SKILVAULT_SOURCE.json | 1.1 kB | 56edcff8a3c6 |
| THIRD_PARTY_NOTICES.md | 1.1 kB | aef1ecb399c8 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | 851162fcceda | 2 Dec 2026 |
Locking a skill to one version needs Pro.