@sitar_fiercer4c/skills 0.1.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.
Files changed (50) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +75 -0
  3. package/bin/install.js +45 -0
  4. package/package.json +29 -0
  5. package/skills/architecture-walkthrough/SKILL.md +223 -0
  6. package/skills/architecture-walkthrough/references/sections.md +29 -0
  7. package/skills/architecture-walkthrough/scripts/check_structure.py +200 -0
  8. package/skills/autotest-webapp-ui/SKILL.md +58 -0
  9. package/skills/backend-code-review/SKILL.md +386 -0
  10. package/skills/backend-code-review/references/report-format.md +333 -0
  11. package/skills/backend-code-review/scripts/list_routes.py +269 -0
  12. package/skills/backend-code-review/scripts/sweep.py +550 -0
  13. package/skills/backend-code-review/scripts/verify_citations.py +201 -0
  14. package/skills/be-brief/SKILL.md +18 -0
  15. package/skills/clarke-list-excel/SKILL.md +51 -0
  16. package/skills/clarke-list-excel/references/output-schema.md +125 -0
  17. package/skills/clarke-list-excel/scripts/clarke_common.py +251 -0
  18. package/skills/clarke-list-excel/scripts/clarke_extract.py +487 -0
  19. package/skills/clarke-list-excel/scripts/load_clarke.py +322 -0
  20. package/skills/clarke-list-excel/scripts/run_all.py +63 -0
  21. package/skills/datalab-api/SKILL.md +163 -0
  22. package/skills/datalab-api/references/parameters-and-payload.md +121 -0
  23. package/skills/datalab-api/references/table-selection.md +35 -0
  24. package/skills/datalab-api/scripts/datalab_tables.py +365 -0
  25. package/skills/find-test-seam/SKILL.md +41 -0
  26. package/skills/frontend-code-review/SKILL.md +247 -0
  27. package/skills/frontend-code-review-2/SKILL.md +192 -0
  28. package/skills/frontend-code-review-2/scripts/fetch_pr_comments.py +65 -0
  29. package/skills/frontend-code-review-2/scripts/render_report.py +139 -0
  30. package/skills/murtaza-breif/SKILL.md +143 -0
  31. package/skills/murtaza-breif/scripts/save_brief.py +128 -0
  32. package/skills/pdf-to-json/SKILL.md +42 -0
  33. package/skills/pdf-to-json/references/output-schema.md +168 -0
  34. package/skills/pdf-to-json/scripts/extract_figures.py +319 -0
  35. package/skills/pdf-to-json/scripts/load_mongo.py +287 -0
  36. package/skills/pdf-to-json/scripts/pdf_extract.py +1313 -0
  37. package/skills/record-api-traffic/SKILL.md +434 -0
  38. package/skills/record-api-traffic/references/reading-recordings.md +224 -0
  39. package/skills/record-api-traffic/scripts/check-schema.mjs +184 -0
  40. package/skills/record-api-traffic/scripts/dump-quotation.mjs +67 -0
  41. package/skills/record-api-traffic/scripts/dump-source-excel.mjs +75 -0
  42. package/skills/record-api-traffic/scripts/lib/repo.mjs +109 -0
  43. package/skills/record-api-traffic/scripts/preflight.py +528 -0
  44. package/skills/record-api-traffic/scripts/record-api-traffic.py +720 -0
  45. package/skills/refac-wrt-business-goal/SKILL.md +305 -0
  46. package/skills/refac-wrt-business-goal/references/critic.md +170 -0
  47. package/skills/system-resource-triage/SKILL.md +180 -0
  48. package/skills/system-resource-triage/scripts/reap.sh +116 -0
  49. package/skills/system-resource-triage/scripts/triage.sh +111 -0
  50. package/skills/using-git-worktrees/SKILL.md +167 -0
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env bash
2
+ # Terminate detached, long-lived processes. Dry run unless --confirm is passed.
3
+ #
4
+ # reap.sh --name claude list candidates (dry run)
5
+ # reap.sh --name claude --min-age-days 5 older than 5 days
6
+ # reap.sh --name claude --confirm actually SIGTERM them
7
+ # reap.sh --name vscode-server --match-args match the full command line, not the process name
8
+ # reap.sh --name claude --protect "123 456" keep specific PIDs alive
9
+ #
10
+ # Only ever selects processes with NO controlling terminal: anything with a tty is attached to
11
+ # something a human is using. The calling process and its entire ancestor chain are always
12
+ # excluded, so this cannot kill the session running it.
13
+ #
14
+ # Runs under bash on purpose. In zsh `kill $PIDS` passes the whole list as a single argument and
15
+ # silently fails, which is easy to misread as success.
16
+
17
+ set -uo pipefail
18
+
19
+ NAME=""
20
+ MIN_AGE_DAYS=2
21
+ CONFIRM=0
22
+ MATCH_ARGS=0
23
+ PROTECT=""
24
+
25
+ while [ $# -gt 0 ]; do
26
+ case "$1" in
27
+ --name) NAME="${2:-}"; shift 2 ;;
28
+ --min-age-days) MIN_AGE_DAYS="${2:-2}"; shift 2 ;;
29
+ --protect) PROTECT="${2:-}"; shift 2 ;;
30
+ --match-args) MATCH_ARGS=1; shift ;;
31
+ --confirm) CONFIRM=1; shift ;;
32
+ -h|--help) sed -n '2,16p' "$0"; exit 0 ;;
33
+ *) printf 'unknown option: %s\n' "$1" >&2; exit 2 ;;
34
+ esac
35
+ done
36
+
37
+ [ -z "$NAME" ] && { printf 'error: --name is required\n' >&2; exit 2; }
38
+
39
+ # Walk up from this script's own PID so we can never select ourselves or whatever launched us.
40
+ ancestors=" 1 "
41
+ p=$$
42
+ while [ -n "$p" ] && [ "$p" != "0" ] && [ "$p" != "1" ]; do
43
+ ancestors+="$p "
44
+ p=$(awk '/^PPid:/ { print $2 }' "/proc/$p/status" 2>/dev/null)
45
+ done
46
+ for x in $PROTECT; do ancestors+="$x "; done
47
+
48
+ if [ "$MATCH_ARGS" -eq 1 ]; then
49
+ listing=$(ps -eo pid=,ppid=,stat=,euid=,tty=,etime=,rss=,args=)
50
+ else
51
+ listing=$(ps -eo pid=,ppid=,stat=,euid=,tty=,etime=,rss=,comm=)
52
+ fi
53
+
54
+ candidates=$(printf '%s\n' "$listing" \
55
+ | awk -v want="$NAME" -v minage="$MIN_AGE_DAYS" -v prot="$ancestors" -v me="$(id -u)" '
56
+ BEGIN { n = split(prot, A, " "); for (i = 1; i <= n; i++) if (A[i] != "") P[A[i]] = 1 }
57
+ $1 <= 2 || $2 == 2 { next } # never touch init or kernel threads
58
+ $3 ~ /^Z/ { next } # zombies hold no memory; TERM does nothing
59
+ $4 != me { next } # only your own processes
60
+ $5 != "?" { next } # has a terminal: someone is using it
61
+ {
62
+ split($6, a, "-")
63
+ days = (a[2] == "") ? 0 : a[1] + 0
64
+ if (days < minage) next
65
+ if ($1 in P) next
66
+ pid = $1; age = $6; rss = $7
67
+ $1 = $2 = $3 = $4 = $5 = $6 = $7 = ""
68
+ sub(/^ +/, "")
69
+ if ($0 !~ want) next
70
+ printf "%s|%s|%s|%s\n", pid, age, rss, $0
71
+ }')
72
+
73
+ if [ -z "$candidates" ]; then
74
+ printf 'no candidates: nothing matching /%s/ is detached and older than %s day(s)\n' \
75
+ "$NAME" "$MIN_AGE_DAYS"
76
+ exit 0
77
+ fi
78
+
79
+ printf '%s\n' "$candidates" \
80
+ | awk -F'|' '{ printf " pid=%-9s age=%-14s rss=%7.0f MB %s\n", $1, $2, $3/1024, $4; n++; t += $3 }
81
+ END { printf "\n %d processes, %.1f GB reclaimable\n", n, t/1048576 }'
82
+
83
+ pids=$(printf '%s\n' "$candidates" | cut -d'|' -f1)
84
+
85
+ # Belt and braces: abort rather than kill anything in the protected set.
86
+ for pid in $pids; do
87
+ case "$ancestors" in
88
+ *" $pid "*) printf '\nABORT: protected pid %s appeared in the list\n' "$pid" >&2; exit 1 ;;
89
+ esac
90
+ done
91
+
92
+ if [ "$CONFIRM" -eq 0 ]; then
93
+ printf '\ndry run - nothing was killed. Re-run with --confirm to SIGTERM these.\n'
94
+ exit 0
95
+ fi
96
+
97
+ printf '\nsending SIGTERM...\n'
98
+ sent=0
99
+ for pid in $pids; do
100
+ if kill -TERM "$pid" 2>/dev/null; then sent=$((sent + 1)); else printf ' already gone: %s\n' "$pid"; fi
101
+ done
102
+ printf 'TERM delivered to %d processes, waiting 12s for clean exit...\n' "$sent"
103
+ sleep 12
104
+
105
+ survivors=""
106
+ for pid in $pids; do kill -0 "$pid" 2>/dev/null && survivors+="$pid "; done
107
+
108
+ if [ -n "$survivors" ]; then
109
+ printf '\nstill alive after SIGTERM: %s\n' "$survivors"
110
+ printf 'left running on purpose - SIGKILL loses unflushed state, so confirm before forcing.\n'
111
+ else
112
+ printf '\nall terminated cleanly.\n'
113
+ fi
114
+
115
+ printf '\n== memory now ==\n'
116
+ free -h
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env bash
2
+ # Read-only system resource triage. Gathers everything needed for a diagnosis in one pass.
3
+ #
4
+ # triage.sh group memory by process name
5
+ # triage.sh claude vscode-server group by regex against the full command line
6
+ # triage.sh --snapshot /tmp/before.txt [patterns...]
7
+ #
8
+ # Deliberately avoids spawning a subprocess per PID: on a box with ~1500 processes that generates
9
+ # enough context switches and run-queue depth to show up in the very numbers being measured.
10
+
11
+ set -uo pipefail
12
+
13
+ SNAPSHOT=""
14
+ PATTERNS=()
15
+ while [ $# -gt 0 ]; do
16
+ case "$1" in
17
+ --snapshot) SNAPSHOT="${2:-}"; shift 2 ;;
18
+ -h|--help) sed -n '2,10p' "$0"; exit 0 ;;
19
+ *) PATTERNS+=("$1"); shift ;;
20
+ esac
21
+ done
22
+
23
+ hr() { printf '\n== %s ==\n' "$1"; }
24
+
25
+ main() {
26
+ printf 'triage @ %s\n' "$(date '+%Y-%m-%d %H:%M:%S')"
27
+
28
+ hr "load / uptime"
29
+ uptime
30
+ printf 'cores: %s\n' "$(nproc)"
31
+
32
+ hr "memory"
33
+ free -h
34
+
35
+ hr "cpu (instantaneous - second sample, first is a since-boot average)"
36
+ top -bn2 -d 1 2>/dev/null | grep '^%Cpu' | tail -1
37
+
38
+ hr "vmstat (header row dropped: it is a since-boot average, not now)"
39
+ vmstat 1 3 2>/dev/null | tail -2
40
+
41
+ hr "processes in D state (uninterruptible IO)"
42
+ local dcount
43
+ dcount=$(ps -eo stat= | awk '$1 ~ /^D/' | wc -l)
44
+ printf 'count: %s\n' "$dcount"
45
+ [ "$dcount" -gt 0 ] && ps -eo pid=,stat=,comm= | awk '$2 ~ /^D/' | head -10
46
+
47
+ hr "memory by group (the aggregate view - small processes hide here)"
48
+ if [ ${#PATTERNS[@]} -gt 0 ]; then
49
+ local joined
50
+ joined=$(printf '%s\001' "${PATTERNS[@]}")
51
+ ps -eo rss=,args= | awk -v pats="$joined" '
52
+ BEGIN { np = split(pats, P, "\001") }
53
+ {
54
+ rss = $1; $1 = ""; key = "other"
55
+ for (i = 1; i <= np; i++) if (P[i] != "" && $0 ~ P[i]) { key = P[i]; break }
56
+ n[key]++; s[key] += rss
57
+ }
58
+ END { for (k in n) printf "%.0f|%d|%s\n", s[k]/1024, n[k], k }'
59
+ else
60
+ ps -eo rss=,comm= | awk '{ n[$2]++; s[$2] += $1 }
61
+ END { for (k in n) printf "%.0f|%d|%s\n", s[k]/1024, n[k], k }'
62
+ fi | sort -t'|' -k1 -rn | head -12 \
63
+ | awk -F'|' '{ printf "%9s MB %5s procs %s\n", $1, $2, $3 }'
64
+
65
+ hr "top single processes by RSS"
66
+ ps -eo rss=,pid=,comm= --sort=-rss | head -8 \
67
+ | awk '{ printf "%9.0f MB pid=%-8s %s\n", $1/1024, $2, $3 }'
68
+
69
+ hr "top swap consumers (single awk pass over /proc)"
70
+ awk '/^Name:/ { n = $2 }
71
+ /^VmSwap:/ { if ($2+0 > 0) { split(FILENAME, a, "/"); printf "%9.0f MB pid=%-8s %s\n", $2/1024, a[3], n } }' \
72
+ /proc/[0-9]*/status 2>/dev/null | sort -rn | head -10
73
+
74
+ hr "zombies (no RAM/CPU cost, but they leak PID slots)"
75
+ local zcount
76
+ zcount=$(ps -eo stat= | awk '$1 ~ /^Z/' | wc -l)
77
+ printf 'total: %s\n' "$zcount"
78
+ if [ "$zcount" -gt 0 ]; then
79
+ printf 'by parent (a parent that is not reaping - often PID 1 = "sleep infinity" in a container):\n'
80
+ ps -eo stat=,ppid= | awk '$1 ~ /^Z/ { c[$2]++ } END { for (p in c) print c[p], p }' \
81
+ | sort -rn | head -5 \
82
+ | while read -r n pp; do
83
+ printf ' %6s zombies <- ppid=%-8s %s\n' "$n" "$pp" \
84
+ "$(ps -o comm=,etime= -p "$pp" 2>/dev/null | tr -s ' ')"
85
+ done
86
+ fi
87
+
88
+ hr "process count by name"
89
+ ps -eo comm= | sort | uniq -c | sort -rn | head -10
90
+
91
+ hr "your detached long-lived processes (no terminal, age >= 1 day) - cleanup candidates"
92
+ printf 'system daemons and zombies are excluded: killing them reclaims nothing.\n\n'
93
+ ps -eo pid=,ppid=,stat=,euid=,tty=,etime=,rss=,comm= | awk -v me="$(id -u)" '
94
+ $1 <= 2 || $2 == 2 { next } # init and kernel threads
95
+ $3 ~ /^Z/ { next } # zombies already hold no memory
96
+ $4 != me { next } # someone else s daemon, not yours to reap
97
+ $5 == "?" {
98
+ split($6, a, "-")
99
+ if (a[2] == "") next
100
+ n++; tot += $7
101
+ if (n <= 15) printf " pid=%-8s age=%-14s rss=%7.0f MB %s\n", $1, $6, $7/1024, $8
102
+ }
103
+ END { printf "\n %d processes, %.1f GB reclaimable\n", n+0, tot/1048576 }'
104
+ }
105
+
106
+ if [ -n "$SNAPSHOT" ]; then
107
+ main 2>&1 | tee "$SNAPSHOT"
108
+ printf '\nsnapshot saved to %s\n' "$SNAPSHOT"
109
+ else
110
+ main
111
+ fi
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: using-git-worktrees
3
+ description: Use 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 fallback
4
+ ---
5
+
6
+ # Using Git Worktrees
7
+
8
+ ## Overview
9
+
10
+ Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
11
+
12
+ **Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
13
+
14
+ **Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
15
+
16
+ ## Step 0: Detect Existing Isolation
17
+
18
+ **Before creating anything, check if you are already in an isolated workspace.**
19
+
20
+ ```bash
21
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
22
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
23
+ BRANCH=$(git branch --show-current)
24
+ ```
25
+
26
+ **Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
27
+
28
+ ```bash
29
+ # If this returns a path, you're in a submodule, not a worktree — treat as normal repo
30
+ git rev-parse --show-superproject-working-tree 2>/dev/null
31
+ ```
32
+
33
+ **If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.
34
+
35
+ Report with branch state:
36
+ - On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
37
+ - Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
38
+
39
+ **If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
40
+
41
+ Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
42
+
43
+ > "Would you like me to set up an isolated worktree? It protects your current branch from changes."
44
+
45
+ Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 2.
46
+
47
+ ## Step 1: Create Isolated Workspace
48
+
49
+ **You have two mechanisms. Try them in this order.**
50
+
51
+ ### 1a. Native Worktree Tools (preferred)
52
+
53
+ The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 2.
54
+
55
+ Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
56
+
57
+ Only proceed to Step 1b if you have no native worktree tool available.
58
+
59
+ ### 1b. Git Worktree Fallback
60
+
61
+ **Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
62
+
63
+ #### Directory Selection
64
+
65
+ Follow this priority order. Explicit user preference always beats observed filesystem state.
66
+
67
+ 1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
68
+
69
+ 2. **Check for an existing project-local worktree directory:**
70
+ ```bash
71
+ ls -d .worktrees 2>/dev/null # Preferred (hidden)
72
+ ls -d worktrees 2>/dev/null # Alternative
73
+ ```
74
+ If found, use it. If both exist, `.worktrees` wins.
75
+
76
+ 3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
77
+
78
+ #### Safety Verification (project-local directories only)
79
+
80
+ **MUST verify directory is ignored before creating worktree:**
81
+
82
+ ```bash
83
+ git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
84
+ ```
85
+
86
+ **If NOT ignored:** Add to .gitignore, commit the change, then proceed.
87
+
88
+ **Why critical:** Prevents accidentally committing worktree contents to repository.
89
+
90
+ #### Create the Worktree
91
+
92
+ ```bash
93
+ # Determine path based on chosen location
94
+ path="$LOCATION/$BRANCH_NAME"
95
+
96
+ git worktree add "$path" -b "$BRANCH_NAME"
97
+ cd "$path"
98
+ ```
99
+
100
+ **Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
101
+
102
+ ## Step 2: Project Setup
103
+
104
+ Auto-detect and run appropriate setup:
105
+
106
+ ```bash
107
+ # Node.js
108
+ if [ -f package.json ]; then npm install; fi
109
+
110
+ # Rust
111
+ if [ -f Cargo.toml ]; then cargo build; fi
112
+
113
+ # Python
114
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
115
+ if [ -f pyproject.toml ]; then poetry install; fi
116
+
117
+ # Go
118
+ if [ -f go.mod ]; then go mod download; fi
119
+ ```
120
+
121
+ ## Step 3: Verify Clean Baseline
122
+
123
+ Run tests to ensure workspace starts clean:
124
+
125
+ ```bash
126
+ # Use project-appropriate command
127
+ npm test / cargo test / pytest / go test ./...
128
+ ```
129
+
130
+ **If tests fail:** Report failures, ask whether to proceed or investigate.
131
+
132
+ **If tests pass:** Report ready.
133
+
134
+ ### Report
135
+
136
+ ```
137
+ Worktree ready at <full-path>
138
+ Tests passing (<N> tests, 0 failures)
139
+ Ready to implement <feature-name>
140
+ ```
141
+
142
+ ## Quick Reference
143
+
144
+ | Situation | Action |
145
+ |-----------|--------|
146
+ | Already in linked worktree | Skip creation (Step 0) |
147
+ | In a submodule | Treat as normal repo (Step 0 guard) |
148
+ | Native worktree tool available | Use it (Step 1a) |
149
+ | No native tool | Git worktree fallback (Step 1b) |
150
+ | `.worktrees/` exists | Use it (verify ignored) |
151
+ | `worktrees/` exists | Use it (verify ignored) |
152
+ | Both exist | Use `.worktrees/` |
153
+ | Neither exists | Check instruction file, then default `.worktrees/` |
154
+ | Directory not ignored | Add to .gitignore + commit |
155
+ | Permission error on create | Sandbox fallback, work in place |
156
+ | Tests fail during baseline | Report failures + ask |
157
+ | No package.json/Cargo.toml | Skip dependency install |
158
+
159
+ ## Common Rationalizations
160
+
161
+ | Excuse | Reality |
162
+ |--------|---------|
163
+ | "I'm obviously not in a worktree — no need to check" | Run Step 0. Harness-created isolation and submodules both fool eyeballing; the detection commands settle it. |
164
+ | "`git worktree add` is quicker than hunting for a native tool" | A native tool (e.g. `EnterWorktree`) owns placement, branching, and cleanup. Bypassing it is the #1 mistake — it creates phantom state your harness can't see or manage. |
165
+ | "The worktree directory is surely ignored already" | Run `git check-ignore`. An unignored worktree directory commits the whole tree into the repo. |
166
+ | "Any directory name works" | Explicit instructions beat an existing project-local directory, which beats the `.worktrees/` default. |
167
+ | "The workspace is fresh — baseline tests can wait" | A dirty baseline makes every later failure ambiguous. Run the tests now; proceeding past failures is your human partner's call. |