Intelligent feature injection with project knowledge. Extracts project structure, plans implementation following conventions, and safely injects new code.
Ships in chkim-su-serena-refactor. Installing the plugin adds it to Claude Code.
Intelligent feature injection based on project knowledge extraction.
Skill("serena-refactor:project-knowledge-graph")
Skill("serena-refactor:feature-injection-rules")
/serena-refactor:inject [feature description]
┌──────────────────────────────────────────────────────────────┐
│ /inject Workflow │
├──────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ │
│ │ Start │ │
│ └──────┬──────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ Check for existing │───▶│ knowledge-extractor │ │
│ │ knowledge graph │ No │ agent │ │
│ └──────┬──────────────┘ └──────────┬──────────┘ │
│ │ Yes │ │
│ ▼ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Project Knowledge Available │ │
│ └──────────────────────┬──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ feature-planner agent │ │
│ │ (Design implementation plan) │ │
│ └──────────────────────┬──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ User Review │ │
│ │ (Approve/Modify Plan) │ │
│ └──────────────────────┬──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ code-injector agent │ │
│ │ (Execute injection) │ │
│ └──────────────────────┬──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Update Knowledge Graph │ │
│ └──────────────────────┬──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ Complete │ │
│ └─────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
mcp__serena__read_memory:
key: "project-knowledge-graph.md"
AskUserQuestion:
question: "프로젝트 지식 그래프가 없습니다. 추출할까요?"
header: "지식 추출"
options:
- label: "전체 추출 (Recommended)"
description: "프로젝트 전체를 분석하여 지식 그래프 생성"
- label: "특정 디렉토리만"
description: "분석할 디렉토리 지정"
- label: "건너뛰기"
description: "지식 그래프 없이 진행 (비권장)"
Task:
agent: "knowledge-extractor"
prompt: |
Extract project knowledge for feature injection.
Project path: [current directory]
Scope: [full/specific path based on user choice]
Return comprehensive knowledge graph including:
- Project structure
- Key symbols and their relationships
- Detected patterns
- Coding conventions
If not provided in command:
AskUserQuestion:
question: "어떤 기능을 추가하시겠습니까?"
header: "기능 설명"
options:
- label: "새 서비스/클래스"
description: "새로운 비즈니스 로직 컴포넌트"
- label: "기존 클래스 확장"
description: "기존 클래스에 메서드/기능 추가"
- label: "새 엔드포인트/핸들러"
description: "새로운 API 엔드포인트 또는 이벤트 핸들러"
- label: "유틸리티/헬퍼"
description: "재사용 가능한 유틸리티 함수"
Then ask for details:
AskUserQuestion:
question: "기능에 대해 자세히 설명해주세요 (목적, 입출력, 동작 등)"
header: "상세 설명"
Task:
agent: "feature-planner"
prompt: |
Plan feature implementation based on project knowledge.
## Project Knowledge
[knowledge_graph from step 1]
## Feature Request
[user's feature description from step 2]
## Requirements
1. Follow existing project conventions
2. Maintain SOLID principles
3. Plan safe injection points
4. Include all necessary imports
5. Consider impact on existing code
Return detailed implementation plan with:
- Step-by-step instructions
- Exact code to inject
- File locations and anchors
- Import requirements
- Rollback plan
Present the plan to user:
## 구현 계획
### 요약
[Brief summary of what will be created/modified]
### 단계별 계획
| 단계 | 작업 | 대상 | 설명 |
|------|------|------|------|
| 1 | [create/insert/modify] | [file:symbol] | [description] |
| 2 | ... | ... | ... |
### 코드 미리보기
[Code preview for each step]
### 영향 분석
- 영향받는 파일: [count]
- 생성할 심볼: [count]
- 수정할 심볼: [count]
- Breaking changes: [yes/no]
AskUserQuestion:
question: "이 계획대로 진행할까요?"
header: "승인"
options:
- label: "승인 및 실행"
description: "계획대로 코드 삽입 진행"
- label: "Dry Run 먼저"
description: "실제 변경 없이 시뮬레이션"
- label: "계획 수정 필요"
description: "요구사항 변경 또는 추가 설명"
- label: "취소"
description: "작업 취소"
Task:
agent: "code-injector"
prompt: |
Perform dry run of injection plan.
## Plan
[implementation plan from step 3]
## Mode
dry_run: true
Validate all steps without making changes.
Report any potential issues.
Task:
agent: "code-injector"
prompt: |
Execute injection plan.
## Plan
[implementation plan from step 3]
## Mode
dry_run: false
Execute all steps in order.
Verify each step before proceeding.
Report results and any issues.
Syntax Check Run appropriate linter/compiler for the language
Symbol Verification Confirm all new symbols are accessible
Reference Check Ensure no broken references
# 1. Read existing graph
mcp__serena__read_memory:
key: "project-knowledge-graph.md"
# 2. Merge updates and write back
mcp__serena__write_memory:
key: "project-knowledge-graph.md"
content: |
[Updated knowledge graph with new additions:
- New symbols: [list]
- New dependencies: [list]
- Updated patterns: [list]]
## 완료!
### 추가된 항목
- [list of created/modified items]
### 다음 단계 제안
1. **테스트 작성**
```bash
# 새 기능에 대한 테스트 추가
[test command suggestion]
변경사항 검토
git diff
커밋 (만족스러운 경우)
git add . && git commit -m "feat: [feature description]"
추가 기능
/serena-refactor:inject 로 더 많은 기능 추가
---
## Error Handling
### Knowledge Extraction Failed
```markdown
지식 추출 중 오류가 발생했습니다.
**가능한 원인:**
- Serena 프로젝트가 활성화되지 않음
- 지원되지 않는 언어/프레임워크
- 파일 접근 권한 문제
**해결 방법:**
1. `/serena-refactor:analyze` 로 프로젝트 상태 확인
2. Serena 설정 확인
구현 계획 생성 중 오류가 발생했습니다.
**가능한 원인:**
- 기능 설명이 모호함
- 일치하는 패턴을 찾을 수 없음
- 프로젝트 구조와 맞지 않는 요청
**해결 방법:**
1. 더 구체적인 기능 설명 제공
2. 예시 코드나 참조할 기존 코드 지정
코드 삽입 중 오류가 발생했습니다.
**오류 상세:**
[error details]
**롤백 상태:**
[rollback status]
**복구 방법:**
1. `git status` 로 변경된 파일 확인
2. `git checkout [file]` 로 원복
3. 계획 수정 후 재시도
/serena-refactor:inject 사용자 알림을 처리하는 NotificationService 추가
Expected flow:
/serena-refactor:inject UserRepository에 findByEmail 메서드 추가
Expected flow:
/serena-refactor:inject POST /api/orders 엔드포인트 추가, 주문 생성 처리
Expected flow:
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
11 commands in this plugin
/analyzeAnalyze CommandSerena MCP-based SOLID analysis. Symbol-level analysis for accurate violation detection and auto-fix paths./auditAudit CommandQuick code quality audit. Verifies code quality before and after refactoring./debugDebug CommandSystematic debugging workflow with parallel agent exploration, root cause analysis, fix strategy design, and verification. Adapted from feature-dev methodology./detect-duplicatesDetect Duplicates CommandDuplicate code and role detection. Identifies clone code, similar functions, and duplicate constants, suggesting consolidation approaches./e2e-testE2E Test CommandExecute real user behavior simulation tests. UI interactions (clicks, inputs, drag-drop), API sequences, and scenario-based E2E testing using Playwright MCP./extractExtract CommandSerena-based code extraction. Safely performs method, interface, and class extraction at the symbol level./chkim-su-serena-refactor:injectfrom chkim-su-serena-refactor
chkim-su-serena-refactor@cascade-code-general-misc-1 is listed by joshuarweaver/cascade-code-general-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin chkim-su-serena-refactorOther plugins' commands for the same job