Skip to content

notque/vexjoy-agent / skills/programming/programming

programming

Flagged

Language-specific patterns and tooling: Go, Kotlin, PHP, Swift, TypeScript.

FileKindSize
SKILL.mdskill md11.6 KB
references/go/code-review.mdmarkdown12.0 KB
references/go/code-review/common-review-comments.mdmarkdown6.6 KB
references/go/concurrency.mdmarkdown11.5 KB
references/go/concurrency/concurrency-patterns.mdmarkdown5.7 KB
references/go/error-handling.mdmarkdown10.8 KB
references/go/error-handling/patterns.mdmarkdown4.2 KB
references/go/google-style-guide/SHA256SUMSother313 B
references/go/google-style-guide/UPSTREAM_REVISIONother41 B
references/go/google-style-guide/best-practices/part-01.mdmarkdown10.0 KB
references/go/google-style-guide/best-practices/part-02.mdmarkdown15.0 KB
references/go/google-style-guide/best-practices/part-03.mdmarkdown14.1 KB
references/go/google-style-guide/best-practices/part-04.mdmarkdown13.5 KB
references/go/google-style-guide/best-practices/part-05.mdmarkdown10.5 KB
references/go/google-style-guide/best-practices/part-06.mdmarkdown14.4 KB
references/go/google-style-guide/best-practices/part-07.mdmarkdown16.1 KB
references/go/google-style-guide/best-practices/part-08.mdmarkdown11.4 KB
references/go/google-style-guide/best-practices/part-09.mdmarkdown13.7 KB
references/go/google-style-guide/best-practices/part-10.mdmarkdown16.9 KB
references/go/google-style-guide/decisions/part-01.mdmarkdown15.0 KB
references/go/google-style-guide/decisions/part-02.mdmarkdown12.5 KB
references/go/google-style-guide/decisions/part-03.mdmarkdown11.5 KB
references/go/google-style-guide/decisions/part-04.mdmarkdown8.4 KB
references/go/google-style-guide/decisions/part-05.mdmarkdown9.8 KB
references/go/google-style-guide/decisions/part-06.mdmarkdown14.7 KB
references/go/google-style-guide/decisions/part-07.mdmarkdown13.3 KB
references/go/google-style-guide/decisions/part-08.mdmarkdown14.3 KB
references/go/google-style-guide/decisions/part-09.mdmarkdown15.3 KB
references/go/google-style-guide/decisions/part-10.mdmarkdown8.3 KB
references/go/google-style-guide/guide/part-01.mdmarkdown16.3 KB
references/go/google-style-guide/guide/part-02.mdmarkdown3.0 KB
references/go/google-style-guide/index.mdmarkdown8.4 KB
references/go/preferred-patterns.mdmarkdown12.5 KB
references/go/preferred-patterns/code-examples.mdmarkdown11.6 KB
references/go/quality-gate.mdmarkdown7.3 KB
references/go/quality-gate/common-lint-errors.jsonconfig7.6 KB
references/go/quality-gate/examples.mdmarkdown11.0 KB
references/go/quality-gate/makefile-targets.jsonconfig5.1 KB
references/go/sapcc-conventions.mdmarkdown34.6 KB
references/go/sapcc-conventions/api-design-detailed.mdmarkdown22.7 KB
references/go/sapcc-conventions/architecture-patterns.mdmarkdown18.6 KB
references/go/sapcc-conventions/build-ci-detailed.mdmarkdown18.7 KB
references/go/sapcc-conventions/error-handling-detailed.mdmarkdown20.1 KB
references/go/sapcc-conventions/extended-patterns.mdmarkdown7.1 KB
references/go/sapcc-conventions/go-bits-philosophy-detailed.mdmarkdown24.5 KB
references/go/sapcc-conventions/library-reference.mdmarkdown14.0 KB
references/go/sapcc-conventions/pr-mining-insights.mdmarkdown17.5 KB
references/go/sapcc-conventions/review-standards.mdmarkdown10.5 KB
references/go/sapcc-conventions/sapcc-code-patterns.mdmarkdown46.2 KB
references/go/testing.mdmarkdown9.7 KB
references/go/testing/go-benchmark-and-concurrency.mdmarkdown5.6 KB
references/go/testing/go-test-patterns.mdmarkdown9.0 KB
references/kotlin/concurrency-patterns.mdmarkdown5.4 KB
references/kotlin/kotlin-testing.mdmarkdown7.9 KB
references/php/modern-php-features.mdmarkdown4.4 KB
references/php/testing-patterns.mdmarkdown7.5 KB
references/swift/preferred-patterns.mdmarkdown2.4 KB
references/swift/swift-testing.mdmarkdown6.6 KB
references/swift/task-patterns.mdmarkdown3.6 KB
scripts/bench-compare.shscript7.1 KB
scripts/check-errors.shscript7.1 KB
scripts/check-interface-compliance.shscript6.4 KB
scripts/check-sapcc-auth-ordering.shscript5.5 KB
scripts/check-sapcc-httptest.shscript4.4 KB
scripts/check-sapcc-identify-endpoint.shscript5.8 KB
scripts/check-sapcc-json-strict.shscript4.9 KB
scripts/check-sapcc-time-now.shscript4.2 KB
scripts/check-sapcc-todo-format.shscript4.1 KB
scripts/gen-table-test.shscript4.2 KB
scripts/quality_checker.pyscript16.2 KB
scripts/sync-google-style-guide.pyscript2.5 KB
scripts/validate.pyscript6.3 KB

scripts/gen-table-test.sh

View on GitHub
#!/usr/bin/env bash
set -euo pipefail

VERSION="1.0.0"
SCRIPT_NAME="$(basename "$0")"

usage() {
    cat <<EOF
$SCRIPT_NAME v$VERSION — Generate a table-driven test scaffold for a Go function

USAGE
    bash $SCRIPT_NAME [options] <FuncName> <package>

DESCRIPTION
    Outputs a table-driven test file for the given function and package.
    By default writes to stdout; use --output to write to a file.

    Exits 0 on success, 2 on error.

OPTIONS
    -h, --help           Show this help message
    -v, --version        Show version
    --output FILE        Write to FILE instead of stdout
    --force              Allow --output to overwrite an existing file
    --parallel           Include t.Parallel() in generated test
    --json               Output structured JSON metadata to stdout

ARGUMENTS
    FuncName             Name of the function to test (must be exported/uppercase)
    package              Go package name for the test file

EXAMPLES
    bash $SCRIPT_NAME ParseConfig config
    bash $SCRIPT_NAME --parallel ParseConfig config
    bash $SCRIPT_NAME --output config/parse_config_test.go ParseConfig config
    bash $SCRIPT_NAME --force --output config/parse_config_test.go ParseConfig config
    bash $SCRIPT_NAME --json --output config/parse_config_test.go ParseConfig config
    bash $SCRIPT_NAME ParseConfig config > config/parse_config_test.go
EOF
}

json_escape() {
    local s="$1"
    s="${s//\\/\\\\}"
    s="${s//\"/\\\"}"
    s="${s//$'\t'/\\t}"
    s="${s//$'\r'/}"
    s="${s//$'\n'/\\n}"
    printf '%s' "$s"
}

OUTPUT=""
PARALLEL=false
JSON_OUTPUT=false
FORCE=false
POSITIONAL=()

while [[ $# -gt 0 ]]; do
    case "$1" in
        -h|--help)    usage; exit 0 ;;
        -v|--version) echo "$SCRIPT_NAME v$VERSION"; exit 0 ;;
        --output)     OUTPUT="${2:?error: --output requires a file path}"; shift 2 ;;
        --force)      FORCE=true; shift ;;
        --parallel)   PARALLEL=true; shift ;;
        --json)       JSON_OUTPUT=true; shift ;;
        -*)           echo "error: unknown option: $1" >&2; usage >&2; exit 2 ;;
        *)            POSITIONAL+=("$1"); shift ;;
    esac
done

if [[ ${#POSITIONAL[@]} -lt 2 ]]; then
    echo "error: FuncName and package are required" >&2
    usage >&2
    exit 2
fi

FUNC="${POSITIONAL[0]}"
PKG="${POSITIONAL[1]}"

if [[ ! "$FUNC" =~ ^[A-Z] ]]; then
    echo "error: FuncName '$FUNC' must start with an uppercase letter" >&2
    exit 2
fi

generate_test() {
    local parallel_top="" parallel_sub=""
    if $PARALLEL; then
        parallel_top=$'\tt.Parallel()\n'
        parallel_sub=$'\t\t\tt.Parallel()\n'
    fi

    cat <<EOF
package ${PKG}

import (
	"testing"
)

func Test${FUNC}(t *testing.T) {
${parallel_top}	tests := []struct {
		name string
		give string // TODO: replace with actual input type
		want string // TODO: replace with actual output type
	}{
		{
			name: "basic case",
			give: "",
			want: "",
		},
		// TODO: add more test cases
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
${parallel_sub}			got := ${FUNC}(tt.give)
			if got != tt.want {
				t.Errorf("${FUNC}(%q) = %q, want %q", tt.give, got, tt.want)
			}
			// For richer diffs, consider:
			//   if diff := cmp.Diff(tt.want, got); diff != "" {
			//       t.Errorf("${FUNC}() mismatch (-want +got):\n%s", diff)
			//   }
		})
	}
}
EOF
}

if [[ -n "$OUTPUT" ]]; then
    OUTPUT_DIR="$(dirname "$OUTPUT")"
    if [[ ! -d "$OUTPUT_DIR" ]]; then
        echo "error: directory '$OUTPUT_DIR' does not exist" >&2
        exit 2
    fi
    if [[ -f "$OUTPUT" ]] && ! $FORCE; then
        echo "error: '$OUTPUT' already exists (use --force to overwrite)" >&2
        exit 2
    fi
    generate_test > "$OUTPUT"
    if $JSON_OUTPUT; then
        FUNC_ESC="$(json_escape "$FUNC")"
        PKG_ESC="$(json_escape "$PKG")"
        OUTPUT_ESC="$(json_escape "$OUTPUT")"
        cat <<EOF
{"func":"$FUNC_ESC","package":"$PKG_ESC","output_file":"$OUTPUT_ESC","parallel":$PARALLEL,"written":true}
EOF
    else
        echo "Wrote test scaffold to $OUTPUT"
    fi
else
    if $JSON_OUTPUT; then
        generate_test >&2
        FUNC_ESC="$(json_escape "$FUNC")"
        PKG_ESC="$(json_escape "$PKG")"
        cat <<EOF
{"func":"$FUNC_ESC","package":"$PKG_ESC","output_file":"","parallel":$PARALLEL,"written":false}
EOF
    else
        generate_test
    fi
fi

exit 0
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 319kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 319kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 319kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 319kUpdated Claude CodeCodexVerifiedInstall