@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,157 @@
1
+ ---
2
+ name: scrapemaster
3
+ description: Build resilient web scrapers using a static-vs-JS-rendered decision tree, Playwright/Cheerio/BeautifulSoup, robots.txt compliance, retry/backoff, pagination handling, and structured output schemas. Use when a user needs to extract data from websites, build a scraper, or parse HTML/DOM content.
4
+ ---
5
+
6
+ # ScrapeMaster
7
+
8
+ ## Overview
9
+
10
+ ScrapeMaster builds production-grade scrapers with the right tool for the rendering environment, ethical compliance checks, resilience patterns, and clean output schemas.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Static vs. JS-Rendered Decision Tree
15
+
16
+ Before writing any code, determine how the target page renders its content:
17
+
18
+ ```
19
+ Does the data appear in `curl https://example.com` raw HTML?
20
+ YES → Static page → use Cheerio (JS) or BeautifulSoup (Python)
21
+ NO → JS-rendered → use Playwright (preferred) or Puppeteer
22
+
23
+ Is the data returned by a JSON API call?
24
+ YES → Call the API directly (inspect Network tab in DevTools → XHR/Fetch)
25
+ → Reverse-engineer the API endpoint instead of scraping the DOM
26
+ NO → Scrape the rendered DOM
27
+ ```
28
+
29
+ Checking for an API endpoint first saves 90% of the work and produces more stable output.
30
+
31
+ ### 2. Compliance Check (Do This Before Writing Code)
32
+
33
+ 1. **Check `robots.txt`**: `https://example.com/robots.txt`. Honor `Disallow` rules for your scraper's User-Agent. If the target explicitly disallows scraping, inform the user and stop.
34
+ 2. **Check Terms of Service**: look for sections on automated access, data scraping, or commercial use.
35
+ 3. **Rate limiting**: never hit a site faster than ~1 request/second without explicit permission. Use `Crawl-delay` from robots.txt if specified.
36
+ 4. **Set a descriptive User-Agent**: `MyCompanyScraper/1.0 (+https://mycompany.com/bot)`.
37
+
38
+ ### 3. Choose the Right Tool
39
+
40
+ **Static HTML (no JS required):**
41
+
42
+ *Python — BeautifulSoup + httpx:*
43
+ ```python
44
+ import httpx
45
+ from bs4 import BeautifulSoup
46
+
47
+ async def fetch_page(url: str) -> BeautifulSoup:
48
+ async with httpx.AsyncClient(headers={"User-Agent": "MyScraper/1.0"}) as client:
49
+ r = await client.get(url, follow_redirects=True)
50
+ r.raise_for_status()
51
+ return BeautifulSoup(r.text, "lxml")
52
+
53
+ soup = await fetch_page("https://example.com/products")
54
+ items = soup.select("div.product-card") # CSS selectors preferred over find_all
55
+ ```
56
+
57
+ *Node.js — Cheerio + got:*
58
+ ```js
59
+ import * as cheerio from 'cheerio';
60
+ import got from 'got';
61
+
62
+ const { body } = await got('https://example.com/products');
63
+ const $ = cheerio.load(body);
64
+ const items = $('div.product-card').map((_, el) => ({
65
+ title: $(el).find('h2').text().trim(),
66
+ price: $(el).find('.price').text().trim(),
67
+ })).get();
68
+ ```
69
+
70
+ **JS-rendered pages (React/Vue/Angular SPA):**
71
+
72
+ *Python — Playwright:*
73
+ ```python
74
+ from playwright.async_api import async_playwright
75
+
76
+ async def scrape_spa(url: str):
77
+ async with async_playwright() as p:
78
+ browser = await p.chromium.launch(headless=True)
79
+ page = await browser.new_page()
80
+ await page.goto(url, wait_until="networkidle")
81
+ # Wait for the specific element that contains your data
82
+ await page.wait_for_selector("div.product-card", timeout=10_000)
83
+ items = await page.eval_on_selector_all(
84
+ "div.product-card",
85
+ "els => els.map(el => ({ title: el.querySelector('h2').textContent.trim() }))"
86
+ )
87
+ await browser.close()
88
+ return items
89
+ ```
90
+
91
+ ### 4. Retry & Backoff Pattern
92
+
93
+ Wrap all network calls in retry logic with exponential backoff:
94
+
95
+ ```python
96
+ from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
97
+
98
+ @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=2, max=30),
99
+ retry=retry_if_exception_type((httpx.HTTPStatusError, httpx.TransportError)))
100
+ async def fetch_with_retry(client, url):
101
+ r = await client.get(url)
102
+ if r.status_code == 429:
103
+ await asyncio.sleep(int(r.headers.get("Retry-After", 60)))
104
+ r.raise_for_status()
105
+ r.raise_for_status()
106
+ return r
107
+ ```
108
+
109
+ In Node.js: `got(url, { retry: { limit: 3, methods: ['GET'] } })`.
110
+
111
+ ### 5. Pagination & Infinite Scroll
112
+
113
+ **Offset pagination:** Increment `?page=N` until `parse_items()` returns empty.
114
+
115
+ **Cursor/next-link:** Follow `a[rel="next"]` href until absent.
116
+
117
+ **Infinite scroll (Playwright):** Simulate scrolling and wait for new network requests:
118
+ ```python
119
+ async def scrape_infinite_scroll(page):
120
+ results = []
121
+ prev_count = 0
122
+ while True:
123
+ items = await page.eval_on_selector_all(".item", "els => els.map(e => e.textContent)")
124
+ results = items
125
+ if len(items) == prev_count:
126
+ break
127
+ prev_count = len(items)
128
+ await page.evaluate("window.scrollTo(0, document.body.scrollHeight)")
129
+ # Wait for new content to load
130
+ await page.wait_for_timeout(1500)
131
+ return results
132
+ ```
133
+ For API-backed infinite scroll, intercept XHR/fetch via `page.on("response", ...)` and collect JSON payloads directly — no DOM parsing needed.
134
+
135
+ ### 6. Define the Output Schema
136
+
137
+ Always define a Pydantic model before parsing. Store prices as integer cents (not float). Export as JSON Lines (`.jsonl`) for large datasets, CSV for tabular consumers, SQLite for queryable output.
138
+
139
+ ### 7. Deliver the Output
140
+
141
+ Provide:
142
+ 1. Decision tree result (static/JS-rendered/API) with evidence.
143
+ 2. Complete scraper script with retry logic and polite delay.
144
+ 3. Output schema (Pydantic model or TypeScript type).
145
+ 4. Sample output (5 records in the schema format).
146
+ 5. robots.txt compliance status.
147
+ 6. Notes on fragility: which CSS selectors are likely to break if the site redesigns.
148
+
149
+ ## Edge Cases
150
+
151
+ **1. Anti-bot detection (Cloudflare, DataDome, PerimeterX).** Do not bypass security controls without explicit permission — this may violate the CFAA. Inform the user; suggest an official API or data partnership. If the user has explicit permission, `playwright-extra` + `puppeteer-extra-plugin-stealth` reduces fingerprinting signals.
152
+
153
+ **2. CAPTCHA walls.** CAPTCHAs are a hard blocker. Surface this clearly to the user. If they have explicit legal permission and a legitimate use case, third-party solving services such as 2captcha or Anti-Captcha can integrate via API. Never attempt to bypass CAPTCHAs on sites where scraping is prohibited.
154
+
155
+ **3. Brittle selectors.** Prefer stability order: `data-testid` > `aria-label`/`role` > meaningful class names > positional selectors. Add record-count validation to catch silent DOM changes.
156
+
157
+ **4. Login-gated content.** Use Playwright `page.fill` + `page.click` for auth, then `context.storage_state(path="state.json")` to reuse sessions across runs. Never hardcode credentials — use environment variables.
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: secretsniffer
3
+ description: Audits codebases and git history for hardcoded credentials, API keys, and sensitive data exposures. Use when asked to scan for secrets, check for leaked credentials, or set up pre-commit secret detection.
4
+ ---
5
+
6
+ # SecretSniffer
7
+
8
+ ## Overview
9
+
10
+ Scans source code and git history for hardcoded secrets using industry-standard tools (TruffleHog, Gitleaks, detect-secrets). Classifies findings by severity, maps to secret type, and produces SARIF-compatible output suitable for GitHub Advanced Security or CI gatekeeping.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Scope & Tool Selection
15
+
16
+ - Determine scan target: working tree only, staged files (pre-commit), or full git history.
17
+ - Select tool based on scope:
18
+ - **TruffleHog v3** (`trufflehog git file://. --json`): deep entropy + regex, best for git history.
19
+ - **Gitleaks** (`gitleaks detect --source . --report-format sarif --report-path findings.sarif`): fast, SARIF output, good for CI.
20
+ - **detect-secrets** (`detect-secrets scan > .secrets.baseline`): baseline-based, low false-positive rate for pre-commit hooks.
21
+ - For pre-commit integration, install via `pre-commit` framework using `gitleaks` or `detect-secrets` hooks.
22
+
23
+ ### 2. Pattern Coverage
24
+
25
+ Ensure the scan config covers these high-priority secret types:
26
+
27
+ | Secret Type | Regex / Entropy Signal |
28
+ |-------------|------------------------|
29
+ | AWS Access Key | `AKIA[0-9A-Z]{16}` |
30
+ | AWS Secret Key | 40-char base62, high entropy adjacent to "aws_secret" |
31
+ | JWT | `eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+` |
32
+ | PEM private key | `-----BEGIN (RSA\|EC\|OPENSSH) PRIVATE KEY-----` |
33
+ | GCP Service Account | `"type": "service_account"` in JSON |
34
+ | GitHub PAT | `gh[pousr]_[A-Za-z0-9]{36,}` |
35
+ | Generic high-entropy string | Shannon entropy > 4.5 over 20+ char alphanumeric strings |
36
+ | DB connection string | `(postgres\|mysql\|mongodb)://[^@]+:[^@]+@` |
37
+
38
+ For custom patterns, add to `.gitleaks.toml` under `[[rules]]` or extend the `detect-secrets` plugin list.
39
+
40
+ ### 3. Severity Classification
41
+
42
+ Assign severity using this rubric:
43
+
44
+ - **CRITICAL**: Private keys (PEM/PKCS8), cloud provider master credentials (AWS root, GCP service accounts with `roles/owner`), database passwords in production configs.
45
+ - **HIGH**: Active API keys for third-party services (Stripe, Twilio, SendGrid), OAuth client secrets, JWT signing secrets.
46
+ - **MEDIUM**: Tokens that may be expired or test-only, internal service credentials.
47
+ - **LOW**: Patterns matching secret formats but confirmed test/placeholder values (e.g., `test_`, `dummy_`, `example_`).
48
+
49
+ ### 4. Git History Deep Scan
50
+
51
+ When scanning history:
52
+ ```bash
53
+ trufflehog git file://. --since-commit HEAD~100 --json | jq '.SourceMetadata.Data.Git'
54
+ ```
55
+ - Check `--branch` flag to scope to a specific branch.
56
+ - Flag commits that introduced secrets even if later removed — they remain in history and require `git filter-repo` or BFG Repo Cleaner for remediation.
57
+ - Report the commit SHA, author, and timestamp for each finding.
58
+
59
+ ### 5. Output Format
60
+
61
+ Produce findings in two formats:
62
+
63
+ **SARIF** (for GitHub/Azure DevOps integration):
64
+ ```json
65
+ {
66
+ "runs": [{
67
+ "results": [{
68
+ "ruleId": "aws-access-key",
69
+ "level": "error",
70
+ "message": { "text": "AWS Access Key detected" },
71
+ "locations": [{ "physicalLocation": { "artifactLocation": { "uri": "config/settings.py" }, "region": { "startLine": 42 }}}]
72
+ }]
73
+ }]
74
+ }
75
+ ```
76
+
77
+ **Human-readable summary table**:
78
+ ```
79
+ SEVERITY | FILE | LINE | SECRET TYPE | COMMIT
80
+ CRITICAL | config/settings.py | 42 | AWS Access Key | a1b2c3d
81
+ HIGH | .env.example | 7 | Stripe Secret Key | HEAD
82
+ ```
83
+
84
+ ### 6. Remediation Guidance
85
+
86
+ For each confirmed finding, provide:
87
+ 1. **Immediate**: Revoke the exposed credential at the provider (AWS IAM, GitHub settings, Stripe dashboard).
88
+ 2. **Short-term**: Replace with environment variable (`os.environ['SECRET_KEY']`) or secrets manager reference (AWS Secrets Manager ARN, HashiCorp Vault path, Azure Key Vault secret URI).
89
+ 3. **History cleanup**: If in git history, use `git filter-repo --path <file> --invert-paths` or BFG `--delete-files`.
90
+ 4. **Prevention**: Add `.gitleaks.toml` + pre-commit hook, set `SECRETS_BASELINE` in CI to block new commits.
91
+
92
+ ## Additional Scan Targets
93
+
94
+ **Git submodule scanning:** By default, TruffleHog and Gitleaks do not recurse into submodules. Add `--include-submodules` (TruffleHog) or configure `[allowlist] paths` inversely. Run `git submodule update --init --recursive` before scanning so submodule history is available locally.
95
+
96
+ **Jupyter notebook cell output:** Notebook `.ipynb` files store cell outputs (including printed secrets) as JSON. Use `nbstripout` (`pip install nbstripout`) to strip output before committing: `nbstripout --install` adds a pre-commit hook. Scan existing notebooks with `trufflehog filesystem --directory . --json` which reads IPYNB as text and catches secrets in output cells.
97
+
98
+ **Blast radius analysis for shared secrets:** When a secret is shared across multiple services (e.g., a shared DB password, a monorepo-wide signing key), rotation affects all consumers simultaneously. Before rotating: enumerate all services using the secret (`grep` across repos/configs), plan a coordinated rollout, and verify each service's ability to hot-reload secrets (e.g., via AWS Secrets Manager rotation Lambda) before revoking the old credential.
99
+
100
+ ## Edge Cases
101
+
102
+ **False positives in test fixtures**: Suppress with `# gitleaks:allow` inline comment or add path exclusion in `.gitleaks.toml` under `[allowlist] paths`. Always verify suppressed patterns are not real credentials.
103
+
104
+ **Secrets in binary/compiled files**: TruffleHog's `--only-verified` flag reduces noise but may miss unverified live secrets. Run `strings` extraction separately on `.jar`, `.pyc`, `.wasm` artifacts.
105
+
106
+ **Monorepos with multiple .env files**: Scope scans per service directory. Use `gitleaks detect --source ./services/auth` per bounded context to keep signal-to-noise ratio high.
107
+
108
+ ## CI Integration Example
109
+
110
+ ```yaml
111
+ # .github/workflows/secret-scan.yml
112
+ - name: Run Gitleaks
113
+ uses: gitleaks/gitleaks-action@v2
114
+ env:
115
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116
+ with:
117
+ args: --report-format sarif --report-path results.sarif
118
+
119
+ - name: Upload SARIF
120
+ uses: github/codeql-action/upload-sarif@v3
121
+ with:
122
+ sarif_file: results.sarif
123
+ ```
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: securescan
3
+ description: Performs static application security testing (SAST) to identify OWASP Top 10 vulnerabilities, CWE weaknesses, and insecure coding patterns. Use when asked to security audit code, find vulnerabilities, run SAST analysis, or recommend secure coding fixes.
4
+ ---
5
+
6
+ # SecureScan
7
+
8
+ ## Overview
9
+
10
+ Runs SAST analysis using Semgrep, Bandit (Python), or CodeQL to identify vulnerabilities mapped to OWASP Top 10 2021 and CWE categories. Produces severity-rated findings with taint-tracking paths and concrete remediation guidance — not generic advice.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Tool Selection by Language
15
+
16
+ | Language | Primary Tool | Secondary |
17
+ |----------|-------------|-----------|
18
+ | Python | Bandit (`bandit -r . -f json`) + Semgrep | Safety (deps) |
19
+ | JavaScript/TypeScript | Semgrep (`semgrep --config=p/javascript`) | ESLint security plugin |
20
+ | Java | CodeQL (`codeql database analyze --format=sarif-latest`) | SpotBugs + FindSecBugs |
21
+ | Go | Semgrep (`semgrep --config=p/golang`) | gosec |
22
+ | Ruby | Brakeman (`brakeman -f json`) | Semgrep |
23
+ | PHP | Semgrep + PHPCS Security Audit | |
24
+ | Multi-language | Semgrep with `--config=p/owasp-top-ten` | CodeQL |
25
+
26
+ Always run `semgrep --config=p/secrets` alongside SAST for defense-in-depth.
27
+
28
+ ### 2. Vulnerability Categories to Check
29
+
30
+ Map every finding to OWASP Top 10 2021 and CWE:
31
+
32
+ | OWASP Category | CWE | What to Look For |
33
+ |----------------|-----|------------------|
34
+ | A01 Broken Access Control | CWE-284, CWE-639 | Missing authz checks, IDOR patterns, path traversal |
35
+ | A02 Cryptographic Failures | CWE-327, CWE-330 | Weak algos (MD5/SHA1 for passwords, DES/RC4), hardcoded IV, non-random nonces |
36
+ | A03 Injection | CWE-89, CWE-78, CWE-917 | SQL/NoSQL/LDAP/OS command injection; unsanitized user input in queries |
37
+ | A05 Security Misconfiguration | CWE-16 | Debug mode enabled, permissive CORS (`*`), missing security headers |
38
+ | A07 Auth Failures | CWE-287, CWE-798 | Hardcoded creds, weak session tokens, missing MFA enforcement |
39
+ | A08 SSRF | CWE-918 | User-controlled URLs in HTTP requests without allowlist |
40
+ | A09 Logging Failures | CWE-778, CWE-532 | Sensitive data in logs, missing audit trails for auth events |
41
+
42
+ ### 3. Taint Tracking Analysis
43
+
44
+ For injection vulnerabilities, trace the full taint path:
45
+ 1. **Source**: Where does untrusted input enter? (HTTP params, headers, file uploads, env vars, DB reads from external systems)
46
+ 2. **Propagation**: Does the value flow through transformations that could neutralize it? (sanitize functions, parameterized queries)
47
+ 3. **Sink**: Where does the tainted value land? (SQL execute, `subprocess.run`, `eval`, `innerHTML`, file write)
48
+
49
+ Document taint path in findings:
50
+ ```
51
+ TAINT PATH: request.args['user_id'] → format string → db.execute()
52
+ File: app/routes.py, line 47 → line 53
53
+ CWE-89 (SQL Injection), OWASP A03
54
+ ```
55
+
56
+ ### 4. Severity Rating
57
+
58
+ Use CVSS v3.1 base score guidance:
59
+
60
+ - **CRITICAL (9.0-10.0)**: Unauthenticated RCE, SQLi in auth bypass, hardcoded admin credentials.
61
+ - **HIGH (7.0-8.9)**: Authenticated SQLi/RCE, SSRF with internal network access, broken object-level authorization.
62
+ - **MEDIUM (4.0-6.9)**: Reflected XSS, insecure deserialization without direct code exec, weak crypto for non-password data.
63
+ - **LOW (0.1-3.9)**: Missing security headers, verbose error messages, non-sensitive info disclosure.
64
+ - **INFORMATIONAL**: Style issues, defense-in-depth recommendations.
65
+
66
+ ### 5. Output Format
67
+
68
+ Produce a structured findings report:
69
+
70
+ ```markdown
71
+ ## Finding #1
72
+ - **ID**: SS-2024-001
73
+ - **Severity**: HIGH
74
+ - **CWE**: CWE-89 (SQL Injection)
75
+ - **OWASP**: A03:2021 – Injection
76
+ - **File**: app/models/user.py, line 83
77
+ - **Description**: String interpolation used in raw SQL query with user-supplied input.
78
+ - **Vulnerable Code**:
79
+ ```python
80
+ query = f"SELECT * FROM users WHERE email = '{email}'"
81
+ db.execute(query)
82
+ ```
83
+ - **Taint Path**: `request.form['email']` → `email` parameter → `db.execute()`
84
+ - **Remediation**: Use parameterized queries: `db.execute("SELECT * FROM users WHERE email = ?", (email,))`
85
+ - **References**: CWE-89, OWASP Testing Guide v4 OTG-INPVAL-005
86
+ ```
87
+
88
+ ### 6. Remediation Guidance by Category
89
+
90
+ **SQL Injection**: Always use parameterized queries or ORM (SQLAlchemy, Hibernate, ActiveRecord). Never concatenate user input into query strings.
91
+
92
+ **XSS**: Use framework-native output escaping (React's JSX auto-escaping, Django's `{{ var }}`). For raw HTML insertion, use DOMPurify with strict config.
93
+
94
+ **SSRF**: Validate URLs against an allowlist of domains/IPs. Block `169.254.169.254` (AWS metadata), `::1`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`.
95
+
96
+ **Insecure Crypto**: Replace MD5/SHA1 with SHA-256+ for integrity. Use bcrypt/argon2id for passwords (never SHA for passwords). Use AES-256-GCM for symmetric encryption.
97
+
98
+ **Hardcoded Secrets**: Move to environment variables or secrets manager. See SecretSniffer skill for scanner integration.
99
+
100
+ ### 7. Additional Vulnerability Categories
101
+
102
+ **Insecure deserialization (CWE-502):** Deserializing untrusted data with native mechanisms is critical-severity. Java `ObjectInputStream.readObject()` can execute arbitrary code via gadget chains (use ysoserial to test). Python `pickle.loads()` is unsafe on any external input — replace with `json` or `msgpack`. PHP `unserialize()` with user input triggers object injection — use `json_decode()` instead. Flag any deserialization of HTTP body, message queue payloads, or cookie values using these mechanisms.
103
+
104
+ **Supply chain integrity:** Verify that dependency lockfiles (`package-lock.json`, `poetry.lock`, `Cargo.lock`) are committed and pinned to exact versions, not ranges. Check for lockfile hash verification (`npm ci` vs `npm install`). For critical dependencies, verify SLSA provenance attestations (`cosign verify-attestation`). Flag packages that override dependencies of dependencies (`npm overrides`, `pip --constraint`) without hash verification.
105
+
106
+ **Triage workflow for 400+ finding sets:** When SAST produces hundreds of findings, apply this filter order: (1) deduplicate by rule ID + file path, (2) suppress test/generated/vendor directories, (3) group by CWE category and sort by CRITICAL → HIGH, (4) present the top 10 highest-confidence findings first with full taint paths, (5) provide a count summary by severity for the full set. Never present a raw unsorted 400-item list.
107
+
108
+ ## Edge Cases
109
+
110
+ **Third-party library vulnerabilities**: SAST tools miss transitive dependency CVEs. Supplement with `pip-audit`, `npm audit`, `trivy fs .` for dependency scanning. Report OSV database matches separately.
111
+
112
+ **False positives in test code**: Exclude `tests/`, `spec/`, `__tests__/` directories from severity counts but still report them — test code sometimes gets copied to production. Use `# nosec` (Bandit) or `// nosemgrep` inline to suppress confirmed false positives with justification comments.
113
+
114
+ **Framework-specific sinks**: Generic Semgrep rules miss framework-specific injection points (e.g., Django's `RawSQL()`, Spring's `@Query` with native=true, Rails' `find_by_sql`). Augment with framework-specific rulesets: `semgrep --config=p/django` or `semgrep --config=p/spring`.
115
+
116
+ ## CI Integration
117
+
118
+ ```yaml
119
+ - name: Semgrep SAST
120
+ uses: semgrep/semgrep-action@v1
121
+ with:
122
+ config: >-
123
+ p/owasp-top-ten
124
+ p/secrets
125
+ p/default
126
+ env:
127
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
128
+ ```
129
+
130
+ Block PRs on CRITICAL/HIGH findings. Report MEDIUM/LOW as warnings. Upload SARIF to GitHub Security tab.
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: servicesplitter
3
+ description: Decomposes monolithic applications into microservices using DDD bounded contexts, event storming, and the strangler fig pattern. Use when asked to split a monolith, design microservice boundaries, define service contracts, or implement saga/circuit breaker patterns.
4
+ ---
5
+
6
+ # ServiceSplitter
7
+
8
+ ## Overview
9
+
10
+ Guides microservice decomposition using Domain-Driven Design (DDD) bounded contexts, event storming workshops, and incremental extraction via the strangler fig pattern. Produces service boundary maps, API contracts, event schemas, and resilience patterns (sagas, circuit breakers) — grounded in concrete architecture decisions rather than abstract principles.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Domain Discovery via Event Storming
15
+
16
+ Before drawing service boundaries, map the domain:
17
+
18
+ 1. **Big Picture Event Storming**: List all domain events (past tense, orange stickies) across the full system: `OrderPlaced`, `PaymentProcessed`, `InventoryReserved`, `ShipmentDispatched`.
19
+ 2. **Identify commands and actors**: What triggers each event? Who initiates it?
20
+ 3. **Find aggregates**: Group events that share a consistency boundary (transactional consistency requirement).
21
+ 4. **Spot pivot events**: Events that cross team/subdomain boundaries are natural seams for service cuts.
22
+ 5. **Define bounded contexts**: Each context has its own ubiquitous language. The same word means different things in different contexts (e.g., "Customer" in Sales vs. Support vs. Billing).
23
+
24
+ Output: Context map diagram showing bounded contexts and their relationships (Partnership, Customer-Supplier, Conformist, Anti-Corruption Layer, Open Host Service).
25
+
26
+ ### 2. Service Boundary Identification
27
+
28
+ Apply these heuristics to validate candidate boundaries:
29
+
30
+ | Criterion | Good Boundary Signal |
31
+ |-----------|---------------------|
32
+ | Business capability | Service owns one cohesive business capability end-to-end |
33
+ | Data ownership | Service is the single writer for its data; no direct DB sharing |
34
+ | Change frequency | Service deploys independently without coordinating other teams |
35
+ | Team alignment | Matches Conway's Law — one team owns one service |
36
+ | Transaction boundary | Avoids distributed transactions; uses eventual consistency |
37
+
38
+ Red flags: two services that always deploy together, services that call each other synchronously in a chain deeper than 2 hops, shared databases.
39
+
40
+ ### 3. Strangler Fig Extraction Pattern
41
+
42
+ For incremental extraction from a monolith:
43
+
44
+ 1. **Identify the seam**: Pick a bounded context with clear in/out HTTP or event boundaries.
45
+ 2. **Route at the edge**: Place an API gateway or reverse proxy (Nginx, AWS API Gateway, Kong) in front of the monolith. All traffic still flows through.
46
+ 3. **Implement the new service**: Build the extracted service in its own repo/deployment unit with its own database.
47
+ 4. **Feature flag traffic routing**: Gradually route traffic to the new service (1% → 10% → 100%) using feature flags or weighted routing rules.
48
+ 5. **Delete the monolith code**: Only after the new service handles 100% of traffic and is stable. Remove the dead code path from the monolith.
49
+ 6. **Repeat**: Move to the next bounded context.
50
+
51
+ Never do a Big Bang rewrite. Extract one context at a time.
52
+
53
+ ### 4. API Contracts
54
+
55
+ Define contracts before implementation using OpenAPI 3.1 or AsyncAPI 2.x:
56
+
57
+ **Synchronous (REST/gRPC)**:
58
+ ```yaml
59
+ # openapi: 3.1.0
60
+ paths:
61
+ /orders/{orderId}:
62
+ get:
63
+ operationId: getOrder
64
+ parameters:
65
+ - name: orderId
66
+ in: path
67
+ required: true
68
+ schema: { type: string, format: uuid }
69
+ responses:
70
+ '200':
71
+ content:
72
+ application/json:
73
+ schema: { $ref: '#/components/schemas/Order' }
74
+ '404':
75
+ content:
76
+ application/json:
77
+ schema: { $ref: '#/components/schemas/ProblemDetail' }
78
+ ```
79
+
80
+ **Asynchronous (events)**:
81
+ Use AsyncAPI to document event schemas. Publish Avro or JSON Schema to a schema registry (Confluent Schema Registry, AWS Glue Schema Registry) for schema evolution governance.
82
+
83
+ Contract testing: use **Pact** (consumer-driven contract tests) to verify service contracts in CI without running the full stack.
84
+
85
+ ### 5. Saga Pattern for Distributed Transactions
86
+
87
+ Use sagas for multi-service business transactions that span consistency boundaries.
88
+
89
+ **Choreography saga** (event-driven, no central coordinator):
90
+ - Each service listens for events and publishes compensating events on failure.
91
+ - Simple for 2–3 services. Difficult to debug as complexity grows.
92
+ - Use Kafka or RabbitMQ as the event bus.
93
+
94
+ **Orchestration saga** (central coordinator, recommended for complex flows):
95
+ - Use **Temporal** (`io.temporal.workflow`) or **AWS Step Functions** as the orchestrator.
96
+ - Coordinator calls services and handles compensation:
97
+
98
+ ```python
99
+ # Temporal workflow example
100
+ @workflow.defn
101
+ class OrderFulfillmentWorkflow:
102
+ @workflow.run
103
+ async def run(self, order_id: str) -> str:
104
+ try:
105
+ await workflow.execute_activity(reserve_inventory, order_id)
106
+ await workflow.execute_activity(charge_payment, order_id)
107
+ await workflow.execute_activity(ship_order, order_id)
108
+ except ActivityError:
109
+ await workflow.execute_activity(cancel_inventory_reservation, order_id)
110
+ await workflow.execute_activity(refund_payment, order_id)
111
+ raise
112
+ ```
113
+
114
+ Each activity must be **idempotent** — implement idempotency keys using a UUID stored in the DB with a unique constraint.
115
+
116
+ ### 6. Circuit Breakers and Resilience
117
+
118
+ Implement circuit breakers on all synchronous inter-service calls:
119
+
120
+ - **Resilience4j** (Java): `@CircuitBreaker(name = "inventoryService", fallbackMethod = "fallback")`
121
+ - **resilience4j-js** or **Polly** (.NET) for other stacks
122
+ - **Istio** service mesh: configure circuit breaking at the infrastructure level via `DestinationRule`
123
+
124
+ Circuit breaker states: CLOSED (normal) → OPEN (failing, reject calls) → HALF_OPEN (probe recovery).
125
+ Configure: `failureRateThreshold=50`, `waitDurationInOpenState=30s`, `slidingWindowSize=10`.
126
+
127
+ Add **bulkheads** (thread pool isolation) to prevent one slow downstream from exhausting shared thread pools.
128
+
129
+ ### 7. Output Artifacts
130
+
131
+ Produce:
132
+ 1. **Context map** (Mermaid diagram): bounded contexts with relationship types.
133
+ 2. **Service decomposition table**: service name, owned capabilities, owned data, APIs exposed, events published/consumed.
134
+ 3. **Strangler fig migration plan**: ordered list of extraction phases with rollback strategy per phase.
135
+ 4. **API contracts**: OpenAPI stubs for synchronous APIs, AsyncAPI for event schemas.
136
+ 5. **Saga design**: sequence diagram showing happy path and compensation flows.
137
+ 6. **ADR (Architecture Decision Record)**: document the decomposition rationale and rejected alternatives.
138
+
139
+ ## Additional Patterns
140
+
141
+ **Network latency cost of extraction:** Each synchronous inter-service call adds 1–10ms of network overhead. After extracting a service, profile call chains: if ServiceA calls ServiceB synchronously on every request, co-locate them or introduce an async messaging pattern (publish event, consume asynchronously). Cache stable reference data (product catalog, user profile) in the calling service with a short TTL to eliminate round trips for read-heavy paths.
142
+
143
+ **Event schema backward/forward compatibility:** Follow these rules for Avro/JSON Schema event evolution: (1) adding optional fields is backward compatible — consumers that don't know the field ignore it; (2) removing or renaming fields is breaking — use a deprecation period with both old and new field present; (3) changing a field's type is always breaking. Register all schemas in a schema registry and enforce compatibility mode (`BACKWARD` or `FULL`) in CI before merging schema changes.
144
+
145
+ **God table physical splitting:** When a single table serves multiple bounded contexts (e.g., a `users` table with columns from Auth, Profile, Billing, and Analytics), split it physically by creating new tables per context with the same primary key, backfilling data, and then migrating reads/writes service by service using the strangler fig pattern. Use database views during transition to avoid a flag day. Do not split without first confirming each context's column set via query log analysis.
146
+
147
+ ## Edge Cases
148
+
149
+ **Shared data without clear ownership**: When multiple services need the same data (e.g., product catalog), designate one service as the system of record and expose a read API or publish events. Never allow two services to write to the same table. Use the CQRS pattern to maintain read-optimized projections in downstream services.
150
+
151
+ **Distributed transactions you cannot avoid**: If strong consistency is truly required (e.g., financial double-entry bookkeeping), do not split those aggregates across services. Keep them in the same service behind a single ACID transaction. Distributed saga compensation is eventually consistent — not a substitute for ACID where correctness requires it.
152
+
153
+ **Service mesh vs. library-based resilience**: Istio/Linkerd handle circuit breaking and retries transparently but add operational complexity. For teams new to microservices, start with library-based resilience (Resilience4j, Polly) and migrate to a service mesh only when the per-service configuration overhead becomes prohibitive.