refactor: skill v2 — thinking frameworks, NEVER list, fallbacks

Evaluated via skill-judge: 106/120 (B grade).
- Thinking framework before analysis
- Prioritization criteria (what's worth digging into)
- 10-item NEVER list from 5-repo experience
- Commands externalized to references/commands.md
- Fallbacks for edge cases (no PRs, private repos, young repos)
- Each phase teaches what matters, not how to grep
This commit is contained in:
Rodin
2026-04-30 11:56:54 -07:00
parent 38a9d66072
commit 946119a3cc
2 changed files with 300 additions and 121 deletions
+122
View File
@@ -0,0 +1,122 @@
# Commands Reference
Shell patterns for each phase. Load only when you need the exact
syntax — the SKILL.md tells you WHAT to look for; this tells you HOW.
---
## Phase 1: Shape
```bash
# Clone (always full — never --depth 1)
cd ~/src/analysis && git clone <url>
# Dimensions
du -sh <repo>
find . -name "*.go" | grep -v vendor | wc -l # Go files
git log --oneline | wc -l # commits
git log --format="%an" | sort -u | wc -l # contributors
ls -d */ # top-level dirs
```
## Phase 2: Import Hierarchy
```bash
# Go: most-imported internal packages
grep -rh '"<module>/' --include="*.go" \
| sed 's/.*"<module>\///' | sed 's/".*//' \
| cut -d/ -f1 | sort | uniq -c | sort -rn | head -15
# Elixir: most-aliased modules
grep -rh "alias " --include="*.ex" \
| sed 's/.*alias //' | cut -d. -f1-2 \
| sort | uniq -c | sort -rn | head -15
```
## Phase 3: Interfaces
```bash
# Go interfaces (skip test/mock/generated)
grep -rn "type.*interface {" --include="*.go" \
| grep -v test | grep -v mock | grep -v _gen.go
# Elixir behaviours/protocols
grep -rn "@callback\|@behaviour\|defprotocol" --include="*.ex"
```
## Phase 4: Quality Markers
```bash
# TODOs (non-test, note format)
grep -rn "TODO" --include="*.go" | grep -v test | wc -l
grep -rh "// TODO" --include="*.go" | head -5 # check format
# Other markers
grep -rn "FIXME\|HACK" --include="*.go" | grep -v test | wc -l
# Test ratio
find . -name "*_test.go" | wc -l # test files
find . -name "*mock*" | wc -l # mock files
```
## Phase 6: Git Archaeology
```bash
# When was a file/pattern introduced?
git log --all --oneline --diff-filter=A -- path/to/file
# Who wrote it and why?
git log --format="%an%n%ad%n%s%n%b" <commit> -1
# When was a string added/removed (pickaxe search)?
git log -p -S "pattern_string" -- relevant/path/
# TODOs added with context
git log --all -p -S "TODO" -- lib/ \
| grep "^commit\|^+.*TODO\|^-.*TODO" | head -20
# Find if full clone or shallow
git rev-parse --is-shallow-repository
# Unshallow if needed
git fetch --unshallow
```
## Phase 7: PR Lookup
```bash
# Find PR by title/content
gh api "search/issues?q=repo:<org>/<repo>+<keywords>+type:pr" \
--jq '.items[] | {number: .number, title: .title}'
# Read PR metadata
gh api repos/<org>/<repo>/pulls/<num> \
--jq '{title, body: (.body | split("\n") | .[0:30] | join("\n")), comments, review_comments, created_at, merged_at}'
# Read review comments (the debate)
gh api "repos/<org>/<repo>/pulls/<num>/comments?per_page=30" \
--jq '.[] | select(.body | length > 50) | {user: .user.login, body: (.body | split("\n") | .[0:5] | join("\n"))}'
# Read issue comments
gh api repos/<org>/<repo>/issues/<num>/comments \
--jq '.[] | {user: .user.login, body: (.body | split("\n") | .[0:6] | join("\n"))}'
```
## Output: Repo Creation & Push
```bash
GITEA_TOKEN=$(cat ~/.openclaw/credentials/gitea-rodin)
# Create repo
curl -s -X POST "https://gitea.weiker.me/api/v1/user/repos" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "<project>-conventions", "auto_init": true, "default_branch": "master", "license": "MIT"}'
# Clone, add content, push
git clone "https://rodin:${GITEA_TOKEN}@gitea.weiker.me/rodin/<project>-conventions.git"
cd <project>-conventions
git config user.name "Rodin"
git config user.email "rodin@forgedthought.ai"
# ... add files ...
git add -A && git commit -m "docs: initial conventions from <org>/<project>" && git push
```