npx claudepluginhub shakestzd/htmlgraphThis skill uses the workspace's default tool permissions.
> **DEPRECATED:** This skill is replaced by the `copilot-operator` agent.
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.
DEPRECATED: This skill is replaced by the
copilot-operatoragent. UseAgent(subagent_type="htmlgraph:copilot-operator", prompt="...")instead. The copilot-operator agent tries Copilot CLI first with hook-based compliance verification.
โ ๏ธ IMPORTANT: This skill provides TWO EXECUTION PATTERNS
This skill teaches HOW to use both. See "EXECUTION PATTERNS" below for when to use each.
CopilotSpawner is the HtmlGraph-integrated way to invoke external CLIs (Copilot, Gemini, Codex) with full parent event context and subprocess tracking.
Key distinction: CopilotSpawner is invoked directly via Python SDK - NOT wrapped in Task(). Task() is only for Claude subagents (Haiku, Sonnet, Opus).
Instead of running CLI commands directly (which creates "black boxes"), CopilotSpawner:
Use CopilotSpawner when:
Use Bash directly when:
import os
import sys
from pathlib import Path
from datetime import datetime, timezone
import uuid
# Add plugin agents directory to path
PLUGIN_AGENTS_DIR = Path("/path/to/htmlgraph/packages/claude-plugin/.claude-plugin/agents")
sys.path.insert(0, str(PLUGIN_AGENTS_DIR))
from htmlgraph import SDK
from htmlgraph.orchestration.spawners import CopilotSpawner
from htmlgraph.db.schema import HtmlGraphDB
from htmlgraph.config import get_database_path
from spawner_event_tracker import SpawnerEventTracker
# Initialize
sdk = SDK(agent='claude')
db = HtmlGraphDB(str(get_database_path()))
session_id = f"sess-{uuid.uuid4().hex[:8]}"
db._ensure_session_exists(session_id, "claude")
# Create parent event context (like PreToolUse hook does)
user_query_event_id = f"event-query-{uuid.uuid4().hex[:8]}"
parent_event_id = f"event-{uuid.uuid4().hex[:8]}"
start_time = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
# Insert UserQuery event
db.connection.cursor().execute(
"""INSERT INTO agent_events
(event_id, agent_id, event_type, session_id, tool_name, input_summary, status, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
(user_query_event_id, "claude-code", "tool_call", session_id, "UserPromptSubmit",
"Test git workflow", "completed", start_time)
)
# Insert Task delegation event
db.connection.cursor().execute(
"""INSERT INTO agent_events
(event_id, agent_id, event_type, session_id, tool_name, input_summary,
context, parent_event_id, subagent_type, status, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(parent_event_id, "claude-code", "task_delegation", session_id, "Task",
"Guide git workflow", '{"subagent_type":"general-purpose"}',
user_query_event_id, "general-purpose", "started", start_time)
)
db.connection.commit()
# Export parent context (like PreToolUse hook does)
os.environ["HTMLGRAPH_PARENT_EVENT"] = parent_event_id
os.environ["HTMLGRAPH_PARENT_SESSION"] = session_id
os.environ["HTMLGRAPH_SESSION_ID"] = session_id
# Create tracker with parent context
tracker = SpawnerEventTracker(
delegation_event_id=parent_event_id,
parent_agent="claude",
spawner_type="copilot",
session_id=session_id
)
tracker.db = db
# Invoke CopilotSpawner with FULL tracking
spawner = CopilotSpawner()
result = spawner.spawn(
prompt="Recommend next semantic version and git workflow commands",
track_in_htmlgraph=True, # Enable SDK activity tracking
tracker=tracker, # Enable subprocess event tracking
parent_event_id=parent_event_id, # Link to parent event
allow_all_tools=True,
timeout=120
)
# Check results
print(f"Success: {result.success}")
print(f"Response: {result.response}")
if result.tracked_events:
print(f"Tracked {len(result.tracked_events)} events in HtmlGraph")
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | str | โ | Task description for Copilot |
track_in_htmlgraph | bool | โ | Enable SDK activity tracking (default: True) |
tracker | SpawnerEventTracker | โ | Tracker instance for subprocess events |
parent_event_id | str | โ | Parent event ID for event hierarchy |
allow_tools | list[str] | โ | Tools to auto-approve (e.g., ["shell(git)"]) |
allow_all_tools | bool | โ | Auto-approve all tools (default: False) |
deny_tools | list[str] | โ | Tools to deny |
timeout | int | โ | Max seconds to wait (default: 120) |
With CopilotSpawner, you get this event hierarchy in HtmlGraph:
UserQuery Event (from UserPromptSubmit hook)
โโโ Task Delegation Event (from PreToolUse hook)
โโโ CopilotSpawner Start (activity tracking)
โโโ Subprocess Invocation (subprocess event)
โ โโโ subprocess.copilot tool call
โโโ CopilotSpawner Result (activity tracking)
โโโ All activities linked with parent_event_id
This provides complete observability - no "black boxes" for external tool execution.
# See above code example + this prompt:
result = spawner.spawn(
prompt="""HtmlGraph project status:
- Completed CLI module refactoring (all tests passing)
- Completed skill documentation clarification
- Completed spawner architecture modularization
- Current version: ~0.26.x
Please recommend:
1. Next semantic version (MAJOR.MINOR.PATCH)
2. Version update git workflow including all necessary files
3. Tag and push commands
""",
track_in_htmlgraph=True,
tracker=tracker,
parent_event_id=parent_event_id,
allow_all_tools=True,
timeout=120
)
# Result: Full tracking with Copilot's version recommendation (0.27.0)
# All subprocess invocations recorded in HtmlGraph
CRITICAL: If external spawner fails, delegate to Claude sub-agent (NOT direct execution).
# Try external spawner first
try:
spawner = CopilotSpawner()
result = spawner.spawn(
prompt="Your task",
tracker=tracker,
parent_event_id=parent_event_id,
allow_all_tools=True,
timeout=120
)
if result.success:
return result # Success, use spawner result
else:
# Spawner returned error result
raise Exception(f"Spawner failed: {result.error}")
except Exception as e:
# External spawner failed (CLI not installed, timeout, permission denied, etc.)
# FALLBACK to Claude sub-agent - do NOT attempt direct execution
print(f"โ ๏ธ CopilotSpawner failed: {e}")
print("๐ Falling back to Claude sub-agent...")
return Task(
subagent_type="general-purpose",
prompt="Your task here"
)
# Task() guarantees execution via Claude
Why fallback to Task()?
Pattern Summary:
GitHub CLI (gh) is a command-line tool for GitHub operations:
Works in your terminal with the gh command.
CRITICAL DISTINCTION:
| What | Description |
|---|---|
| This Skill | Documentation teaching HOW to use gh CLI |
| Bash Tool | ACTUAL execution of gh commands |
Workflow:
gh CLI syntax and options# Install GitHub CLI
# macOS
brew install gh
# Ubuntu/Debian
sudo apt update && sudo apt install gh
# Windows
choco install gh
# Authenticate with GitHub
gh auth login
# Verify installation
gh --version
โ ๏ธ To actually execute GitHub operations, use these commands via the Bash tool:
# Basic PR creation
gh pr create --title "Feature: Add authentication" --body "Implements JWT auth"
# PR with multiple options
gh pr create --title "Fix bug" --body "Description" --base main --head feature-branch
# Interactive PR creation
gh pr create --web
# Create issue
gh issue create --title "Bug: Login fails" --body "Steps to reproduce..."
# List issues
gh issue list --state open
# View issue
gh issue view 123
# Clone repository
gh repo clone owner/repo
# Fork repository
gh repo fork owner/repo --clone
# Create repository
gh repo create my-new-repo --public
# Check status and create commit
git add . && git commit -m "feat: add new feature"
# Push and create PR in one command
git push && gh pr create --fill
# View PR status
gh pr status
STEP 1: Read this skill to learn gh CLI syntax
# This loads the documentation (this file)
Skill(skill=".claude-plugin:copilot")
STEP 2: Execute commands via Bash tool
# This ACTUALLY creates a PR
Bash("gh pr create --title 'Feature' --body 'Description'")
# This ACTUALLY creates an issue
Bash("gh issue create --title 'Bug' --body 'Details'")
# This ACTUALLY clones a repo
Bash("gh repo clone user/repo")
What this skill does:
To execute: Use Bash tool with the commands shown in "EXECUTION" section.
# Create PR after committing changes
Bash("gh pr create --title 'Add feature X' --body 'Implements X with tests'")
# Create draft PR
Bash("gh pr create --draft --title 'WIP: Feature Y'")
# List your PRs
Bash("gh pr list --author @me")
# Merge PR
Bash("gh pr merge 123 --squash")
# Create bug report
Bash("gh issue create --title 'Bug: Auth fails' --body 'Steps: 1. Login 2. Error'")
# List open issues
Bash("gh issue list --state open")
# Close issue
Bash("gh issue close 456")
# Clone repo
Bash("gh repo clone anthropics/claude-code")
# Fork and clone
Bash("gh repo fork user/repo --clone")
# View repo details
Bash("gh repo view")
# Commit all changes and create PR
Bash("git add . && git commit -m 'feat: new feature' && git push && gh pr create --fill")
# Amend last commit and force push
Bash("git commit --amend --no-edit && git push --force-with-lease")
# Check PR status
Bash("gh pr status")
# List workflow runs
Bash("gh run list")
# View specific run
Bash("gh run view 123")
# Re-run failed jobs
Bash("gh run rerun 123 --failed")
gh CLI installedgh auth loginTrack GitHub operations in features:
from htmlgraph import SDK
sdk = SDK(agent="claude")
# Document PR creation
feature = sdk.features.create(
title="Authentication Feature PR",
description="""
Created PR via gh CLI:
- Title: Add JWT authentication
- Branch: feature/jwt-auth
- Status: Ready for review
Command used:
gh pr create --title "Add JWT auth" --body "Full implementation with tests"
"""
).save()
โ Use GitHub CLI (gh) for:
โ Don't use gh CLI for:
/gemini skill instead)gh pr create --fillgh pr status or gh issue list before creating new itemsgh auth login at start of sessiongit push && gh pr creategh pr create --web# 1. Create feature branch
Bash("git checkout -b feature/new-feature")
# 2. Make changes, commit
Bash("git add . && git commit -m 'feat: implement feature'")
# 3. Push and create PR
Bash("git push -u origin feature/new-feature && gh pr create --fill")
# 1. Create issue for bug
Bash("gh issue create --title 'Bug: Description' --body 'Steps to reproduce'")
# 2. Create branch from issue
Bash("git checkout -b fix/issue-123")
# 3. Fix, commit, and create PR
Bash("git add . && git commit -m 'fix: resolve issue #123' && gh pr create --fill")
# 1. Commit all changes
Bash("git add . && git commit -m 'feat: quick feature'")
# 2. Push and create PR in one command
Bash("git push && gh pr create --title 'Quick Feature' --body 'Description'")
/gemini - For exploring repository structure and large codebases/codex - For code generation and implementation/code-quality - For validating code quality before creating PRAvoid GitHub CLI for:
/gemini skill)Error: "gh: command not found"
Solution (via Bash):
# macOS
Bash("brew install gh")
# Verify
Bash("gh --version")
Error: "authentication required"
Solution (via Bash):
Bash("gh auth login")
# Follow prompts in terminal
Error: "permission denied to repository"
Solution (via Bash):
# Check authentication status
Bash("gh auth status")
# Re-authenticate if needed
Bash("gh auth login --force")
Bash("gh pr create --title 'Feature' --body 'Desc' --reviewer user1,user2 --label bug,enhancement")
Bash("gh issue create --template bug_report.md")
# Close multiple issues
Bash("gh issue list --state open --json number --jq '.[].number' | xargs -I {} gh issue close {}")
# Rebase and force push
Bash("git rebase main && git push --force-with-lease && gh pr ready")
# Squash commits and update PR
Bash("git rebase -i HEAD~3 && git push --force-with-lease")
| Feature | GitHub CLI (gh) | Description |
|---|---|---|
| Pull Requests | โ | Create, merge, review, comment |
| Issues | โ | Create, list, close, assign |
| Repositories | โ | Clone, fork, create, view |
| Authentication | โ | Login, status, token management |
| GitHub Actions | โ | List, view, re-run workflows |
| API Access | โ | Direct GitHub API calls via gh api |