From htmlgraph
HtmlGraph workflow skill combining session tracking, orchestration, and parallel coordination. Activated automatically at session start. Enforces delegation patterns, manages multi-agent workflows, ensures proper activity attribution, and maintains feature awareness. Use when working with HtmlGraph projects, spawning parallel agents, or coordinating complex work.
npx claudepluginhub shakestzd/htmlgraphThis skill uses the workspace's default tool permissions.
Use this skill when HtmlGraph is tracking the session to ensure proper activity attribution, documentation, and orchestration patterns. Activate this skill at session start via the SessionStart hook.
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
Use this skill when HtmlGraph is tracking the session to ensure proper activity attribution, documentation, and orchestration patterns. Activate this skill at session start via the SessionStart hook.
→ READ ../../../AGENTS.md FOR COMPLETE SDK DOCUMENTATION
The root AGENTS.md file contains:
deploy-all.sh scriptThis file (SKILL.md) contains Claude Code-specific instructions only.
For SDK usage, deployment, and general agent workflows → USE AGENTS.md
Trigger keywords: htmlgraph, feature tracking, session tracking, drift detection, activity log, work attribution, feature status, session management, orchestrator, parallel, concurrent, delegation, Task tool, multi-agent, spawn agents
Every session MUST have an active work item before any code changes:
htmlgraph status — shows in-progress featureshtmlgraph feature start <id> — attributes all activity to this featurehtmlgraph feature complete <id> — marks feature donehtmlgraph feature create "Title" — creates and returns an IDhtmlgraph feature start <id>The YOLO mode hook will BLOCK Write/Edit tools if no feature is active for the current session.
Run htmlgraph help for the full command reference.
I MUST NOT execute these operations directly. I MUST delegate ALL of these to subagents via Task():
I MAY ONLY execute these operations directly:
htmlgraph feature create, htmlgraph spike create)EVERYTHING ELSE → DELEGATE VIA Task()
I MUST delegate by default. I MUST NOT rationalize direct execution.
Before executing ANY tool call, I MUST ask:
Is this operation in the FORBIDDEN list? → If YES: HALT. Delegate via Task(). No exceptions.
Could this require error handling or retries? → If YES: HALT. Delegate via Task(). No exceptions.
Could this cascade into 2+ tool calls? → If YES: HALT. Delegate via Task(). No exceptions.
Am I thinking "this is simple enough to do directly"? → If YES: HALT. That's rationalization. Delegate via Task().
If uncertain whether to delegate, I MUST delegate. No exceptions.
I MUST NOT execute git commands directly under ANY circumstances.
FORBIDDEN COMMANDS:
REQUIRED ACTION: I MUST delegate ALL git operations via Task().
ENFORCEMENT:
WHY THIS IS ABSOLUTE: Git operations cascade unpredictably:
Context cost: Direct execution = 7-15 tool calls vs Delegation = 2 tool calls
Delegation Pattern:
# Delegate git operations to copilot-operator
Task(
subagent_type="htmlgraph:copilot-operator",
description="Commit and push changes",
prompt="Commit files CLAUDE.md, SKILL.md with message 'docs: consolidate skills'. Push to origin main. Handle any errors."
)
NEVER DO THIS:
# FORBIDDEN - Direct git commands
Bash(command="git add .")
Bash(command="git commit -m 'fix bug'")
Bash(command="git push origin main")
WHY FORBIDDEN:
✅ CORRECT APPROACH:
Task(
prompt="""
Commit and push changes:
- Files: All modified files
- Message: 'fix bug'
- Handle errors (hooks, conflicts, push failures)
""",
subagent_type="general-purpose"
)
NEVER DO THIS:
# FORBIDDEN - Direct multi-file changes
Edit(file_path="src/auth.py", ...)
Edit(file_path="src/middleware.py", ...)
Bash(command="pytest tests/test_auth.py")
WHY FORBIDDEN:
✅ CORRECT APPROACH:
Task(
prompt="""
Implement authentication:
1. Edit src/auth.py (add JWT validation)
2. Edit src/middleware.py (add auth middleware)
3. Write tests in tests/test_auth.py
4. Run pytest until all pass
Report: What you implemented and test results
""",
subagent_type="general-purpose"
)
NEVER DO THIS:
# FORBIDDEN - Direct codebase search
Grep(pattern="authenticate", path="src/")
Read(file_path="src/auth.py")
Grep(pattern="JWT", path="src/")
Read(file_path="src/middleware.py")
WHY FORBIDDEN:
✅ CORRECT APPROACH:
Task(
prompt="""
Find all authentication code:
- Search for: authenticate, JWT, token validation
- Scope: src/ directory
- Report: Which files handle auth and what each does
""",
subagent_type="Explore"
)
Before ANY tool execution, ask:
See: packages/claude-plugin/rules/orchestration.md for complete orchestrator directives and delegation patterns.
When coordinating multiple agents with Task tool, follow this structured workflow:
1. ANALYZE → Check dependencies, assess parallelizability
2. PREPARE → Cache shared context, partition files
3. DISPATCH → Generate prompts via SDK, spawn agents in ONE message
4. MONITOR → Track health metrics per agent
5. AGGREGATE → Collect results, detect conflicts
6. VALIDATE → Verify outputs, run tests
Quick Start - Parallel Execution:
# Check what's ready (no dependencies = safe to parallelize)
htmlgraph analytics summary
htmlgraph find features --status todo
# DISPATCH - Spawn all agents in ONE message (critical!)
Task(subagent_type="htmlgraph:codex-operator", description="Feature A", prompt="Implement feature A...")
Task(subagent_type="htmlgraph:sonnet-coder", description="Feature B", prompt="Implement feature B...")
Task(subagent_type="htmlgraph:haiku-coder", description="Feature C", prompt="Implement feature C (simple)...")
When to Parallelize:
htmlgraph find features --status todo shows 2+ independent tasksWhen NOT to Parallelize:
Anti-Patterns to Avoid:
ABSOLUTE RULE: DO NOT use Read, Write, or Edit tools on .htmlgraph/ HTML files.
Use the Go CLI to ensure all HTML is validated and the SQLite index stays in sync.
❌ FORBIDDEN:
# NEVER DO THIS
Write('/path/to/.htmlgraph/features/feature-123.html', ...)
Edit('/path/to/.htmlgraph/sessions/session-456.html', ...)
✅ REQUIRED - Use CLI:
# Create work items
htmlgraph feature create "Title"
htmlgraph bug create "Bug description"
htmlgraph spike create "Investigation title"
# Update status
htmlgraph feature start <id>
htmlgraph feature complete <id>
# Query
htmlgraph find features --status todo
htmlgraph find bugs --status open
htmlgraph feature show <id>
# Analytics
htmlgraph snapshot --summary
htmlgraph analytics summary
htmlgraph analytics summary
Why SDK is best:
Why this matters:
NO EXCEPTIONS: NEVER read, write, or edit .htmlgraph/ files directly.
Use the CLI for inspection:
# ✅ CORRECT - Inspect sessions/events via CLI
htmlgraph session list
htmlgraph status
htmlgraph snapshot --summary
❌ FORBIDDEN - Reading files directly:
# NEVER DO THIS
cat .htmlgraph/features/feature-123.html
tail -10 .htmlgraph/events/session-123.jsonl
Always know which feature(s) are currently in progress:
htmlgraph statusABSOLUTE REQUIREMENT: Track ALL work in HtmlGraph.
Update HtmlGraph immediately after completing each piece of work:
htmlgraph feature start <id>htmlgraph feature complete <id>htmlgraph spike create "title"htmlgraph bug create "title"HtmlGraph automatically tracks tool usage. Action items:
description parameterFor every significant piece of work:
Tracks are high-level containers for multi-feature work (conductor-style planning):
When to create a track:
When to skip tracks:
# Create a track
htmlgraph track new "User Authentication System"
htmlgraph track list
# Link features to a track when creating them
htmlgraph feature create "OAuth Integration"
# Then associate via: htmlgraph feature show <id> (note the track-id field)
# 1. Create track
htmlgraph track new "API Rate Limiting"
# 2. Create features for the track
htmlgraph feature create "Core Implementation: token bucket + Redis"
htmlgraph feature create "API Integration: middleware + error handling"
htmlgraph feature create "Testing & Validation: unit + load tests"
# 3. Work on features
htmlgraph feature start <feat-id>
# ... do the work ...
htmlgraph feature complete <feat-id>
# 4. Track progress
htmlgraph track list
htmlgraph snapshot --summary
docs/TRACK_WORKFLOW.mddocs/AGENT_FRIENDLY_SDK.mdNEW: HtmlGraph enforces the workflow via a PreToolUse validation hook that ensures code changes are always tracked.
The validation hook runs BEFORE every tool execution and makes decisions based on your current work item:
VALIDATION RULES:
| Scenario | Tool | Action | Reason |
|---|---|---|---|
| Active Feature | Read | ✅ Allow | Exploration is always allowed |
| Active Feature | Write/Edit/Delete | ✅ Allow | Code changes match active feature |
| Active Spike | Read | ✅ Allow | Spikes permit exploration |
| Active Spike | Write/Edit/Delete | ⚠️ Warn + Allow | Planning spike, code changes not tracked |
| Auto-Spike (session-init) | All | ✅ Allow | Planning phase, don't block |
| No Active Work | Read | ✅ Allow | Exploration without feature is OK |
| No Active Work | Write/Edit/Delete (1 file) | ⚠️ Warn + Allow | Single-file changes often trivial |
| No Active Work | Write/Edit/Delete (3+ files) | ❌ Deny | Requires explicit feature creation |
| SDK Operations | All | ✅ Allow | Creating work items always allowed |
Validation DENIES code changes (Write/Edit/Delete) when ALL of these are true:
What you see:
PreToolUse Validation: Cannot proceed without active work item
- Reason: Multi-file changes (5 files) without tracked work item
- Action: Create a feature first with htmlgraph feature create
Resolution: Create a feature using the feature decision framework, then try again.
Validation WARNS BUT ALLOWS when:
What you see:
PreToolUse Validation: Warning - activity may not be tracked
- File: src/config.py (1 file)
- Reason: Single-file change without active feature
- Option: Create feature if this is significant work
You can continue - but consider if the work deserves a feature.
Auto-spikes are automatic planning spikes created during session initialization.
When the validation hook detects the start of a new session:
spike-session-init-abc123)Why auto-spikes?
Example auto-spike lifecycle:
Session Start
↓
Auto-spike created: spike-session-init-20251225
↓
Investigation/exploration work
↓
"This needs to be a feature" → Create feature, link to spike
↓
Feature takes primary attribution
↓
Spike marked as resolved
Use this framework to decide if you need a feature before making code changes:
User request or idea
├─ Single file, <30 min? → DIRECT CHANGE (validation warns, allows)
├─ 3+ files? → CREATE FEATURE (validation denies without feature)
├─ New tests needed? → CREATE FEATURE (validation blocks)
├─ Multi-component impact? → CREATE FEATURE (validation blocks)
├─ Hard to revert? → CREATE FEATURE (validation blocks)
├─ Needs documentation? → CREATE FEATURE (validation blocks)
└─ Otherwise → DIRECT CHANGE (validation warns, allows)
Key insight: Validation's deny threshold (3+ files) aligns with the feature decision threshold in CLAUDE.md.
Situation: You just started a new session. No features are active.
# Session starts → auto-spike created automatically
# spike-session-init-20251225 is now active (auto-created)
# All of these work WITHOUT creating a feature:
- Read code files (exploration)
- Write to a single file (validation warns but allows)
- Create a feature (SDK operation, always allowed)
- Ask the user what to work on
Flow:
htmlgraph feature create "User Authentication"Result: Work is properly attributed to the feature, not the throwaway auto-spike.
Situation: User says "Build a user authentication system"
WITHOUT feature:
# Try to edit 5 files without creating a feature
htmlgraph something that touches 5 files
# Validation DENIES:
# ❌ PreToolUse Validation: Cannot proceed without active work item
# Reason: Multi-file changes (5 files) without tracked work item
# Action: Create a feature first
WITH feature:
# Create the feature first
htmlgraph feature create "User Authentication"
# → feat-abc123 created and marked in-progress
# Now implement - all 5 files allowed
# Edit src/auth.py
# Edit src/middleware.py
# Edit src/models.py
# Write tests/test_auth.py
# Update docs/authentication.md
# Validation ALLOWS:
# ✅ All changes attributed to feat-abc123
# ✅ Session shows feature context
# ✅ Work is trackable
Result: Multi-file feature work is tracked and attributed.
Situation: You notice a typo in a docstring.
# Edit a single file without creating a feature
# Edit src/utils.py (fix typo)
# Validation WARNS BUT ALLOWS:
# ⚠️ PreToolUse Validation: Warning - activity may not be tracked
# File: src/utils.py (1 file)
# Reason: Single-file change without active feature
# Option: Create feature if this is significant work
# You can choose:
# - Continue (typo is trivial, doesn't need feature)
# - Cancel and create feature (if it's a bigger fix)
Result: Small fixes don't require features, but validation tracks the decision.
Use the Go CLI for all HtmlGraph operations.
# Check Current Status
htmlgraph status
htmlgraph feature list
# Start Working on a Feature
htmlgraph feature start <feature-id>
# Set Primary Feature (when multiple are active)
htmlgraph feature start <feature-id>
# Complete a Feature
htmlgraph feature complete <feature-id>
# Create work items
htmlgraph feature create "Title"
htmlgraph bug create "Bug description"
htmlgraph spike create "Investigation title"
# Query
htmlgraph find features --status todo
htmlgraph find features --status in-progress
htmlgraph find bugs --status open
htmlgraph feature show <id>
# Analytics
htmlgraph snapshot --summary
htmlgraph analytics summary
htmlgraph analytics summary
NEW: HtmlGraph now provides intelligent analytics to help you make smart decisions about what to work on next.
# Get smart recommendations on what to work on
htmlgraph analytics summary
Identify tasks blocking the most downstream work:
htmlgraph analytics summary
Find tasks that can be worked on simultaneously:
htmlgraph find features --status todo
Get smart recommendations considering priority, dependencies, and impact:
htmlgraph analytics summary
Check for dependency-related risks:
htmlgraph snapshot --summary
This provides a project health overview including blocked tasks and dependency issues.
See what work is available and what's blocking progress:
htmlgraph analytics summary
htmlgraph analytics summary
At the start of each work session:
# 1. Check for bottlenecks
htmlgraph analytics summary
# 2. Get recommendations
htmlgraph analytics summary
# 3. Check parallel opportunities
htmlgraph find features --status todo
# 4. Project health snapshot
htmlgraph snapshot --summary
htmlgraph analytics summary: At session start, during sprint planninghtmlgraph analytics summary: When deciding what task to pick uphtmlgraph find features --status todo: When coordinating multiple agentshtmlgraph snapshot --summary: During project health checks, before milestonesSee also: docs/AGENT_STRATEGIC_PLANNING.md for complete guide
CRITICAL: When spawning subagents with Task tool, follow the orchestrator workflow.
Use orchestration (spawn subagents) when:
htmlgraph find features --status todo shows 2+ independent tasks1. ANALYZE → Check dependencies with htmlgraph analytics
2. PREPARE → Cache shared context, partition files
3. DISPATCH → Spawn agents in ONE message (parallel)
4. MONITOR → Track health metrics per agent
5. AGGREGATE → Collect results, detect conflicts
6. VALIDATE → Verify outputs, run tests
Dispatch all independent tasks in a single message for true parallelism:
# 1. ANALYZE - Check what's available
# Run: htmlgraph analytics summary
# Run: htmlgraph find features --status todo
# 2. DISPATCH - Spawn all agents in ONE message (parallel)
Task(
subagent_type="htmlgraph:gemini-operator",
description="Research: Find API endpoints",
prompt="Research the codebase and find all API endpoints in src/api/. Document patterns."
)
Task(
subagent_type="htmlgraph:sonnet-coder",
description="Implement feat-123",
prompt="Implement feat-123. Context: [paste research findings]. Test command: uv run pytest"
)
# 3. VALIDATE - After agents complete, run quality gates
# Run: uv run pytest && uv run ruff check
| Scenario | Pattern |
|---|---|
| Independent tasks | Dispatch ALL in one message |
| Task B depends on Task A | Run A first, then B |
| Research before implementation | Sequential (research blocks coding) |
| Tests + docs update | Parallel (independent) |
❌ DON'T: Send Task calls in separate messages (sequential)
# BAD - agents run one at a time
result1 = Task(...) # Wait
result2 = Task(...) # Then next
✅ DO: Send all Task calls in ONE message (parallel)
# GOOD - true parallelism, all dispatched at once
Task(prompt="Update docs...", subagent_type="htmlgraph:gemini-operator")
Task(prompt="Update tests...", subagent_type="htmlgraph:sonnet-coder")
Task(prompt="Create migration guide...", subagent_type="htmlgraph:gemini-operator")
See also: /htmlgraph:orchestrator-directives-skill for detailed delegation patterns
NEW: HtmlGraph now automatically categorizes all work by type to differentiate exploratory work from implementation.
All events are automatically tagged with a work type based on the active feature:
Use spikes for timeboxed investigation:
# Create a spike for research
htmlgraph spike create "Investigate OAuth providers"
# Start working on it
htmlgraph spike start <spike-id>
# Mark complete when done
htmlgraph spike complete <spike-id>
When to create a spike:
Use chores for maintenance tasks:
# Create a chore
htmlgraph chore create "Refactor authentication module"
# Start working on it
htmlgraph chore start <chore-id>
When to create a chore:
# View current project status
htmlgraph status
# View snapshot with work distribution
htmlgraph snapshot --summary
# Find in-progress work by type
htmlgraph find features --status in-progress
htmlgraph find bugs --status open
Work type is automatically inferred from work item ID prefix:
feat-* → feature-implementationspike-* → spike-investigationbug-* → bug-fixchore-* → maintenanceNo manual tagging required! The system automatically categorizes your work based on what you're working on.
Work type classification enables you to:
CRITICAL: Always research BEFORE implementing solutions. Never guess.
HtmlGraph enforces a research-first philosophy. This emerged from dogfooding where we repeatedly made trial-and-error attempts before researching documentation.
Complete debugging guide: See DEBUGGING.md
STOP and research if:
REQUIRED PATTERN:
1. RESEARCH → Use documentation, claude-code-guide, GitHub issues
2. UNDERSTAND → Identify root cause through evidence
3. IMPLEMENT → Apply fix based on understanding
4. VALIDATE → Test to confirm fix works
5. DOCUMENT → Capture learning in HtmlGraph spike
❌ NEVER do this:
1. Try Fix A → Doesn't work
2. Try Fix B → Doesn't work
3. Try Fix C → Doesn't work
4. Research → Find actual root cause
5. Apply fix → Finally works
Debugging Agents (use these!):
Researcher Agent - Research documentation before implementing
.claude/agents/researcher.mdDebugger Agent - Systematically analyze errors
.claude/agents/debugger.mdTest Runner Agent - Enforce quality gates
.claude/agents/test-runner.mdClaude Code Tools:
# Built-in debug commands
claude --debug <command> # Verbose output
/hooks # List active hooks
/hooks PreToolUse # Show specific hook
/doctor # System diagnostics
claude --verbose # Detailed logging
Documentation Resources:
Before implementing ANY fix, ask yourself:
Scenario: Hooks are duplicating
✅ CORRECT (Research First):
1. STOP - Don't remove files yet
2. RESEARCH - Read Claude Code hook loading documentation
3. Use /hooks command to inspect active hooks
4. Check GitHub issues for "duplicate hooks"
5. UNDERSTAND - Hooks from multiple sources MERGE
6. IMPLEMENT - Remove duplicates from correct source
7. VALIDATE - Verify fix with /hooks command
8. DOCUMENT - Create spike with findings
❌ WRONG (Trial and Error):
1. Remove .claude/hooks/hooks.json - Still broken
2. Clear plugin cache - Still broken
3. Remove old plugin versions - Still broken
4. Remove marketplaces symlink - Still broken
5. Finally research documentation
6. Find root cause: Hook merging behavior
REQUIRED: Capture all research in HtmlGraph spike:
htmlgraph spike create "Research: [Problem] — Root cause: [finding]. Sources: [docs/issues]. Solution: [what was chosen and why]."
The validation hook already prevents multi-file changes without a feature. Research checkpoints add another layer:
Both work together to maintain quality and prevent wasted effort.
CRITICAL: Use this framework to decide when to create a feature vs implementing directly.
Create a FEATURE if ANY apply:
Implement DIRECTLY if ALL apply:
User request received
├─ Bug in existing feature? → See Bug Fix Workflow in WORKFLOW.md
├─ >30 minutes? → CREATE FEATURE
├─ 3+ files? → CREATE FEATURE
├─ New tests needed? → CREATE FEATURE
├─ Multi-component impact? → CREATE FEATURE
├─ Hard to revert? → CREATE FEATURE
└─ Otherwise → IMPLEMENT DIRECTLY
✅ CREATE FEATURE:
❌ IMPLEMENT DIRECTLY:
When in doubt, CREATE A FEATURE. Over-tracking is better than losing attribution.
See docs/WORKFLOW.md for the complete decision framework with detailed criteria, thresholds, and edge cases.
MANDATORY: Follow this checklist for EVERY session. No exceptions.
htmlgraph status - Get comprehensive session context (optimized, 1 call)
htmlgraph feature start <id>IMPORTANT: After finishing each step, mark it complete using the CLI:
# Mark a step complete
htmlgraph feature step-complete <feature-id> <step-number>
Step numbering is 0-based (first step = 0, second step = 1, etc.)
When to mark complete:
Example workflow:
htmlgraph feature start feat-123htmlgraph feature step-complete feat-123 0htmlgraph feature step-complete feat-123 1htmlgraph feature complete feat-123uv run pytest - All tests MUST passhtmlgraph feature complete <id>REMINDER: Completing a feature without doing all of the above means incomplete work. Don't skip steps.
When you see a drift warning like:
Drift detected (0.74): Activity may not align with feature-self-tracking
Consider:
htmlgraph feature start <id> to change attributionAt the start of each session:
At the end of each session:
.htmlgraph/sessions/Include feature context:
feat(feature-id): Description of the change
- Details about what was done
- Why this approach was chosen
🤖 Generated with Claude Code
When using Bash tool, always provide a description:
# Good - descriptive
Bash(description="Install dependencies for auth feature")
# Bad - no context
Bash(command="npm install")
When making architectural decisions:
htmlgraph track "Decision" "Chose X over Y because Z"View progress visually:
htmlgraph serve
# Open http://localhost:8080
The dashboard shows:
.htmlgraph/features/ - Feature HTML files (the graph nodes).htmlgraph/sessions/ - Session HTML files with activity logsindex.html - Dashboard (open in browser)HtmlGraph hooks track:
All data is stored as HTML files - human-readable, git-friendly, browser-viewable.