Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions go-linter-driven-development/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/user-prompt-submit.sh"
}
]
}
]
}
}
39 changes: 39 additions & 0 deletions go-linter-driven-development/hooks/user-prompt-submit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e

# Read hook input from stdin
input=$(cat)
user_message=$(echo "$input" | jq -r '.message')

# Signal 1: Go file mentioned or Go project context
is_go_work=$(echo "$user_message" | grep -qiE '\.go|go\.mod|go\.sum|golang' && echo "true" || echo "false")

# If not mentioned, check if working directory has Go files
if [ "$is_go_work" = "false" ]; then
project_dir=$(echo "$input" | jq -r '.cwd')
# Check for go.mod or .go files (safe with set -e)
if [ -f "$project_dir/go.mod" ] || find "$project_dir" -maxdepth 1 -name "*.go" -type f 2>/dev/null | head -1 | grep -q .; then
is_go_work="true"
fi
fi

# Signal 2: Code work verbs
is_code_work=$(echo "$user_message" | grep -qiE "implement|build|create|add|write|fix|refactor|update|change|modify|continue|finish|complete|ldd|linter|test" && echo "true" || echo "false")

# Both signals → Use skill
if [ "$is_go_work" = "true" ] && [ "$is_code_work" = "true" ]; then
cat <<EOF
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"additionalContext": "AUTO-INVOKE DETECTED: This request matches the conditions for 'go-linter-driven-development:linter-driven-development' skill (Go project + code work request). This skill should be invoked to handle the complete workflow: design → test → lint → refactor → review."
}
}
EOF
else
cat <<EOF
{}
EOF
fi

exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ description: |
META ORCHESTRATOR for implementation workflow: design → test → lint → refactor → review → commit.
Use for any commit: features, bug fixes, refactors.

## AUTO-ENGAGEMENT (When Invoked by Hook)

If you're reading this because the UserPromptSubmit hook detected Go code work, the detection is already done.

**Simply announce and proceed:**

"Using go-ldd workflow for this Go code work"

Then jump directly to the Pre-Flight Check to gather context and start the workflow.

---

## When to Use
- Implementing any code change that should result in a commit
- Need automatic workflow management with quality gates
Expand Down