AI 18 min

From a Jira Ticket to a Clean Pull Request with Spec Kit: Step-by-Step Guide to AI Coding Agents

Hands-on Spec Kit walkthrough: take a real Jira ticket through specify, clarify, plan, tasks, analyze, implement, and converge for clean, reviewable PRs.

Written by Samir El Azem Crovetto • Senior Backend Engineer & DevSecOps

From a Jira Ticket to a Clean Pull Request with Spec Kit: Step-by-Step Guide to AI Coding Agents

You probably know this Monday morning feeling. You open Jira, pick up ticket PAY-412 ("Allow exporting invoices to CSV filtered by date"), and because you want to move fast, you copy those ten words and paste them straight into your AI coding agent chat in Google Antigravity, Claude Code, or OpenAI Codex. Five minutes later, the agent finishes. You smile—until you run git status and discover it touched 18 files, changed configuration nobody asked for, broke two existing tests, and produced a Pull Request (PR)—the code review request before merging to main—so massive that no teammate wants to review it.

As we examined in AI Coding Agents in December 2026: Antigravity, Claude Ship, Codex, and the MCP Security Crisis, today's real bottleneck is no longer generating lines of code; it is getting AI to build exactly what your team needs without breaking the rest of the codebase. That is the exact problem solved by our Spec-Driven Development (SDD) series using Spec Kit. Instead of improvising with ad-hoc prompts, let us walk end-to-end through one real Jira ticket using every Spec Kit step in order, explained clearly from scratch.


1. The Big Picture: The Complete Spec Kit Map in 1 Minute

In practical terms, Spec Kit (the open-source SDD toolkit introduced in The SDD Pipeline in Practice) turns an ambiguous Jira ticket into a short, structured sequence inside your editor. Instead of asking the agent to "code this" blindly, each slash command (/speckit.*) performs one clear job before handing off to the next:

Step Command / Action What it does in plain language Output / Artifact
0 Jira-aligned Git branch Isolates this ticket in its own branch so AI never mixes tasks. feature/PAY-412_export-csv
1 /speckit.specify Turns the Jira ticket into an unambiguous specification using EARS rules. specs/PAY-412_export-csv/spec.md
2 /speckit.clarify The AI spots missing details in the ticket and asks 3-4 quick questions before designing. Updates spec.md
3 /speckit.plan Designs which classes, endpoints, and schemas to create or update under your project rules. plan.md, data-model.md, research.md
4 /speckit.tasks Breaks the design into an ordered checklist of small, testable tasks. tasks.md
5 /speckit.analyze Verifies that spec, plan, and tasks match your project Constitution before writing code. Consistency check (pass/block)
6 /speckit.implement Executes tasks.md step by step, writes code, and runs local tests. Source code + passing tests
7 /speckit.converge Final audit: verifies the implementation covers 100% of spec.md before opening the PR. Appends missing tasks or gives green light
flowchart LR
    Jira["Jira Ticket PAY-412 + Git Branch"] --> Specify["1. /speckit.specify (spec.md with EARS rules)"]
    Specify --> Clarify["2. /speckit.clarify (Resolve gaps before design)"]
    Clarify --> Plan["3. /speckit.plan (plan.md + data-model.md)"]
    Plan --> Tasks["4. /speckit.tasks (Step-by-step tasks.md)"]
    Tasks --> Analyze["5. /speckit.analyze (Check project rules)"]
    Analyze --> Implement["6. /speckit.implement (Code + Tests)"]
    Implement --> Converge["7. /speckit.converge (Verify 100% coverage)"]
    Converge --> PR["Small PR + Jenkins / GitHub Actions"]

    classDef model fill:#1e1b4b,stroke:#6366f1,color:#e0e7ff;
    classDef safe fill:#064e3b,stroke:#10b981,color:#ecfdf5;

    class Jira,Specify,Clarify,Plan,Tasks model;
    class Analyze,Implement,Converge,PR safe;

If you already read our conceptual overview in Spec-Driven Development (SDD): AI Agent Governance and the End of 'Vibe Coding', think of this guide as the concrete hands-on walkthrough applied to an everyday sprint ticket.


2. Step-by-Step Walkthrough on a Real Project: From Jira PAY-412 to a Clean PR

Let us walk through an everyday task in a typical Java / Spring Boot backend (the exact same workflow applies to Node.js, TypeScript, or Python). Your Jira ticket reads:

Ticket PAY-412: "As a customer, I want to download my invoices as a CSV file filtered by date range so I can send them to my accountant."

Step 0: Prepare your Git branch and repo setup (once per feature)

Make sure your repository has .specify/ initialized (as covered in our SDD Cheatsheet) with a short .specify/memory/constitution.md listing non-negotiable rules: Java/Spring version, no edits to .env or unapproved dependencies, and mandatory unit/integration tests.

Next, apply the "single-shot rifle" discipline from The Challenge of Existing Code (Brownfield) and Managing Multiple Specs with Jira/Git: one Git branch and one spec folder per Jira ticket, never mixing two tasks:

git checkout main && git pull
git checkout -b feature/PAY-412_export-csv

Step 1: /speckit.specify — Turn the Jira ticket into clear rules (no guessing)

In your agentic IDE chat, pass the ticket key via slug= so Spec Kit names the folder specs/PAY-412_export-csv/ instead of a generic counter, and describe what you need:

/speckit.specify slug=PAY-412_export-csv Add GET /api/v1/invoices/export to download the authenticated customer's invoices as a CSV file filtered by from and to dates (YYYY-MM-DD). Enforce date/row limits, guarantee one tenant can never see another tenant's invoices, and neutralize Excel formula injection. Do not modify pom.xml or global Spring Security config.

Spec Kit creates specs/PAY-412_export-csv/spec.md formatted with EARS (Easy Approach to Requirements Syntax)—simply structured sentences using keywords like WHEN, IF... THEN, and THE SYSTEM SHALL so zero ambiguity survives:

# Specification PAY-412: Export invoices to CSV

## Functional & Security Requirements (EARS)
- REQ-01 (Event-Driven): WHEN an authenticated user calls GET /api/v1/invoices/export?from=...&to=..., THE SYSTEM SHALL return a UTF-8 CSV file using `;` as delimiter.
- REQ-02 (Security / Isolation): THE SYSTEM SHALL always read `tenantId` (company identifier) from the verified session JWT token, never from a URL parameter.
- REQ-03 (Unwanted Behavior): IF `from` is after `to` or the date span exceeds 365 days, THEN THE SYSTEM SHALL return HTTP 400 without querying the database.
- REQ-04 (Limit): THE SYSTEM SHALL cap exported rows at 5,000 per request.
- REQ-05 (CSV Safety): IF any text cell begins with `=`, `+`, `-`, `@`, tab, or carriage return, THEN THE SYSTEM SHALL prefix a single quote (`'`) to prevent CSV Injection in Excel.
- REQ-06 (Scope): THE SYSTEM SHALL NOT add dependencies to `pom.xml` or alter global Spring Security filters.

Step 2: /speckit.clarify — Let the agent ask now what Jira forgot

Before designing code files, run the second command:

/speckit.clarify

The agent inspects spec.md, finds gaps missing from the original Jira ticket, and asks concise multiple-choice questions, such as:

  1. "If no invoices exist in the date range, should the endpoint return HTTP 200 with a header-only CSV or HTTP 204 No Content?"
  2. "What exact filename should appear in the Content-Disposition header (e.g., invoices-YYYY-MM-DD.csv or invoices.csv)?"
  3. "If matching records exceed 5,000 rows, should we truncate at 5,000 or return HTTP 422 asking for a narrower date range?"

You answer in thirty seconds (e.g., 1A, 2B, 3B) and Spec Kit updates spec.md automatically before a single line of Java is designed.

Step 3: /speckit.plan — Technical design before coding

Next, run:

/speckit.plan

The agent reads spec.md, inspects your Java packages, and generates three planning artifacts inside specs/PAY-412_export-csv/:

  • plan.md: lists the exact classes to edit (InvoiceService.java, InvoiceRepository.java) and create (InvoiceCsvExporter.java, InvoiceExportController.java, plus tests under src/test/).
  • data-model.md: defines the DTO (Data Transfer Object, a flat carrier object returning only the 4 needed fields instead of exposing internal database entities) and API (Application Programming Interface, your HTTP endpoint contract).
  • research.md: confirms standard Java and Spring Boot APIs cover everything with zero external libraries.

If plan.md proposes touching an unwanted file, you correct it right here in 10 seconds before any code is written.

Step 4: /speckit.tasks & Step 5: /speckit.analyze — Atomic checklist and consistency gate

With the plan approved, split the work and run the consistency gate:

/speckit.tasks
/speckit.analyze

/speckit.tasks produces specs/PAY-412_export-csv/tasks.md ordered by dependencies (bottom-up):

  • [ ] T01 Create InvoiceExportRow record and tenant-scoped date-range query in InvoiceRepository.
  • [ ] T02 Implement InvoiceCsvExporter with anti-CSV-Injection escaping and unit tests.
  • [ ] T03 Expose GET /api/v1/invoices/export in InvoiceExportController reading tenantId from JWT.
  • [ ] T04 Add integration test verifying tenant A never receives tenant B invoices.

Immediately after, /speckit.analyze cross-checks that every requirement (REQ-01 through REQ-06) maps to concrete tasks and violates zero rules in constitution.md. If anything conflicts, it halts before coding starts.

sequenceDiagram
    autonumber
    actor Dev as Developer
    participant Agent as AI Agent + Spec Kit
    participant Repo as Spring Boot Repo / Git

    Dev->>Agent: /speckit.specify + /speckit.clarify (on Jira ticket PAY-412)
    Agent->>Repo: Creates and refines specs/PAY-412_export-csv/spec.md
    Dev->>Agent: /speckit.plan -> /speckit.tasks -> /speckit.analyze
    Agent-->>Dev: Outputs 4-file plan, tasks.md & green consistency check
    Dev->>Agent: /speckit.implement
    Agent->>Repo: Writes InvoiceCsvExporter, Controller & JUnit tests; runs mvn test
    Dev->>Agent: /speckit.converge
    Agent-->>Dev: Confirms 100% requirement coverage against spec.md
    Dev->>Repo: Checks git diff --stat and opens small Pull Request

Step 6: /speckit.implement — Focused code and real tests

Running /speckit.implement executes tasks.md item by item, marking each [x] once its tests pass. Thanks to the upstream specification and plan, the generated implementation stays clean, scoped, and secure by default.

The exporter component isolates formatting and blocks spreadsheet formula injection:

package com.secdevoops.billing.export;

import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Component;

@Component
public class InvoiceCsvExporter {

    private static final Set<Character> FORMULA_PREFIXES = Set.of('=', '+', '-', '@', '\t', '\r');
    private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ISO_LOCAL_DATE;

    public String toCsv(List<InvoiceExportRow> rows) {
        StringBuilder sb = new StringBuilder();
        sb.append("invoice_number;issue_date;amount_eur;customer_name\n");

        for (InvoiceExportRow row : rows) {
            sb.append(sanitizeCell(row.invoiceNumber())).append(';')
              .append(DATE_FMT.format(row.issueDate())).append(';')
              .append(row.amountEur().toPlainString()).append(';')
              .append(sanitizeCell(row.customerName())).append('\n');
        }
        return sb.toString();
    }

    String sanitizeCell(String rawValue) {
        if (rawValue == null) {
            return "";
        }
        String cleaned = rawValue.replace("\n", " ").replace("\r", " ").trim();
        if (!cleaned.isEmpty() && FORMULA_PREFIXES.contains(cleaned.charAt(0))) {
            cleaned = "'" + cleaned;
        }
        if (cleaned.contains(";") || cleaned.contains("\"")) {
            return "\"" + cleaned.replace("\"", "\"\"") + "\"";
        }
        return cleaned;
    }
}

And the controller reads tenantId strictly from the verified JWT (JSON Web Token, the signed cryptographic credential proving who is logged in) rather than trusting URL parameters:

package com.secdevoops.billing.api;

import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;

@RestController
@RequestMapping("/api/v1/invoices")
public class InvoiceExportController {

    private final InvoiceService invoiceService;
    private final InvoiceCsvExporter csvExporter;

    public InvoiceExportController(InvoiceService invoiceService, InvoiceCsvExporter csvExporter) {
        this.invoiceService = invoiceService;
        this.csvExporter = csvExporter;
    }

    @GetMapping("/export")
    public ResponseEntity<byte[]> exportInvoicesCsv(
            @AuthenticationPrincipal Jwt jwt,
            @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate from,
            @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate to) {

        if (from.isAfter(to) || ChronoUnit.DAYS.between(from, to) > 365) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid date range (max 365 days).");
        }

        String tenantId = jwt.getClaimAsString("tenant_id");
        if (tenantId == null || tenantId.isBlank()) {
            throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Unauthorized tenant.");
        }

        var rows = invoiceService.findForExport(tenantId, from, to, 5000);
        byte[] csvBytes = csvExporter.toCsv(rows).getBytes(StandardCharsets.UTF_8);

        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(new MediaType("text", "csv", StandardCharsets.UTF_8));
        headers.setContentDisposition(ContentDisposition.attachment().filename("invoices.csv").build());
        return ResponseEntity.ok().headers(headers).body(csvBytes);
    }
}

Step 7: /speckit.converge & pre-PR check

Before pushing, run /speckit.converge so the agent audits the code against spec.md. If it missed an edge-case test (for example, checking that a 400-day span returns HTTP 400), it automatically appends that task to tasks.md.

Finally, run two quick sanity checks in your terminal before opening the PR and triggering Jenkins or GitHub Actions:

git diff --stat
mvn test

3. Two Classic Beginner Mistakes with Spec Kit (and How to Avoid Them)

When teams adopt this workflow, two early mistakes show up repeatedly:

  1. Stuffing a huge multi-week Jira epic into a single /speckit.specify: If a ticket touches SQL migrations, multiple APIs, frontend views, and Jenkins scripts, plan.md and the final PR both blow up in size. Split large epics into 1-to-3-day stories and run the Spec Kit loop per story.
  2. Skipping /speckit.clarify and /speckit.analyze to "save time": Those two commands take under two minutes and eliminate 80% of agent hallucinations. Without clarify, the AI guesses missing Jira requirements; without analyze, it can violate project conventions or add unapproved libraries.

4. Production Field Notes

Running this workflow across real teams using Jira, Git, and CI pipelines (Jenkins or GitHub Actions) surfaces three practical lessons:

  • Link specs/PAY-412_export-csv/ inside the PR description: When a teammate opens your Pull Request and reads spec.md and plan.md first, review time drops sharply because design intent and security rules are explicit upfront.
  • Stay pragmatic about trivial fixes: Fixing a typo, a CSS margin, or an obvious 3-line null check with a unit test does not need all seven Spec Kit steps. Reserve the full cycle for new features, business-rule changes, or multi-file refactors.
  • Keep branches clean after merge: Once human reviewers and Jenkins/GitHub Actions approve and merge into main, delete your local feature branch so context stays crisp for the next ticket.

5. Try This Today in 15 Minutes + Quick Self-Check

Your 15-minute exercise: Pick the next real Jira ticket in your sprint. Create a dedicated branch (feature/TICKETname), run /speckit.specify slug=TICKETname ... followed by /speckit.clarify, /speckit.plan, /speckit.tasks, and /speckit.analyze. Notice how answering the three clarify questions immediately exposes edge cases missing from the original Jira ticket before running /speckit.implement.

Quick self-check

  1. Why pass slug=PAY-412_export-csv when calling /speckit.specify?

Answer: It preserves 1-to-1 traceability between your Jira ticket, Git branch, and specs/ folder, avoiding generic counters when multiple engineers work in parallel.

  1. What does /speckit.clarify solve compared to jumping straight to code?

Answer: It surfaces missing business and edge-case details in the Jira ticket (empty states, row caps, filename format) and lets you decide before any design or code is written.

  1. What is the difference between /speckit.analyze and /speckit.converge?

Answer: /speckit.analyze runs before coding to validate consistency across spec.md, plan.md, tasks.md, and the Constitution; /speckit.converge runs after coding to verify 100% requirement coverage.

  1. Which two security controls protected the PAY-412 CSV export?

Answer: Extracting tenantId strictly from the verified server-side JWT token (preventing cross-tenant data access) and prefixing ' on cells starting with =, +, -, or @ to stop CSV Formula Injection.


6. Quick Pre-PR Checklist

  • [ ] Created a dedicated Git branch for this Jira ticket (1 spec = 1 branch).
  • [ ] Completed /speckit.specify and resolved ambiguities with /speckit.clarify.
  • [ ] Reviewed plan.md, tasks.md, and passed /speckit.analyze against the Constitution.
  • [ ] Executed /speckit.implement and verified full coverage with /speckit.converge.
  • [ ] Inspected git diff --stat and ran local tests (mvn test) before opening the Pull Request.

Recommended next step: In the next installment, we will cover how to keep commits small and structured during /speckit.implement to open Pull Requests your team can review in 5 minutes, plus automated checks in Jenkins and GitHub Actions before human review.


If you are introducing AI coding agents and Spec-Driven Development across your engineering team—from Jira and Git workflows to secure CI pipelines—explore my Architecture & Security Services or learn more on About Me.


References & Official Sources