go-pr-description

Installation
SKILL.md

Go PR — Affected Endpoints Generator

Produce the Affected endpoints block for a Go backend pull request description — nothing more. Output only the formatted list, ready to paste into a PR body.

Target output format

Affected endpoints:
- GET `/ms/studio/v1/gen-ai-requests`
- POST `/ms/studio/v1/gen-ai-requests`
- POST `/ms/studio/svc/v1/gen-ai-requests`
- CMD `genai video`
- CMD `genai music` (NEW)

Append (NEW) to any item that originated from an added file (A status in git diff).


Step 1 — Get changed files with status

git diff --name-status origin/master...HEAD

Each line is <status>\t<path>. Status codes:

  • A = added → mark as (NEW)
  • M / R / C = modified/renamed/copied → no suffix

Keep a set of "new" paths for later annotation.


Step 2 — Classify paths into buckets

Bucket Path prefix
api-public app/api/public/
api-cms app/api/cms/
api-svc app/api/svc/
cmd-genai app/cmd/genai/
cmd-image app/cmd/image/
cmd-credit app/cmd/credit/
service app/service/
repository app/repository/
util-or-other everything else

Adapt these prefixes to the actual repo structure if different.


Step 3 — Resolve each bucket

API buckets

For every changed file under app/api/{variant}/v1/:

  1. Identify the domain from the file path. Examples:

    • app/api/public/v1/api/genairequestapi/list.go → domain genairequestapi
    • app/api/cms/v1/router/gen_ai_style.go → domain gen_ai_style
  2. Find the router file for this domain in app/api/{variant}/v1/router/. If the changed file is the router file, use it directly. Otherwise look for a router file whose name matches the domain (e.g. gen_ai_request.go for genairequestapi).

    ls app/api/{variant}/v1/router/
    
  3. Read the router file and extract:

    • The base path suffix from the http.NewHttpRouter call:
      router := http.NewHttpRouter(app, prefixUrl+"/gen-ai-requests", accessType)
      
    • Every HTTP method + sub-path registered afterward:
      router.Get("", ...)           // → GET  <base>
      router.Post("", ...)          // → POST <base>
      router.Put("/{id}", ...)      // → PUT  <base>/{id}
      router.Delete("/{id}", ...)   // → DELETE <base>/{id}
      
  4. Get the variant's root URL prefix by reading the routes registration file once per variant:

    • app/api/public/routes.go → look for rootUrlV1 := (typically /ms/studio/v1)
    • app/api/cms/routes.go → similar (typically /ms/studio/cms/v1)
    • app/api/svc/routes.go → similar (typically /ms/studio/svc/v1)
  5. Compose the full path: rootUrl + baseSuffix + subPath

If only a specific handler method changed (e.g. list.go was modified but create.go was not), list only the route(s) that call the changed handler — not every route in the file.

Command buckets

Read app/cmd/{name}/root.go and the changed subcommand files. Find the Use field of each cobra.Command struct or AddCommand registration:

var videoCmd = &cobra.Command{Use: "video", ...}
rootCmd.AddCommand(videoCmd)

Format as: CMD \genai video`(directory name as parent,Use` value as subcommand).

Parent names: cmd/genaigenai, cmd/imageimage, cmd/creditcredit.

If root.go itself changed, include every registered subcommand.

Service bucket

Services are called by API handlers and commands — trace one level up:

# Example: changed file is app/service/videogenerationsvc/video_generation.go
# Extract package name: "videogenerationsvc"
grep -rl "videogenerationsvc" app/api/ app/cmd/ --include="*.go"

For each file the grep returns, apply the API or command resolution logic above.

Repository bucket

Repos are called by services — trace two levels up:

# Example: changed file is app/repository/db/genairequests/list.go
# Package name: "genairequests"
grep -rl "genairequests" app/service/ --include="*.go"
# → finds affected services
# Then for each service, run the service-bucket trace above

util-or-other bucket

Grep broadly for the package or type name across all api and cmd files, then apply the appropriate bucket resolution on each match:

grep -rl "<package-name>" app/api/ app/cmd/ --include="*.go"

If the grep returns too many files (a broadly shared utility), list the most clearly affected routes based on which handlers actually call the changed function, or note the scope inline rather than listing every route.


Step 4 — Deduplicate, sort, and emit

Collect all resolved entries. Remove exact duplicates. Sort order:

  1. HTTP endpoints — public variant first, then cms, then svc; within each variant sort by path
  2. CMD entries — alphabetically by command string

Output only this block, with no preamble or explanation:

Affected endpoints:
- METHOD `/full/path`
- CMD `parent sub` (NEW)

If nothing can be resolved (e.g. only config or doc files changed), output:

Affected endpoints:
- (no direct API or command surface affected)

Accuracy over completeness

When uncertain whether a route is truly affected, omit it rather than guess. A short accurate list is more useful in a PR than a long speculative one. If you genuinely cannot trace a file to a specific route, add a brief inline comment:

- CMD `genai video`  <!-- indirect: shared utility change -->
Related skills

More from sultanfarizbythen/skills

Installs
4
First Seen
10 days ago