Skip to content

code-yeongyu/oh-my-openagent / packages/shared-skills/skills/programming

programming

Flagged

Applies strict, modern language practice (typed errors, exhaustive match, tests that can fail) for Python, Rust, TypeScript, JavaScript, and Go. Use for work on .py, .rs, .ts, .js, or .go files, and whenever a test or spec file is written, reshaped, reviewed, or deleted: the four-question test authoring gate and the junk-test classes live here.

FileKindSize
SKILL.mdskill md33.3 KB
references/code-smells.mdmarkdown13.9 KB
references/go/README.mdmarkdown7.7 KB
references/go/backend-stack.mdmarkdown16.6 KB
references/go/bootstrap.mdmarkdown8.9 KB
references/go/bubbletea-v2.mdmarkdown11.3 KB
references/go/cobra-stack.mdmarkdown11.5 KB
references/go/concurrency.mdmarkdown10.9 KB
references/go/data-modeling.mdmarkdown12.0 KB
references/go/error-handling.mdmarkdown10.1 KB
references/go/golangci-strict.mdmarkdown10.0 KB
references/go/grpc-connect.mdmarkdown10.3 KB
references/go/libraries.mdmarkdown13.7 KB
references/go/one-liners.mdmarkdown5.5 KB
references/go/sqlc-pgx.mdmarkdown12.7 KB
references/go/testing.mdmarkdown14.2 KB
references/go/type-patterns.mdmarkdown9.5 KB
references/logging.mdmarkdown10.5 KB
references/python/README.mdmarkdown15.7 KB
references/python/async-anyio.mdmarkdown14.2 KB
references/python/data-modeling.mdmarkdown6.6 KB
references/python/data-processing.mdmarkdown4.2 KB
references/python/error-handling.mdmarkdown6.0 KB
references/python/fastapi-stack.mdmarkdown9.2 KB
references/python/httpx2-optimization.mdmarkdown12.0 KB
references/python/libraries.mdmarkdown10.6 KB
references/python/one-liners.mdmarkdown7.9 KB
references/python/orjson-stack.mdmarkdown13.3 KB
references/python/pydantic-ai.mdmarkdown8.2 KB
references/python/pyproject-strict.mdmarkdown9.0 KB
references/python/textual-tui.mdmarkdown5.1 KB
references/python/type-patterns.mdmarkdown4.1 KB
references/rust-ub/README.mdmarkdown9.9 KB
references/rust-ub/miri-sanitizers-loom.mdmarkdown11.5 KB
references/rust-ub/ub-taxonomy.mdmarkdown13.3 KB
references/rust/README.mdmarkdown16.6 KB
references/rust/api-design.mdmarkdown6.5 KB
references/rust/async-tokio.mdmarkdown12.6 KB
references/rust/axum-stack.mdmarkdown14.2 KB
references/rust/cargo-strict.mdmarkdown10.0 KB
references/rust/clap-stack.mdmarkdown12.1 KB
references/rust/concurrency.mdmarkdown14.3 KB
references/rust/libraries.mdmarkdown17.4 KB
references/rust/macros.mdmarkdown3.3 KB
references/rust/one-liners.mdmarkdown7.5 KB
references/rust/proptest-insta.mdmarkdown13.9 KB
references/rust/type-state.mdmarkdown13.1 KB
references/rust/unsafe-discipline.mdmarkdown12.9 KB
references/rust/zero-cost-safety.mdmarkdown16.9 KB
references/testing/README.mdmarkdown10.3 KB
references/testing/junk-classes.mdmarkdown6.2 KB
references/typescript/README.mdmarkdown10.6 KB
references/typescript/backend-hono.mdmarkdown21.2 KB
references/typescript/bootstrap.mdmarkdown6.9 KB
references/typescript/data-modeling.mdmarkdown5.0 KB
references/typescript/error-handling.mdmarkdown4.7 KB
references/typescript/oxc-lint.mdmarkdown7.6 KB
references/typescript/tsconfig-strict.mdmarkdown3.9 KB
references/typescript/type-patterns.mdmarkdown5.2 KB
scripts/go/check-no-excuse-rules.shexecutablescript7.1 KB
scripts/go/new-project.tsscript6.8 KB
scripts/go/templates/.editorconfigother206 B
scripts/go/templates/.golangci.ymlconfig1.5 KB
scripts/go/templates/AGENTS.md.tmplother845 B
scripts/go/templates/README.md.tmplother207 B
scripts/go/templates/Taskfile.ymlconfig706 B
scripts/go/templates/ci.ymlconfig863 B
scripts/go/templates/config.goscript643 B
scripts/go/templates/gitignoreother99 B
scripts/go/templates/main.go.tmplother329 B
scripts/go/templates/run.goscript350 B
scripts/python/check-no-excuse-rules.pyscript24.9 KB
scripts/python/new-project.tsscript6.7 KB
scripts/python/new-script.tsscript4.2 KB
scripts/rust/check-no-excuse-rules.shexecutablescript7.5 KB
scripts/rust/check-no-excuse-rules.test.tsscript3.4 KB
scripts/rust/new-project.tsscript6.1 KB
scripts/scaffolders.test.tsscript4.9 KB
scripts/shared/run-tool.tsscript855 B
scripts/typescript/check-no-excuse-rules.test.tsscript4.0 KB
scripts/typescript/check-no-excuse-rules.tsscript13.1 KB
scripts/typescript/check-test-junk-rules.tsscript5.5 KB
scripts/typescript/check-test-junk.test.tsscript4.9 KB
scripts/typescript/check-test-junk.tsscript5.4 KB
scripts/typescript/mutation-proof.test.tsscript1.9 KB
scripts/typescript/mutation-proof.tsscript6.4 KB
scripts/typescript/new-project.test.tsscript6.8 KB
scripts/typescript/new-project.tsscript3.1 KB
scripts/typescript/oxc/.oxfmtrc.jsonconfig256 B
scripts/typescript/oxc/.oxlintrc.jsonconfig1.7 KB
scripts/typescript/oxc/lint/oxlint-plugin/LICENSEother1.0 KB
scripts/typescript/oxc/lint/oxlint-plugin/index.jsscript288 B
scripts/typescript/oxc/lint/oxlint-plugin/no-em-dash-copy.jsscript785 B
scripts/typescript/oxc/lint/oxlint-plugin/require-suppression-reason.jsscript2.3 KB
scripts/typescript/oxc/tsconfig.jsonconfig794 B

scripts/go/check-no-excuse-rules.sh

View on GitHub
#!/usr/bin/env bash
# No-excuse rule checker for Go files.
# Mirrors the philosophy of python-programmer / typescript-programmer / rust-programmer scripts:
# only rules that can be enforced via pure text matching live here.
# Everything semantic is on golangci-lint + nilaway + go test -race.

set -euo pipefail

if [ $# -eq 0 ]; then
    echo "Usage: $0 <file.go> [file.go ...]" >&2
    exit 2
fi

violations=0
report() {
    local file="$1"
    local line="$2"
    local rule="$3"
    local detail="$4"
    echo "::error file=${file},line=${line}::[${rule}] ${detail}" >&2
    violations=$((violations + 1))
}

is_test_file() {
    case "$1" in
        *_test.go) return 0 ;;
    esac
    return 1
}

is_generated_file() {
    local file="$1"
    case "$file" in
        *.pb.go|*.connect.go|*.gen.go) return 0 ;;
        *_string.go) return 0 ;;
    esac
    # First-line check for "Code generated ... DO NOT EDIT." (the official marker)
    if [ -f "$file" ]; then
        head -n 5 "$file" 2>/dev/null | grep -qE "^// Code generated .* DO NOT EDIT\.$" && return 0
    fi
    return 1
}

for file in "$@"; do
    [ -f "$file" ] || continue
    case "$file" in
        *.go) ;;
        *) continue ;;
    esac

    if is_generated_file "$file"; then
        continue
    fi

    in_test=0
    if is_test_file "$file"; then
        in_test=1
    fi

    line_no=0
    while IFS= read -r raw_line || [ -n "$raw_line" ]; do
        line_no=$((line_no + 1))
        line="$raw_line"

        # Strip line comments before pattern checks
        # (block comments are not handled — keep the rules robust to that limitation).
        code_only="${line%%//*}"

        # ── Exemption marker: // no-excuse-ok: <reason> ──────────────────
        if [[ "$line" =~ //[[:space:]]*no-excuse-ok:[[:space:]]*.+ ]]; then
            continue
        fi

        # ── Rule: no `_ = err` (silent error swallow) ────────────────────
        # The errcheck linter catches most of these but the `_ = err` form
        # specifically slips through if used with named returns.
        if [[ "$code_only" =~ ^[[:space:]]*_[[:space:]]*=[[:space:]]*err[[:space:]]*$ ]] ||
           [[ "$code_only" =~ ^[[:space:]]*_[[:space:]]*=[[:space:]]*err[[:space:]]*[^a-zA-Z0-9_].*$ ]]; then
            if [ "$in_test" -eq 0 ]; then
                report "$file" "$line_no" "silent-err" "discarding err with '_ = err' — handle the error"
            fi
        fi

        # ── Rule: no `panic(` in non-test, non-main code ─────────────────
        # Allowed in main(), allowed in tests, allowed with explicit marker.
        if [[ "$code_only" =~ [^a-zA-Z0-9_]panic\( ]] || [[ "$code_only" =~ ^[[:space:]]*panic\( ]]; then
            if [ "$in_test" -eq 0 ]; then
                # main package main.go is the one exception
                pkg_line=$(head -n 5 "$file" 2>/dev/null | grep -m1 "^package ")
                if [[ "$pkg_line" != "package main" ]]; then
                    report "$file" "$line_no" "panic-in-lib" "panic outside main/test — return error instead"
                fi
            fi
        fi

        # ── Rule: no `log.Fatal` / `log.Panic` in library code ───────────
        if [[ "$code_only" =~ log\.(Fatal|Panic)(f|ln)?\( ]]; then
            if [ "$in_test" -eq 0 ]; then
                pkg_line=$(head -n 5 "$file" 2>/dev/null | grep -m1 "^package ")
                if [[ "$pkg_line" != "package main" ]]; then
                    report "$file" "$line_no" "log-fatal-in-lib" "log.Fatal/Panic outside main — return error"
                fi
            fi
        fi

        # ── Rule: no init() functions ─────────────────────────────────
        # init() ruins testability and creates hidden global state.
        # Exception: //go:build constraint files and generated code.
        if [[ "$code_only" =~ ^func[[:space:]]+init\(\)[[:space:]]*\{ ]]; then
            report "$file" "$line_no" "no-init-func" "init() ruins testability — use explicit constructor"
        fi

        # ── Rule: no `time.Sleep` in non-test code ──────────────────────
        if [[ "$code_only" =~ time\.Sleep\( ]]; then
            if [ "$in_test" -eq 0 ]; then
                report "$file" "$line_no" "time-sleep" "time.Sleep in production code — use ticker/timer with ctx"
            fi
        fi

        # ── Rule: no `context.Background()` inside functions (only in main/init/test) ──
        if [[ "$code_only" =~ context\.Background\(\) ]]; then
            if [ "$in_test" -eq 0 ]; then
                pkg_line=$(head -n 5 "$file" 2>/dev/null | grep -m1 "^package ")
                if [[ "$pkg_line" != "package main" ]]; then
                    report "$file" "$line_no" "ctx-background-in-lib" "context.Background() outside main — propagate ctx as parameter"
                fi
            fi
        fi

        # ── Rule: no `interface{}` (use `any`, the alias from Go 1.18+) ──
        if [[ "$code_only" =~ interface\{\} ]]; then
            report "$file" "$line_no" "old-interface-empty" "use 'any' instead of 'interface{}' (Go 1.18+)"
        fi

        # ── Rule: no bare `fmt.Println` for logging (use slog) ───────────
        # Acceptable in main.go (CLI output) and tests. Reject in libraries.
        if [[ "$code_only" =~ fmt\.(Print|Println|Printf)\( ]]; then
            if [ "$in_test" -eq 0 ]; then
                pkg_line=$(head -n 5 "$file" 2>/dev/null | grep -m1 "^package ")
                if [[ "$pkg_line" != "package main" ]]; then
                    report "$file" "$line_no" "fmt-print-in-lib" "fmt.Print* in library — use slog for structured logs"
                fi
            fi
        fi

        # ── Rule: no `nolint` directive without reason ───────────────────
        if [[ "$line" =~ //nolint(:|$| ) ]]; then
            if ! [[ "$line" =~ //nolint:[a-zA-Z0-9_,-]+[[:space:]]+//[[:space:]]*[^[:space:]] ]]; then
                report "$file" "$line_no" "nolint-no-reason" "//nolint requires a // reason after the linter list"
            fi
        fi

        # ── Rule: no TODO / FIXME without an issue link or owner ─────────
        # Check the full line — TODOs live in comments, which $code_only has stripped.
        if echo "$line" | grep -qE '(TODO|FIXME|XXX)([[:space:]]|:)'; then
            if ! echo "$line" | grep -qE '(TODO|FIXME|XXX).*[(@[]'; then
                report "$file" "$line_no" "todo-no-owner" "TODO/FIXME requires (#issue) or @owner attribution"
            fi
        fi
    done < "$file"
done

if [ "$violations" -gt 0 ]; then
    echo "" >&2
    echo "go-programmer: $violations violation(s). Run also:" >&2
    echo "  gofumpt -l ." >&2
    echo "  golangci-lint run --timeout 5m ./..." >&2
    echo "  nilaway ./..." >&2
    echo "  go test -race -shuffle=on -count=1 ./..." >&2
    exit 1
fi

echo "go-programmer: no-excuse rules passed for $# file(s)."
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall