@workingpayload/agent-skills 1.0.1 → 2.0.1

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 (130) hide show
  1. package/APIForge/skill.md +165 -0
  2. package/AccessPlus/skill.md +136 -0
  3. package/AlgoMaster/skill.md +125 -0
  4. package/Architekt AI/skill.md +140 -0
  5. package/AuthCraft/skill.md +144 -0
  6. package/AutoScriptor/skill.md +137 -0
  7. package/BoilerCore/skill.md +136 -0
  8. package/BugHunter Pro/skill.md +133 -0
  9. package/ChangeScribe/skill.md +113 -0
  10. package/CodeMap/skill.md +194 -0
  11. package/CodeSage/skill.md +163 -0
  12. package/CommitCraft/skill.md +113 -0
  13. package/CoverageMax/skill.md +161 -0
  14. package/CronGenius/skill.md +157 -0
  15. package/DataPolish/skill.md +142 -0
  16. package/DataWeaver/skill.md +151 -0
  17. package/DockMaster/skill.md +158 -0
  18. package/DocuGenie/skill.md +138 -0
  19. package/EdgeGuard/skill.md +160 -0
  20. package/EnvWizard/skill.md +156 -0
  21. package/ErrorMedic/skill.md +152 -0
  22. package/FeatureSmith/skill.md +139 -0
  23. package/FlexiLayout/skill.md +144 -0
  24. package/FlowTester/skill.md +154 -0
  25. package/FunctionForge/skill.md +136 -0
  26. package/InputShield/skill.md +144 -0
  27. package/IssueForge/skill.md +148 -0
  28. package/KubeCrafter/skill.md +149 -0
  29. package/LogicLens/skill.md +132 -0
  30. package/MockSmith/skill.md +146 -0
  31. package/ModelSensei/skill.md +138 -0
  32. package/PRMentor/skill.md +103 -0
  33. package/PerfDetective/skill.md +90 -0
  34. package/PipelinePro/skill.md +146 -0
  35. package/PolyglotShift/skill.md +94 -0
  36. package/PromptForge/skill.md +118 -0
  37. package/QueryPulse/skill.md +123 -0
  38. package/README.md +327 -216
  39. package/ReadMeCraft/skill.md +127 -0
  40. package/RefactorX/skill.md +110 -0
  41. package/RenderBoost/skill.md +148 -0
  42. package/SEOMancer/skill.md +156 -0
  43. package/ScrapeMaster/skill.md +157 -0
  44. package/SecretSniffer/skill.md +123 -0
  45. package/SecureScan/skill.md +130 -0
  46. package/ServiceSplitter/skill.md +153 -0
  47. package/SpeedSmith/skill.md +155 -0
  48. package/StackWise/skill.md +155 -0
  49. package/TaskOrchestrator/skill.md +135 -0
  50. package/TestCrafter/skill.md +158 -0
  51. package/TraceMind/skill.md +143 -0
  52. package/UISmith/skill.md +131 -0
  53. package/bin/cli.js +436 -0
  54. package/extension-extender/SKILL.md +122 -0
  55. package/fastapi-furious/SKILL.md +148 -0
  56. package/package.json +42 -32
  57. package/python-master/SKILL.md +108 -0
  58. package/react-ranger/SKILL.md +93 -0
  59. package/scripts/build_index.py +282 -0
  60. package/scripts/doctor.py +542 -0
  61. package/scripts/install.py +436 -0
  62. package/scripts/route.py +348 -0
  63. package/scripts/score.py +355 -0
  64. package/scripts/test_skill.py +501 -0
  65. package/scripts/validate.py +254 -0
  66. package/skills-routing.json +1156 -0
  67. package/skills.json +3389 -0
  68. package/cli.js +0 -181
  69. package/skills/APIForge/skill.md +0 -32
  70. package/skills/AccessPlus/skill.md +0 -32
  71. package/skills/AlgoMaster/skill.md +0 -32
  72. package/skills/Architekt AI/skill.md +0 -32
  73. package/skills/AuthCraft/skill.md +0 -32
  74. package/skills/AutoScriptor/skill.md +0 -32
  75. package/skills/BoilerCore/skill.md +0 -32
  76. package/skills/BugHunter Pro/skill.md +0 -32
  77. package/skills/ChangeScribe/skill.md +0 -32
  78. package/skills/CodeSage/skill.md +0 -32
  79. package/skills/CommitCraft/skill.md +0 -32
  80. package/skills/CoverageMax/skill.md +0 -32
  81. package/skills/CronGenius/skill.md +0 -32
  82. package/skills/DataPolish/skill.md +0 -32
  83. package/skills/DataWeaver/skill.md +0 -32
  84. package/skills/DockMaster/skill.md +0 -32
  85. package/skills/DocuGenie/skill.md +0 -32
  86. package/skills/EdgeGuard/skill.md +0 -32
  87. package/skills/EnvWizard/skill.md +0 -32
  88. package/skills/ErrorMedic/skill.md +0 -32
  89. package/skills/Extension-Extender/SKILL.md +0 -41
  90. package/skills/Extension-Extender/references/ui-guidelines.md +0 -26
  91. package/skills/Fastapi-Furious/README.md +0 -16
  92. package/skills/Fastapi-Furious/SKILL.md +0 -37
  93. package/skills/FeatureSmith/skill.md +0 -32
  94. package/skills/FlexiLayout/skill.md +0 -32
  95. package/skills/FlowTester/skill.md +0 -32
  96. package/skills/FunctionForge/skill.md +0 -32
  97. package/skills/InputShield/skill.md +0 -32
  98. package/skills/IssueForge/skill.md +0 -32
  99. package/skills/KubeCrafter/skill.md +0 -32
  100. package/skills/LogicLens/skill.md +0 -32
  101. package/skills/MockSmith/skill.md +0 -32
  102. package/skills/ModelSensei/skill.md +0 -32
  103. package/skills/PRMentor/skill.md +0 -32
  104. package/skills/PerfDetective/skill.md +0 -32
  105. package/skills/PipelinePro/skill.md +0 -32
  106. package/skills/PolyglotShift/skill.md +0 -32
  107. package/skills/PromptForge/skill.md +0 -32
  108. package/skills/Python-Master/README.md +0 -11
  109. package/skills/Python-Master/SKILL.md +0 -37
  110. package/skills/QueryPulse/skill.md +0 -32
  111. package/skills/React-Ranger/README.md +0 -17
  112. package/skills/React-Ranger/SKILL.md +0 -37
  113. package/skills/ReadMeCraft/skill.md +0 -32
  114. package/skills/RefactorX/skill.md +0 -32
  115. package/skills/RenderBoost/skill.md +0 -32
  116. package/skills/SEOMancer/skill.md +0 -32
  117. package/skills/ScrapeMaster/skill.md +0 -32
  118. package/skills/SecretSniffer/skill.md +0 -32
  119. package/skills/SecureScan/skill.md +0 -32
  120. package/skills/ServiceSplitter/skill.md +0 -32
  121. package/skills/SpeedSmith/skill.md +0 -32
  122. package/skills/StackWise/skill.md +0 -32
  123. package/skills/TaskOrchestrator/skill.md +0 -32
  124. package/skills/TestCrafter/skill.md +0 -32
  125. package/skills/TraceMind/skill.md +0 -32
  126. package/skills/UISmith/skill.md +0 -32
  127. /package/{skills/Extension-Extender → extension-extender}/assets/manifest.json +0 -0
  128. /package/{skills/Extension-Extender → extension-extender}/assets/popup.css +0 -0
  129. /package/{skills/Extension-Extender → extension-extender}/assets/popup.html +0 -0
  130. /package/{skills/Extension-Extender → extension-extender}/assets/popup.js +0 -0
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: authcraft
3
+ description: Builds secure authentication and authorization systems covering OAuth 2.0/PKCE, JWT lifecycle management, password hashing with bcrypt/Argon2, session security, and OWASP ASVS compliance. Use when a user needs to implement login flows, token management, MFA, SSO, or audit an existing auth system for vulnerabilities.
4
+ ---
5
+
6
+ # AuthCraft
7
+
8
+ ## Domain Scope
9
+
10
+ Authentication (identity verification), authorization (access control), session management, token lifecycle, multi-factor authentication (MFA), SSO/federation, and secure credential storage. Governed by OWASP ASVS Level 2 as the baseline standard.
11
+
12
+ ---
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Classify the Auth Requirement
17
+ - **User authentication**: password + MFA, social login (OAuth), magic link, passkeys (WebAuthn)
18
+ - **Machine-to-machine**: Client Credentials grant, API keys, mTLS
19
+ - **Delegated access** (user grants app access to another service): OAuth 2.0 Authorization Code + PKCE
20
+ - **SSO/federation**: SAML 2.0 (enterprise), OIDC (modern web/mobile)
21
+ - **Re-authentication**: step-up auth for sensitive operations (payment, settings change)
22
+
23
+ ### 2. OAuth 2.0 and OIDC Implementation
24
+
25
+ **Authorization Code + PKCE** (for all public clients: SPAs, mobile apps):
26
+ ```
27
+ 1. Client generates code_verifier (43-128 random bytes, base64url encoded)
28
+ 2. Client computes code_challenge = BASE64URL(SHA256(code_verifier))
29
+ 3. Auth request: GET /authorize?response_type=code
30
+ &client_id=...
31
+ &redirect_uri=...
32
+ &code_challenge=...
33
+ &code_challenge_method=S256
34
+ &state=<random_csrf_token>
35
+ &scope=openid profile email
36
+ 4. Exchange: POST /token with code + code_verifier (no client_secret for public clients)
37
+ 5. Validate state param to prevent CSRF
38
+ ```
39
+
40
+ **Token Validation** (JWT, every request):
41
+ - Verify signature against JWKS endpoint (cache keys, refresh on `kid` miss).
42
+ - Check `iss` (matches your auth server), `aud` (matches your API), `exp` (not expired), `nbf` (not before).
43
+ - Check `jti` against revocation list for sensitive tokens.
44
+ - Use RS256 or ES256 — never HS256 in distributed systems (shared secret is a risk).
45
+
46
+ **Refresh Token Rotation**:
47
+ - Issue a new refresh token on every use; invalidate the old one.
48
+ - If an old refresh token is presented (replay attack), invalidate the entire token family.
49
+ - Refresh token TTL: 30 days (sliding); access token TTL: 15 minutes maximum.
50
+ - Store refresh tokens hashed (SHA-256) in the database — treat like passwords.
51
+
52
+ ### 3. Password Storage
53
+ Never store plaintext or reversible-encryption passwords.
54
+
55
+ **Argon2id** (preferred, winner of Password Hashing Competition):
56
+ ```python
57
+ # Using argon2-cffi
58
+ from argon2 import PasswordHasher
59
+ ph = PasswordHasher(
60
+ time_cost=3, # iterations
61
+ memory_cost=65536, # 64 MB
62
+ parallelism=4,
63
+ hash_len=32,
64
+ salt_len=16
65
+ )
66
+ hash = ph.hash(password)
67
+ ph.verify(hash, input_password) # raises VerifyMismatchError on failure
68
+ ```
69
+
70
+ **bcrypt** (widely supported fallback):
71
+ - Work factor: minimum 12 (2024 guidance). Rehash on successful login if work factor is below current minimum.
72
+ - Input limit: 72 bytes — prehash with SHA-256 if passwords may exceed this: `bcrypt(base64(sha256(password)))`.
73
+
74
+ **Never use**: MD5, SHA-1, SHA-256 alone (without key stretching), unsalted hashes.
75
+
76
+ ### 4. Session Security
77
+ - Server-side sessions (preferred over pure JWT for web apps requiring revocation):
78
+ - Session ID: minimum 128 bits of entropy, cryptographically random (use `secrets.token_urlsafe(32)` in Python, `crypto.randomBytes(32)` in Node).
79
+ - Store: Redis with TTL, or encrypted DB sessions.
80
+ - Cookie attributes: `Secure; HttpOnly; SameSite=Lax` (or `Strict` for pure same-origin). Set `Path=/`.
81
+ - Rotate session ID on privilege change (login, role elevation) to prevent session fixation.
82
+ - Session TTL: idle timeout (15-30 min for sensitive apps) + absolute timeout (8-24h).
83
+ - On logout: invalidate server-side session AND clear cookie. Do not rely solely on cookie deletion.
84
+
85
+ ### 5. Multi-Factor Authentication (MFA)
86
+ **TOTP (RFC 6238)** — Google Authenticator, Authy:
87
+ - Use `pyotp` (Python) or `otplib` (Node). 30-second window, allow 1 step of clock drift (90-second valid window total).
88
+ - Store TOTP secret encrypted at rest (AES-256-GCM with a KMS-managed key).
89
+ - Provide backup codes (8-10 codes, single-use, bcrypt-hashed in DB).
90
+
91
+ **WebAuthn/Passkeys** (strongest, phishing-resistant):
92
+ - Use `@simplewebauthn/server` (Node) or `webauthn4j` (Java).
93
+ - Verify `rpId`, `origin`, and `challenge` on every assertion.
94
+ - Store `credentialPublicKey` and `counter`; reject if counter does not increment (cloned authenticator detection).
95
+
96
+ **SMS OTP**: acceptable for low-risk apps; vulnerable to SIM swap. Do not use for high-value accounts.
97
+
98
+ ### 6. Token Exchange — RFC 8693 (On-Behalf-Of)
99
+ Used for service-to-service identity propagation: Service A receives a user token and needs to call Service B while preserving the user's identity.
100
+ ```
101
+ POST /token
102
+ grant_type=urn:ietf:params:oauth:grant-type:token-exchange
103
+ subject_token=<user_access_token>
104
+ subject_token_type=urn:ietf:params:oauth:token-type:access_token
105
+ audience=service-b
106
+ requested_token_type=urn:ietf:params:oauth:token-type:access_token
107
+ ```
108
+ The authorization server issues a new token scoped to Service B but with the original user's claims. Service B can then verify the `act` (actor) claim to see that Service A made the call. Never forward the user's original token to downstream services — always exchange it so each hop has a narrowly scoped token.
109
+
110
+ ### 7. Passkey Credential Lifecycle
111
+ - **List**: expose `GET /auth/passkeys` returning credential IDs with labels and last-used timestamps.
112
+ - **Label**: allow users to rename credentials (e.g., "MacBook Touch ID") via `PATCH /auth/passkeys/{id}`.
113
+ - **Revoke**: `DELETE /auth/passkeys/{id}` removes the credential from the server; the authenticator cannot be used again. Require re-authentication (step-up) before revocation.
114
+ - **Recovery when all passkeys are lost**: provide a fallback (backup codes, email OTP) registered at enrollment. Do not allow account recovery that bypasses MFA entirely. After recovery, prompt user to register a new passkey immediately.
115
+
116
+ ### 8. OWASP ASVS Level 2 Checklist
117
+ Key controls to verify:
118
+ - [ ] V2.1: Passwords ≥ 12 chars; checked against HaveIBeenPwned API (k-anonymity model) or a local breached password list
119
+ - [ ] V2.3: Account lockout after 5 failed attempts with exponential backoff (not hard lockout — use token bucket to prevent DoS via lockout)
120
+ - [ ] V3.3: Session invalidated after logout and on absolute timeout
121
+ - [ ] V3.7: Re-authentication required before changing email, password, or payment method
122
+ - [ ] V6.2: All secrets stored encrypted at rest; no hardcoded credentials in source
123
+ - [ ] V8.3: Sensitive data not logged (passwords, tokens, PII)
124
+ - [ ] V9.1: TLS 1.2 minimum on all auth endpoints; HSTS enforced
125
+
126
+ ---
127
+
128
+ ## Output Artifacts
129
+
130
+ - Auth flow sequence diagram (Mermaid) showing happy path + token refresh + logout
131
+ - Code snippets: token issuance, validation middleware, password hash/verify
132
+ - ASVS compliance checklist (checkboxes with current pass/fail status)
133
+ - Secret storage schema: which fields are hashed vs. encrypted, key management approach
134
+ - Session configuration: cookie settings, TTLs, rotation policy
135
+
136
+ ---
137
+
138
+ ## Edge Cases
139
+
140
+ 1. **JWT revocation without a denylist**: JWTs are stateless — a signed token is valid until expiry even after logout. Solutions: (a) keep access tokens short-lived (≤15 min) and accept the revocation window, (b) maintain a Redis-backed `jti` denylist for tokens issued to revoked sessions (check on every request, O(1) Redis lookup), (c) switch to opaque tokens with introspection endpoint. Document the chosen approach and its revocation lag in the security model.
141
+
142
+ 2. **OAuth token leakage in browser history and logs**: The `response_type=token` implicit flow puts the access token in the URL fragment, which lands in browser history and server access logs. Always use Authorization Code + PKCE. For redirect URIs, ensure exact string matching (not prefix matching) to prevent open redirect attacks that steal the authorization code.
143
+
144
+ 3. **Account enumeration via timing and error messages**: Returning different error messages for "user not found" vs. "wrong password" enables user enumeration. Always return a generic message ("Invalid credentials"). Use constant-time comparison (`hmac.compare_digest` in Python, `crypto.timingSafeEqual` in Node) for token/hash comparisons. Add a consistent artificial delay (~100ms) to all failed auth responses to prevent timing-based enumeration.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: autoscriptor
3
+ description: Generates production-grade automation scripts in Bash, Python, and PowerShell with idempotency, dry-run mode, error handling, and ShellCheck compliance. Use when a user needs a cron job, deployment script, file processing utility, system automation, or any CLI tool for repetitive developer or ops tasks.
4
+ ---
5
+
6
+ # AutoScriptor
7
+
8
+ ## Domain Scope
9
+
10
+ Shell scripts (Bash/POSIX sh), Python CLI tools (argparse/click/typer), PowerShell automation, cron/systemd timer scheduling, and CI/CD pipeline scripts. Focus on correctness, idempotency, and operability.
11
+
12
+ ---
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Gather Script Requirements
17
+ Before writing, confirm:
18
+ - **Target OS/shell**: Bash on Linux/macOS, POSIX sh for portability, PowerShell 7+ for Windows/cross-platform.
19
+ - **Idempotency requirement**: Can the script be run twice safely without side effects?
20
+ - **Dry-run requirement**: Should `--dry-run` print what would happen without executing?
21
+ - **Input sources**: args, env vars, config file, stdin?
22
+ - **Error handling**: fail-fast, retry, or continue-on-error?
23
+
24
+ ### 2. Bash Script Standards
25
+
26
+ **Mandatory header**:
27
+ ```bash
28
+ #!/usr/bin/env bash
29
+ set -euo pipefail
30
+ IFS=$'\n\t'
31
+ ```
32
+ - `set -e`: exit on error; `set -u`: unset vars are errors; `set -o pipefail`: pipe fails if any stage fails.
33
+
34
+ **`set -e` pitfall**: Commands that legitimately return non-zero (e.g., `grep` returning 1 when no match, `diff` returning 1 when files differ) will abort the script. Guard them:
35
+ ```bash
36
+ grep "pattern" file || true # ignore non-zero exit
37
+ if diff file1 file2 > /dev/null; then echo "same"; fi # use if guard
38
+ ```
39
+
40
+ **Dry-run pattern**:
41
+ ```bash
42
+ DRY_RUN=false
43
+ run() { [[ "$DRY_RUN" == true ]] && echo "[DRY-RUN] $*" || "$@"; }
44
+ run rm -rf "$TMP_DIR"
45
+ ```
46
+
47
+ **Idempotency patterns**:
48
+ - `[[ -d "$DIR" ]] || mkdir -p "$DIR"`
49
+ - `command -v jq &>/dev/null || apt-get install -y jq`
50
+ - Use migration tables for DB scripts to track applied steps.
51
+
52
+ ### 3. ShellCheck Compliance
53
+ - Run `shellcheck script.sh` before finalizing. Zero warnings is the target.
54
+ - Quote all variables: `"$VAR"`. Use `[[ ]]` over `[ ]`. Use `$()` over backticks.
55
+
56
+ ### 4. Python CLI Scripts
57
+
58
+ ```python
59
+ #!/usr/bin/env python3
60
+ import click
61
+ from pathlib import Path
62
+
63
+ @click.command()
64
+ @click.option("--input", "-i", type=click.Path(exists=True, path_type=Path), required=True)
65
+ @click.option("--dry-run", is_flag=True, default=False)
66
+ def main(input: Path, dry_run: bool) -> None:
67
+ """Process INPUT file."""
68
+ # Use sys.exit(1) on failure; never silently catch Exception
69
+ ```
70
+
71
+ **Large file streaming** — avoid loading entire files into memory:
72
+ ```python
73
+ import csv, itertools
74
+
75
+ # Stream CSV rows
76
+ with open("big.csv") as f:
77
+ reader = csv.reader(f)
78
+ for row in itertools.islice(reader, 1000): # process first 1000
79
+ process(row)
80
+
81
+ # pandas chunked reading
82
+ for chunk in pd.read_csv("big.csv", chunksize=10_000):
83
+ process(chunk)
84
+ ```
85
+
86
+ - Use `pathlib.Path` over `os.path`. Atomic writes: write to temp file, then `Path.rename()`.
87
+
88
+ ### 5. Docker Volume UID/GID Mapping
89
+ When mounting host volumes into containers, file permission mismatches occur if the container user UID differs from the host file owner:
90
+ ```dockerfile
91
+ # Match container user UID to host developer UID
92
+ ARG UID=1000
93
+ RUN adduser -u $UID -S app
94
+ USER app
95
+ ```
96
+ Build with: `docker build --build-arg UID=$(id -u) .`
97
+ For rootless compose: set `user: "${UID}:${GID}"` in `docker-compose.yml` and export `UID`/`GID` in the shell. Alternatively, use named volumes (Docker manages ownership) rather than bind mounts to avoid UID conflicts in CI.
98
+
99
+ ### 6. Scheduling
100
+
101
+ **Crontab**: `30 2 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1` — always use full paths and redirect stderr.
102
+
103
+ **systemd timer** (preferred):
104
+ ```ini
105
+ [Timer]
106
+ OnCalendar=*-*-* 02:30:00 UTC
107
+ Persistent=true
108
+ ```
109
+ Enable: `systemctl enable --now backup.timer`.
110
+
111
+ ### 7. PowerShell Standards
112
+ ```powershell
113
+ #Requires -Version 7.0
114
+ Set-StrictMode -Version Latest
115
+ $ErrorActionPreference = 'Stop'
116
+ param([Parameter(Mandatory)][string]$TargetPath, [switch]$DryRun)
117
+ try { Write-Host "Starting (DryRun=$DryRun)" } catch { Write-Host $_.Exception.Message; exit 1 }
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Output Artifacts
123
+
124
+ - Complete script with shebang, set flags, logging, arg parsing, dry-run, and trap/cleanup.
125
+ - ShellCheck result (0 warnings) or accepted deviations with justification.
126
+ - Cron/systemd unit file if scheduling is required.
127
+ - Example invocations (normal, dry-run, verbose).
128
+
129
+ ---
130
+
131
+ ## Edge Cases
132
+
133
+ 1. **Script fails partway through**: Use `flock` for locking and `trap cleanup EXIT` for rollback. Write completed steps to a state file so re-runs skip them.
134
+
135
+ 2. **File paths with spaces/special characters**: Always quote variables. Use `find -print0 | xargs -0`. In Python, always use `subprocess.run(["cmd", arg])` list form — never f-string shell injection.
136
+
137
+ 3. **Unexpected environments (CI, Docker, restricted PATH)**: Do not rely on `~/.bashrc`. Set `PATH` explicitly. Check dependencies at startup: `for cmd in jq aws; do command -v "$cmd" >/dev/null || die "$cmd not found"; done`.
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: boilercore
3
+ description: Scaffolds production-ready project structures with ecosystem-appropriate conventions, CI/CD pipelines, linter/formatter configs, and dependency setup. Use when a user needs to start a new project, add missing tooling infrastructure to an existing codebase, or standardize a project layout.
4
+ ---
5
+
6
+ # BoilerCore
7
+
8
+ ## Domain Scope
9
+
10
+ Project initialization and scaffolding for: Node.js/TypeScript, Python, Go, Java/Kotlin, Rust. Covers file structure, dependency management, linting, formatting, testing setup, CI/CD pipeline, Docker, and environment configuration.
11
+
12
+ ---
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Intake Checklist
17
+ Before scaffolding, determine:
18
+ - [ ] **Language / runtime**: Node 20+, Python 3.11+, Go 1.22+, Java 21, Rust stable?
19
+ - [ ] **Project type**: REST API, CLI tool, library/package, frontend app, monorepo?
20
+ - [ ] **Framework**: Express/Fastify/NestJS, FastAPI/Django/Flask, Gin/Chi, Spring Boot, Axum?
21
+ - [ ] **Test framework**: Jest/Vitest, pytest, Go test, JUnit 5, cargo test?
22
+ - [ ] **CI platform**: GitHub Actions, GitLab CI, CircleCI, Jenkins?
23
+ - [ ] **Container**: Docker required? Kubernetes manifests needed?
24
+ - [ ] **Package manager**: npm/pnpm/yarn, pip/uv/poetry, go mod, Maven/Gradle, Cargo?
25
+
26
+ ### 2. File Tree Output
27
+ Always provide an annotated file tree first:
28
+ ```
29
+ my-api/
30
+ ├── src/
31
+ │ ├── routes/ # Route handlers
32
+ │ ├── services/ # Business logic
33
+ │ ├── repositories/ # Data access layer
34
+ │ └── index.ts # Entry point
35
+ ├── tests/unit/ tests/integration/
36
+ ├── .github/workflows/ # ci.yml, release.yml
37
+ ├── docker/Dockerfile docker-compose.yml
38
+ ├── .env.example
39
+ └── package.json / pyproject.toml / go.mod
40
+ ```
41
+
42
+ ### 3. Language-Specific Conventions
43
+
44
+ **Node.js / TypeScript**: `tsconfig.json` with `strict: true`, `noUncheckedIndexedAccess: true`. ESLint + `@typescript-eslint/recommended`. Prettier. pnpm (monorepos). Vitest.
45
+
46
+ **Python**: `pyproject.toml` (PEP 517). `uv` or `poetry`. Ruff (lint + format). mypy `strict = true`. pytest + `pytest-cov`. Use `src/` layout.
47
+
48
+ **Go**: `go.mod`. `cmd/`, `internal/`, `pkg/` layout. `golangci-lint` with `errcheck`, `gosec`. Makefile with `build`, `test`, `lint`, `clean`.
49
+
50
+ **Rust**: `Cargo.toml` workspace. `cargo clippy -- -D warnings`. `cargo fmt`. `cargo audit` in CI.
51
+
52
+ ### 4. npm Dual-Registry Publishing
53
+ For packages published to both npm public registry and a private registry (e.g., GitHub Packages):
54
+ ```ini
55
+ # .npmrc
56
+ @myorg:registry=https://npm.pkg.github.com
57
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
58
+ ```
59
+ ```json
60
+ // package.json
61
+ "publishConfig": {
62
+ "registry": "https://registry.npmjs.org",
63
+ "access": "public"
64
+ }
65
+ ```
66
+ Scoped packages (`@myorg/pkg`) route to the private registry; unscoped packages use the public registry. In CI, set `NODE_AUTH_TOKEN` for npm and `GITHUB_TOKEN` for GitHub Packages as separate secrets.
67
+
68
+ ### 5. Alpine vs Slim Docker Images
69
+ - **Alpine** (`node:20-alpine`, `python:3.11-alpine`): ~5–10 MB base. Uses musl libc. Native extensions that require glibc (e.g., `sharp`, `bcrypt`, some Python C extensions) **will fail** or require extra build packages (`apk add python3 make g++`).
70
+ - **Slim** (`node:20-slim`, `python:3.11-slim`): ~50–80 MB base. Uses glibc. Native extensions work out of the box.
71
+ - **Rule of thumb**: use Alpine for pure-JS/pure-Python services. Use slim (or `debian:bookworm-slim`) when any dependency includes native extensions. Always test the final image — not just the build stage.
72
+
73
+ ### 6. CI/CD Pipeline (GitHub Actions)
74
+ ```yaml
75
+ name: CI
76
+ on: [pull_request, push]
77
+ jobs:
78
+ lint-and-test:
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+ - uses: actions/setup-node@v4
83
+ with: { node-version: '20', cache: 'pnpm' }
84
+ - run: pnpm install --frozen-lockfile
85
+ - run: pnpm run typecheck && pnpm run lint && pnpm run test -- --coverage
86
+ ```
87
+ Key rules: `--frozen-lockfile` always; fail on warnings (`--max-warnings 0`); cache by lockfile hash; coverage gate ≥ 80%.
88
+
89
+ ### 7. Environment Configuration
90
+ `.env.example`: document every var with type and example. Never commit `.env`. Validate at startup:
91
+ ```typescript
92
+ // env.ts
93
+ import { z } from 'zod';
94
+ export const env = z.object({
95
+ DATABASE_URL: z.string().url(),
96
+ JWT_SECRET: z.string().min(32),
97
+ PORT: z.coerce.number().default(3000),
98
+ }).parse(process.env);
99
+ ```
100
+
101
+ ### 8. Docker Setup
102
+ ```dockerfile
103
+ FROM node:20-slim AS builder # slim for native extension compatibility
104
+ WORKDIR /app
105
+ COPY pnpm-lock.yaml package.json ./
106
+ RUN corepack enable && pnpm install --frozen-lockfile
107
+ COPY . . && RUN pnpm build
108
+
109
+ FROM node:20-slim AS runner
110
+ RUN addgroup -S app && adduser -S app -G app
111
+ COPY --from=builder --chown=app:app /app/dist ./dist
112
+ COPY --from=builder --chown=app:app /app/node_modules ./node_modules
113
+ USER app
114
+ EXPOSE 3000
115
+ CMD ["node", "dist/index.js"]
116
+ ```
117
+ `.dockerignore`: exclude `node_modules`, `.git`, `.env`, `*.log`.
118
+
119
+ ---
120
+
121
+ ## Output Artifacts
122
+
123
+ - Annotated file tree with purpose comments.
124
+ - All config files: tsconfig/pyproject/go.mod, linter, formatter.
125
+ - CI/CD workflow file(s), Dockerfile + docker-compose.yml.
126
+ - `.env.example` with all required variables documented.
127
+
128
+ ---
129
+
130
+ ## Edge Cases
131
+
132
+ 1. **Monorepo with mixed languages**: Workspace root with shared CI matrix. Node.js: pnpm workspaces + Turborepo (`turbo.json` pipeline). Avoid sharing `node_modules` between packages with incompatible peer deps.
133
+
134
+ 2. **Conflicting peer dependencies**: Document in `peerDependenciesMeta` or add `overrides`. Python: pin all deps with `uv.lock` / `poetry.lock`. Never `pip install` without a lockfile in production.
135
+
136
+ 3. **Scaffolding onto existing codebase**: Check for existing configs before writing. Present a diff of proposed changes. Require explicit confirmation before overwriting.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: bughunter-pro
3
+ description: Diagnoses application bugs using hypothesis-driven debugging, reproduces failures with minimal test cases, isolates root causes, and produces regression tests. Use when a user has an error, unexpected behavior, crash, memory leak, race condition, or intermittent failure they cannot explain.
4
+ ---
5
+
6
+ # BugHunter Pro
7
+
8
+ ## Domain Scope
9
+
10
+ Logic bugs, runtime errors, memory leaks, race conditions, performance regressions, intermittent/flaky failures, and misconfiguration-induced failures. Across languages: Python, JavaScript/TypeScript, Java, Go, C/C++, Rust.
11
+
12
+ ---
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Collect Evidence
17
+ Before forming hypotheses, gather:
18
+ - **Error message + full stack trace**: get the entire trace, not just the last line.
19
+ - **Reproduction steps**: what exact inputs/actions trigger it? Is it 100% reproducible or intermittent?
20
+ - **When it started**: last known-good commit/version. Run `git bisect` if unclear.
21
+ - **Environment delta**: what changed? (dependency update, config change, OS update, data volume increase)
22
+ - **Logs**: timestamps, surrounding context — not just the error line.
23
+ - **Code path**: identify the entry point and trace to the failure site.
24
+
25
+ ### 2. Form Hypotheses (Before Touching Code)
26
+ Write down 2-4 candidate causes ranked by likelihood. For each:
27
+ - State the hypothesis in one sentence.
28
+ - State what evidence would confirm or refute it.
29
+ - State how to test it without side effects (read-only investigation first).
30
+
31
+ Example:
32
+ ```
33
+ Hypothesis: Cache returns stale data after TTL expiry because TTL is set in seconds
34
+ but the cache library expects milliseconds.
35
+ Evidence to confirm: log cache TTL value and compare with documentation default unit.
36
+ Test: print effective TTL in ms, check if items expire at wrong time.
37
+ ```
38
+
39
+ ### 3. Reproduce with a Minimal Test Case
40
+ - Reduce the reproduction to the smallest possible input/state. A 5-line reproducer is more valuable than a 500-line one.
41
+ - Isolate from external dependencies: mock out database, network, file system where possible.
42
+ - Make it deterministic: set seeds for random, control time (`freezegun` in Python, `jest.useFakeTimers()` in JS, `clock.Install()` in Go).
43
+ - Write the reproducer as a failing test first — this becomes the regression test.
44
+
45
+ ```python
46
+ # Minimal reproducer example
47
+ def test_cache_ttl_bug():
48
+ cache = Cache(ttl=1) # 1 second TTL
49
+ cache.set("key", "value")
50
+ time.sleep(1.1)
51
+ assert cache.get("key") is None # Fails: returns "value" — TTL bug confirmed
52
+ ```
53
+
54
+ ### 4. Isolate Root Cause
55
+
56
+ **Binary search the call stack**: if you have a multi-step pipeline, add assertions/logging at the midpoint to determine which half contains the bug. Repeat until the single faulty function is identified.
57
+
58
+ **Debugger-first for runtime errors**:
59
+ - Python: `python -m pdb script.py` or `breakpoint()` in code; use `pdb.pm()` post-mortem after exception.
60
+ - Node.js: `node --inspect-brk` + Chrome DevTools or VS Code debugger.
61
+ - Java: remote debug port (`-agentlib:jdwp=transport=dt_socket,server=y,address=5005`).
62
+ - Go: `dlv debug` or `dlv test`.
63
+ - C/C++: `gdb` with `bt` (backtrace), `info locals`, `watch` on memory addresses.
64
+
65
+ **Memory issues**:
66
+ - Python: `tracemalloc` for allocation tracing; `objgraph.show_growth()` for reference leaks.
67
+ - Node.js: `--inspect` + Chrome heap snapshot; `clinic.js` for allocation profiling.
68
+ - C/C++: `valgrind --leak-check=full`; `AddressSanitizer` (`-fsanitize=address`).
69
+ - Rust: memory safety by default; use `valgrind` or `heaptrack` for fragmentation/performance.
70
+
71
+ **Race conditions**:
72
+ - Python: `threading.Lock()` around shared state; use `queue.Queue` for thread communication.
73
+ - Go: `go test -race` (ThreadSanitizer integration); always run with `-race` in CI.
74
+ - Java: `synchronized`, `ReentrantLock`, or `java.util.concurrent` atomics; detect with ThreadSanitizer or Helgrind.
75
+ - Node.js: event loop is single-threaded but async code has shared state bugs — look for closure captures in callbacks modifying shared variables.
76
+
77
+ **Intermittent failures checklist**:
78
+ - [ ] Time-dependent (timezone, DST, clock skew) — use UTC everywhere, mock system time in tests
79
+ - [ ] Order-dependent (tests sharing global state) — add test isolation; check for missing `setUp`/`tearDown`
80
+ - [ ] Resource exhaustion (file descriptors, connections) — check for missing `close()`/`finally` blocks
81
+ - [ ] Race condition (timing-dependent on CPU/load) — add synchronization, use `-race` flag
82
+ - [ ] External service flakiness — add retry logic with backoff; mock in tests
83
+
84
+ ### 5. Fix with Minimal Scope
85
+ - Fix only what is broken — do not refactor surrounding code in the same commit.
86
+ - Comment the fix with: why this happened, what the fix does, and a link to the issue/ticket.
87
+ - If the fix is a workaround rather than a root-cause fix, add a TODO with the root cause explanation.
88
+
89
+ ### 6. Write the Regression Test
90
+ The minimal reproducer from Step 3 becomes the regression test. Ensure it:
91
+ - Is in the appropriate test suite (unit if isolated, integration if it requires a real DB/service).
92
+ - Has a descriptive name: `test_cache_returns_none_after_ttl_expiry_in_seconds_not_ms`.
93
+ - Fails before the fix, passes after.
94
+ - Is added to CI so it runs on every PR.
95
+
96
+ ### 7. Post-Fix Verification
97
+ - Run the full test suite, not just the new test.
98
+ - If the bug was in production: verify with the same data/inputs that triggered the original failure.
99
+ - For performance bugs: benchmark before and after (`pytest-benchmark`, `go test -bench=.`, `criterion` for Rust).
100
+
101
+ ### 8. CI Parallelism and Test Isolation
102
+ When running tests in parallel with `pytest-xdist` (`pytest -n auto`), tests share a single process per worker but not across workers. Common pitfalls:
103
+ - **Database conflicts**: use per-worker databases. In `conftest.py`, read `worker_id = os.environ.get("PYTEST_XDIST_WORKER", "gw0")` and create/use `test_db_{worker_id}`.
104
+ - **Temp directory collisions**: use `tmp_path` fixture (xdist-safe) instead of hardcoded `/tmp/test_*` paths.
105
+ - **Port conflicts**: bind to `port=0` (OS assigns ephemeral port) instead of a fixed port in test servers.
106
+ - Fixture scope matters: `scope="session"` fixtures are shared within a worker process, not across workers — avoid mutable session-scoped state.
107
+
108
+ ### 9. Production Memory Leak Detection
109
+ For live services, use continuous profiling instead of one-shot heap dumps:
110
+ - **Pyroscope** (Go/Python/Ruby): agent auto-instruments and streams flame graphs to the Pyroscope server. Zero code changes for Go; add `pyroscope.start()` for Python.
111
+ - **Parca** (eBPF-based, language-agnostic): attaches to running processes via eBPF, no instrumentation required. Safe for production — read-only kernel hooks.
112
+ - **Heap snapshots in Node.js**: use `v8.writeHeapSnapshot()` triggered by `SIGUSR2` signal handler — safer than `--inspect` in production. Compare two snapshots with Chrome DevTools to find retained objects.
113
+ - Establish a baseline heap size metric in your APM (Datadog, Prometheus) and alert when heap grows >20% over 1 hour without traffic increase.
114
+
115
+ ---
116
+
117
+ ## Output Artifacts
118
+
119
+ - **Root cause statement**: 1-2 sentences explaining exactly what is wrong and why.
120
+ - **Minimal reproducer**: failing test case (code).
121
+ - **Fix**: minimal diff with explanatory comment.
122
+ - **Regression test**: named test that prevents recurrence.
123
+ - **Impact assessment**: was other code affected by the same pattern?
124
+
125
+ ---
126
+
127
+ ## Edge Cases
128
+
129
+ 1. **Heisenbug — bug disappears when instrumented**: Adding logging or a debugger changes timing or memory layout, making the bug disappear. For race conditions: use `ThreadSanitizer`/`-race` instead of print statements. For memory bugs: use `AddressSanitizer` or Valgrind. For timing-sensitive bugs: write a stress test that runs the scenario in a tight loop (1000+ iterations) to increase the probability of manifestation.
130
+
131
+ 2. **Bug in a third-party library**: Confirm the bug is in the library and not in how it is called by writing a standalone minimal reproducer that uses only the library's public API. Check the library's issue tracker and changelog. If confirmed: pin to a known-good version, add a wrapper that documents the workaround, and open an upstream issue. Do not monkey-patch library internals without documenting it explicitly.
132
+
133
+ 3. **Data-dependent bugs that only appear in production**: The production dataset has edge cases not present in dev/test (null values, Unicode, very large records, specific date ranges). Steps: (a) sanitize and import a production data sample into a local environment, (b) add database query logging to identify the exact record(s) triggering failure, (c) add property-based tests (`hypothesis` in Python, `fast-check` in JS, `quickcheck` in Rust/Haskell) that generate random inputs including boundary values to catch similar cases automatically.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: changescribe
3
+ description: Generates and maintains changelogs following Keep a Changelog format and Conventional Commits, determines semver bump rules from commit history, and parses git log output into structured release notes. Use when a user needs to create a CHANGELOG.md, prepare release notes, determine the next version number, or automate changelog generation in CI.
4
+ ---
5
+
6
+ # ChangeScribe
7
+
8
+ ## Domain Scope
9
+
10
+ Changelog generation, semantic versioning (semver 2.0.0), Conventional Commits specification parsing, Keep a Changelog format, git log analysis, and release automation.
11
+
12
+ ---
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Parse the Commit History
17
+ ```bash
18
+ git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%H|%s|%b|%an|%ae|%ci" --no-merges
19
+ ```
20
+
21
+ ### 2. Classify Commits — Type-to-Semver Mapping
22
+
23
+ | Commit Type | Semver Bump | Changelog Section |
24
+ |-------------|-------------|-------------------|
25
+ | `feat` | MINOR | Added |
26
+ | `fix`, `perf` | PATCH | Fixed / Changed |
27
+ | `refactor` | PATCH (if behavior change) | Changed |
28
+ | `docs`, `chore`, `test`, `ci`, `build` | none | (omit) |
29
+ | `BREAKING CHANGE` or `!` suffix | MAJOR | Breaking Changes |
30
+
31
+ **Breaking change detection**: footer `BREAKING CHANGE: <desc>` or type with `!` suffix (`feat!: remove API`). Always list breaking changes first.
32
+
33
+ ### 3. Determine the Next Version
34
+ ```
35
+ Current: 1.4.2 → BREAKING CHANGE → 2.0.0
36
+ → feat commits → 1.5.0
37
+ → fix/perf only → 1.4.3
38
+ → docs/chore only → no release
39
+ ```
40
+ Version `0.x.y`: MINOR bumps may contain breaking changes — document in changelog header.
41
+
42
+ ### 4. Write the Changelog Entry
43
+
44
+ Follow **Keep a Changelog** format:
45
+ ```markdown
46
+ ## [1.5.0] - 2026-03-28
47
+
48
+ ### Breaking Changes
49
+ - **api**: Removed `GET /v1/users/search`. Use `POST /v1/users/query`. ([#342](link)) — by @alice
50
+
51
+ ### Added
52
+ - **auth**: WebAuthn/passkey authentication ([#318](link)) — by @bob
53
+
54
+ ### Fixed
55
+ - **auth**: Refresh token not invalidated on logout ([#340](link)) — by @alice
56
+ ```
57
+ **Section order**: Breaking Changes → Added → Changed → Deprecated → Removed → Fixed → Security.
58
+ Entry format: `- **<scope>**: <Imperative description> ([#<issue>](<url>)) — by @<author>`
59
+
60
+ ### 5. Maintain CHANGELOG.md Structure
61
+ ```markdown
62
+ # Changelog
63
+ ## [Unreleased]
64
+ ## [1.5.0] - 2026-03-28
65
+ ...
66
+ [Unreleased]: https://github.com/owner/repo/compare/v1.5.0...HEAD
67
+ [1.5.0]: https://github.com/owner/repo/compare/v1.4.2...v1.5.0
68
+ ```
69
+ Rules: never delete old entries; `[Unreleased]` always present; newest version first; version comparison links at bottom.
70
+
71
+ ### 6. Monorepo Per-Package Changelogs
72
+ Use **changesets** for monorepos with independent package versioning:
73
+ ```bash
74
+ npx changeset # developer describes change + bump type interactively
75
+ npx changeset version # consumes changesets, bumps package.json versions, writes CHANGELOG.md per package
76
+ npx changeset publish # publishes to npm
77
+ ```
78
+ For commit-based automation without changesets, scope parsing by directory: filter `git log` with `-- packages/my-pkg/` and parse only commits touching that package's path. `git-cliff` supports per-package `cliff.toml` with `commit_parsers` scoped to `paths`.
79
+
80
+ ### 7. Hotfix Branch Changelog Placement
81
+ When a hotfix is cut from a release branch (e.g., `release/1.4.x`) and produces `v1.4.3` after `v1.5.0` already exists on main:
82
+ - Insert the `## [1.4.3]` section **chronologically** in CHANGELOG.md (after `1.5.0`, before `1.4.2`), not at the top.
83
+ - Add a note: `_Backport of security fix from v1.5.1 to the v1.4.x maintenance branch._`
84
+ - After merging the hotfix back to main, update the `[Unreleased]` diff link to include the hotfix commits.
85
+
86
+ ### 8. Automation in CI
87
+ ```bash
88
+ # git-cliff: generate changelog from last tag to HEAD
89
+ git cliff --output CHANGELOG.md --latest
90
+
91
+ # GitHub Actions: determine bump + generate
92
+ BUMP=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s" | python scripts/bump_type.py)
93
+ git cliff --tag "$NEXT_VERSION" --unreleased --output release-notes.md
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Output Artifacts
99
+
100
+ - Updated `CHANGELOG.md` with new release section.
101
+ - Version determination rationale: commit types found and resulting bump.
102
+ - `release-notes.md` for GitHub Release body.
103
+ - Git tag command: `git tag -a v1.5.0 -m "Release 1.5.0"`.
104
+
105
+ ---
106
+
107
+ ## Edge Cases
108
+
109
+ 1. **Non-conventional commits**: Classify by keyword heuristics (fix/bug → Fixed; add/new → Added; update/migrate → Changed; remove/drop → Removed). Flag ambiguous commits for review. Recommend `commitlint` hook going forward.
110
+
111
+ 2. **Multiple releases from one branch**: Split commits by tag boundary. Use `git log v1.4.2..v1.4.3` and `git log v1.4.3..v1.5.0` separately — never aggregate all commits under the latest version.
112
+
113
+ 3. **Merge commits, reverts, squash PRs**: Skip merge commits. Reverts remove the original entry and add a note only if user-visible. For squash-merged PRs, enforce PR title linting via branch protection rules.