Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add msbaek/msbaek-claude-plugins --skill segregate-functional-coregit clone --depth 1 https://github.com/msbaek/msbaek-claude-pluginsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/segregate-functional-core)<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/segregate-functional-core"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/segregate-functional-core/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/segregate-functional-core"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/segregate-functional-core.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00124 | $0.03832 |
| Opus 5.5 | $0.00050 | $0.01533 |
| Sonnet 5.5 | $0.00025 | $0.00766 |
| Haiku 4.5 | $0.00012 | $0.00383 |
Grade A, and why
segregate-functional-core scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 340 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Segregate Functional Core Skill
I/O 호출이나 Mock collaborator 호출과 순수 계산이 혼재된 메서드를 Impure-Pure-Impure Sandwich(빵속빵) 구조로 분리. Functional Core(순수 로직)와 Imperative Shell(I/O)이 나뉘어 테스트 용이성과 가독성 향상.
GOAL
- 성공 = I/O/Mock과 계산이 혼재된 메서드가 Functional Core와 Imperative Shell로 분리되어 커밋 완료됨
- T1(I/O + 계산 혼재) 또는 T2(Mock stub + 계산 혼재) smell 식별
- Functional Core는 순수 함수로 추출 (입력만 받고 결정/instruction 반환)
- Imperative Shell은 I/O만 담당 (read → pure → write 순서)
- Functional Core 테스트는 mock 없이 값 기반으로 작성
- 모든 기존 테스트 통과
CONSTRAINTS
- 계열: System-wide — 후보 제시 후 승인 받고 적용 (
../../references/refactoring-procedure.md§0·§3-B)
Hard Rules
- 동작 변경 금지 — 구조 개선만 수행
- 테스트 수정 금지 — 기존 테스트는 그대로 통과해야 함 (Functional Core 테스트는 추가)
- 사용자 확인 없이 리팩토링 금지 — 모든 후보는 사용자 승인 후 실행
- 커밋 단위 — 1파일 x 1기법 = 1커밋 (Shell/Core/새 테스트는 논리적으로 함께 커밋)
- git add -A 금지 — 변경된 파일만 명시적으로 추가
Functional Core / Imperative Shell 원칙
- Functional Core: 순수 함수. I/O 호출 없음. mutation 없음. 같은 입력 → 같은 출력
- Imperative Shell: I/O만 담당 (DB, 파일, 네트워크, 시스템 시간). Functional Core에 데이터를 제공하고, 리턴된 instruction/결정을 실행
- 구조:
Impure(read) → Pure(decide) → Impure(write)— 샌드위치의 빵-속-빵 - DDD Trilemma: 도메인 모델을 완전한 불변으로 만드는 비용이 지나치게 크면 Mutable Shell 수용. 순수성·완전성·성능 중 둘만 동시 만족 가능
적용 패턴
Segregate Functional Core 리팩토링 단계:
- 필요 데이터 식별 — Functional Core가 판단에 필요한 모든 입력을 목록화
- 데이터 사전 로드 — Imperative Shell이 함수 시작 전 필요한 데이터를 모두 읽어옴
- Functional Core 추출 — 파라미터로 데이터를 받고, 판단 결과 또는 Instruction 객체를 반환하는 순수 static 함수로 추출
- Imperative Shell 수렴 — 호출자를
read → pure → write순서로 재배치 - Functional Core 테스트 추가 — Mock 없이 값 기반 테스트로 작성
Before/After 예시 (감사 로그 서비스)
출처: Vladimir Khorikov 『단위 테스트』 + Mark Seemann "Impureim Sandwich"
// Before: I/O + 계산 혼재 (T1) + Mock-heavy test (T2)
public class AuditService {
private final FilePersister filePersister; // mock 대상
private final int maxEntries;
public AuditService(FilePersister filePersister, int maxEntries) {
this.filePersister = filePersister;
this.maxEntries = maxEntries;
}
// T1: 읽기(I/O) + 판단(계산) + 쓰기(I/O) 혼재
public void addRecord(String name, LocalDateTime timestamp) {
List<Path> files = filePersister.listAuditFiles(); // I/O
Path current = files.isEmpty() ? null : files.get(files.size() - 1);
int count = current == null
? 0
: filePersister.readLines(current).size(); // I/O
String entry = name + ";" + timestamp.toString();
if (current == null || count >= maxEntries) { // 계산
Path newFile = Paths.get("audit_" + (files.size() + 1) + ".txt");
filePersister.writeLines(newFile, List.of(entry)); // I/O
} else {
filePersister.appendLine(current, entry); // I/O
}
}
}
// T2: 테스트에서 mock stub이 다수 필요
class AuditServiceTest {
@Mock FilePersister persister;
@Test void addRecord_new_file_when_max_entries_reached() {
when(persister.listAuditFiles())
.thenReturn(List.of(Paths.get("audit_1.txt"))); // stub 1
when(persister.readLines(any()))
.thenReturn(List.of("a;...", "b;...", "c;...")); // stub 2
doNothing().when(persister).writeLines(any(), any()); // stub 3
// ...
new AuditService(persister, 3).addRecord("d", NOW);
verify(persister).writeLines(any(), any()); // verify 1
}
}
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago Changed · +1 lines · +67 tokens per session 2245ee541b46
- 2mo ago Changed 75b54cf45fd2
- 3mo ago First seen · 339 lines · 57 tokens per session scan A 216a13d1ce8f
segregate-functional-core is a skill published in the GitHub repository msbaek/msbaek-claude-plugins (8 stars, last pushed 1mo ago), licensed MIT. It adds 124 tokens to every session and 3,832 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
segregate-functional-core compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| segregate-functional-coremsbaek/msbaek-claude-plugins | Skill | 8 | 1mo ago | MIT | A | 124 | Claude Code |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | today | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | today | MIT | A | 71 | Claude Code, Codex |
| observability-audit-sessionsIBM/mcp-context-forge | Skill | 4.9k | today | Apache-2.0 | A | 64 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 343 | today | Apache-2.0 | A | 112 | Claude Code |
| performance-verificationvalkor-ai/loom | Skill | 1.6k | 3d ago | Apache-2.0 | A | 45 | Claude Code, Codex |
| loop-engineeringhuytieu/COG-second-brain | Skill | 1.6k | yesterday | MIT | A | 63 | Claude Code |