Automating the Full Development Cycle with Claude Code’s /prd, /goal, and /after-goal
Using a real-world case, the article demonstrates how Claude Code’s three slash commands—/prd, /goal, and /after-goal—can fully automate a development workflow, turning requirement decomposition into structured PRDs, card‑based implementation, and automatic code submission, review, and closure, thereby boosting efficiency and consistency.
Three‑Stage AI‑Assisted Development Workflow
Claude Code provides three slash‑commands— /prd, /goal, and /after-goal —that can be combined into a reusable Skill to automate the full pipeline from requirement definition to code merge.
Stage 1 – /prd : Requirement Decomposition
Install the PRD Skill at https://console.cloud.baidu-int.com/onetool/skills/4793.
Run /prd with the product idea “诊断案例记录与反馈闭环”. Claude Code generates a structured PRD document saved to tasks/prd-self-evolution.md and creates five iCafe cards covering description, acceptance criteria, priority, and dependencies.
The PRD forces clarification of user stories, non‑goals, and card dependencies before any code is written, reducing misunderstanding and missing edge cases.
Stage 2 – /goal : Card‑Based Implementation
Each card is processed individually with /goal. Two representative cards are shown.
Card 46 – Case data model & Markdown I/O library
Claude Code queries the card via icafe-cli card get to obtain description and acceptance criteria.
Project context is read from diag/CLAUDE.md and diag/model/types.go.
Four core functions are generated: WriteCase, ReadCase, ListCases, UpdateCase.
Ten unit tests cover round‑trip serialization, file I/O, list filtering, partial updates, empty results, special characters, and error scenarios.
All checks ( go vet, go build, go test ./diag/...) pass.
Card 47 – Pipeline integration
The exported function claude.BuildPrompt is extracted and a new configuration field PipelineConfig.CasesDir is added to make case‑file output optional. Pipeline.Run is modified to defer writing the case file, handling success and failure paths with golog.Warn without blocking the main flow.
The helper extractSections is fixed to locate content by known section titles ( System Prompt, User Prompt) instead of naïve newline splitting, correctly handling sub‑headings ( ##).
Three new tests verify successful write, failure handling, and behavior when CasesDir is empty.
The /goal command performs code generation and testing; it does not submit code or update cards.
Stage 3 – /after-goal : Automatic Submission, Review, Merge, and Card Closure
Install the after‑goal Skill at https://console.cloud.baidu-int.com/onetool/skills/4797.
After a card’s code is generated, Claude Code automatically invokes the after‑goal Skill.
Step 1 – Commit : git add diag/cases/case.go diag/llm/claude/claude.go … and
git commit -m "baidu-sys-nccl-sys-skills-47 Pipeline 诊断完成后自动写入 Case 文件". The commit message starts with the card ID, satisfying iCode’s requirement to bind the commit to a card.
Step 2 – Push to Gerrit : git push origin HEAD:refs/for/master. The refs/for/ prefix creates a review request and returns the CR number.
Step 3 – Review & Merge
icode-cli api get_review_info -n 120869646 -o table
icode-cli api set_review_score -r baidu/sys-nccl/sys-skills -n 120869646 -s 2
icode-cli api submit_review -r baidu/sys-nccl/sys-skills -n 120869646Step 4 – Update Card Description
icafe-cli card update --space baidu-sys-nccl-sys-skills --sequence 47 \
--detail "original description<h3>实现总结</h3><ul>…</ul>"The --detail flag overwrites the description, so the original content must be retained and the implementation summary appended.
Step 5 – Close Card : Determine the correct status name (e.g., “已完成” or “Done”) with icafe-cli card next-statuses --space … --sequence 47, then close the card:
icafe-cli card update --space … --sequence 47 --status 已完成Key Technical Observations
PRD first : A structured PRD forces clear scope and acceptance criteria, preventing rework caused by AI mis‑interpreting vague requirements.
Appropriate card granularity : Small, well‑defined cards (e.g., separate data‑model and pipeline integration) enable AI to implement each piece correctly without losing focus.
Dependency‑driven order : Implement cards according to their dependency graph (Card 47 depends on Card 46) to avoid conflicts.
CLI over browser : Using CLI tools ( icafe-cli, icode-cli, git) is faster and more reliable than manual browser interactions.
Skill as knowledge carrier : The /after-goal Skill encapsulates the entire post‑implementation process (commit, push, review, merge, card update, closure), turning tacit operational knowledge into reusable automation.
Early bug fixes : Issues discovered during a card’s implementation (e.g., extractSections failing on sub‑headings) are fixed immediately, minimizing downstream cost.
Reference Implementation
The workflow is open‑sourced at https://github.com/smallnest/goal-workflow and documented at https://goal.rpcx.io/.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
