@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,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: command-creator
|
|
3
|
+
description: "Creates new Claude Code slash commands with frontmatter, workflow guidance, and validation"
|
|
4
|
+
effort: high
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: "[command name or description]"
|
|
7
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Command Creator
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Create a new Claude Code slash command following ai-toolkit conventions.
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
1. **Capture intent** -- what should the command do and who invokes it?
|
|
19
|
+
2. **Pick scope** -- project command, user command, or plugin command?
|
|
20
|
+
3. **Define frontmatter** -- description, argument hint, allowed tools, model if needed
|
|
21
|
+
4. **Write command body** -- instructions for Claude, not explanation for the user
|
|
22
|
+
5. **Add validation context** -- expected output, constraints, follow-up checks
|
|
23
|
+
6. **Test and iterate** -- invoke the command with representative arguments
|
|
24
|
+
|
|
25
|
+
## Command Locations
|
|
26
|
+
|
|
27
|
+
- Project: `.claude/commands/<name>.md`
|
|
28
|
+
- User: `~/.claude/commands/<name>.md`
|
|
29
|
+
- Plugin: `plugin-name/commands/<name>.md`
|
|
30
|
+
|
|
31
|
+
In `ai-toolkit`, command-development guidance belongs in skill form and any reusable command templates should live under `app/skills/<skill-name>/templates/` or KB docs.
|
|
32
|
+
|
|
33
|
+
## Frontmatter Template
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
---
|
|
37
|
+
description: "One-line help text shown in /help"
|
|
38
|
+
argument-hint: "[target]"
|
|
39
|
+
allowed-tools: Read, Grep, Bash
|
|
40
|
+
model: sonnet
|
|
41
|
+
---
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Command Authoring Rules
|
|
45
|
+
|
|
46
|
+
- Write commands as **instructions for Claude**, not marketing copy for the user
|
|
47
|
+
- Keep the first paragraph action-oriented and deterministic
|
|
48
|
+
- Use `$ARGUMENTS` early when the command takes user input
|
|
49
|
+
- Prefer numbered phases for multi-step workflows
|
|
50
|
+
- List required checks explicitly (`lint`, `tests`, `docs`, etc.)
|
|
51
|
+
- Avoid hidden assumptions about project structure unless the command is project-specific
|
|
52
|
+
|
|
53
|
+
## Minimal Template
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
---
|
|
57
|
+
description: "{one-line description}"
|
|
58
|
+
argument-hint: "[arguments]"
|
|
59
|
+
allowed-tools: Read, Grep, Bash
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
# {Command Title}
|
|
63
|
+
|
|
64
|
+
$ARGUMENTS
|
|
65
|
+
|
|
66
|
+
Perform the requested task using this workflow:
|
|
67
|
+
|
|
68
|
+
1. Gather context from the repository.
|
|
69
|
+
2. Ask clarifying questions if critical information is missing.
|
|
70
|
+
3. Execute the task using the smallest safe set of changes.
|
|
71
|
+
4. Validate the result.
|
|
72
|
+
5. Summarize outcome and follow-up actions.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Validation Checklist
|
|
76
|
+
|
|
77
|
+
- [ ] Command file uses markdown and valid YAML frontmatter
|
|
78
|
+
- [ ] Help text is concise and searchable
|
|
79
|
+
- [ ] Body is instruction-oriented, not user-facing prose
|
|
80
|
+
- [ ] `$ARGUMENTS` is present when arguments are expected
|
|
81
|
+
- [ ] Validation steps are explicit
|
|
82
|
+
- [ ] Command has been tested with at least one realistic invocation
|
|
83
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: "Create Conventional Commits with pre-commit validation"
|
|
4
|
+
effort: medium
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: "[message or scope]"
|
|
7
|
+
allowed-tools: Bash, Read, Grep
|
|
8
|
+
hooks:
|
|
9
|
+
PreToolUse:
|
|
10
|
+
- matcher: "Bash"
|
|
11
|
+
hooks:
|
|
12
|
+
- type: command
|
|
13
|
+
command: "echo 'Reminder: ensure linting passes before committing'"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Git Commit
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
Creates well-structured git commits following Conventional Commits specification.
|
|
21
|
+
|
|
22
|
+
## Project context
|
|
23
|
+
|
|
24
|
+
- Staged changes: !`git diff --cached --stat 2>/dev/null || echo "nothing staged"`
|
|
25
|
+
- Current branch: !`git branch --show-current 2>/dev/null`
|
|
26
|
+
|
|
27
|
+
## Commit Format
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<type>(<scope>): <description>
|
|
31
|
+
|
|
32
|
+
[optional body]
|
|
33
|
+
|
|
34
|
+
[optional footer]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Types
|
|
38
|
+
|
|
39
|
+
| Type | Description |
|
|
40
|
+
|------|-------------|
|
|
41
|
+
| `feat` | New feature |
|
|
42
|
+
| `fix` | Bug fix |
|
|
43
|
+
| `docs` | Documentation only |
|
|
44
|
+
| `style` | Formatting, no code change |
|
|
45
|
+
| `refactor` | Code restructuring |
|
|
46
|
+
| `perf` | Performance improvement |
|
|
47
|
+
| `test` | Adding/updating tests |
|
|
48
|
+
| `chore` | Maintenance tasks |
|
|
49
|
+
| `ci` | CI/CD changes |
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Feature
|
|
55
|
+
git commit -m "$(cat <<'EOF'
|
|
56
|
+
feat(search): add multi-hop reasoning support
|
|
57
|
+
|
|
58
|
+
- Implement query decomposition
|
|
59
|
+
- Add iterative retrieval with reasoning
|
|
60
|
+
- Include answer synthesis from aggregated context
|
|
61
|
+
EOF
|
|
62
|
+
)"
|
|
63
|
+
|
|
64
|
+
# Bug fix
|
|
65
|
+
git commit -m "$(cat <<'EOF'
|
|
66
|
+
fix(cache): resolve connection pool exhaustion
|
|
67
|
+
|
|
68
|
+
Root cause: connections not returned to pool on error
|
|
69
|
+
Solution: use context manager for automatic cleanup
|
|
70
|
+
|
|
71
|
+
Fixes #123
|
|
72
|
+
EOF
|
|
73
|
+
)"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Automated Pre-Commit Check
|
|
77
|
+
|
|
78
|
+
Run the bundled script for structured pre-commit analysis:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python3 ${CLAUDE_SKILL_DIR}/scripts/pre-commit-check.py
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use the output to validate staged changes, detect secrets, and suggest commit type/scope.
|
|
85
|
+
|
|
86
|
+
## Pre-Commit Checklist
|
|
87
|
+
|
|
88
|
+
Before committing:
|
|
89
|
+
- [ ] Run linting: `make lint` (or `docker exec {app-container} make lint`)
|
|
90
|
+
- [ ] Run tests: `make test` (or `docker exec {app-container} make test`)
|
|
91
|
+
- [ ] Check for secrets: No API keys or passwords
|
|
92
|
+
|
|
93
|
+
## Git Safety
|
|
94
|
+
|
|
95
|
+
- NEVER use `--force` push without explicit request
|
|
96
|
+
- NEVER skip hooks (`--no-verify`) unless explicitly asked
|
|
97
|
+
- ALWAYS create NEW commits (don't amend previous unless asked)
|
|
98
|
+
- Stage specific files, avoid `git add -A` with sensitive files
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Pre-commit validation: staged files, secrets detection, commit type suggestion."""
|
|
3
|
+
import json, subprocess, re, sys
|
|
4
|
+
|
|
5
|
+
def run(cmd):
|
|
6
|
+
r = subprocess.run(cmd, capture_output=True, text=True)
|
|
7
|
+
return r.stdout.strip()
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
branch = run(["git", "branch", "--show-current"])
|
|
11
|
+
staged_raw = run(["git", "diff", "--cached", "--name-only"])
|
|
12
|
+
staged = staged_raw.split('\n') if staged_raw else []
|
|
13
|
+
stat = run(["git", "diff", "--cached", "--stat"])
|
|
14
|
+
|
|
15
|
+
# Detect secrets patterns
|
|
16
|
+
diff = run(["git", "diff", "--cached"])
|
|
17
|
+
secret_patterns = [
|
|
18
|
+
r'(?i)(api[_-]?key|secret|password|token|bearer)\s*[=:]\s*["\'][^"\']{8,}',
|
|
19
|
+
r'(?i)AKIA[0-9A-Z]{16}', # AWS
|
|
20
|
+
r'sk-[a-zA-Z0-9]{20,}', # OpenAI
|
|
21
|
+
]
|
|
22
|
+
secrets = []
|
|
23
|
+
for i, line in enumerate(diff.split('\n')):
|
|
24
|
+
if line.startswith('+') and not line.startswith('+++'):
|
|
25
|
+
for p in secret_patterns:
|
|
26
|
+
if re.search(p, line):
|
|
27
|
+
secrets.append({"line": i, "pattern": p.split(')')[0].split('(')[-1], "preview": line[:80]})
|
|
28
|
+
|
|
29
|
+
# Large files (>1MB)
|
|
30
|
+
large = []
|
|
31
|
+
for f in staged:
|
|
32
|
+
try:
|
|
33
|
+
r = subprocess.run(
|
|
34
|
+
["git", "cat-file", "-s", f":{f}"],
|
|
35
|
+
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True,
|
|
36
|
+
)
|
|
37
|
+
size = int(r.stdout.strip() or "0")
|
|
38
|
+
if size > 1_000_000:
|
|
39
|
+
large.append({"file": f, "size_mb": round(size/1_000_000, 1)})
|
|
40
|
+
except (ValueError, subprocess.SubprocessError):
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
# Suggest type from file paths
|
|
44
|
+
type_map = {"test": "test", "doc": "docs", "README": "docs", ".yml": "ci", ".yaml": "ci",
|
|
45
|
+
"Dockerfile": "ci", "migration": "feat", "fix": "fix"}
|
|
46
|
+
type_suggestion = "feat"
|
|
47
|
+
for f in staged:
|
|
48
|
+
for key, val in type_map.items():
|
|
49
|
+
if key.lower() in f.lower():
|
|
50
|
+
type_suggestion = val
|
|
51
|
+
break
|
|
52
|
+
|
|
53
|
+
# Suggest scope from common directory
|
|
54
|
+
scopes = set()
|
|
55
|
+
for f in staged:
|
|
56
|
+
parts = f.split('/')
|
|
57
|
+
if len(parts) > 1:
|
|
58
|
+
scopes.add(parts[0] if parts[0] != 'src' and parts[0] != 'app' else (parts[1] if len(parts) > 2 else parts[0]))
|
|
59
|
+
scope_suggestion = list(scopes)[0] if len(scopes) == 1 else None
|
|
60
|
+
|
|
61
|
+
# Parse additions/deletions
|
|
62
|
+
additions = len([l for l in diff.split('\n') if l.startswith('+') and not l.startswith('+++')])
|
|
63
|
+
deletions = len([l for l in diff.split('\n') if l.startswith('-') and not l.startswith('---')])
|
|
64
|
+
|
|
65
|
+
result = {
|
|
66
|
+
"branch": branch,
|
|
67
|
+
"staged_files": len(staged),
|
|
68
|
+
"staged_file_list": staged[:20],
|
|
69
|
+
"additions": additions,
|
|
70
|
+
"deletions": deletions,
|
|
71
|
+
"type_suggestion": type_suggestion,
|
|
72
|
+
"scope_suggestion": scope_suggestion,
|
|
73
|
+
"secrets_detected": secrets,
|
|
74
|
+
"large_files": large,
|
|
75
|
+
"warnings": []
|
|
76
|
+
}
|
|
77
|
+
if secrets:
|
|
78
|
+
result["warnings"].append(f"SECRETS DETECTED: {len(secrets)} potential secrets in staged changes")
|
|
79
|
+
if large:
|
|
80
|
+
result["warnings"].append(f"LARGE FILES: {len(large)} files over 1MB")
|
|
81
|
+
if not staged:
|
|
82
|
+
result["warnings"].append("NO FILES STAGED: nothing to commit")
|
|
83
|
+
|
|
84
|
+
print(json.dumps(result, indent=2))
|
|
85
|
+
|
|
86
|
+
if __name__ == "__main__":
|
|
87
|
+
main()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Conventional Commit Template
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
<type>(<scope>): <description>
|
|
5
|
+
|
|
6
|
+
<body>
|
|
7
|
+
|
|
8
|
+
<footer>
|
|
9
|
+
|
|
10
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Types
|
|
14
|
+
|
|
15
|
+
| Type | When to use |
|
|
16
|
+
|------|-------------|
|
|
17
|
+
| `feat` | New feature for the user |
|
|
18
|
+
| `fix` | Bug fix for the user |
|
|
19
|
+
| `docs` | Documentation only changes |
|
|
20
|
+
| `style` | Formatting, missing semicolons, etc. |
|
|
21
|
+
| `refactor` | Code change that neither fixes a bug nor adds a feature |
|
|
22
|
+
| `perf` | Performance improvement |
|
|
23
|
+
| `test` | Adding or correcting tests |
|
|
24
|
+
| `chore` | Build process, auxiliary tools, libraries |
|
|
25
|
+
| `ci` | CI/CD configuration changes |
|
|
26
|
+
| `revert` | Reverts a previous commit |
|
|
27
|
+
|
|
28
|
+
## Scope examples
|
|
29
|
+
|
|
30
|
+
- `auth`, `api`, `db`, `ui`, `config`, `deps`, `docker`, `ci`
|
|
31
|
+
|
|
32
|
+
## Breaking changes
|
|
33
|
+
|
|
34
|
+
Add `!` after type/scope and `BREAKING CHANGE:` in footer:
|
|
35
|
+
```
|
|
36
|
+
feat(api)!: change authentication endpoint
|
|
37
|
+
|
|
38
|
+
BREAKING CHANGE: /auth/login now requires email instead of username
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Multi-line body
|
|
42
|
+
|
|
43
|
+
Use bullet points for multiple changes:
|
|
44
|
+
```
|
|
45
|
+
feat(search): add advanced filtering
|
|
46
|
+
|
|
47
|
+
- Add date range filter
|
|
48
|
+
- Add category filter with multi-select
|
|
49
|
+
- Add saved filters functionality
|
|
50
|
+
|
|
51
|
+
Closes #456
|
|
52
|
+
```
|