@workingpayload/agent-skills 1.0.0 → 2.0.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.
- package/APIForge/skill.md +150 -17
- package/AccessPlus/skill.md +122 -18
- package/AlgoMaster/skill.md +110 -17
- package/Architekt AI/skill.md +125 -17
- package/AuthCraft/skill.md +129 -17
- package/AutoScriptor/skill.md +122 -17
- package/BoilerCore/skill.md +121 -17
- package/BugHunter Pro/skill.md +118 -17
- package/ChangeScribe/skill.md +98 -17
- package/CodeSage/skill.md +148 -17
- package/CommitCraft/skill.md +97 -16
- package/CoverageMax/skill.md +145 -16
- package/CronGenius/skill.md +141 -16
- package/DataPolish/skill.md +126 -16
- package/DataWeaver/skill.md +135 -16
- package/DockMaster/skill.md +142 -16
- package/DocuGenie/skill.md +122 -16
- package/EdgeGuard/skill.md +144 -16
- package/EnvWizard/skill.md +140 -16
- package/ErrorMedic/skill.md +136 -16
- package/FeatureSmith/skill.md +123 -16
- package/FlexiLayout/skill.md +128 -16
- package/FlowTester/skill.md +138 -16
- package/FunctionForge/skill.md +120 -16
- package/InputShield/skill.md +128 -16
- package/IssueForge/skill.md +132 -16
- package/KubeCrafter/skill.md +133 -16
- package/LogicLens/skill.md +116 -16
- package/MockSmith/skill.md +130 -16
- package/ModelSensei/skill.md +122 -16
- package/PRMentor/skill.md +103 -32
- package/PerfDetective/skill.md +90 -32
- package/PipelinePro/skill.md +146 -32
- package/PolyglotShift/skill.md +94 -32
- package/PromptForge/skill.md +118 -32
- package/QueryPulse/skill.md +123 -32
- package/README.md +416 -329
- package/ReadMeCraft/skill.md +127 -32
- package/RefactorX/skill.md +84 -32
- package/RenderBoost/skill.md +148 -32
- package/SEOMancer/skill.md +140 -16
- package/ScrapeMaster/skill.md +157 -32
- package/SecretSniffer/skill.md +107 -16
- package/SecureScan/skill.md +114 -16
- package/ServiceSplitter/skill.md +137 -16
- package/SpeedSmith/skill.md +139 -16
- package/StackWise/skill.md +139 -16
- package/TaskOrchestrator/skill.md +119 -16
- package/TestCrafter/skill.md +142 -16
- package/TraceMind/skill.md +127 -16
- package/UISmith/skill.md +115 -16
- package/bin/cli.js +377 -0
- package/extension-extender/SKILL.md +122 -0
- package/fastapi-furious/SKILL.md +148 -0
- package/package.json +41 -28
- package/python-master/SKILL.md +108 -0
- package/react-ranger/SKILL.md +93 -0
- package/scripts/build_index.py +282 -0
- package/scripts/doctor.py +541 -0
- package/scripts/install.py +397 -0
- package/scripts/route.py +348 -0
- package/scripts/score.py +355 -0
- package/scripts/test_skill.py +473 -0
- package/scripts/validate.py +254 -0
- package/skills-routing.json +1131 -0
- package/skills.json +3261 -0
- package/Extension-Extender/SKILL.md +0 -41
- package/Extension-Extender/references/ui-guidelines.md +0 -26
- package/Fastapi-Furious/README.md +0 -16
- package/Fastapi-Furious/SKILL.md +0 -37
- package/Python-Master/README.md +0 -11
- package/Python-Master/SKILL.md +0 -37
- package/React-Ranger/README.md +0 -17
- package/React-Ranger/SKILL.md +0 -37
- package/cli.js +0 -181
- package/parse_skills.py +0 -44
- /package/{Extension-Extender → extension-extender}/assets/manifest.json +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.css +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.html +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.js +0 -0
package/PRMentor/skill.md
CHANGED
|
@@ -1,32 +1,103 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: prmentor
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PRMentor
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
- Identify the
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
### 2.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
1
|
+
---
|
|
2
|
+
name: prmentor
|
|
3
|
+
description: Review pull requests with structured diff analysis, tiered feedback (blocking/suggestion/nit), scope checks, test coverage delta, and a merge readiness checklist. Use when a user wants a PR reviewed, wants to write better PRs, or needs feedback on code changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PRMentor
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
PRMentor performs thorough, actionable PR reviews using a severity-tiered feedback model. Every review ends with a clear merge readiness verdict.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Read the Diff Holistically First
|
|
15
|
+
|
|
16
|
+
Before commenting on individual lines:
|
|
17
|
+
- Understand the stated purpose of the PR (title, description, linked issue).
|
|
18
|
+
- Identify the scope: is this a bug fix, feature addition, refactor, or dependency update?
|
|
19
|
+
- Check that the changes are coherent — a PR should do one thing. Flag scope creep explicitly.
|
|
20
|
+
|
|
21
|
+
### 2. Analyze the Diff
|
|
22
|
+
|
|
23
|
+
Work through the diff systematically:
|
|
24
|
+
|
|
25
|
+
**Correctness:**
|
|
26
|
+
- Does the logic match the intended behavior?
|
|
27
|
+
- Are there off-by-one errors, missing null checks, or incorrect conditionals?
|
|
28
|
+
- Does error handling cover all failure modes (network timeout, empty input, concurrent access)?
|
|
29
|
+
|
|
30
|
+
**Test Coverage Delta:**
|
|
31
|
+
- Identify new functions/branches added. Do they have corresponding tests?
|
|
32
|
+
- If using a coverage tool (Istanbul/nyc, pytest-cov, JaCoCo), estimate whether coverage went up or down.
|
|
33
|
+
- A PR that adds logic without tests is a suggestion-level concern; a PR that removes tests is blocking.
|
|
34
|
+
|
|
35
|
+
**Security:**
|
|
36
|
+
- New inputs: are they validated and sanitized?
|
|
37
|
+
- New secrets or credentials: are they in environment variables, not hardcoded?
|
|
38
|
+
- SQL: parameterized queries only? New endpoints: authenticated?
|
|
39
|
+
|
|
40
|
+
**Performance:**
|
|
41
|
+
- New loops over collections: is there an N+1 query risk?
|
|
42
|
+
- New synchronous operations on the hot path that should be async?
|
|
43
|
+
|
|
44
|
+
**Readability & maintainability:**
|
|
45
|
+
- Function length > 40 lines or cyclomatic complexity > 10 → suggest extraction.
|
|
46
|
+
- Variable names that are ambiguous or single-letter (outside obvious iterators).
|
|
47
|
+
|
|
48
|
+
### 3. Apply Severity Tiers
|
|
49
|
+
|
|
50
|
+
Label every comment with one of three tiers:
|
|
51
|
+
|
|
52
|
+
- **[BLOCKING]** — Must be resolved before merge. Examples: logic bug, security vulnerability, test regression, broken API contract, hardcoded secret.
|
|
53
|
+
- **[SUGGESTION]** — Strongly recommended but not a merge blocker. Examples: missing test for new branch, inefficient query, unclear error message, missing docstring on public API.
|
|
54
|
+
- **[NIT]** — Minor style or preference. Examples: variable naming, comment wording, import ordering. Batch nits at the end; do not scatter them through the review.
|
|
55
|
+
|
|
56
|
+
### 4. Check Conventional Commits & PR Hygiene
|
|
57
|
+
|
|
58
|
+
- PR title should follow Conventional Commits: `feat:`, `fix:`, `chore:`, `refactor:`, `docs:`, `test:`, `perf:`, `ci:`.
|
|
59
|
+
- PR body should include: what changed, why it changed, how to test it, and any migration notes.
|
|
60
|
+
- Branch should be up to date with `main`/`master` (no merge conflicts).
|
|
61
|
+
- CI checks should be green before review is finalized.
|
|
62
|
+
|
|
63
|
+
### 5. Deliver the Review
|
|
64
|
+
|
|
65
|
+
Structure the output as:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
## PR Summary
|
|
69
|
+
<1–2 sentences on what the PR does and overall impression>
|
|
70
|
+
|
|
71
|
+
## Blocking Issues
|
|
72
|
+
- [BLOCKING] <file>:<line> — <problem> → <required fix>
|
|
73
|
+
|
|
74
|
+
## Suggestions
|
|
75
|
+
- [SUGGESTION] <file>:<line> — <observation> → <recommended change>
|
|
76
|
+
|
|
77
|
+
## Nits
|
|
78
|
+
- [NIT] <file>:<line> — <minor item>
|
|
79
|
+
|
|
80
|
+
## Merge Readiness Checklist
|
|
81
|
+
- [ ] All blocking issues resolved
|
|
82
|
+
- [ ] New logic has test coverage
|
|
83
|
+
- [ ] No hardcoded secrets
|
|
84
|
+
- [ ] CI passing
|
|
85
|
+
- [ ] PR title follows Conventional Commits
|
|
86
|
+
- [ ] Migration/breaking-change notes included (if applicable)
|
|
87
|
+
|
|
88
|
+
## Verdict: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Edge Cases
|
|
92
|
+
|
|
93
|
+
**1. Large PRs (>500 lines changed).** Request a split into smaller PRs if scope allows. If the PR cannot be split, review in layers: data model first, business logic second, UI/API surface third. Note that the size increases review risk.
|
|
94
|
+
|
|
95
|
+
**2. PR touches files you lack full context for.** State explicitly: "[SUGGESTION] I cannot fully verify this — recommend an additional review from someone with [X] domain expertise." Do not rubber-stamp it.
|
|
96
|
+
|
|
97
|
+
**3. PR fixes a bug but introduces a regression elsewhere.** Scan callers of modified functions. If a signature or return type changes, grep all call sites and flag missed updates as [BLOCKING].
|
|
98
|
+
|
|
99
|
+
**4. IaC review (Terraform/Pulumi/CDK).** Always request the `terraform plan` output alongside the diff. Flag: resource deletions (`-/+` or `-` lines on stateful resources like RDS, S3), security group rule additions (ingress `0.0.0.0/0`), and unintended cost increases. Mark resource deletions as [BLOCKING] unless explicitly approved.
|
|
100
|
+
|
|
101
|
+
**5. First-time contributors.** Use constructive framing — explain *why* a change is needed, not just *what* to fix. Prefer: "This could cause a race condition when X and Y happen concurrently — consider using a mutex here" over "This is wrong, use a mutex." Nits should be prefixed with "Optional:" so the contributor knows what is truly required vs. stylistic preference.
|
|
102
|
+
|
|
103
|
+
**6. Breaking API change detection.** Flag as [BLOCKING]: adding a required field to an existing request schema (breaks existing callers), changing a field type (e.g., `string` → `number`), removing or renaming a response field, and changing an endpoint's HTTP method or URL. Suggest using API versioning (`/v2/`) or a deprecation period with a sunset header instead of in-place breaking changes.
|
package/PerfDetective/skill.md
CHANGED
|
@@ -1,32 +1,90 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: perfdetective
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PerfDetective
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
---
|
|
2
|
+
name: perfdetective
|
|
3
|
+
description: Profile application performance, identify CPU/memory/I/O bottlenecks, and deliver optimized code with before/after benchmarks. Use when a user needs to find performance issues, reduce latency, lower memory usage, or speed up slow functions/endpoints.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PerfDetective
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
PerfDetective diagnoses and resolves performance bottlenecks across Python, JVM, Node.js, and browser environments using profiling tools, flamegraph analysis, and targeted optimization patterns.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Identify the Runtime & Collect a Profile
|
|
15
|
+
|
|
16
|
+
Choose the right profiler for the environment:
|
|
17
|
+
|
|
18
|
+
- **Python**: `py-spy record -o profile.svg --pid <PID>` (sampling, no code changes) or `cProfile` + `snakeviz` for function-level stats. For async code use `austin` or `yappi`.
|
|
19
|
+
- **JVM (Java/Kotlin/Scala)**: `async-profiler` (`asprof -e cpu -f flamegraph.html <PID>`); for heap leaks use `jmap -histo` + Eclipse MAT or VisualVM.
|
|
20
|
+
- **Node.js**: `node --prof app.js` + `node --prof-process` or `clinic.js flame` (Clinic.js Doctor for I/O). Use Chrome DevTools Performance tab for in-process profiling.
|
|
21
|
+
- **Browser JS/rendering**: Chrome DevTools Performance panel — record a session, look at the "Bottom-Up" and "Call Tree" tabs for hot functions.
|
|
22
|
+
- **Benchmarking**: Python → `pytest-benchmark`; JS → `Benchmark.js`; JVM → JMH. Always run 5+ iterations and report median ± p95.
|
|
23
|
+
|
|
24
|
+
### 2. Read the Flamegraph
|
|
25
|
+
|
|
26
|
+
- The **width** of a frame = total CPU time consumed (self + children).
|
|
27
|
+
- Look for **plateaus** (wide flat tops): that function is the bottleneck.
|
|
28
|
+
- Distinguish **CPU-bound** (thick application frames) from **I/O-bound** (thin frames, large gaps, or kernel/syscall stacks like `epoll_wait`, `recv`, `fsync`).
|
|
29
|
+
- Identify **unexpected callers**: a utility function appearing high in the stack often signals a hot loop.
|
|
30
|
+
|
|
31
|
+
### 3. Apply Targeted Optimizations
|
|
32
|
+
|
|
33
|
+
**CPU-bound hot loops:**
|
|
34
|
+
- Memoize pure functions with `functools.lru_cache` (Python) or a `Map`-based cache (JS).
|
|
35
|
+
- Replace interpreted loops with vectorized operations: NumPy/pandas for Python, SIMD-friendly array methods in JS/Rust.
|
|
36
|
+
- Move heavy computation off the main thread: `concurrent.futures.ProcessPoolExecutor` (Python), Worker Threads (Node.js).
|
|
37
|
+
|
|
38
|
+
**I/O-bound bottlenecks:**
|
|
39
|
+
- Batch database queries: replace N+1 ORM calls with `SELECT ... WHERE id IN (...)` or `DataLoader` (GraphQL).
|
|
40
|
+
- Use connection pooling: `psycopg2.pool`, HikariCP, `pg-pool`.
|
|
41
|
+
- Add async I/O: `asyncio`/`aiohttp` (Python), `Promise.all` over sequential `await` (JS).
|
|
42
|
+
- Cache repeated external calls with Redis (`redis-py`, `ioredis`) using a TTL appropriate to data freshness.
|
|
43
|
+
|
|
44
|
+
**Memory pressure:**
|
|
45
|
+
- Profile heap with `tracemalloc` (Python) or heap snapshots in Chrome DevTools.
|
|
46
|
+
- Replace large in-memory collections with generators/streams.
|
|
47
|
+
- Fix leaks: deregister event listeners, clear caches, use `WeakRef`/`WeakMap`.
|
|
48
|
+
|
|
49
|
+
### 4. Benchmark Before & After
|
|
50
|
+
|
|
51
|
+
Always produce a side-by-side comparison:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Function: process_records()
|
|
55
|
+
Before: 842 ms median (p95: 1,204 ms), RSS: 340 MB
|
|
56
|
+
After: 91 ms median (p95: 118 ms), RSS: 112 MB
|
|
57
|
+
Improvement: 9.3× faster, 67% less memory
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Report the profiling command used so results are reproducible.
|
|
61
|
+
|
|
62
|
+
### 5. Deliver the Output
|
|
63
|
+
|
|
64
|
+
Provide:
|
|
65
|
+
1. Root-cause summary (1–3 sentences naming the bottleneck and why it's slow).
|
|
66
|
+
2. Diff or rewritten function with inline comments explaining each change.
|
|
67
|
+
3. Benchmark table (before/after).
|
|
68
|
+
4. Any follow-up work (e.g., "add a Redis layer if this endpoint is called >50 req/s").
|
|
69
|
+
|
|
70
|
+
## Edge Cases
|
|
71
|
+
|
|
72
|
+
**1. Profiler overhead skews results.** Sampling profilers (py-spy, async-profiler) have <1% overhead; instrumentation profilers (cProfile, JVM agents) can add 10–50%. Switch to a sampling profiler if numbers look suspiciously slow.
|
|
73
|
+
|
|
74
|
+
**2. Optimization invalidated by the compiler/JIT.** JVM JIT and V8 TurboFan can eliminate dead code. Always benchmark the production build. Micro-benchmarks eliminated by the optimizer give false wins.
|
|
75
|
+
|
|
76
|
+
**3. The fix is an architectural change, not a code tweak.** If the flamegraph shows 80%+ in a DB round-trip inside a loop, the right fix is query restructuring or caching — not micro-optimizing the loop body.
|
|
77
|
+
|
|
78
|
+
**4. JVM GC pause analysis.** Enable GC logging: `-Xlog:gc*:file=gc.log:time,uptime`. Analyze with GCViewer or the online GC Easy tool. Prolonged pauses (>200 ms) in G1 usually indicate too-small heap regions or humongous allocations. Switch to ZGC (`-XX:+UseZGC`) for sub-millisecond pauses on heaps >4 GB; use Shenandoah for moderate heaps with low-latency requirements. Set `-XX:MaxGCPauseMillis` as a target, not a guarantee.
|
|
79
|
+
|
|
80
|
+
**5. Async Python profiling.** `cProfile` measures wall clock per call but attributes async I/O wait time to the event loop, not the awaiting coroutine — misleading for async code. Use `yappi` with wall-clock mode:
|
|
81
|
+
```python
|
|
82
|
+
import yappi
|
|
83
|
+
yappi.set_clock_type("wall")
|
|
84
|
+
yappi.start()
|
|
85
|
+
await your_async_function()
|
|
86
|
+
yappi.stop()
|
|
87
|
+
yappi.get_func_stats().print_all()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**6. Long-running memory leak strategy.** Single heap snapshots miss slow leaks. Take three snapshots: at startup, after 30 minutes of load, and after 60 minutes. Compare object counts between snapshots 2 and 3 — objects that grow continuously are the leak candidates. In Python use `tracemalloc`; in Node.js use `--heap-prof` or Chrome DevTools Memory tab (heap snapshot diff); in JVM use Eclipse MAT's "Leak Suspects" report on a heap dump from `jcmd <pid> VM.heap_dump`.
|
package/PipelinePro/skill.md
CHANGED
|
@@ -1,32 +1,146 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pipelinepro
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PipelinePro
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
---
|
|
2
|
+
name: pipelinepro
|
|
3
|
+
description: Design and implement CI/CD pipelines using GitHub Actions or GitLab CI, including pipeline stages, secrets management, deployment strategies (blue-green, canary), artifact pinning, and rollback procedures. Use when a user needs to build, fix, or improve a CI/CD pipeline or deployment workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PipelinePro
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
PipelinePro builds production-grade CI/CD pipelines for GitHub Actions and GitLab CI, covering the full lifecycle from commit to production deployment with safety controls.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Gather Requirements
|
|
15
|
+
|
|
16
|
+
Before writing any YAML, confirm:
|
|
17
|
+
- **Platform**: GitHub Actions (`.github/workflows/`) or GitLab CI (`.gitlab-ci.yml`)?
|
|
18
|
+
- **Build target**: Docker image, npm package, Python wheel, binary, Terraform plan?
|
|
19
|
+
- **Environments**: dev / staging / production? Any approval gates?
|
|
20
|
+
- **Deployment strategy**: rolling, blue-green, or canary?
|
|
21
|
+
- **Secret sources**: GitHub/GitLab secret store, AWS Secrets Manager, Vault, or `.env` file?
|
|
22
|
+
|
|
23
|
+
### 2. Structure the Pipeline Stages
|
|
24
|
+
|
|
25
|
+
Use this canonical stage order:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
lint → test → build → security-scan → publish-artifact → deploy-staging → [approval] → deploy-production
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**GitHub Actions skeleton:**
|
|
32
|
+
```yaml
|
|
33
|
+
on: { push: { branches: [main] }, pull_request: {} }
|
|
34
|
+
jobs:
|
|
35
|
+
lint:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps: [{ uses: actions/checkout@v4 }, { run: npm ci && npm run lint }]
|
|
38
|
+
test:
|
|
39
|
+
needs: lint
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps: [{ uses: actions/checkout@v4 }, { run: npm ci && npm test -- --coverage }]
|
|
42
|
+
build:
|
|
43
|
+
needs: test
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- uses: docker/build-push-action@v5
|
|
48
|
+
with: { push: true, tags: "ghcr.io/${{ github.repository }}:${{ github.sha }}" }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3. Secrets Injection — OIDC-Based Cloud Auth (Preferred)
|
|
52
|
+
|
|
53
|
+
Never use static cloud credentials in CI. Use OIDC to assume short-lived roles:
|
|
54
|
+
|
|
55
|
+
**GitHub Actions → AWS:**
|
|
56
|
+
```yaml
|
|
57
|
+
permissions:
|
|
58
|
+
id-token: write
|
|
59
|
+
contents: read
|
|
60
|
+
steps:
|
|
61
|
+
- uses: aws-actions/configure-aws-credentials@v4
|
|
62
|
+
with:
|
|
63
|
+
role-to-assume: arn:aws:iam::123456789012:role/github-ci-role
|
|
64
|
+
aws-region: us-east-1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**GitHub Actions → GCP:**
|
|
68
|
+
```yaml
|
|
69
|
+
- uses: google-github-actions/auth@v2
|
|
70
|
+
with:
|
|
71
|
+
workload_identity_provider: projects/123/locations/global/workloadIdentityPools/github/providers/github
|
|
72
|
+
service_account: ci@my-project.iam.gserviceaccount.com
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For static secrets (API keys, DB passwords): store in GitHub/GitLab secret store or Vault (`hashicorp/vault-action@v3`). Use `environment:` scoping so production secrets are only available in the production job. Never echo secrets; use `::add-mask::` for dynamic values.
|
|
76
|
+
|
|
77
|
+
### 4. Artifact Pinning
|
|
78
|
+
|
|
79
|
+
- Pin third-party actions to a full commit SHA, not a mutable tag:
|
|
80
|
+
```yaml
|
|
81
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
82
|
+
```
|
|
83
|
+
- Pin Docker base images to digest: `FROM node:20-alpine@sha256:abc123...`
|
|
84
|
+
- Use `actions/upload-artifact@v4` / `download-artifact@v4` to pass build outputs between jobs rather than rebuilding.
|
|
85
|
+
|
|
86
|
+
### 5. Deployment Strategies
|
|
87
|
+
|
|
88
|
+
**Blue-Green:** Deploy to idle environment → smoke test → swap load balancer target → keep old live 10–15 min for instant rollback.
|
|
89
|
+
|
|
90
|
+
**Canary:** Deploy at 1–5% traffic weight (Argo Rollouts, Flagger) → monitor error rate + p99 for 5–30 min → auto-promote or rollback on threshold breach.
|
|
91
|
+
|
|
92
|
+
**Rollback:** `kubectl rollout undo deployment/my-app`. Store previous image SHA as a pipeline artifact for deterministic rollback.
|
|
93
|
+
|
|
94
|
+
### 6. Output Artifacts
|
|
95
|
+
|
|
96
|
+
Deliver:
|
|
97
|
+
1. Complete, runnable YAML file(s) with inline comments.
|
|
98
|
+
2. List of secrets/variables that must be configured and where.
|
|
99
|
+
3. Deployment strategy diagram (text-based if needed).
|
|
100
|
+
4. Rollback command or job snippet.
|
|
101
|
+
|
|
102
|
+
### 6. DB Migration Sequencing
|
|
103
|
+
|
|
104
|
+
Run migrations before the new code deploys — never after. The pattern:
|
|
105
|
+
```yaml
|
|
106
|
+
migrate:
|
|
107
|
+
needs: build
|
|
108
|
+
steps:
|
|
109
|
+
- run: |
|
|
110
|
+
npx prisma migrate deploy # or: alembic upgrade head / rails db:migrate
|
|
111
|
+
if [ $? -ne 0 ]; then echo "Migration failed — aborting deploy"; exit 1; fi
|
|
112
|
+
deploy:
|
|
113
|
+
needs: migrate
|
|
114
|
+
```
|
|
115
|
+
For rollback: always provide a `down` migration and keep the previous image SHA as a pipeline artifact so `kubectl rollout undo` or a re-deploy of the prior image is deterministic.
|
|
116
|
+
|
|
117
|
+
### 7. Container Image Vulnerability Scanning
|
|
118
|
+
|
|
119
|
+
Scan images after build, before publish. Fail the pipeline on critical or high CVEs:
|
|
120
|
+
```yaml
|
|
121
|
+
scan:
|
|
122
|
+
needs: build
|
|
123
|
+
steps:
|
|
124
|
+
- uses: aquasecurity/trivy-action@master
|
|
125
|
+
with:
|
|
126
|
+
image-ref: ghcr.io/${{ github.repository }}:${{ github.sha }}
|
|
127
|
+
format: table
|
|
128
|
+
exit-code: '1' # fail pipeline
|
|
129
|
+
severity: CRITICAL,HIGH
|
|
130
|
+
ignore-unfixed: true # skip CVEs with no fix available
|
|
131
|
+
```
|
|
132
|
+
Grype alternative: `grype ghcr.io/myorg/myapp:sha --fail-on high`. Review and suppress false positives via `.trivyignore` or `grype.db` exceptions with documented justification.
|
|
133
|
+
|
|
134
|
+
## Edge Cases
|
|
135
|
+
|
|
136
|
+
**1. Self-hosted runners with no internet access.** Cache dependencies explicitly (`actions/cache@v4`, `pip download --dest`, npm `--prefer-offline`) and mirror Docker images to an internal registry. Document the exact registry URL as an environment variable.
|
|
137
|
+
|
|
138
|
+
**2. Flaky tests causing false deployment failures.** Add a retry mechanism (`retry: 2` in GitLab; a step-level `continue-on-error` + re-run logic in GitHub Actions) only for known-flaky test suites. Mark the job with a `flaky` label and open a tracking issue — never silently suppress test failures in gates.
|
|
139
|
+
|
|
140
|
+
**3. Monorepo with multiple independently deployable services.** Use path filters to trigger only affected pipelines:
|
|
141
|
+
```yaml
|
|
142
|
+
on:
|
|
143
|
+
push:
|
|
144
|
+
paths: ['services/api/**']
|
|
145
|
+
```
|
|
146
|
+
Or use tools like `nx affected`, `turborepo`, or GitLab's `rules: changes:` to skip unaffected jobs.
|
package/PolyglotShift/skill.md
CHANGED
|
@@ -1,32 +1,94 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: polyglotshift
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PolyglotShift
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
---
|
|
2
|
+
name: polyglotshift
|
|
3
|
+
description: Translate code accurately between programming languages, preserving logic and semantics while adopting target-language idioms, type systems, and standard libraries. Use when a user needs to port, convert, or rewrite code from one language to another.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PolyglotShift
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
PolyglotShift translates code between programming languages with semantic fidelity, idiomatic target-language style, and explicit annotation of every non-trivial mapping decision.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Identify Source & Target Languages
|
|
15
|
+
|
|
16
|
+
State both explicitly. If the user hasn't specified the target, ask. Confirm the target's major version (e.g., Python 3.11, TypeScript 5, Java 21, Rust 2021 edition) as standard library APIs differ.
|
|
17
|
+
|
|
18
|
+
### 2. Audit Type System Differences
|
|
19
|
+
|
|
20
|
+
Map source types to target equivalents before writing any code:
|
|
21
|
+
|
|
22
|
+
| Concept | Python | TypeScript | Java | Rust |
|
|
23
|
+
|---|---|---|---|---|
|
|
24
|
+
| Optional value | `Optional[T]` / `T \| None` | `T \| undefined` / `T \| null` | `Optional<T>` | `Option<T>` |
|
|
25
|
+
| Dynamic list | `list[T]` | `T[]` / `Array<T>` | `List<T>` | `Vec<T>` |
|
|
26
|
+
| Key-value map | `dict[K, V]` | `Record<K,V>` / `Map<K,V>` | `Map<K,V>` | `HashMap<K,V>` |
|
|
27
|
+
| Error handling | `raise` / `try/except` | `throw` / `try/catch` | `throw` / checked exceptions | `Result<T,E>` |
|
|
28
|
+
| Async | `async/await` + `asyncio` | `async/await` + `Promise` | `CompletableFuture` | `async/await` + `tokio` |
|
|
29
|
+
|
|
30
|
+
Flag any source types that have no direct equivalent — these require a design decision, not a mechanical substitution.
|
|
31
|
+
|
|
32
|
+
### 3. Map Idioms Explicitly
|
|
33
|
+
|
|
34
|
+
Do not transliterate — translate. Apply target-language conventions:
|
|
35
|
+
|
|
36
|
+
- **Python → TypeScript**: Replace list comprehensions with `.filter().map()`, `dataclass` with a `type` or `interface`, `__dunder__` methods with class methods or operator overloads where supported.
|
|
37
|
+
- **Python → Rust**: Replace `None` with `Option<T>`, `raise Exception` with `Err(...)`, GC-managed objects with owned structs + lifetimes. Flag heap allocations explicitly.
|
|
38
|
+
- **Java → Kotlin**: Replace verbose getters/setters with `data class`, `Optional` with `?` nullable types, `Stream` API with Kotlin collection extensions.
|
|
39
|
+
- **JavaScript → TypeScript**: Add explicit type annotations; replace `any` with proper generics; convert callback-style APIs to `async/await`.
|
|
40
|
+
- **SQL dialects**: Flag `ILIKE` (Postgres-only), `LIMIT`/`TOP` differences, and window function syntax variations.
|
|
41
|
+
|
|
42
|
+
### 4. Write the Translation
|
|
43
|
+
|
|
44
|
+
Structure the output as:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
## Source ({source_lang})
|
|
48
|
+
<original code block>
|
|
49
|
+
|
|
50
|
+
## Target ({target_lang})
|
|
51
|
+
<translated code block, with inline comments on non-obvious mappings>
|
|
52
|
+
|
|
53
|
+
## Translation Notes
|
|
54
|
+
- <mapping 1: why X became Y>
|
|
55
|
+
- <mapping 2: semantic difference to be aware of>
|
|
56
|
+
- <any behavioral differences or caveats>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Inline comments should use the pattern `// [PolyglotShift] reason for this choice`.
|
|
60
|
+
|
|
61
|
+
### 5. Verify Semantic Equivalence
|
|
62
|
+
|
|
63
|
+
After translating, manually trace through at least one representative input/output path in both versions. Check:
|
|
64
|
+
- Loop bounds and off-by-one behavior.
|
|
65
|
+
- Error paths: does the translated code surface the same errors?
|
|
66
|
+
- Mutability: does the source mutate in place where the target version creates a new object?
|
|
67
|
+
- Integer overflow/underflow (especially Python's arbitrary-precision int → fixed-width Java/Rust int).
|
|
68
|
+
|
|
69
|
+
## Additional Mapping Patterns
|
|
70
|
+
|
|
71
|
+
**Prototype mutation / monkey patching:** Languages like JavaScript, Ruby, and Python allow modifying built-in prototypes or classes at runtime. This has no safe equivalent in statically typed targets. When translating monkey-patched code: (a) extract the patched behavior into a standalone utility function or wrapper class, (b) replace call sites with explicit calls to the wrapper, (c) document the original intent in a `// [PolyglotShift]` comment.
|
|
72
|
+
|
|
73
|
+
**`asyncio.gather` → Rust concurrent futures:**
|
|
74
|
+
```python
|
|
75
|
+
results = await asyncio.gather(fetch_a(), fetch_b(), fetch_c())
|
|
76
|
+
```
|
|
77
|
+
```rust
|
|
78
|
+
// tokio::join! for a fixed set of futures
|
|
79
|
+
let (a, b, c) = tokio::join!(fetch_a(), fetch_b(), fetch_c());
|
|
80
|
+
// FuturesUnordered for a dynamic collection
|
|
81
|
+
use futures::stream::{FuturesUnordered, StreamExt};
|
|
82
|
+
let mut tasks: FuturesUnordered<_> = urls.iter().map(|u| fetch(u)).collect();
|
|
83
|
+
while let Some(result) = tasks.next().await { ... }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Java checked exceptions → Python:** Java's checked exceptions (declared in `throws`) enforce caller handling at compile time. Python has no equivalent. When translating: document every checked exception as a `Raises:` entry in the docstring, and consider wrapping callers in explicit `try/except` blocks corresponding to each checked exception type. Do not silently swallow them.
|
|
87
|
+
|
|
88
|
+
## Edge Cases
|
|
89
|
+
|
|
90
|
+
**1. Garbage-collected → memory-managed languages (e.g., Python/Java → Rust/C++).** Ownership and lifetime semantics have no direct equivalent. Identify every heap allocation in the source, decide whether the Rust translation should use `Box<T>`, `Rc<T>`, or `Arc<T>`, and document the decision. Do not silently clone everywhere — explain the trade-off.
|
|
91
|
+
|
|
92
|
+
**2. Dynamic typing → static typing with incomplete type information.** Source code using duck typing or `any`-typed inputs requires the translator to infer or ask for the intended type contracts. List every place where a type assumption was made and flag it for human review.
|
|
93
|
+
|
|
94
|
+
**3. Standard library gaps.** The source may use a library (e.g., Python's `itertools`, Java's `Guava`) with no direct target equivalent. In these cases: (a) identify the closest built-in, (b) link to a well-maintained equivalent library if one exists, (c) write a minimal inline implementation if neither exists. Never silently drop functionality.
|