forgecraft-mcp 1.2.0 → 1.3.2

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 (136) hide show
  1. package/README.md +525 -525
  2. package/dist/cli/help.js +44 -44
  3. package/dist/registry/renderer-skeletons.js +92 -92
  4. package/dist/shared/gs-score-logger.js +6 -6
  5. package/dist/tools/add-module.js +123 -123
  6. package/dist/tools/advice-registry.js +18 -18
  7. package/dist/tools/check-cascade-report.js +64 -64
  8. package/dist/tools/configure-mcp.d.ts +3 -0
  9. package/dist/tools/configure-mcp.d.ts.map +1 -1
  10. package/dist/tools/configure-mcp.js +10 -0
  11. package/dist/tools/configure-mcp.js.map +1 -1
  12. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  13. package/dist/tools/forgecraft-dispatch.js +3 -0
  14. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  15. package/dist/tools/forgecraft-schema-params.d.ts +9 -0
  16. package/dist/tools/forgecraft-schema-params.d.ts.map +1 -1
  17. package/dist/tools/forgecraft-schema-params.js +21 -0
  18. package/dist/tools/forgecraft-schema-params.js.map +1 -1
  19. package/dist/tools/forgecraft-schema.d.ts +9 -0
  20. package/dist/tools/forgecraft-schema.d.ts.map +1 -1
  21. package/dist/tools/refresh-output.js +14 -14
  22. package/dist/tools/scaffold-spec-stubs.js +115 -115
  23. package/dist/tools/scaffold-templates.js +62 -62
  24. package/dist/tools/setup-artifact-writers.d.ts +30 -0
  25. package/dist/tools/setup-artifact-writers.d.ts.map +1 -1
  26. package/dist/tools/setup-artifact-writers.js +120 -8
  27. package/dist/tools/setup-artifact-writers.js.map +1 -1
  28. package/dist/tools/setup-phase1.d.ts +3 -0
  29. package/dist/tools/setup-phase1.d.ts.map +1 -1
  30. package/dist/tools/setup-phase1.js +79 -35
  31. package/dist/tools/setup-phase1.js.map +1 -1
  32. package/dist/tools/setup-phase2.d.ts +2 -0
  33. package/dist/tools/setup-phase2.d.ts.map +1 -1
  34. package/dist/tools/setup-phase2.js +10 -1
  35. package/dist/tools/setup-phase2.js.map +1 -1
  36. package/dist/tools/setup-project.d.ts +18 -0
  37. package/dist/tools/setup-project.d.ts.map +1 -1
  38. package/dist/tools/setup-project.js +77 -1
  39. package/dist/tools/setup-project.js.map +1 -1
  40. package/dist/tools/spec-parser-tags.d.ts +9 -0
  41. package/dist/tools/spec-parser-tags.d.ts.map +1 -1
  42. package/dist/tools/spec-parser-tags.js +92 -0
  43. package/dist/tools/spec-parser-tags.js.map +1 -1
  44. package/package.json +89 -86
  45. package/templates/analytics/instructions.yaml +37 -37
  46. package/templates/analytics/mcp-servers.yaml +11 -11
  47. package/templates/analytics/structure.yaml +25 -25
  48. package/templates/api/instructions.yaml +231 -231
  49. package/templates/api/mcp-servers.yaml +22 -13
  50. package/templates/api/nfr.yaml +23 -23
  51. package/templates/api/review.yaml +103 -103
  52. package/templates/api/structure.yaml +34 -34
  53. package/templates/api/verification.yaml +132 -132
  54. package/templates/cli/instructions.yaml +31 -31
  55. package/templates/cli/mcp-servers.yaml +11 -11
  56. package/templates/cli/review.yaml +53 -53
  57. package/templates/cli/structure.yaml +16 -16
  58. package/templates/data-lineage/instructions.yaml +28 -28
  59. package/templates/data-lineage/mcp-servers.yaml +22 -22
  60. package/templates/data-pipeline/instructions.yaml +84 -84
  61. package/templates/data-pipeline/mcp-servers.yaml +13 -13
  62. package/templates/data-pipeline/nfr.yaml +39 -39
  63. package/templates/data-pipeline/structure.yaml +23 -23
  64. package/templates/fintech/hooks.yaml +55 -55
  65. package/templates/fintech/instructions.yaml +112 -112
  66. package/templates/fintech/mcp-servers.yaml +13 -13
  67. package/templates/fintech/nfr.yaml +46 -46
  68. package/templates/fintech/playbook.yaml +210 -210
  69. package/templates/fintech/verification.yaml +239 -239
  70. package/templates/game/instructions.yaml +289 -289
  71. package/templates/game/mcp-servers.yaml +38 -38
  72. package/templates/game/nfr.yaml +64 -64
  73. package/templates/game/playbook.yaml +214 -214
  74. package/templates/game/review.yaml +97 -97
  75. package/templates/game/structure.yaml +67 -67
  76. package/templates/game/verification.yaml +174 -174
  77. package/templates/healthcare/instructions.yaml +42 -42
  78. package/templates/healthcare/mcp-servers.yaml +13 -13
  79. package/templates/healthcare/nfr.yaml +47 -47
  80. package/templates/hipaa/instructions.yaml +41 -41
  81. package/templates/hipaa/mcp-servers.yaml +13 -13
  82. package/templates/infra/instructions.yaml +104 -104
  83. package/templates/infra/mcp-servers.yaml +20 -20
  84. package/templates/infra/nfr.yaml +46 -46
  85. package/templates/infra/review.yaml +65 -65
  86. package/templates/infra/structure.yaml +25 -25
  87. package/templates/library/instructions.yaml +36 -36
  88. package/templates/library/mcp-servers.yaml +20 -20
  89. package/templates/library/review.yaml +56 -56
  90. package/templates/library/structure.yaml +19 -19
  91. package/templates/medallion-architecture/instructions.yaml +41 -41
  92. package/templates/medallion-architecture/mcp-servers.yaml +22 -22
  93. package/templates/ml/instructions.yaml +85 -85
  94. package/templates/ml/mcp-servers.yaml +11 -11
  95. package/templates/ml/nfr.yaml +39 -39
  96. package/templates/ml/structure.yaml +25 -25
  97. package/templates/ml/verification.yaml +156 -156
  98. package/templates/mobile/instructions.yaml +44 -44
  99. package/templates/mobile/mcp-servers.yaml +11 -11
  100. package/templates/mobile/nfr.yaml +49 -49
  101. package/templates/mobile/structure.yaml +27 -27
  102. package/templates/mobile/verification.yaml +121 -121
  103. package/templates/observability-xray/instructions.yaml +40 -40
  104. package/templates/observability-xray/mcp-servers.yaml +15 -15
  105. package/templates/realtime/instructions.yaml +42 -42
  106. package/templates/realtime/mcp-servers.yaml +13 -13
  107. package/templates/soc2/instructions.yaml +41 -41
  108. package/templates/soc2/mcp-servers.yaml +24 -24
  109. package/templates/social/instructions.yaml +43 -43
  110. package/templates/social/mcp-servers.yaml +24 -24
  111. package/templates/state-machine/instructions.yaml +42 -42
  112. package/templates/state-machine/mcp-servers.yaml +11 -11
  113. package/templates/tools-registry.yaml +164 -164
  114. package/templates/universal/hooks.yaml +531 -531
  115. package/templates/universal/instructions.yaml +1692 -1692
  116. package/templates/universal/mcp-servers.yaml +50 -50
  117. package/templates/universal/nfr.yaml +197 -197
  118. package/templates/universal/reference.yaml +326 -326
  119. package/templates/universal/review.yaml +204 -204
  120. package/templates/universal/skills.yaml +262 -262
  121. package/templates/universal/structure.yaml +67 -67
  122. package/templates/universal/verification.yaml +416 -416
  123. package/templates/web-react/hooks.yaml +44 -44
  124. package/templates/web-react/instructions.yaml +207 -207
  125. package/templates/web-react/mcp-servers.yaml +20 -20
  126. package/templates/web-react/nfr.yaml +27 -27
  127. package/templates/web-react/review.yaml +94 -94
  128. package/templates/web-react/structure.yaml +46 -46
  129. package/templates/web-react/verification.yaml +126 -126
  130. package/templates/web-static/instructions.yaml +115 -115
  131. package/templates/web-static/mcp-servers.yaml +20 -20
  132. package/templates/web3/instructions.yaml +44 -44
  133. package/templates/web3/mcp-servers.yaml +11 -11
  134. package/templates/web3/verification.yaml +159 -159
  135. package/templates/zero-trust/instructions.yaml +41 -41
  136. package/templates/zero-trust/mcp-servers.yaml +15 -15
@@ -1,115 +1,115 @@
1
- tag: WEB-STATIC
2
- section: instructions
3
- blocks:
4
- - id: static-site-architecture
5
- tier: recommended
6
- title: "Static Site Architecture"
7
- content: |
8
- ## Static Site & Jamstack Patterns
9
-
10
- - Use Static Site Generation (SSG) as the default rendering strategy; reserve SSR or ISR only for pages requiring dynamic data at request time.
11
- - Pre-render all content pages at build time. Ensure the build pipeline fails fast on broken links, missing assets, or template errors.
12
- - Separate content from presentation: store structured content in Markdown, MDX, or a headless CMS, and consume it via build-time data fetching.
13
- - Implement incremental builds where supported to keep build times under 60 seconds for content-heavy sites.
14
- - Use content hashing for all emitted assets (JS, CSS, images) to enable aggressive, immutable caching (`Cache-Control: public, max-age=31536000, immutable`).
15
- - Serve the site behind a CDN. Configure cache invalidation on deploy so users never see stale HTML entry points.
16
- - Generate a `sitemap.xml` and `robots.txt` at build time. Include canonical URLs and Open Graph meta tags on every page.
17
- - Keep JavaScript payload minimal. Audit bundle size on every PR; set a performance budget (e.g., < 100 KB compressed JS for the critical path).
18
-
19
- - id: asset-optimization
20
- tier: recommended
21
- title: "Asset Optimization"
22
- content: |
23
- ## Asset Optimization & Performance
24
-
25
- - Serve images in modern formats (WebP/AVIF) with `<picture>` fallbacks. Use responsive `srcset` and `sizes` attributes to deliver appropriately sized images.
26
- - Inline critical CSS for above-the-fold content and defer non-critical stylesheets. Avoid render-blocking resources.
27
- - Enable Brotli or gzip compression on the CDN/server for all text-based assets (HTML, CSS, JS, SVG, JSON).
28
- - Lazy-load below-the-fold images and iframes using `loading="lazy"` or Intersection Observer.
29
- - Preload key resources (`<link rel="preload">`) such as fonts and hero images. Use `font-display: swap` to prevent FOIT.
30
- - Minimize third-party scripts. Load analytics and tracking asynchronously and after the main content is interactive.
31
- - Run Lighthouse CI in the build pipeline; fail the build if performance score drops below the agreed threshold (e.g., 90).
32
-
33
- - id: html-css-best-practices
34
- tier: recommended
35
- title: "HTML & CSS Best Practices"
36
- content: |
37
- ## HTML & CSS Quality Standards
38
-
39
- - Write semantic HTML5 markup. Use `<header>`, `<nav>`, `<main>`, `<article>`, `<section>`, and `<footer>` to convey document structure.
40
- - Ensure all pages pass WCAG 2.1 AA. Provide alt text for images, proper heading hierarchy, sufficient color contrast, and keyboard navigability.
41
- - Use CSS custom properties (variables) for theming. Maintain a design-token file as the single source of truth for colors, spacing, and typography.
42
- - Prefer utility-first or modular CSS methodologies (e.g., Tailwind, CSS Modules) to avoid specificity conflicts and dead CSS accumulation.
43
- - Validate HTML output with the W3C validator in CI. Fix all errors; treat warnings as errors in new code.
44
- - Support dark mode via `prefers-color-scheme` media query or a user-togglable theme that persists in `localStorage`.
45
-
46
- - id: static-deployment
47
- tier: recommended
48
- title: "Static Site Deployment"
49
- content: |
50
- ## Static Site Deployment
51
-
52
- ### Platforms
53
- - **Netlify**: Git-push deploy, instant rollbacks, form handling, edge functions, split testing.
54
- Free tier generous for static sites. Build plugins for Lighthouse, broken link detection.
55
- - **Vercel**: Zero-config for Next.js/Astro/SvelteKit. Preview deployments per PR.
56
- - **Cloudflare Pages**: Unlimited bandwidth, global edge network, Pages Functions for dynamic routes.
57
- - **GitHub Pages**: Free for open-source. Limited (no server functions, no redirects file natively).
58
- Suitable for docs sites and project landing pages only.
59
- - **AWS S3 + CloudFront**: Maximum control, lowest cost at scale. Use `aws-cdk` or Terraform
60
- to define the stack: S3 bucket (private) → CloudFront distribution → Route53 DNS → ACM cert.
61
-
62
- ### Build Pipeline
63
- - Build locally mirrors CI exactly (same Node version, same env vars). Use `.nvmrc` or `.node-version`.
64
- - Build output is a static directory (`dist/`, `out/`, `public/`). No server process.
65
- - Atomic deploys: new version fully uploaded before traffic switches. No partial states.
66
- - Rollback = redeploy previous build artifact. Must complete in < 30 seconds.
67
-
68
- ### Cache Strategy
69
- - HTML: `Cache-Control: public, max-age=300, stale-while-revalidate=86400`.
70
- Short-lived so deploys take effect quickly.
71
- - Hashed assets (JS, CSS, images): `Cache-Control: public, max-age=31536000, immutable`.
72
- Filename changes on content change — cache forever.
73
- - Invalidate CDN cache on deploy (automatic on Netlify/Vercel/CF Pages; manual on CloudFront).
74
-
75
- - id: web-static-smoke-testing
76
- tier: recommended
77
- title: "Static Site Smoke Testing (Post-Deploy)"
78
- content: |
79
- ## Static Site Smoke Testing
80
-
81
- ### Required: Playwright Full Browser
82
- Tag all smoke tests `@smoke` for isolated execution:
83
- ```
84
- npx playwright test --config playwright.smoke.config.ts --grep @smoke
85
- ```
86
-
87
- Minimum smoke suite:
88
- - **Key pages load**: home + primary section pages render, no console errors, title present
89
- - **No broken assets**: no 404 network requests (images, JS, CSS)
90
- - **404 handling**: non-existent path returns 404, custom error page renders (not browser default)
91
- - **HTTPS redirect**: `http://` redirects to `https://` (if applicable)
92
-
93
- ```typescript
94
- // tests/smoke/site.smoke.ts
95
- import { test, expect } from '@playwright/test';
96
-
97
- const KEY_PAGES = ['/', '/about', '/contact'];
98
-
99
- for (const path of KEY_PAGES) {
100
- test(`@smoke ${path} loads without broken assets`, async ({ page }) => {
101
- const failed: string[] = [];
102
- page.on('requestfailed', r => failed.push(r.url()));
103
- page.on('response', r => { if (r.status() === 404) failed.push(r.url()); });
104
- await page.goto(path);
105
- await expect(page).toHaveTitle(/.+/);
106
- expect(failed).toHaveLength(0);
107
- });
108
- }
109
-
110
- test('@smoke 404 renders custom page', async ({ page }) => {
111
- const res = await page.goto('/this-path-does-not-exist-smoke-xyz');
112
- expect(res?.status()).toBe(404);
113
- await expect(page.locator('body')).not.toBeEmpty();
114
- });
115
- ```
1
+ tag: WEB-STATIC
2
+ section: instructions
3
+ blocks:
4
+ - id: static-site-architecture
5
+ tier: recommended
6
+ title: "Static Site Architecture"
7
+ content: |
8
+ ## Static Site & Jamstack Patterns
9
+
10
+ - Use Static Site Generation (SSG) as the default rendering strategy; reserve SSR or ISR only for pages requiring dynamic data at request time.
11
+ - Pre-render all content pages at build time. Ensure the build pipeline fails fast on broken links, missing assets, or template errors.
12
+ - Separate content from presentation: store structured content in Markdown, MDX, or a headless CMS, and consume it via build-time data fetching.
13
+ - Implement incremental builds where supported to keep build times under 60 seconds for content-heavy sites.
14
+ - Use content hashing for all emitted assets (JS, CSS, images) to enable aggressive, immutable caching (`Cache-Control: public, max-age=31536000, immutable`).
15
+ - Serve the site behind a CDN. Configure cache invalidation on deploy so users never see stale HTML entry points.
16
+ - Generate a `sitemap.xml` and `robots.txt` at build time. Include canonical URLs and Open Graph meta tags on every page.
17
+ - Keep JavaScript payload minimal. Audit bundle size on every PR; set a performance budget (e.g., < 100 KB compressed JS for the critical path).
18
+
19
+ - id: asset-optimization
20
+ tier: recommended
21
+ title: "Asset Optimization"
22
+ content: |
23
+ ## Asset Optimization & Performance
24
+
25
+ - Serve images in modern formats (WebP/AVIF) with `<picture>` fallbacks. Use responsive `srcset` and `sizes` attributes to deliver appropriately sized images.
26
+ - Inline critical CSS for above-the-fold content and defer non-critical stylesheets. Avoid render-blocking resources.
27
+ - Enable Brotli or gzip compression on the CDN/server for all text-based assets (HTML, CSS, JS, SVG, JSON).
28
+ - Lazy-load below-the-fold images and iframes using `loading="lazy"` or Intersection Observer.
29
+ - Preload key resources (`<link rel="preload">`) such as fonts and hero images. Use `font-display: swap` to prevent FOIT.
30
+ - Minimize third-party scripts. Load analytics and tracking asynchronously and after the main content is interactive.
31
+ - Run Lighthouse CI in the build pipeline; fail the build if performance score drops below the agreed threshold (e.g., 90).
32
+
33
+ - id: html-css-best-practices
34
+ tier: recommended
35
+ title: "HTML & CSS Best Practices"
36
+ content: |
37
+ ## HTML & CSS Quality Standards
38
+
39
+ - Write semantic HTML5 markup. Use `<header>`, `<nav>`, `<main>`, `<article>`, `<section>`, and `<footer>` to convey document structure.
40
+ - Ensure all pages pass WCAG 2.1 AA. Provide alt text for images, proper heading hierarchy, sufficient color contrast, and keyboard navigability.
41
+ - Use CSS custom properties (variables) for theming. Maintain a design-token file as the single source of truth for colors, spacing, and typography.
42
+ - Prefer utility-first or modular CSS methodologies (e.g., Tailwind, CSS Modules) to avoid specificity conflicts and dead CSS accumulation.
43
+ - Validate HTML output with the W3C validator in CI. Fix all errors; treat warnings as errors in new code.
44
+ - Support dark mode via `prefers-color-scheme` media query or a user-togglable theme that persists in `localStorage`.
45
+
46
+ - id: static-deployment
47
+ tier: recommended
48
+ title: "Static Site Deployment"
49
+ content: |
50
+ ## Static Site Deployment
51
+
52
+ ### Platforms
53
+ - **Netlify**: Git-push deploy, instant rollbacks, form handling, edge functions, split testing.
54
+ Free tier generous for static sites. Build plugins for Lighthouse, broken link detection.
55
+ - **Vercel**: Zero-config for Next.js/Astro/SvelteKit. Preview deployments per PR.
56
+ - **Cloudflare Pages**: Unlimited bandwidth, global edge network, Pages Functions for dynamic routes.
57
+ - **GitHub Pages**: Free for open-source. Limited (no server functions, no redirects file natively).
58
+ Suitable for docs sites and project landing pages only.
59
+ - **AWS S3 + CloudFront**: Maximum control, lowest cost at scale. Use `aws-cdk` or Terraform
60
+ to define the stack: S3 bucket (private) → CloudFront distribution → Route53 DNS → ACM cert.
61
+
62
+ ### Build Pipeline
63
+ - Build locally mirrors CI exactly (same Node version, same env vars). Use `.nvmrc` or `.node-version`.
64
+ - Build output is a static directory (`dist/`, `out/`, `public/`). No server process.
65
+ - Atomic deploys: new version fully uploaded before traffic switches. No partial states.
66
+ - Rollback = redeploy previous build artifact. Must complete in < 30 seconds.
67
+
68
+ ### Cache Strategy
69
+ - HTML: `Cache-Control: public, max-age=300, stale-while-revalidate=86400`.
70
+ Short-lived so deploys take effect quickly.
71
+ - Hashed assets (JS, CSS, images): `Cache-Control: public, max-age=31536000, immutable`.
72
+ Filename changes on content change — cache forever.
73
+ - Invalidate CDN cache on deploy (automatic on Netlify/Vercel/CF Pages; manual on CloudFront).
74
+
75
+ - id: web-static-smoke-testing
76
+ tier: recommended
77
+ title: "Static Site Smoke Testing (Post-Deploy)"
78
+ content: |
79
+ ## Static Site Smoke Testing
80
+
81
+ ### Required: Playwright Full Browser
82
+ Tag all smoke tests `@smoke` for isolated execution:
83
+ ```
84
+ npx playwright test --config playwright.smoke.config.ts --grep @smoke
85
+ ```
86
+
87
+ Minimum smoke suite:
88
+ - **Key pages load**: home + primary section pages render, no console errors, title present
89
+ - **No broken assets**: no 404 network requests (images, JS, CSS)
90
+ - **404 handling**: non-existent path returns 404, custom error page renders (not browser default)
91
+ - **HTTPS redirect**: `http://` redirects to `https://` (if applicable)
92
+
93
+ ```typescript
94
+ // tests/smoke/site.smoke.ts
95
+ import { test, expect } from '@playwright/test';
96
+
97
+ const KEY_PAGES = ['/', '/about', '/contact'];
98
+
99
+ for (const path of KEY_PAGES) {
100
+ test(`@smoke ${path} loads without broken assets`, async ({ page }) => {
101
+ const failed: string[] = [];
102
+ page.on('requestfailed', r => failed.push(r.url()));
103
+ page.on('response', r => { if (r.status() === 404) failed.push(r.url()); });
104
+ await page.goto(path);
105
+ await expect(page).toHaveTitle(/.+/);
106
+ expect(failed).toHaveLength(0);
107
+ });
108
+ }
109
+
110
+ test('@smoke 404 renders custom page', async ({ page }) => {
111
+ const res = await page.goto('/this-path-does-not-exist-smoke-xyz');
112
+ expect(res?.status()).toBe(404);
113
+ await expect(page.locator('body')).not.toBeEmpty();
114
+ });
115
+ ```
@@ -1,20 +1,20 @@
1
- tag: WEB-STATIC
2
- section: mcp-servers
3
- servers:
4
- - name: chrome-devtools
5
- description: "Chrome DevTools integration for debugging, profiling, and network inspection"
6
- command: npx
7
- args: ["-y", "@anthropic/chrome-devtools-mcp@latest"]
8
- tags: [WEB-REACT, WEB-STATIC, ANALYTICS]
9
- category: devtools
10
- tier: recommended
11
- url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp"
12
-
13
- - name: playwright
14
- description: "Browser automation for E2E testing, screenshots, and web scraping"
15
- command: npx
16
- args: ["-y", "@anthropic/mcp-server-playwright"]
17
- tags: [WEB-REACT, WEB-STATIC]
18
- category: testing
19
- tier: recommended
20
- url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-server-playwright"
1
+ tag: WEB-STATIC
2
+ section: mcp-servers
3
+ servers:
4
+ - name: chrome-devtools
5
+ description: "Chrome DevTools integration for debugging, profiling, and network inspection"
6
+ command: npx
7
+ args: ["-y", "@anthropic/chrome-devtools-mcp@latest"]
8
+ tags: [WEB-REACT, WEB-STATIC, ANALYTICS]
9
+ category: devtools
10
+ tier: recommended
11
+ url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp"
12
+
13
+ - name: playwright
14
+ description: "Browser automation for E2E testing, screenshots, and web scraping"
15
+ command: npx
16
+ args: ["-y", "@anthropic/mcp-server-playwright"]
17
+ tags: [WEB-REACT, WEB-STATIC]
18
+ category: testing
19
+ tier: recommended
20
+ url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-server-playwright"
@@ -1,44 +1,44 @@
1
- tag: WEB3
2
- section: instructions
3
- blocks:
4
- - id: smart-contract-patterns
5
- tier: recommended
6
- title: "Smart Contract Design"
7
- content: |
8
- ## Smart Contract Design Patterns
9
-
10
- - Follow the Checks-Effects-Interactions pattern in every state-mutating function: validate inputs, update state, then make external calls. This prevents reentrancy attacks.
11
- - Use the proxy pattern (UUPS or Transparent Proxy) for upgradeable contracts. Separate storage layout from logic, and never change the order of existing storage variables.
12
- - Minimize on-chain storage. Store large data off-chain (IPFS, Arweave) and keep only content hashes on-chain for verification.
13
- - Emit events for every significant state change. Events are the primary mechanism for off-chain indexers and UIs to track contract activity.
14
- - Use OpenZeppelin's audited base contracts for standard functionality (ERC-20, ERC-721, ERC-1155, AccessControl, ReentrancyGuard) rather than writing from scratch.
15
- - Implement access control with role-based patterns. Use multi-sig or timelocks for admin operations to prevent single points of compromise.
16
- - Write comprehensive Solidity NatSpec comments for every public and external function, including `@param`, `@return`, and `@notice` tags.
17
- - Target 100% branch coverage in contract tests. Test edge cases: zero values, max uint values, unauthorized callers, reentrancy attempts, and contract self-destruction scenarios.
18
-
19
- - id: gas-optimization
20
- tier: recommended
21
- title: "Gas Optimization"
22
- content: |
23
- ## Gas Optimization Strategies
24
-
25
- - Pack struct fields by size to minimize storage slots. Group `uint128` pairs, `bool` clusters, and `address` + smaller types into single 32-byte slots.
26
- - Use `calldata` instead of `memory` for read-only function parameters in external functions to avoid unnecessary copying.
27
- - Prefer mappings over arrays for lookups. If iteration is needed, maintain a separate array of keys alongside the mapping.
28
- - Batch operations where possible: multi-transfer, batch minting, and batch approvals reduce per-transaction overhead.
29
- - Use custom errors (`error InsufficientBalance(uint256 available, uint256 required)`) instead of `require` strings to save deployment and runtime gas.
30
- - Cache storage variables in local `memory` or `stack` variables when accessed multiple times within a function.
31
- - Profile gas usage in tests using Hardhat's gas reporter. Set gas budgets per function and fail CI if a change exceeds the budget.
32
-
33
- - id: wallet-offchain
34
- tier: recommended
35
- title: "Wallet Integration & Off-Chain Patterns"
36
- content: |
37
- ## Wallet Integration & Off-Chain Architecture
38
-
39
- - Support multiple wallet providers (MetaMask, WalletConnect, Coinbase Wallet) via a unified connector abstraction. Never hard-code a single provider.
40
- - Handle chain switching and network mismatch gracefully. Prompt users to switch networks and display clear error messages for unsupported chains.
41
- - Use EIP-712 typed structured data for off-chain signature requests so users can read and understand what they are signing.
42
- - Implement an off-chain indexer (The Graph, custom) to serve query-heavy read operations. Never query the blockchain directly from the frontend for list or aggregate views.
43
- - Design for L2 and multi-chain: abstract chain-specific logic behind an interface so the application can deploy to new chains without rewriting business logic.
44
- - Validate all inputs on-chain even if they were validated off-chain. Off-chain validation is a UX convenience; on-chain validation is the security boundary.
1
+ tag: WEB3
2
+ section: instructions
3
+ blocks:
4
+ - id: smart-contract-patterns
5
+ tier: recommended
6
+ title: "Smart Contract Design"
7
+ content: |
8
+ ## Smart Contract Design Patterns
9
+
10
+ - Follow the Checks-Effects-Interactions pattern in every state-mutating function: validate inputs, update state, then make external calls. This prevents reentrancy attacks.
11
+ - Use the proxy pattern (UUPS or Transparent Proxy) for upgradeable contracts. Separate storage layout from logic, and never change the order of existing storage variables.
12
+ - Minimize on-chain storage. Store large data off-chain (IPFS, Arweave) and keep only content hashes on-chain for verification.
13
+ - Emit events for every significant state change. Events are the primary mechanism for off-chain indexers and UIs to track contract activity.
14
+ - Use OpenZeppelin's audited base contracts for standard functionality (ERC-20, ERC-721, ERC-1155, AccessControl, ReentrancyGuard) rather than writing from scratch.
15
+ - Implement access control with role-based patterns. Use multi-sig or timelocks for admin operations to prevent single points of compromise.
16
+ - Write comprehensive Solidity NatSpec comments for every public and external function, including `@param`, `@return`, and `@notice` tags.
17
+ - Target 100% branch coverage in contract tests. Test edge cases: zero values, max uint values, unauthorized callers, reentrancy attempts, and contract self-destruction scenarios.
18
+
19
+ - id: gas-optimization
20
+ tier: recommended
21
+ title: "Gas Optimization"
22
+ content: |
23
+ ## Gas Optimization Strategies
24
+
25
+ - Pack struct fields by size to minimize storage slots. Group `uint128` pairs, `bool` clusters, and `address` + smaller types into single 32-byte slots.
26
+ - Use `calldata` instead of `memory` for read-only function parameters in external functions to avoid unnecessary copying.
27
+ - Prefer mappings over arrays for lookups. If iteration is needed, maintain a separate array of keys alongside the mapping.
28
+ - Batch operations where possible: multi-transfer, batch minting, and batch approvals reduce per-transaction overhead.
29
+ - Use custom errors (`error InsufficientBalance(uint256 available, uint256 required)`) instead of `require` strings to save deployment and runtime gas.
30
+ - Cache storage variables in local `memory` or `stack` variables when accessed multiple times within a function.
31
+ - Profile gas usage in tests using Hardhat's gas reporter. Set gas budgets per function and fail CI if a change exceeds the budget.
32
+
33
+ - id: wallet-offchain
34
+ tier: recommended
35
+ title: "Wallet Integration & Off-Chain Patterns"
36
+ content: |
37
+ ## Wallet Integration & Off-Chain Architecture
38
+
39
+ - Support multiple wallet providers (MetaMask, WalletConnect, Coinbase Wallet) via a unified connector abstraction. Never hard-code a single provider.
40
+ - Handle chain switching and network mismatch gracefully. Prompt users to switch networks and display clear error messages for unsupported chains.
41
+ - Use EIP-712 typed structured data for off-chain signature requests so users can read and understand what they are signing.
42
+ - Implement an off-chain indexer (The Graph, custom) to serve query-heavy read operations. Never query the blockchain directly from the frontend for list or aggregate views.
43
+ - Design for L2 and multi-chain: abstract chain-specific logic behind an interface so the application can deploy to new chains without rewriting business logic.
44
+ - Validate all inputs on-chain even if they were validated off-chain. Off-chain validation is a UX convenience; on-chain validation is the security boundary.
@@ -1,11 +1,11 @@
1
- tag: WEB3
2
- section: mcp-servers
3
- servers:
4
- - name: solidity
5
- description: "Solidity smart contract development — compilation, ABI generation, and deployment helpers"
6
- command: npx
7
- args: ["-y", "mcp-server-solidity"]
8
- tags: [WEB3]
9
- category: devtools
10
- tier: recommended
11
- url: "https://github.com/AIMONGmbH/solidity-mcp-server"
1
+ tag: WEB3
2
+ section: mcp-servers
3
+ servers:
4
+ - name: solidity
5
+ description: "Solidity smart contract development — compilation, ABI generation, and deployment helpers"
6
+ command: npx
7
+ args: ["-y", "mcp-server-solidity"]
8
+ tags: [WEB3]
9
+ category: devtools
10
+ tier: recommended
11
+ url: "https://github.com/AIMONGmbH/solidity-mcp-server"