@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/AuthCraft/skill.md
CHANGED
|
@@ -1,32 +1,144 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: authcraft
|
|
3
|
-
description:
|
|
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
4
|
---
|
|
5
5
|
|
|
6
6
|
# AuthCraft
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Domain Scope
|
|
9
9
|
|
|
10
|
-
|
|
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
|
+
---
|
|
11
13
|
|
|
12
14
|
## Workflow
|
|
13
15
|
|
|
14
|
-
|
|
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.
|
|
15
84
|
|
|
16
|
-
###
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
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
|
+
---
|
|
20
137
|
|
|
21
|
-
|
|
22
|
-
- Apply the core logic of AuthCraft perfectly.
|
|
23
|
-
- Prioritize clean architecture, high efficiency, and robust error handling.
|
|
24
|
-
- Strive for a flawless, comprehensive solution that directly addresses the user's needs.
|
|
138
|
+
## Edge Cases
|
|
25
139
|
|
|
26
|
-
|
|
27
|
-
- Review the generated output against industry best practices for security.
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
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.
|
|
29
141
|
|
|
30
|
-
|
|
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.
|
|
31
143
|
|
|
32
|
-
-
|
|
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.
|
package/AutoScriptor/skill.md
CHANGED
|
@@ -1,32 +1,137 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autoscriptor
|
|
3
|
-
description:
|
|
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
4
|
---
|
|
5
5
|
|
|
6
6
|
# AutoScriptor
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Domain Scope
|
|
9
9
|
|
|
10
|
-
|
|
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
|
+
---
|
|
11
13
|
|
|
12
14
|
## Workflow
|
|
13
15
|
|
|
14
|
-
|
|
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)
|
|
15
80
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
---
|
|
20
130
|
|
|
21
|
-
|
|
22
|
-
- Apply the core logic of AutoScriptor perfectly.
|
|
23
|
-
- Prioritize clean architecture, high efficiency, and robust error handling.
|
|
24
|
-
- Strive for a flawless, comprehensive solution that directly addresses the user's needs.
|
|
131
|
+
## Edge Cases
|
|
25
132
|
|
|
26
|
-
|
|
27
|
-
- Review the generated output against industry best practices for automation.
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
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.
|
|
29
134
|
|
|
30
|
-
|
|
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.
|
|
31
136
|
|
|
32
|
-
|
|
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`.
|
package/BoilerCore/skill.md
CHANGED
|
@@ -1,32 +1,136 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: boilercore
|
|
3
|
-
description:
|
|
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
4
|
---
|
|
5
5
|
|
|
6
6
|
# BoilerCore
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Domain Scope
|
|
9
9
|
|
|
10
|
-
|
|
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
|
+
---
|
|
11
13
|
|
|
12
14
|
## Workflow
|
|
13
15
|
|
|
14
|
-
|
|
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.
|
|
15
72
|
|
|
16
|
-
###
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
---
|
|
20
129
|
|
|
21
|
-
|
|
22
|
-
- Apply the core logic of BoilerCore perfectly.
|
|
23
|
-
- Prioritize clean architecture, high efficiency, and robust error handling.
|
|
24
|
-
- Strive for a flawless, comprehensive solution that directly addresses the user's needs.
|
|
130
|
+
## Edge Cases
|
|
25
131
|
|
|
26
|
-
|
|
27
|
-
- Review the generated output against industry best practices for setup, codegen.
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
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.
|
|
29
133
|
|
|
30
|
-
|
|
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.
|
|
31
135
|
|
|
32
|
-
|
|
136
|
+
3. **Scaffolding onto existing codebase**: Check for existing configs before writing. Present a diff of proposed changes. Require explicit confirmation before overwriting.
|
package/BugHunter Pro/skill.md
CHANGED
|
@@ -1,32 +1,133 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bughunter-pro
|
|
3
|
-
description:
|
|
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
4
|
---
|
|
5
5
|
|
|
6
6
|
# BugHunter Pro
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Domain Scope
|
|
9
9
|
|
|
10
|
-
|
|
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
|
+
---
|
|
11
13
|
|
|
12
14
|
## Workflow
|
|
13
15
|
|
|
14
|
-
|
|
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.
|
|
15
76
|
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
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
|
+
---
|
|
20
126
|
|
|
21
|
-
|
|
22
|
-
- Apply the core logic of BugHunter Pro perfectly.
|
|
23
|
-
- Prioritize clean architecture, high efficiency, and robust error handling.
|
|
24
|
-
- Strive for a flawless, comprehensive solution that directly addresses the user's needs.
|
|
127
|
+
## Edge Cases
|
|
25
128
|
|
|
26
|
-
|
|
27
|
-
- Review the generated output against industry best practices for debug.
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
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.
|
|
29
130
|
|
|
30
|
-
|
|
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.
|
|
31
132
|
|
|
32
|
-
-
|
|
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.
|