@softspark/ai-toolkit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +412 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +632 -0
- package/action.yml +53 -0
- package/app/.claude-plugin/plugin.json +44 -0
- package/app/ARCHITECTURE.md +306 -0
- package/app/CLAUDE.md.template +23 -0
- package/app/agents/ai-engineer.md +128 -0
- package/app/agents/backend-specialist.md +193 -0
- package/app/agents/business-intelligence.md +54 -0
- package/app/agents/chaos-monkey.md +67 -0
- package/app/agents/chief-of-staff.md +51 -0
- package/app/agents/code-archaeologist.md +127 -0
- package/app/agents/code-reviewer.md +184 -0
- package/app/agents/command-expert.md +131 -0
- package/app/agents/data-analyst.md +205 -0
- package/app/agents/data-scientist.md +151 -0
- package/app/agents/database-architect.md +317 -0
- package/app/agents/debugger.md +238 -0
- package/app/agents/devops-implementer.md +194 -0
- package/app/agents/documenter.md +364 -0
- package/app/agents/explorer-agent.md +145 -0
- package/app/agents/fact-checker.md +172 -0
- package/app/agents/frontend-specialist.md +209 -0
- package/app/agents/game-developer.md +216 -0
- package/app/agents/incident-responder.md +226 -0
- package/app/agents/infrastructure-architect.md +127 -0
- package/app/agents/infrastructure-validator.md +247 -0
- package/app/agents/llm-ops-engineer.md +237 -0
- package/app/agents/mcp-expert.md +228 -0
- package/app/agents/mcp-server-architect.md +195 -0
- package/app/agents/mcp-testing-engineer.md +292 -0
- package/app/agents/meta-architect.md +58 -0
- package/app/agents/ml-engineer.md +136 -0
- package/app/agents/mobile-developer.md +190 -0
- package/app/agents/night-watchman.md +55 -0
- package/app/agents/nlp-engineer.md +154 -0
- package/app/agents/orchestrator.md +437 -0
- package/app/agents/performance-optimizer.md +254 -0
- package/app/agents/predictive-analyst.md +57 -0
- package/app/agents/product-manager.md +194 -0
- package/app/agents/project-planner.md +287 -0
- package/app/agents/prompt-engineer.md +103 -0
- package/app/agents/qa-automation-engineer.md +182 -0
- package/app/agents/rag-engineer.md +201 -0
- package/app/agents/research-synthesizer.md +138 -0
- package/app/agents/search-specialist.md +101 -0
- package/app/agents/security-architect.md +62 -0
- package/app/agents/security-auditor.md +293 -0
- package/app/agents/seo-specialist.md +111 -0
- package/app/agents/system-governor.md +57 -0
- package/app/agents/tech-lead.md +62 -0
- package/app/agents/technical-researcher.md +103 -0
- package/app/agents/test-engineer.md +264 -0
- package/app/constitution.md +38 -0
- package/app/hooks/_profile-check.sh +11 -0
- package/app/hooks/guard-destructive.sh +74 -0
- package/app/hooks/guard-path.sh +73 -0
- package/app/hooks/post-tool-use.sh +35 -0
- package/app/hooks/pre-compact.sh +31 -0
- package/app/hooks/quality-check.sh +22 -0
- package/app/hooks/quality-gate.sh +49 -0
- package/app/hooks/save-session.sh +24 -0
- package/app/hooks/session-end.sh +37 -0
- package/app/hooks/session-start.sh +29 -0
- package/app/hooks/subagent-start.sh +16 -0
- package/app/hooks/subagent-stop.sh +16 -0
- package/app/hooks/track-usage.sh +50 -0
- package/app/hooks/user-prompt-submit.sh +25 -0
- package/app/hooks.json +178 -0
- package/app/mcp-defaults.json +23 -0
- package/app/output-styles/golden-rules.md +43 -0
- package/app/plugins/README.md +19 -0
- package/app/plugins/csharp-pack/README.md +11 -0
- package/app/plugins/csharp-pack/plugin.json +18 -0
- package/app/plugins/enterprise-pack/README.md +16 -0
- package/app/plugins/enterprise-pack/hooks/output-style.sh +6 -0
- package/app/plugins/enterprise-pack/hooks/status-line.sh +8 -0
- package/app/plugins/enterprise-pack/plugin.json +24 -0
- package/app/plugins/frontend-pack/README.md +14 -0
- package/app/plugins/frontend-pack/plugin.json +22 -0
- package/app/plugins/java-pack/README.md +11 -0
- package/app/plugins/java-pack/plugin.json +18 -0
- package/app/plugins/kotlin-pack/README.md +11 -0
- package/app/plugins/kotlin-pack/plugin.json +18 -0
- package/app/plugins/memory-pack/README.md +24 -0
- package/app/plugins/memory-pack/hooks/observation-capture.sh +67 -0
- package/app/plugins/memory-pack/hooks/session-summary.sh +71 -0
- package/app/plugins/memory-pack/plugin.json +22 -0
- package/app/plugins/memory-pack/scripts/init_db.py +81 -0
- package/app/plugins/memory-pack/scripts/strip_private.py +22 -0
- package/app/plugins/memory-pack/skills/mem-search/SKILL.md +70 -0
- package/app/plugins/research-pack/README.md +14 -0
- package/app/plugins/research-pack/plugin.json +22 -0
- package/app/plugins/ruby-pack/README.md +11 -0
- package/app/plugins/ruby-pack/plugin.json +18 -0
- package/app/plugins/rust-pack/README.md +11 -0
- package/app/plugins/rust-pack/plugin.json +18 -0
- package/app/plugins/security-pack/README.md +15 -0
- package/app/plugins/security-pack/plugin.json +23 -0
- package/app/plugins/swift-pack/README.md +11 -0
- package/app/plugins/swift-pack/plugin.json +18 -0
- package/app/rules/claude-toolkit-rules.md +21 -0
- package/app/rules/git-conventions.md +5 -0
- package/app/rules/quality-gates.md +10 -0
- package/app/skills/_lib/__init__.py +1 -0
- package/app/skills/_lib/detect_utils.py +150 -0
- package/app/skills/agent-creator/SKILL.md +82 -0
- package/app/skills/analyze/SKILL.md +92 -0
- package/app/skills/analyze/scripts/complexity.py +165 -0
- package/app/skills/api-patterns/SKILL.md +305 -0
- package/app/skills/app-builder/SKILL.md +187 -0
- package/app/skills/architecture-audit/SKILL.md +141 -0
- package/app/skills/architecture-decision/SKILL.md +55 -0
- package/app/skills/architecture-decision/templates/adr-template.md +36 -0
- package/app/skills/biz-scan/SKILL.md +30 -0
- package/app/skills/briefing/SKILL.md +27 -0
- package/app/skills/build/SKILL.md +97 -0
- package/app/skills/build/scripts/detect-build.py +151 -0
- package/app/skills/chaos/SKILL.md +32 -0
- package/app/skills/ci/SKILL.md +77 -0
- package/app/skills/ci/scripts/ci-detect.py +135 -0
- package/app/skills/ci/templates/github-actions-node.yml +38 -0
- package/app/skills/ci/templates/github-actions-python.yml +42 -0
- package/app/skills/ci-cd-patterns/SKILL.md +299 -0
- package/app/skills/clean-code/SKILL.md +110 -0
- package/app/skills/clean-code/reference/dart.md +18 -0
- package/app/skills/clean-code/reference/go.md +23 -0
- package/app/skills/clean-code/reference/php.md +32 -0
- package/app/skills/clean-code/reference/python.md +180 -0
- package/app/skills/clean-code/reference/typescript.md +26 -0
- package/app/skills/command-creator/SKILL.md +83 -0
- package/app/skills/commit/SKILL.md +98 -0
- package/app/skills/commit/scripts/pre-commit-check.py +87 -0
- package/app/skills/commit/templates/conventional-commit.md +52 -0
- package/app/skills/csharp-patterns/SKILL.md +450 -0
- package/app/skills/database-patterns/SKILL.md +297 -0
- package/app/skills/debug/SKILL.md +154 -0
- package/app/skills/debug/scripts/error-parser.py +187 -0
- package/app/skills/debugging-tactics/SKILL.md +136 -0
- package/app/skills/deploy/SKILL.md +130 -0
- package/app/skills/deploy/scripts/pre_deploy_check.py +171 -0
- package/app/skills/deploy/templates/deployment-checklist.md +31 -0
- package/app/skills/design-an-interface/SKILL.md +105 -0
- package/app/skills/design-engineering/SKILL.md +260 -0
- package/app/skills/docker-devops/SKILL.md +303 -0
- package/app/skills/docs/SKILL.md +145 -0
- package/app/skills/docs/scripts/doc-inventory.py +176 -0
- package/app/skills/docs/templates/adr-template.md +36 -0
- package/app/skills/docs/templates/readme-template.md +67 -0
- package/app/skills/documentation-standards/SKILL.md +191 -0
- package/app/skills/ecommerce-patterns/SKILL.md +209 -0
- package/app/skills/evaluate/SKILL.md +132 -0
- package/app/skills/evolve/SKILL.md +27 -0
- package/app/skills/explain/SKILL.md +54 -0
- package/app/skills/explain/scripts/dependency-graph.py +215 -0
- package/app/skills/explore/SKILL.md +112 -0
- package/app/skills/explore/scripts/visualize.py +117 -0
- package/app/skills/fix/SKILL.md +78 -0
- package/app/skills/fix/scripts/error-classifier.py +191 -0
- package/app/skills/flutter-patterns/SKILL.md +254 -0
- package/app/skills/git-mastery/SKILL.md +70 -0
- package/app/skills/grill-me/SKILL.md +38 -0
- package/app/skills/health/SKILL.md +91 -0
- package/app/skills/health/scripts/health_check.py +162 -0
- package/app/skills/hive-mind/SKILL.md +56 -0
- package/app/skills/hook-creator/SKILL.md +107 -0
- package/app/skills/index/SKILL.md +74 -0
- package/app/skills/instinct-review/SKILL.md +77 -0
- package/app/skills/java-patterns/SKILL.md +442 -0
- package/app/skills/kotlin-patterns/SKILL.md +446 -0
- package/app/skills/lint/SKILL.md +103 -0
- package/app/skills/lint/scripts/detect-linters.py +112 -0
- package/app/skills/mcp-patterns/SKILL.md +270 -0
- package/app/skills/mem-search/SKILL.md +70 -0
- package/app/skills/migrate/SKILL.md +90 -0
- package/app/skills/migrate/scripts/migration-status.py +195 -0
- package/app/skills/migration-patterns/SKILL.md +260 -0
- package/app/skills/night-watch/SKILL.md +28 -0
- package/app/skills/observability-patterns/SKILL.md +203 -0
- package/app/skills/onboard/SKILL.md +76 -0
- package/app/skills/orchestrate/SKILL.md +86 -0
- package/app/skills/panic/SKILL.md +30 -0
- package/app/skills/performance-profiling/SKILL.md +59 -0
- package/app/skills/plan/SKILL.md +110 -0
- package/app/skills/plan/templates/plan-template.md +40 -0
- package/app/skills/plan-writing/SKILL.md +201 -0
- package/app/skills/plugin-creator/SKILL.md +78 -0
- package/app/skills/pr/SKILL.md +129 -0
- package/app/skills/pr/scripts/pr-summary.py +175 -0
- package/app/skills/prd-to-issues/SKILL.md +108 -0
- package/app/skills/prd-to-plan/SKILL.md +120 -0
- package/app/skills/predict/SKILL.md +30 -0
- package/app/skills/qa-session/SKILL.md +110 -0
- package/app/skills/rag-patterns/SKILL.md +203 -0
- package/app/skills/refactor/SKILL.md +124 -0
- package/app/skills/refactor/scripts/refactor-scan.py +210 -0
- package/app/skills/refactor-plan/SKILL.md +112 -0
- package/app/skills/repeat/SKILL.md +149 -0
- package/app/skills/research-mastery/SKILL.md +56 -0
- package/app/skills/review/SKILL.md +141 -0
- package/app/skills/review/scripts/diff-analyzer.py +170 -0
- package/app/skills/rollback/SKILL.md +87 -0
- package/app/skills/rollback/scripts/rollback_info.py +149 -0
- package/app/skills/ruby-patterns/SKILL.md +454 -0
- package/app/skills/rust-patterns/SKILL.md +446 -0
- package/app/skills/search/SKILL.md +64 -0
- package/app/skills/security-patterns/SKILL.md +91 -0
- package/app/skills/security-patterns/reference/authentication.md +37 -0
- package/app/skills/security-patterns/reference/authorization.md +22 -0
- package/app/skills/security-patterns/reference/input-validation.md +30 -0
- package/app/skills/security-patterns/reference/oauth-csrf-audit.md +131 -0
- package/app/skills/skill-creator/SKILL.md +154 -0
- package/app/skills/skill-creator/templates/dashboard/index.html +130 -0
- package/app/skills/skill-creator/templates/reasoning-engine/assets/example.json +12 -0
- package/app/skills/skill-creator/templates/reasoning-engine/search.py +110 -0
- package/app/skills/subagent-development/SKILL.md +225 -0
- package/app/skills/subagent-development/reference/code-quality-reviewer-prompt.md +145 -0
- package/app/skills/subagent-development/reference/implementer-prompt.md +118 -0
- package/app/skills/subagent-development/reference/spec-reviewer-prompt.md +100 -0
- package/app/skills/swarm/SKILL.md +81 -0
- package/app/skills/swift-patterns/SKILL.md +500 -0
- package/app/skills/tdd/SKILL.md +174 -0
- package/app/skills/tdd/reference/deep-modules.md +32 -0
- package/app/skills/tdd/reference/interface-design.md +32 -0
- package/app/skills/tdd/reference/mocking.md +52 -0
- package/app/skills/tdd/reference/refactoring.md +10 -0
- package/app/skills/tdd/reference/tests.md +59 -0
- package/app/skills/teams/SKILL.md +101 -0
- package/app/skills/test/SKILL.md +107 -0
- package/app/skills/test/scripts/detect-runner.py +113 -0
- package/app/skills/testing-patterns/SKILL.md +73 -0
- package/app/skills/testing-patterns/reference/flutter-testing.md +33 -0
- package/app/skills/testing-patterns/reference/go-testing.md +52 -0
- package/app/skills/testing-patterns/reference/php-phpunit.md +39 -0
- package/app/skills/testing-patterns/reference/python-pytest.md +228 -0
- package/app/skills/testing-patterns/reference/typescript-vitest.md +50 -0
- package/app/skills/triage-issue/SKILL.md +120 -0
- package/app/skills/typescript-patterns/SKILL.md +256 -0
- package/app/skills/ubiquitous-language/SKILL.md +74 -0
- package/app/skills/verification-before-completion/SKILL.md +108 -0
- package/app/skills/workflow/SKILL.md +250 -0
- package/app/skills/write-a-prd/SKILL.md +129 -0
- package/app/skills/write-a-prd/reference/visual-companion.md +78 -0
- package/app/skills/write-a-prd/scripts/frame-template.html +111 -0
- package/app/skills/write-a-prd/scripts/visual-server.cjs +79 -0
- package/app/templates/skill/generator/SKILL.md.template +40 -0
- package/app/templates/skill/knowledge/SKILL.md.template +52 -0
- package/app/templates/skill/linter/SKILL.md.template +34 -0
- package/app/templates/skill/reviewer/SKILL.md.template +51 -0
- package/app/templates/skill/workflow/SKILL.md.template +49 -0
- package/benchmarks/README.md +111 -0
- package/benchmarks/ecosystem-dashboard.json +148 -0
- package/benchmarks/ecosystem-harvest.json +148 -0
- package/benchmarks/results.json +38 -0
- package/benchmarks/run.py +351 -0
- package/bin/ai-toolkit.js +345 -0
- package/kb/best-practices/README.md +11 -0
- package/kb/howto/README.md +11 -0
- package/kb/procedures/maintenance-sop.md +306 -0
- package/kb/reference/agents-catalog.md +124 -0
- package/kb/reference/anti-pattern-registry-format.md +221 -0
- package/kb/reference/architecture-overview.md +232 -0
- package/kb/reference/benchmark-config.md +62 -0
- package/kb/reference/ci-integration.md +66 -0
- package/kb/reference/claude-ecosystem-benchmark-snapshot.md +80 -0
- package/kb/reference/claude-ecosystem-expansion-foundations.md +102 -0
- package/kb/reference/commands-catalog.md +21 -0
- package/kb/reference/distribution-model.md +63 -0
- package/kb/reference/global-install-model.md +56 -0
- package/kb/reference/hierarchical-override-pattern.md +200 -0
- package/kb/reference/hooks-catalog.md +306 -0
- package/kb/reference/integrations.md +88 -0
- package/kb/reference/language-packs.md +52 -0
- package/kb/reference/merge-friendly-install-model.md +58 -0
- package/kb/reference/plugin-pack-conventions.md +151 -0
- package/kb/reference/quick-wins-implementation-summary.md +70 -0
- package/kb/reference/skill-templates.md +50 -0
- package/kb/reference/skills-catalog.md +215 -0
- package/kb/reference/skills-unification.md +57 -0
- package/kb/reference/stats.md +69 -0
- package/kb/reference/sync.md +76 -0
- package/kb/troubleshooting/README.md +11 -0
- package/llms-full.txt +3068 -0
- package/llms.txt +39 -0
- package/package.json +75 -0
- package/scripts/_common.py +160 -0
- package/scripts/add_rule.py +50 -0
- package/scripts/benchmark_config.py +127 -0
- package/scripts/benchmark_ecosystem.py +288 -0
- package/scripts/check_deps.py +260 -0
- package/scripts/create_skill.py +118 -0
- package/scripts/doctor.py +504 -0
- package/scripts/eject.py +113 -0
- package/scripts/emission.py +256 -0
- package/scripts/evaluate_skills.py +260 -0
- package/scripts/frontmatter.py +58 -0
- package/scripts/generate_agents_md.py +91 -0
- package/scripts/generate_aider_conf.py +51 -0
- package/scripts/generate_cline.py +35 -0
- package/scripts/generate_copilot.py +30 -0
- package/scripts/generate_cursor_rules.py +35 -0
- package/scripts/generate_gemini.py +28 -0
- package/scripts/generate_llms_txt.py +164 -0
- package/scripts/generate_roo_modes.py +80 -0
- package/scripts/generate_windsurf.py +35 -0
- package/scripts/generator_base.py +140 -0
- package/scripts/harvest_ecosystem.py +50 -0
- package/scripts/inject_rule_cli.py +101 -0
- package/scripts/inject_section_cli.py +47 -0
- package/scripts/injection.py +180 -0
- package/scripts/install.py +236 -0
- package/scripts/install_git_hooks.py +71 -0
- package/scripts/install_steps/__init__.py +5 -0
- package/scripts/install_steps/ai_tools.py +261 -0
- package/scripts/install_steps/hooks.py +90 -0
- package/scripts/install_steps/markers.py +79 -0
- package/scripts/install_steps/symlinks.py +87 -0
- package/scripts/merge-hooks.py +192 -0
- package/scripts/plugin.py +642 -0
- package/scripts/plugin_schema.py +138 -0
- package/scripts/remove_rule.py +58 -0
- package/scripts/stats.py +81 -0
- package/scripts/sync.py +215 -0
- package/scripts/uninstall.py +292 -0
- package/scripts/validate.py +700 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: health
|
|
3
|
+
description: "Report service and infrastructure health status"
|
|
4
|
+
effort: medium
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: "[service]"
|
|
7
|
+
allowed-tools: Bash, Read
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Health Check
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Check the health of all project services.
|
|
15
|
+
|
|
16
|
+
## Project context
|
|
17
|
+
|
|
18
|
+
- Services: !`docker compose ps 2>/dev/null || echo "no-docker"`
|
|
19
|
+
|
|
20
|
+
## Auto-Detection
|
|
21
|
+
|
|
22
|
+
Detect services from `docker-compose.yml`, `.env`, or project configuration.
|
|
23
|
+
|
|
24
|
+
### Quick Check
|
|
25
|
+
```bash
|
|
26
|
+
# If using Docker Compose
|
|
27
|
+
docker compose ps
|
|
28
|
+
|
|
29
|
+
# Process check (bare metal)
|
|
30
|
+
ps aux | grep -E "(node|python|java|php)" | grep -v grep
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Common Service Checks
|
|
34
|
+
|
|
35
|
+
| Service | Health Check |
|
|
36
|
+
|---------|-------------|
|
|
37
|
+
| HTTP API | `curl -f http://localhost:{port}/health` |
|
|
38
|
+
| PostgreSQL | `pg_isready -h localhost -p 5432` |
|
|
39
|
+
| MySQL | `mysqladmin ping -h localhost` |
|
|
40
|
+
| Redis | `redis-cli ping` |
|
|
41
|
+
| MongoDB | `mongosh --eval "db.runCommand({ping:1})"` |
|
|
42
|
+
| Elasticsearch | `curl -f http://localhost:9200/_cluster/health` |
|
|
43
|
+
| RabbitMQ | `curl -f http://localhost:15672/api/healthchecks/node` |
|
|
44
|
+
|
|
45
|
+
## Diagnostics
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Container logs (if Docker)
|
|
49
|
+
docker compose logs --tail 50 {service}
|
|
50
|
+
|
|
51
|
+
# Resource usage
|
|
52
|
+
docker stats --no-stream # Docker
|
|
53
|
+
htop # Bare metal
|
|
54
|
+
|
|
55
|
+
# Disk usage
|
|
56
|
+
df -h # System
|
|
57
|
+
docker system df # Docker
|
|
58
|
+
|
|
59
|
+
# Network
|
|
60
|
+
netstat -tlnp # Listening ports
|
|
61
|
+
curl -I http://localhost:{port} # Connectivity
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Common Issues
|
|
65
|
+
|
|
66
|
+
| Symptom | Check | Solution |
|
|
67
|
+
|---------|-------|----------|
|
|
68
|
+
| Service not responding | Process running? Port open? | Restart service |
|
|
69
|
+
| Slow responses | Resource usage, connections | Scale or optimize |
|
|
70
|
+
| Connection refused | Network, firewall, port | Check config |
|
|
71
|
+
| Out of memory | `free -h`, container limits | Increase limits |
|
|
72
|
+
|
|
73
|
+
## Automated Health Check
|
|
74
|
+
|
|
75
|
+
Run the bundled script for a JSON health report:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python3 ${CLAUDE_SKILL_DIR}/scripts/health_check.py http://localhost:8000
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Health Report Format
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
services:
|
|
85
|
+
{service-name}:
|
|
86
|
+
status: healthy|degraded|down
|
|
87
|
+
uptime: Xd Xh
|
|
88
|
+
cpu: X%
|
|
89
|
+
memory: XMB
|
|
90
|
+
notes: "any issues"
|
|
91
|
+
```
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Health check script for common services.
|
|
3
|
+
|
|
4
|
+
Probes Docker services, an HTTP health endpoint, disk usage, and
|
|
5
|
+
available memory. Returns a JSON object with status information for
|
|
6
|
+
each detected subsystem.
|
|
7
|
+
|
|
8
|
+
Usage::
|
|
9
|
+
|
|
10
|
+
python3 health_check.py [service-url]
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import platform
|
|
17
|
+
import shutil
|
|
18
|
+
import subprocess
|
|
19
|
+
import sys
|
|
20
|
+
from datetime import datetime, timezone
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _run(cmd: list[str]) -> subprocess.CompletedProcess[str]:
|
|
25
|
+
"""Run a command, capturing output as text. Never raises."""
|
|
26
|
+
return subprocess.run(
|
|
27
|
+
cmd,
|
|
28
|
+
capture_output=True,
|
|
29
|
+
text=True,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _command_exists(name: str) -> bool:
|
|
34
|
+
"""Return True if *name* is found on PATH."""
|
|
35
|
+
return shutil.which(name) is not None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _check_docker() -> dict[str, Any] | None:
|
|
39
|
+
"""Return Docker service info, or None if Docker is unavailable."""
|
|
40
|
+
if not _command_exists("docker"):
|
|
41
|
+
return None
|
|
42
|
+
result = _run(["docker", "compose", "ps", "--format", "json"])
|
|
43
|
+
if result.returncode != 0:
|
|
44
|
+
return None
|
|
45
|
+
services: list[dict[str, str]] = []
|
|
46
|
+
for line in result.stdout.strip().splitlines():
|
|
47
|
+
line = line.strip()
|
|
48
|
+
if not line:
|
|
49
|
+
continue
|
|
50
|
+
try:
|
|
51
|
+
svc = json.loads(line)
|
|
52
|
+
services.append({
|
|
53
|
+
"name": svc.get("Service", ""),
|
|
54
|
+
"state": svc.get("State", ""),
|
|
55
|
+
})
|
|
56
|
+
except json.JSONDecodeError:
|
|
57
|
+
continue
|
|
58
|
+
if not services:
|
|
59
|
+
return None
|
|
60
|
+
return {"status": "running", "services": services}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _check_http(url: str) -> dict[str, Any] | None:
|
|
64
|
+
"""Probe *url*/health via curl and return status info."""
|
|
65
|
+
if not _command_exists("curl"):
|
|
66
|
+
return None
|
|
67
|
+
health_url = f"{url}/health"
|
|
68
|
+
|
|
69
|
+
# Status code
|
|
70
|
+
code_result = _run([
|
|
71
|
+
"curl", "-sf", "-o", "/dev/null", "-w", "%{http_code}", health_url,
|
|
72
|
+
])
|
|
73
|
+
status_code = int(code_result.stdout.strip()) if code_result.stdout.strip().isdigit() else 0
|
|
74
|
+
|
|
75
|
+
# Response time
|
|
76
|
+
time_result = _run([
|
|
77
|
+
"curl", "-sf", "-o", "/dev/null", "-w", "%{time_total}", health_url,
|
|
78
|
+
])
|
|
79
|
+
try:
|
|
80
|
+
response_time_s = float(time_result.stdout.strip())
|
|
81
|
+
except (ValueError, TypeError):
|
|
82
|
+
response_time_s = 0.0
|
|
83
|
+
response_time_ms = round(response_time_s * 1000, 2)
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
"url": health_url,
|
|
87
|
+
"status_code": status_code,
|
|
88
|
+
"response_time_ms": response_time_ms,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _check_disk() -> dict[str, Any]:
|
|
93
|
+
"""Return disk usage percentage for the current working directory."""
|
|
94
|
+
try:
|
|
95
|
+
usage = shutil.disk_usage(os.getcwd())
|
|
96
|
+
percent = round(usage.used / usage.total * 100) if usage.total else 0
|
|
97
|
+
except OSError:
|
|
98
|
+
percent = 0
|
|
99
|
+
return {"usage_percent": percent}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _check_memory() -> dict[str, Any]:
|
|
103
|
+
"""Return available memory info, platform-aware."""
|
|
104
|
+
system = platform.system()
|
|
105
|
+
if system == "Darwin":
|
|
106
|
+
result = _run(["vm_stat"])
|
|
107
|
+
if result.returncode == 0:
|
|
108
|
+
for line in result.stdout.splitlines():
|
|
109
|
+
if "Pages free" in line:
|
|
110
|
+
parts = line.split()
|
|
111
|
+
# Last token is the number, possibly with a trailing period
|
|
112
|
+
raw = parts[-1].rstrip(".")
|
|
113
|
+
try:
|
|
114
|
+
return {"free_pages": int(raw)}
|
|
115
|
+
except ValueError:
|
|
116
|
+
pass
|
|
117
|
+
return {"free_pages": 0}
|
|
118
|
+
|
|
119
|
+
if system == "Linux":
|
|
120
|
+
try:
|
|
121
|
+
with open("/proc/meminfo", "r") as fh:
|
|
122
|
+
for line in fh:
|
|
123
|
+
if line.startswith("MemAvailable"):
|
|
124
|
+
parts = line.split()
|
|
125
|
+
try:
|
|
126
|
+
return {"available_kb": int(parts[1])}
|
|
127
|
+
except (IndexError, ValueError):
|
|
128
|
+
pass
|
|
129
|
+
except OSError:
|
|
130
|
+
pass
|
|
131
|
+
return {"available_kb": 0}
|
|
132
|
+
|
|
133
|
+
return {}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def main() -> None:
|
|
137
|
+
"""Entry point: run all checks and print JSON to stdout."""
|
|
138
|
+
url = sys.argv[1] if len(sys.argv) > 1 else "http://localhost"
|
|
139
|
+
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
140
|
+
|
|
141
|
+
checks: dict[str, Any] = {}
|
|
142
|
+
|
|
143
|
+
docker_info = _check_docker()
|
|
144
|
+
if docker_info is not None:
|
|
145
|
+
checks["docker"] = docker_info
|
|
146
|
+
|
|
147
|
+
http_info = _check_http(url)
|
|
148
|
+
if http_info is not None:
|
|
149
|
+
checks["http"] = http_info
|
|
150
|
+
|
|
151
|
+
checks["disk"] = _check_disk()
|
|
152
|
+
checks["memory"] = _check_memory()
|
|
153
|
+
|
|
154
|
+
output = {
|
|
155
|
+
"timestamp": now,
|
|
156
|
+
"checks": checks,
|
|
157
|
+
}
|
|
158
|
+
print(json.dumps(output, indent=2))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hive-mind
|
|
3
|
+
description: "Loaded when orchestrating multi-agent swarms or consensus workflows"
|
|
4
|
+
effort: medium
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Hive Mind Skill
|
|
9
|
+
|
|
10
|
+
You are part of a Swarm. You are not alone.
|
|
11
|
+
|
|
12
|
+
## 🔴 Swarm Protocols
|
|
13
|
+
|
|
14
|
+
### 1. Consensus (The Vote)
|
|
15
|
+
When agents disagree:
|
|
16
|
+
1. Each agent generates a solution + confidence score.
|
|
17
|
+
2. **Weighted Voting**: Higher confidence = Higher weight.
|
|
18
|
+
3. **Majority Rule**: >50% wins.
|
|
19
|
+
|
|
20
|
+
### 2. Aggregation (The Merge)
|
|
21
|
+
When multiple agents produce outputs:
|
|
22
|
+
1. **Format Standardization**: Ensure all JSON/Markdown matches.
|
|
23
|
+
2. **De-duplication**: Remove identical findings.
|
|
24
|
+
3. **Synthesis**: Combine unique insights into one report.
|
|
25
|
+
|
|
26
|
+
### 3. File Ownership (Agent Teams Mode)
|
|
27
|
+
|
|
28
|
+
**With Agent Teams enabled**: File conflicts are prevented by **file ownership assignment** at spawn time. Each teammate gets distinct files/directories. No locking needed.
|
|
29
|
+
|
|
30
|
+
- Lead assigns ownership when creating the team
|
|
31
|
+
- Teammates respect boundaries in their prompts
|
|
32
|
+
- Quality hooks verify completeness on `TaskCompleted`
|
|
33
|
+
|
|
34
|
+
**Without Agent Teams** (fallback):
|
|
35
|
+
1. Before editing a file: Check if another agent is editing.
|
|
36
|
+
2. Use `touch .lock.{filename}`.
|
|
37
|
+
3. Remove lock after edit.
|
|
38
|
+
|
|
39
|
+
### 4. Communication (Agent Teams Mode)
|
|
40
|
+
|
|
41
|
+
- **message**: Send to ONE specific teammate (targeted, low cost)
|
|
42
|
+
- **broadcast**: Send to ALL teammates (use sparingly — costs N×)
|
|
43
|
+
- **Shared task list**: `~/.claude/tasks/{team-name}/` — all agents can see/claim
|
|
44
|
+
|
|
45
|
+
## Example Workflow (Map-Reduce)
|
|
46
|
+
|
|
47
|
+
### With Agent Teams
|
|
48
|
+
1. **Map**: Lead spawns 5 teammates, each scanning 20 files
|
|
49
|
+
2. **Parallel**: All teammates execute simultaneously in tmux panes
|
|
50
|
+
3. **Reduce**: Lead waits, collects results, applies Aggregation protocol
|
|
51
|
+
4. **Report**: `final_report.md` synthesized from all findings
|
|
52
|
+
|
|
53
|
+
### Without Agent Teams (Fallback)
|
|
54
|
+
1. **Map**: "Scan 100 files for leaks." → 10 Agents × 10 Files.
|
|
55
|
+
2. **Reduce**: Agents output `leaks_{i}.json`.
|
|
56
|
+
3. **Hive Mind**: Merge all `leaks_*.json` → `final_report.json`.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hook-creator
|
|
3
|
+
description: "Creates new Claude Code hooks with guided workflow, strict conventions, and validation"
|
|
4
|
+
effort: high
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: "[hook event or description]"
|
|
7
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Hook Creator
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Create a new Claude Code hook following ai-toolkit conventions.
|
|
15
|
+
|
|
16
|
+
## Supported Hook Events
|
|
17
|
+
|
|
18
|
+
| Event | Fires When | Matcher | Typical Use |
|
|
19
|
+
|-------|-----------|---------|-------------|
|
|
20
|
+
| `SessionStart` | Session begins or resumes after compact | `startup\|compact` | Context injection, rules reminder |
|
|
21
|
+
| `Notification` | Claude sends a notification | any | OS alerts, Slack pings |
|
|
22
|
+
| `PreToolUse` | Before a tool executes | tool name (e.g. `Bash`) | Safety guards, validation |
|
|
23
|
+
| `PostToolUse` | After a tool executes | tool name | Feedback loops, logging |
|
|
24
|
+
| `Stop` | Claude finishes responding | any | Quality checks, session save |
|
|
25
|
+
| `PreCompact` | Before context compaction | any | Context preservation |
|
|
26
|
+
| `SubagentStop` | Subagent completes | any | Result validation |
|
|
27
|
+
| `UserPromptSubmit` | User submits a prompt | any | Prompt governance |
|
|
28
|
+
| `TaskCompleted` | Agent Teams task done | any | Lint, type check |
|
|
29
|
+
| `TeammateIdle` | Agent Teams member idle | any | Completeness reminder |
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
1. **Capture intent** -- ask: what should the hook do? Which lifecycle event?
|
|
34
|
+
2. **Select event** -- pick from the Supported Hook Events table above
|
|
35
|
+
3. **Define matcher** -- tool name for PreToolUse/PostToolUse, empty for global
|
|
36
|
+
4. **Write script** -- create `app/hooks/{event-name-kebab}.sh`
|
|
37
|
+
5. **Register in hooks.json** -- add entry to `app/hooks.json`
|
|
38
|
+
6. **Validate** -- run `scripts/validate.py`
|
|
39
|
+
|
|
40
|
+
## Hook Script Conventions
|
|
41
|
+
|
|
42
|
+
- Location: `app/hooks/{event-name-kebab}.sh`
|
|
43
|
+
- Shebang: `#!/bin/bash`
|
|
44
|
+
- Header comment: script name, purpose, event, matcher
|
|
45
|
+
- Respect `TOOLKIT_HOOK_PROFILE` env var (`minimal` = skip non-essential hooks)
|
|
46
|
+
- Always `exit 0` on success (non-zero blocks the operation for Pre* hooks)
|
|
47
|
+
- Output goes to Claude's context as plain text
|
|
48
|
+
- No external dependencies -- bash builtins and coreutils only
|
|
49
|
+
- Keep output concise -- hooks fire frequently
|
|
50
|
+
|
|
51
|
+
## hooks.json Entry Format
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"_source": "ai-toolkit",
|
|
56
|
+
"matcher": "",
|
|
57
|
+
"hooks": [
|
|
58
|
+
{
|
|
59
|
+
"type": "command",
|
|
60
|
+
"command": "\"$HOME/.ai-toolkit/hooks/{script-name}.sh\""
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Required fields:
|
|
67
|
+
- `_source`: always `"ai-toolkit"` (used by merge/strip logic)
|
|
68
|
+
- `matcher`: tool name or regex for Pre/PostToolUse, empty string for global events
|
|
69
|
+
- `hooks[].type`: always `"command"`
|
|
70
|
+
- `hooks[].command`: path to script using `$HOME/.ai-toolkit/hooks/` prefix
|
|
71
|
+
|
|
72
|
+
## Script Template
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
#!/bin/bash
|
|
76
|
+
# {script-name}.sh — {One-line purpose}.
|
|
77
|
+
#
|
|
78
|
+
# Fires on: {EventName}
|
|
79
|
+
# Matcher: {matcher or "all"}
|
|
80
|
+
# Skipped when TOOLKIT_HOOK_PROFILE=minimal.
|
|
81
|
+
|
|
82
|
+
PROFILE="${TOOLKIT_HOOK_PROFILE:-standard}"
|
|
83
|
+
[ "$PROFILE" = "minimal" ] && exit 0
|
|
84
|
+
|
|
85
|
+
# --- Hook logic here ---
|
|
86
|
+
|
|
87
|
+
exit 0
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Rules
|
|
91
|
+
|
|
92
|
+
- One script per hook entry (no inline multi-line commands)
|
|
93
|
+
- Script filename must use kebab-case matching the event purpose
|
|
94
|
+
- Pre* hooks can block operations -- keep them fast and deterministic
|
|
95
|
+
- Never write secrets or credentials to stdout (output goes to LLM context)
|
|
96
|
+
- Test the script standalone before registering: `bash app/hooks/{name}.sh`
|
|
97
|
+
|
|
98
|
+
## Validation Checklist
|
|
99
|
+
|
|
100
|
+
After creating the hook:
|
|
101
|
+
|
|
102
|
+
- [ ] Script exists in `app/hooks/` and is executable (`chmod +x`)
|
|
103
|
+
- [ ] Entry added to `app/hooks.json` with `_source: "ai-toolkit"`
|
|
104
|
+
- [ ] Event name matches a supported lifecycle event
|
|
105
|
+
- [ ] `scripts/validate.py` passes
|
|
106
|
+
- [ ] Script runs without errors: `bash app/hooks/{name}.sh`
|
|
107
|
+
- [ ] Hook count in README.md and docs updated if needed
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: index
|
|
3
|
+
description: "Index codebase into the knowledge base"
|
|
4
|
+
effort: low
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: "[path or scope]"
|
|
7
|
+
allowed-tools: Bash
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Knowledge Base Indexing
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Reindex the knowledge base for semantic search.
|
|
15
|
+
|
|
16
|
+
> **Prerequisite**: This command requires a vector store (e.g., Qdrant) and an indexing pipeline configured for your project. If not configured, this command provides guidance on setup.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/index # Incremental index (detect changes)
|
|
22
|
+
/index --full # Full rebuild
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Execution
|
|
26
|
+
|
|
27
|
+
### Direct Execution
|
|
28
|
+
```bash
|
|
29
|
+
# Incremental index (auto-detects changes)
|
|
30
|
+
make index
|
|
31
|
+
|
|
32
|
+
# Full rebuild
|
|
33
|
+
make index-full
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Docker Execution
|
|
37
|
+
```bash
|
|
38
|
+
docker exec {app-container} make index
|
|
39
|
+
docker exec {app-container} make index-full
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Change Detection
|
|
43
|
+
|
|
44
|
+
The indexer uses content hashing to detect changes:
|
|
45
|
+
|
|
46
|
+
| Scenario | Action |
|
|
47
|
+
|----------|--------|
|
|
48
|
+
| New document | Index |
|
|
49
|
+
| Changed content | Reindex |
|
|
50
|
+
| No changes | Skip |
|
|
51
|
+
| Deleted document | Remove from index |
|
|
52
|
+
|
|
53
|
+
## Frontmatter Validation
|
|
54
|
+
|
|
55
|
+
Before indexing, ensure all KB documents have valid frontmatter:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
---
|
|
59
|
+
title: "Document Title"
|
|
60
|
+
service: {service-name}
|
|
61
|
+
category: reference|howto|procedures|troubleshooting|decisions|best-practices
|
|
62
|
+
tags: [tag1, tag2]
|
|
63
|
+
last_updated: "YYYY-MM-DD"
|
|
64
|
+
---
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Troubleshooting
|
|
68
|
+
|
|
69
|
+
| Problem | Solution |
|
|
70
|
+
|---------|----------|
|
|
71
|
+
| Index not updating | Check file timestamps, run full rebuild |
|
|
72
|
+
| Missing documents | Verify frontmatter is valid |
|
|
73
|
+
| Slow indexing | Check embedding service performance |
|
|
74
|
+
| No vector store | Set up Qdrant or compatible vector DB |
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: instinct-review
|
|
3
|
+
description: "Review and manage learned instincts from past sessions"
|
|
4
|
+
effort: low
|
|
5
|
+
user-invocable: true
|
|
6
|
+
argument-hint: "[--list | --promote <id> | --remove <id> | --clear]"
|
|
7
|
+
allowed-tools: Bash, Read, Write, Glob
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /instinct-review - Manage Learned Instincts
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
## What This Does
|
|
15
|
+
|
|
16
|
+
Manages the instinct system that learns patterns from your sessions.
|
|
17
|
+
|
|
18
|
+
Instincts are stored in `.claude/instincts/` and loaded at session start.
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
### List all instincts
|
|
23
|
+
```
|
|
24
|
+
/instinct-review --list
|
|
25
|
+
```
|
|
26
|
+
Shows all instincts with confidence scores and source sessions.
|
|
27
|
+
|
|
28
|
+
### Review and curate
|
|
29
|
+
```
|
|
30
|
+
/instinct-review
|
|
31
|
+
```
|
|
32
|
+
Interactive review: shows each instinct and asks promote/remove/keep.
|
|
33
|
+
|
|
34
|
+
### Promote instinct (always apply)
|
|
35
|
+
```
|
|
36
|
+
/instinct-review --promote <filename>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Remove instinct
|
|
40
|
+
```
|
|
41
|
+
/instinct-review --remove <filename>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Clear all instincts
|
|
45
|
+
```
|
|
46
|
+
/instinct-review --clear
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## How Instincts Work
|
|
50
|
+
|
|
51
|
+
1. **Extraction**: At session end, the Stop hook extracts patterns from the session
|
|
52
|
+
2. **Storage**: Saved as `.claude/instincts/<pattern-name>.md` with confidence score
|
|
53
|
+
3. **Loading**: At session start, instincts are loaded and shown to Claude
|
|
54
|
+
4. **Curation**: Use `/instinct-review` to promote good ones and remove bad ones
|
|
55
|
+
|
|
56
|
+
## Instinct Format
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
# Pattern: [pattern name]
|
|
60
|
+
Confidence: 0.85
|
|
61
|
+
Sessions: 3
|
|
62
|
+
Last seen: 2026-03-25
|
|
63
|
+
|
|
64
|
+
[Description of the pattern or preference]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Steps
|
|
68
|
+
|
|
69
|
+
1. Run `ls .claude/instincts/ 2>/dev/null || echo "No instincts yet"`
|
|
70
|
+
2. For each instinct file, read it and display confidence/summary
|
|
71
|
+
3. Based on `$ARGUMENTS`:
|
|
72
|
+
- `--list`: display table of all instincts
|
|
73
|
+
- `--promote <id>`: set confidence to 1.0, add "pinned" tag
|
|
74
|
+
- `--remove <id>`: delete the file
|
|
75
|
+
- `--clear`: delete all files in `.claude/instincts/`
|
|
76
|
+
- no args: interactive review of each instinct
|
|
77
|
+
4. Report summary of changes made
|