Agent skill
raft-consensus-design
Raft 합의 알고리즘 설계 및 구현 가이드. 분산 시스템, 합의 프로토콜, 리더 선출, 로그 복제를 구현할 때 사용한다.
Install this agent skill to your Project
npx add-skill https://github.com/revfactory/claude-code-harness/tree/main/experiments/results/case-011/harness/.claude/skills/raft-consensus-design
SKILL.md
Raft Consensus Design Skill
핵심 개념
노드 상태 전이
starts up
|
[Follower] <--------------------------+
| |
election timeout discovers higher term
| |
[Candidate] -----------------> [Leader]
| wins |
| election |
+------------------------+
discovers higher term
AppendEntries RPC
- 리더 -> 팔로워 heartbeat + 로그 복제
- prevLogIndex/prevLogTerm 일치 검증
- 불일치 시 nextIndex 감소 후 재전송
- leaderCommit으로 커밋 인덱스 동기화
RequestVote RPC
- 후보 -> 전체 노드 투표 요청
- 투표 조건: term이 같거나 높고, 로그가 최소한 같이 up-to-date
- 한 term에 하나의 투표만 허용
안전성 보장
- Election Safety: 한 term에 최대 1명의 리더
- Leader Append-Only: 리더는 로그를 덮어쓰지 않음
- Log Matching: 같은 index+term -> 같은 명령
- Leader Completeness: 커밋된 엔트리는 미래 리더에도 존재
- State Machine Safety: 같은 인덱스 -> 같은 명령 적용
구현 순서
- RaftLog (순수 데이터 구조)
- Message 정의 (AppendEntries, RequestVote)
- RaftNode 상태 머신 (가장 핵심)
- Timer (시뮬레이션용)
- Transport (메시지 전달)
- KVStateMachine
- Cluster (통합)
- 테스트 (선출 -> 복제 -> 파티션)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
interpreter-design
Programming language interpreter design and implementation guide. Use when the user requests building an interpreter, parser, lexer, or language implementation — including Pratt parsing, AST evaluation, scope chains, and closures.
express-api-design
Express.js REST API design and implementation guide. Use when implementing REST API endpoints, creating Express routes, or setting up API project structure with MVC pattern.
query-engine-design
SQL query engine design and implementation guide. Use when the user requests building a SQL engine, query parser, query planner, or query executor — including in-memory storage, SQL parsing, and query optimization.
api-documentation
Write accurate and complete library API documentation. Use when creating API docs, README files, or function reference documentation. Ensures all signatures, parameters, return types, and examples are precise.
async-debugging
Analyze and fix race conditions and concurrency bugs in async code. Use when debugging async bugs, fixing race conditions, resolving concurrency issues, or when shared state is accessed by multiple async operations.
reactive-spreadsheet-design
리액티브 스프레드시트 엔진 설계 가이드. 셀 수식 파싱, 의존성 그래프(DAG), 증분 재계산, 내장 함수 구현 시 사용한다.
Didn't find tool you were looking for?