From zkfy
Reusable 4-phase study SOP for any x-learn project: checkpoint tracking, RAG extraction from any source, team-based parallel implementation with bilingual RADIO docs + FE folder examples, and git commit + doc update per item
npx claudepluginhub jasonsie/zkfy --plugin zkfyThis skill uses the workspace's default tool permissions.
Extracted from two completed x-learn projects:
Guides specification-driven AI development workflows by breaking projects into 2-4 hour sessions using 13 commands like /plansession, /implement, /validate, and /phasebuild.
Guides software development through six-phase workflow: Research, Plan, Iterate Plan, Experiment, Implement, Validate. Generates structured markdown docs via slash commands for auditable trails.
Defines project structure, naming conventions, and workflows for consistent directory layouts, file names, and documentation across skills. Useful for project setup or initialization.
Share bugs, ideas, or general feedback.
Extracted from two completed x-learn projects:
design-patterns/ — 23 GoF patterns (PDF RAG + structured implementation)oop/ — 17 OOP concepts (same pipeline + checkpoint system + git workflow)Use this SOP to bootstrap any new x-learn project or to understand what skills and agents to generate.
Trigger when:
Each project fills in this table once (in its CLAUDE.md or RAG skill):
| Field | Description | design-patterns | oop |
|---|---|---|---|
DOMAIN | Topic area | GoF Design Patterns | OOP Fundamentals |
REFERENCE_TYPE | pdf / web / md / repo / none | pdf | md |
REFERENCE_PATH | Source location | reference/Design_Patterns.pdf | reference/*.md |
TOPIC_CATALOG | Item index file | SUMMARY_MAP.md | SUMMARY_MAP.md |
TIER_SCHEME | Item grouping | 01-foundation/…04-specialized/ | 01-foundations/…03-solid/ |
ITEM_FOLDER_ROOT | Where items live | patterns/ | concepts/ |
LANGUAGE | Implementation language | TypeScript | TypeScript |
TEST_RUNNER | Test command | npx vitest run | npx vitest run |
EXAMPLE_RUNNER | Run example command | npx tsx | npx tsx |
EXTRACTION_FIELDS | What to extract from source | See §6 | See §6 |
Each item (pattern, concept, algorithm) runs through all 4 phases sequentially.
Before any work, record a start checkpoint:
TIMESTAMP=$(date +%Y-%m-%d-%H:%M)
SHA=$(git rev-parse --short HEAD)
echo "${TIMESTAMP} | {ITEM_NAME}-start | ${SHA}" >> .claude/checkpoints.log
Report to user:
CHECKPOINT: {ITEM_NAME}-start
========================
SHA: {sha}
Time: {timestamp}
Rule: Always read the actual source. Never rely on model memory.
Based on REFERENCE_TYPE:
| Type | How to read |
|---|---|
pdf | Use Read tool with pages parameter; look up page range in the page-map table in the RAG skill |
md | Use Read tool on the specific reference .md file(s) mapped to this item |
web | Use WebFetch or /firecrawl-scrape to fetch the canonical documentation URL |
repo | Use Serena MCP (mcp__serena__*) + Grep/Read to scan source code |
none | Skip to Phase 2 Step 2 (deep research only) |
For PDFs spanning > 10 pages: split into two Read calls (PDF tool max = 20 pages per call).
Extract the fields defined by EXTRACTION_FIELDS for this domain (see §6 for domain-specific templates).
Output: a structured block with all fields clearly labeled. This feeds into Phase 2.
When implementing multiple items (e.g., all items in a tier):
If running as a subagent, always re-read the source — never rely on context passed from another agent or prior phases.
Real-world examples are non-negotiable. No Animal/Dog/Cat textbook examples.
Research tools available:
/deep-research — multi-source deep research with reasoning synthesis/firecrawl or /firecrawl-scrape — scrape real library source code or live docs/exa-search — neural search for finding specific implementations in the wild/search-first — research-before-coding: find what already exists before buildingmcp__serena__*) — scan reference source code for real patterns, class hierarchies, and usage examples when the reference is a codebaseResearch questions to answer for every item:
Reasoning process: Show the chain — why this example was chosen, what alternatives were considered, what makes it a good teaching example. The reasoning is part of the output.
3-layer example depth (required):
Write ONE concrete question that:
Format:
EN: {question in English}
中文: {same question in Traditional Chinese}
Create {ITEM_FOLDER_ROOT}/{tier}/{name}/README.md with this exact structure:
# {Item Name}
## Design Scenario (設計情境)
> **EN**: {Concrete design question from Step 3}
> **中文**: {Same question in Traditional Chinese}
---
## [R] Requirements Exploration
### Core Problem
{What is varying? What should stay stable? What breaks without this concept/pattern?}
### When to Use
- {Condition 1}
- {Condition 2}
### When NOT to Use
- {Anti-condition 1: when the simpler approach is fine}
- {Anti-condition 2}
---
## [A] Architecture
### Classification
- **Category / Type**: {e.g., Behavioral / Structural / Creational / Principle}
- **Scope**: {Class / Object / Method / Interface}
- **Core principle**: {One-liner: what OO/design principle this embodies}
### Structure
{ASCII diagram}
### Participants
| Role | Description |
|------|-------------|
| ... | ... |
### Collaborations
{How participants interact at runtime}
---
## [D] Data Model
### Core Interfaces (TypeScript)
\`\`\`typescript
// Key interfaces/types defining the contract
\`\`\`
### Type Relationships
{implements / extends / composes — describe the relationship graph}
---
## [I] Interface Definition
### Public API
\`\`\`typescript
// What client code looks like
\`\`\`
### Extension Points
{How to add a new concrete implementation}
---
## [O] Optimizations & Deep Dive
### Consequences (Trade-offs)
{From source material or reasoned analysis}
### TypeScript-Specific Considerations
- {Generics usage}
- {Functional variant idioms}
### Real-World Usage in the Wild
- **{Framework/Library}**: {How it uses this — specific version/file if known}
- **{Framework/Library}**: {How it uses this}
### Related Items
| Item | Relationship | Notes |
|------|-------------|-------|
| ... | ... | ... |
### Key Design Insights
1. {Most important insight}
2. {Second insight}
3. {Common mistake to avoid}
src/{name}.ts:
demo() or main() section at the bottomany, generics where they add genuine valuesrc/{name}.test.ts:
vitest (import { describe, it, expect } from 'vitest')examples/{scenario-name}/ — Full FE Folder Structure (required):
examples/
{scenario-name}/
types/
index.ts # All interfaces, types, enums — zero implementation
{role-plural}/ # Named after pattern participants:
{concrete-1}.ts # strategies/ handlers/ states/ decorators/ etc.
{concrete-2}.ts # One class per file
{concrete-3}.ts
index.ts # Re-exports all concretes
services/
{context-service}.ts # Context / orchestration / facade layer
index.ts
utils/
index.ts # Pure helpers — no pattern classes
index.ts # Entry point: opens with problem comment, main(), runs it
index.ts entry point requirements:
// Problem: {what breaks without this pattern/concept}async function main() demonstrating: the design scenario, 2-3 concretes in action, runtime swap/extension (if applicable)main().catch(console.error)npx tsx {ITEM_FOLDER_ROOT}/{tier}/{name}/examples/{scenario}/index.tsAfter all files are created and tests pass:
1. Verify:
npx vitest run {ITEM_FOLDER_ROOT}/{tier}/{name}/
npx tsx {ITEM_FOLDER_ROOT}/{tier}/{name}/examples/{scenario}/index.ts
Fix any failures before proceeding.
2. Record done checkpoint:
TIMESTAMP=$(date +%Y-%m-%d-%H:%M)
SHA=$(git rev-parse --short HEAD)
echo "${TIMESTAMP} | {ITEM_NAME}-done | ${SHA}" >> .claude/checkpoints.log
3. Git commit (one commit per completed item):
git add {ITEM_FOLDER_ROOT}/{tier}/{name}/
git commit -m "feat({item-name}): add Tier {N} {tier-label} -- {scenario description}, {N} tests"
Commit message convention: feat({item}): add Tier {N} {tier-label} -- {scenario}, {N} tests
Example: feat(strategy): add Tier 1 Foundation -- payment gateway (3 providers), 12 tests
4. Run /everything-claude-code:update-docs (ECC plugin command) to update related documentation:
{TOPIC_CATALOG} (SUMMARY_MAP) status columndoc-updater agent from ECC5. Report to user:
CHECKPOINT: {ITEM_NAME}-done
========================
SHA: {sha}
Time: {timestamp}
State: complete ({X} files created, {N} tests passed)
Files:
{list of files created}
Run: npx tsx {ITEM_FOLDER_ROOT}/{tier}/{name}/examples/{scenario}/index.ts
File: .claude/checkpoints.log (append-only, never edit past entries)
Format: {YYYY-MM-DD-HH:MM} | {label} | {git-short-sha}
Labels:
project-init — project first created{item-name}-start — beginning work on an item{item-name}-done — item fully complete and testedUsing the log for session resumption:
cat .claude/checkpoints.log
Find unpaired starts (start with no matching done) = work in progress.
feat({item}): add Tier {N} {tier-label} -- {scenario}, {N} testsfeat (new item), fix (correction), chore (scaffold/config), docs (doc-only){project-root}/
CLAUDE.md # Project instructions for Claude
SUMMARY_MAP.md # Topic catalog with status column
reference/ # Source material (PDFs, MDs, etc.)
{ITEM_FOLDER_ROOT}/
{tier-01}/
{item-name}/
README.md # RADIO walkthrough (bilingual)
src/
{item-name}.ts # OOP + functional implementation
{item-name}.test.ts # Vitest tests
examples/
{scenario-name}/ # FE folder structure (not a flat file)
types/index.ts
{role-plural}/ # pattern participants
services/index.ts
utils/index.ts
index.ts # Entry point with main()
{tier-02}/
...
.claude/
checkpoints.log # Append-only progress log
settings.json # Tool permissions for agents
skills/
{domain}-rag.md # RAG skill with source page/file map
implement-{domain}-item.md # Implementation skill (5 steps)
agents/
{domain}-builder.md # Orchestrating agent (4 phases)
When creating a new x-learn project, generate these files:
mkdir -p {project-root}/.claude/{skills,agents}
mkdir -p {project-root}/reference
mkdir -p {project-root}/{ITEM_FOLDER_ROOT}
cd {project-root}
git init
package.json — with tsx, typescript, vitest, @types/node as devDependenciestsconfig.json — strict: true, target: ES2022, module: NodeNext, includes: ["{ITEM_FOLDER_ROOT}/**/*.ts"]SUMMARY_MAP.md — Topic catalog with classification table, relationship diagram, learning order, and status tracker (all items start as "Not started").claude/settings.json — Tool permissions for agents:
{
"permissions": {
"allow": [
"Bash(npx vitest run*)",
"Bash(npx tsx*)",
"Bash(git rev-parse*)",
"Bash(git add*)",
"Bash(git commit*)",
"Bash(date*)",
"Bash(echo*)"
]
}
}
.claude/checkpoints.log — Initialize with project-init entry:
{TIMESTAMP} | project-init | {SHA}
.claude/skills/{domain}-rag.md — RAG skill with:
.claude/skills/implement-{domain}-item.md — Implementation skill with:
.claude/agents/{domain}-builder.md — Orchestrating agent with:
CLAUDE.md — Project instructions summary (structure, commands, agent to use, key reference files)reference/ — Add source material (PDFs, MDs, etc.)git add .
git commit -m "chore: init {DOMAIN} project scaffold"
The SOP references skills, MCP servers, and tools that may not all be available in every project context. This section maps each dependency and how to resolve it.
| Dependency | Type | Scope | How It's Resolved |
|---|---|---|---|
/deep-research | ECC plugin skill | Global | Available everywhere if everything-claude-code plugin is installed |
/firecrawl / /firecrawl-scrape | ECC plugin skill | Global | Available everywhere via ECC plugin |
/exa-search | ECC plugin skill | Global | Available everywhere via ECC plugin. Requires Exa MCP server (see below) |
/search-first | ECC plugin skill | Global | Available everywhere via ECC plugin |
/everything-claude-code:update-docs | ECC plugin command | Global | Available everywhere via ECC plugin |
doc-updater agent | ECC plugin agent | Global | Available everywhere via ECC plugin |
| Serena MCP | MCP server | Per-project | Must be in .mcp.json (project or parent directory) |
| Firecrawl MCP | MCP server | Per-project | Must be in .mcp.json with FIRECRAWL_API_KEY |
| Exa MCP | MCP server | User-level | Must be in ~/.claude.json with EXA_API_KEY |
| Context7 MCP | MCP server | User-level | Already in ~/.claude.json (no key needed) |
WebFetch / WebSearch | Built-in tool | Global | Always available |
Read (PDF pages) | Built-in tool | Global | Always available |
.mcp.json searches upward through all parent directories and merges all configs. This means:
/Users/jason/Developer/x-learn/programming/
.mcp.json ← Shared by ALL x-learn projects
design-patterns/
.mcp.json ← Merges with parent (overrides on conflict)
oop/
.mcp.json ← Merges with parent
{new-project}/ ← Inherits parent .mcp.json automatically!
This is independent of git — even if a subdirectory has its own .git, it still inherits parent .mcp.json.
.mcp.jsonCreate a shared .mcp.json at the programming/ root so all x-learn projects inherit common MCP servers:
// /Users/jason/Developer/x-learn/programming/.mcp.json
{
"mcpServers": {
"serena": {
"command": "uvx",
"args": ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server"]
},
"firecrawl": {
"command": "npx",
"args": ["-y", "firecrawl-mcp"],
"env": { "FIRECRAWL_API_KEY": "${FIRECRAWL_API_KEY}" }
}
}
}
Then add Exa MCP to user-level config (~/.claude.json) since it's useful across all projects:
// Add to ~/.claude.json mcpServers section:
"exa-web-search": {
"command": "npx",
"args": ["-y", "exa-mcp-server"],
"env": { "EXA_API_KEY": "${EXA_API_KEY}" }
}
Move API keys from hardcoded .mcp.json values to environment variables:
| Key | Set In | How |
|---|---|---|
FIRECRAWL_API_KEY | ~/.zshrc | export FIRECRAWL_API_KEY="fc-..." |
EXA_API_KEY | ~/.zshrc | export EXA_API_KEY="..." |
.mcp.json supports ${VAR} syntax to reference env vars — no hardcoded secrets in config files.
The following ECC plugin must be installed for skill dependencies to resolve:
everything-claude-code (v1.9.0+)
This provides: /deep-research, /firecrawl, /firecrawl-scrape, /exa-search, /search-first, /everything-claude-code:update-docs, doc-updater agent, code-reviewer agent, and more.
When bootstrapping a new x-learn project, verify these dependencies:
everything-claude-code plugin is installed (~/.claude/plugins/).mcp.json exists at programming/ root (or create per-project)FIRECRAWL_API_KEY env var is setEXA_API_KEY env var is set (if using /exa-search)~/.claude.json (if using /exa-search)~/.claude.json (already done)| Lesson | Source | Applied In |
|---|---|---|
| Always read source on re-entry — never trust memory | design-patterns/ | Phase 1, Phase 2 Step 1 |
| Checkpoint log enables session resumption | oop/ | Phase 0, Phase 3 |
| SUMMARY_MAP status must be updated on completion | oop/ (wasn't updated) | Phase 3 Step 4 |
| FE folder structure (not flat files) is non-negotiable | design-patterns/ | Step 5 examples/ |
| One commit per item (not batched) | oop/ | Phase 3 Step 3 |
| Real-world examples over textbook examples | both | Phase 2 Step 2 |
| /everything-claude-code:update-docs after every completion | design-patterns/ (missing) | Phase 3 Step 4 |
| Serena MCP for scanning repo-based references | oop/ (MCP config) | Phase 1 source reading |