Boosting Java Backend with SpecKit: AI‑Powered Spec‑Driven Development

This article shares a hands‑on experience of applying SpecKit and AI‑assisted coding to a mature Java backend, detailing the spec‑driven workflow, tool selection, environment setup, step‑by‑step commands, concrete examples, observed benefits, encountered challenges, and practical lessons for future projects.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
Boosting Java Backend with SpecKit: AI‑Powered Spec‑Driven Development

Background

Inspired by an initial trial of AI‑generated code combined with SpecKit, the author summarizes practical insights gained while applying spec‑driven development (SDD) to a mature Java application.

Selection

The AI coding landscape is divided into three layers:

Model layer – different models excel at deep analysis or rapid implementation; choose based on scenario and security requirements.

Coding‑tool layer – two main camps: CLI tools and intelligent IDE extensions.

Security layer – consider code‑upload risks.

Current popular combos include cursor + Claude 4.5 (high quality, two requests) and cursor + composer‑1 (fast, high quality, one request). For C3‑level code security, the chosen stack is IDEA + Qwen Code CLI + Qwen‑3 Coder Plus .

Environment Setup

Install Qwen Code: sudo npm install -g @qwen-code/qwen-code@latest Verify installation: qwen --version Install SpecKit from its GitHub releases: https://github.com/github/spec-kit/releases After downloading, extract the tools into the project root.

SpecKit Workflow

SpecKit follows SDD/TDD principles and breaks development into ordered steps: principle → requirement → plan → task → implementation . The main commands are:

Use /speckit.constitution to create governing principles and development guidelines.

Use /speckit.specify to describe what to build (focus on what and why, not the tech stack).

Use /speckit.plan to provide the tech stack and architecture choices.

Use /speckit.tasks to generate an actionable task list from the plan.

Use /speckit.implement to execute all tasks and build the feature.

Example commands:

/speckit.constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements
/speckit.specify Build an application that can help me organize my photos in separate photo albums. Albums are grouped by date and can be re‑organized by dragging and dropping on the main page. Albums are never in other nested albums. Within each album, photos are previewed in a tile‑like interface.
/speckit.plan The application uses Vite with minimal libraries. Use vanilla HTML, CSS, and JavaScript as much as possible. Images are not uploaded anywhere and metadata is stored in a local SQLite database.
/speckit.tasks
/speckit.implement

Execution Example

Requirement: provide an operation‑team tool that parses an Excel file and generates a zip package of images for reporting.

Key steps (with screenshots omitted for brevity):

Step 1 – Define Principles :

/speckit.constitution 遵循模块化设计原则,采用 COLA 架构,遵循阿里巴巴开发规范,代码遵循最小依赖原则,代码规范和样式统一,SpecKit 相关文件尽量用中文表述

Step 2 – Specify Requirements :

/speckit.specify 需要对 com.alicom.message.supervise.service.register 包下的报备材料功能进行升级,新增加来自供应链反馈的固定材料管理能力,提供给供应链和服务团队的运维人员对固定材料的管理服务,对应的 git 分支为 feature/20251029_27086783_mt_1

Step 3 – Plan Architecture :

/speckit.plan 先分析 RegisterMaterialsManageServiceI 的实现结构,先生成主体代码结构,包含 rpc 实现 domainservice gateway mapper converter,组件生成到 com.alicom.message.supervise.service.register.file.components,预留 excel 解析、图片处理、zip 压缩的逻辑实现

Step 4 – Generate Tasks : /speckit.tasks Step 5 – Implement : /speckit.implement During implementation, the AI repeatedly refined the generated pseudo‑code, added missing context (e.g., OSS client usage), and recorded decisions in ADR files. Multiple rounds of clarification ( /speckit.clarify) and checklist ( /speckit.checklist) were used to ensure completeness.

Advantages

Memory capability – once corrected, the AI retains the changes.

Fine‑grained interaction – each step allows detailed feedback.

High style fidelity – given examples, the generated code matches the desired format and structure.

Issues

Missing early validation caused rework in later stages, increasing time and context size.

Without concrete examples, the AI may infer incorrect structures.

Occasional model stalls required restarting the Qwen Code session, leading to lost context.

Qwen Code file‑reading speed is slower than cursor.

The specify and plan phases did not automatically produce publishable API specifications, requiring manual handling.

Reflection & Summary

1. Productivity boost: After the first implementation, subsequent similar tasks reuse the accumulated knowledge, dramatically shortening delivery time.

2. AI is not magic: Like humans, the model can lose context or make logical errors; clear, focused specifications reduce rework.

3. Dual‑screen workflow: Developers can keep the AI agent on one screen for feedback while working on other tasks on a second screen.

4. Standardization: AI helps enforce coding standards and produce consistent documentation (e.g., architecture, test structure, best‑practice guides).

5. Knowledge retrieval: Future work should integrate global knowledge search so the AI can fetch relevant design patterns without repeated manual input.

AutomationAI codingDevOpsJava BackendSpec‑Driven DevelopmentSpecKit
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.