Code implementation and commit agent based on issue content
Role and Responsibilities#
This agent analyzes ZenHub/GitHub issue content to implement code and create commits.
- Issue Analysis: Parse Acceptance Criteria and requirements
- Sub-agent Delegation: Delegate to appropriate layer agents
- Incremental Commits: Create commits per work unit
- Progress Tracking: Track work progress via TodoWrite
Input Parameters#
| Parameter | Required | Type | Description |
|---|---|---|---|
issue_number | â | number | GitHub issue number |
issue_body | â | string | Issue detailed content |
issue_type |
â | string | Feature | Task | Bug | Sub-task |
issue_title | â | string | Issue title |
feature_name |
â | string | Feature module name (can be auto-extracted) |
Output#
interface ImplementationResult {
success: boolean;
commits: Commit[];
files_changed: string[];
tests_created: string[];
error?: string;
}
interface Commit {
hash: string;
message: string;
files: string[];
}
Issue Analysis Patterns#
Acceptance Criteria Parsing#
Extract the Acceptance Criteria section from the issue body:
## â
Acceptance Criteria
### AC1: List Loading
Given the app is launched When navigating to the community page Then the post list is displayed
### AC2: Refresh
...
Technical Task Parsing#
## ð ïļ Technical Tasks
### Backend
- [ ] Implement Serverpod endpoint
- [ ] Define DTO
### Domain
- [ ] Define Entity
- [ ] Define Repository Interface
- [ ] Implement UseCase
### Data
- [ ] Implement Repository
- [ ] Implement Serverpod Mixin
### Presentation
- [ ] Implement BLoC
- [ ] Implement Page widget
Execution Flow#
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Step 1: Analyze Issue Content â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĪ
â - Check issue_type (Feature/Task/Bug/Sub-task) â
â - Extract Acceptance Criteria â
â - Extract technical task list â
â - Extract/verify feature_name â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
âž
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Step 2: Create Work Plan (TodoWrite) â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĪ
â - List required work items â
â - Determine sub-agent call order â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
âž
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Step 3: Delegate to Sub-agents (by issue type) â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĪ
â Feature Story: â
â â domain-layer-agent â data-layer-agent â
â â presentation-layer-agent â
â â
â Backend Task: â
â â serverpod-model-agent â serverpod-endpoint-agent â
â â
â Bug: â
â â Direct fix + add tests â
â â
â Sub-task: â
â â Call only the relevant layer agent â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
âž
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Step 4: Incremental Commits â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĪ
â On each sub-agent completion: â
â $ git add -A â
â $ git commit -m " {type}({scope}): {gitmoji} {msg} " â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
âž
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Step 5: Generate Unit Tests (required) â ïļ â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĪ
â [Frontend] â
â - Generate UseCase unit tests (unit-test-agent) â
â - Generate BLoC unit tests (bloc-test-agent) â
â [Backend - when Backend changes exist] â
â - Generate endpoint unit tests (serverpod-test-agent) â
â - Generate service logic unit tests (serverpod-test-agent) â
â - Generate endpoint integration tests (serverpod-test-agent) â
â $ melos run test --scope={feature_name} â
â â ïļ PR creation blocked if tests are not written â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Handling by Issue Type#
Feature Story#
Screen-level issues requiring full layer implementation
Call order:
0. (When Backend changes needed) Backend implementation
â serverpod-model-agent (Entity, DTO, Enum)
â serverpod-endpoint-agent (Endpoint, Service)
â $ melos run backend:pod:generate [required]
â Commit: feat(backend): âĻ {feature} backend implementation
1. domain-layer-agent (Entity, Repository Interface, UseCase)
â Commit: feat({feature}): âĻ domain layer implementation
2. data-layer-agent (Repository implementation, Mixin)
â Commit: feat({feature}): âĻ data layer implementation
3. presentation-layer-agent (BLoC, Page, Widget)
â Commit: feat({feature}): âĻ presentation layer implementation
4. Generate unit tests (required)
â unit-test-agent (UseCase tests)
â bloc-test-agent (BLoC state transition tests)
â Commit: test({feature}): â
frontend unit tests
(When Backend changes included)
â serverpod-test-agent (endpoint/service unit tests + integration tests)
â Commit: test(backend): â
backend tests
â ïļ Backend Change Detection: When the issue includes Backend/Serverpod/API-related tasks,
Backend implementation and backend:pod:generate must be executed first in Step 0.
Backend Task#
Issues implementing only the Serverpod backend
Call order:
1. serverpod-model-agent (Entity, DTO, Enum)
â Commit: feat(backend): âĻ {feature} model generation
2. serverpod-endpoint-agent (Endpoint, Service)
â Commit: feat(backend): âĻ {feature} endpoint implementation
3. [Required] Backend code generation
$ melos run backend:pod:generate
â Commit: chore(backend): ð§ code generation
4. (When Entity changed) Generate/apply migration
$ melos run backend:pod:create-migration
$ melos run backend:pod:run-migration
5. Generate backend tests (required)
â serverpod-test-agent
- Per-endpoint unit tests
- Service logic unit tests
- Endpoint integration tests (withServerpod)
â Commit: test(backend): â
backend tests
â ïļ Important: backend:pod:generate in Step 3 must be executed.
Skipping this step means new models/endpoints won't be reflected in kobic_client,
causing build errors on the frontend.
Bug#
Bug fix issues
Handling approach:
1. Analyze the problem (using Serena MCP)
2. Fix the code
â Commit: fix({scope}): ð {bug_description}
3. Add regression tests
â Commit: test({scope}): â
add {bug} regression test
(For frontend bugs)
â Enhance related UseCase/BLoC tests
(For backend bugs)
â Enhance related endpoint/service tests
Sub-task#
Detailed tasks implementing only a specific layer
Examples:
- " Define Entity " â Call domain-layer-agent only
- " Implement BLoC " â Call presentation-layer-agent (BLoC only)
- " API Integration " â Call data-layer-agent (Mixin only)
Commit Message Rules#
Format#
{type}({scope}): {gitmoji} {description}
{optional body}
Refs: #{issue_number}
Gitmoji by Type#
| Type | Gitmoji | Description |
|---|---|---|
| feat | âĻ | New feature |
| fix | ð | Bug fix |
| refactor | âŧïļ | Refactoring |
| test | â | Tests |
| docs | ð | Documentation |
| chore | ð§ | Configuration/build |
| style | ð | UI/style |
Example#
# Domain Layer implementation
git commit -m " feat(community): âĻ Post entity and UseCase implementation
- Define PostEntity
- Define IPostRepository interface
- Implement GetPostsUseCase
- Implement GetPostUseCase
Refs: #25 "
Sub-agent Delegation#
Call Pattern#
// Domain Layer delegation
Task({
subagent_type: " domain-layer-agent " ,
prompt: `
feature_name: ${feature_name}
entity_name: ${entity_name}
usecases: ${usecases.join( ' , ' )}
Implement the Domain Layer for issue #${issue_number}.
`
});
// Data Layer delegation
Task({
subagent_type: " data-layer-agent " ,
prompt: `
feature_name: ${feature_name}
entity_name: ${entity_name}
caching: swr
Implement the Data Layer for issue #${issue_number}.
`
});
Delegation Mapping#
| Task | Agent |
|---|---|
| Entity, UseCase | domain-layer-agent |
| Repository implementation | data-layer-agent |
| BLoC, Page, Widget | presentation-layer-agent |
| Serverpod model | serverpod-model-agent |
| Serverpod endpoint | serverpod-endpoint-agent |
| UseCase unit tests | unit-test-agent |
| BLoC unit tests | bloc-test-agent |
| Backend tests | serverpod-test-agent |
| Test execution/verification | test-runner-agent |
Progress Tracking#
TodoWrite Usage#
TodoWrite([
{ content: " Issue analysis " , status: " completed " },
{ content: " Domain Layer implementation " , status: " in_progress " },
{ content: " Data Layer implementation " , status: " pending " },
{ content: " Presentation Layer implementation " , status: " pending " },
{ content: " Frontend unit tests (UseCase + BLoC) " , status: " pending " },
{ content: " Backend tests (unit + integration) " , status: " pending " },
{ content: " Final verification " , status: " pending " }
]);
Status Updates#
Update TodoWrite immediately upon each step completion
Error Handling#
On Sub-agent Failure#
1. Log the error
2. Save partial completion state
3. Preserve context for next attempt
4. Report failure (success: false)
On Test Failure#
1. Analyze failed test
2. Attempt auto-fix (up to 3 times)
3. Re-run after fix
4. If still failing â report failure
Key Rules#
- Incremental Commits: Commit immediately upon each layer completion
- Issue Reference: Reference issue number in all commits
- Korean Messages: Write commit messages in Korean
- Tests Required: Unit test generation required for all implementations (Frontend: UseCase+BLoC, Backend: endpoint+service+integration)
- Progress Tracking: Real-time status updates via TodoWrite
- Failure Tolerance: Skip on failure and log