crucible-mcp 0.5.0__py3-none-any.whl → 1.0.0__py3-none-any.whl

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 (46) hide show
  1. crucible/cli.py +109 -2
  2. crucible/enforcement/bundled/error-handling.yaml +84 -0
  3. crucible/enforcement/bundled/security.yaml +123 -0
  4. crucible/enforcement/bundled/smart-contract.yaml +110 -0
  5. crucible/hooks/claudecode.py +388 -0
  6. crucible/hooks/precommit.py +117 -25
  7. crucible/knowledge/loader.py +186 -0
  8. crucible/knowledge/principles/API_DESIGN.md +176 -0
  9. crucible/knowledge/principles/COMMITS.md +127 -0
  10. crucible/knowledge/principles/DATABASE.md +138 -0
  11. crucible/knowledge/principles/DOCUMENTATION.md +201 -0
  12. crucible/knowledge/principles/ERROR_HANDLING.md +157 -0
  13. crucible/knowledge/principles/FP.md +162 -0
  14. crucible/knowledge/principles/GITIGNORE.md +218 -0
  15. crucible/knowledge/principles/OBSERVABILITY.md +147 -0
  16. crucible/knowledge/principles/PRECOMMIT.md +201 -0
  17. crucible/knowledge/principles/SECURITY.md +136 -0
  18. crucible/knowledge/principles/SMART_CONTRACT.md +153 -0
  19. crucible/knowledge/principles/SYSTEM_DESIGN.md +153 -0
  20. crucible/knowledge/principles/TESTING.md +129 -0
  21. crucible/knowledge/principles/TYPE_SAFETY.md +170 -0
  22. crucible/skills/accessibility-engineer/SKILL.md +71 -0
  23. crucible/skills/backend-engineer/SKILL.md +69 -0
  24. crucible/skills/customer-success/SKILL.md +69 -0
  25. crucible/skills/data-engineer/SKILL.md +70 -0
  26. crucible/skills/devops-engineer/SKILL.md +69 -0
  27. crucible/skills/fde-engineer/SKILL.md +69 -0
  28. crucible/skills/formal-verification/SKILL.md +86 -0
  29. crucible/skills/gas-optimizer/SKILL.md +89 -0
  30. crucible/skills/incident-responder/SKILL.md +91 -0
  31. crucible/skills/mev-researcher/SKILL.md +87 -0
  32. crucible/skills/mobile-engineer/SKILL.md +70 -0
  33. crucible/skills/performance-engineer/SKILL.md +68 -0
  34. crucible/skills/product-engineer/SKILL.md +68 -0
  35. crucible/skills/protocol-architect/SKILL.md +83 -0
  36. crucible/skills/security-engineer/SKILL.md +63 -0
  37. crucible/skills/tech-lead/SKILL.md +92 -0
  38. crucible/skills/uiux-engineer/SKILL.md +70 -0
  39. crucible/skills/web3-engineer/SKILL.md +79 -0
  40. crucible_mcp-1.0.0.dist-info/METADATA +198 -0
  41. crucible_mcp-1.0.0.dist-info/RECORD +66 -0
  42. crucible_mcp-0.5.0.dist-info/METADATA +0 -161
  43. crucible_mcp-0.5.0.dist-info/RECORD +0 -30
  44. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.0.dist-info}/WHEEL +0 -0
  45. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.0.dist-info}/entry_points.txt +0 -0
  46. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: System Design
3
+ description: Architecture patterns, scalability, distributed systems
4
+ triggers: [architecture, system-design, scalability, distributed]
5
+ type: principle
6
+ ---
7
+
8
+ # System Design Principles
9
+
10
+ ---
11
+
12
+ ## Monolith to Microservices
13
+
14
+ ```
15
+ Progression:
16
+ ├── Monolith: One deployable, one database
17
+ ├── Modular monolith: Clear boundaries, could split
18
+ ├── Microservices: Multiple deployables, distributed
19
+
20
+ Indicators to split:
21
+ ├── Teams blocked by shared codebase
22
+ ├── Components have different scaling requirements
23
+ ├── Regulatory isolation required
24
+ └── Deployment coupling causes issues
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Reference Architecture
30
+
31
+ ```
32
+ ┌─────────────────────────────────────────────────┐
33
+ │ Client │
34
+ │ (Web / Mobile / CLI) │
35
+ └─────────────────────┬───────────────────────────┘
36
+
37
+
38
+ ┌─────────────────────────────────────────────────┐
39
+ │ API Layer │
40
+ │ (Next.js API / tRPC / REST) │
41
+ └─────────────────────┬───────────────────────────┘
42
+
43
+ ┌─────────────┼─────────────┐
44
+ ▼ ▼ ▼
45
+ ┌─────────────┐ ┌───────────┐ ┌───────────────┐
46
+ │ Database │ │ Cache │ │ File Storage │
47
+ │ (Postgres) │ │ (Redis) │ │ (S3) │
48
+ └─────────────┘ └───────────┘ └───────────────┘
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Stateless Servers
54
+
55
+ App servers should hold no state.
56
+
57
+ ```
58
+ Stateful patterns (avoid):
59
+ ├── Session stored in server memory
60
+ ├── Uploaded files on local disk
61
+ ├── In-memory cache per instance
62
+ └── Breaks on horizontal scaling
63
+
64
+ Stateless patterns:
65
+ ├── Session in database or JWT
66
+ ├── Files in S3/object storage
67
+ ├── Cache in Redis (shared)
68
+ └── Any server can handle any request
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Scaling
74
+
75
+ ```
76
+ Vertical (scale up):
77
+ ├── Larger server instance
78
+ ├── No code changes required
79
+ └── Simpler to operate
80
+
81
+ Horizontal (scale out):
82
+ ├── Multiple server instances
83
+ ├── Requires stateless design
84
+ └── More complex to operate
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Async Processing
90
+
91
+ ```
92
+ Queue candidates:
93
+ ├── Emails / notifications
94
+ ├── Image processing
95
+ ├── Report generation
96
+ ├── Third-party API calls
97
+ └── Any operation that can fail and retry
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Caching
103
+
104
+ ```
105
+ Good candidates:
106
+ ├── Read-heavy, write-light data
107
+ ├── Expensive to compute
108
+ ├── Infrequent changes
109
+ ├── Stale data acceptable
110
+
111
+ Poor candidates:
112
+ ├── Frequently changing data
113
+ ├── Strong consistency required
114
+ ├── Already fast enough
115
+ ```
116
+
117
+ Invalidation strategies: time-based expiry, event-based invalidation, cache-aside pattern.
118
+
119
+ ---
120
+
121
+ ## Idempotency
122
+
123
+ Operations that can be retried should produce the same result.
124
+
125
+ ```typescript
126
+ // Non-idempotent: double-charge on retry
127
+ stripe.charge(userId, amount);
128
+
129
+ // Idempotent: same result on retry
130
+ stripe.charge(userId, amount, { idempotencyKey });
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Failure Handling
136
+
137
+ ```
138
+ Design assumptions:
139
+ ├── External APIs will fail
140
+ ├── Database latency will spike
141
+ ├── Code has bugs
142
+
143
+ Strategies:
144
+ ├── Timeouts on all external calls
145
+ ├── Retries with exponential backoff
146
+ ├── Circuit breakers
147
+ ├── Graceful degradation
148
+ └── Health checks
149
+ ```
150
+
151
+ ---
152
+
153
+ *Template. Adapt to your needs.*
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: Testing Principles
3
+ description: Test pyramid, unit/integration/e2e, mocking patterns
4
+ triggers: [testing, tests, unit-tests, integration, e2e]
5
+ type: principle
6
+ ---
7
+
8
+ # Testing Principles
9
+
10
+ What to test, how to structure tests, and patterns that work.
11
+
12
+ ---
13
+
14
+ ## The Pyramid
15
+
16
+ ```
17
+ /\ Few E2E (critical paths only)
18
+ / \
19
+ /────\ Some integration (API, DB)
20
+ / \
21
+ /────────\ Many unit tests (fast, pure)
22
+ ```
23
+
24
+ ---
25
+
26
+ ## What to Test
27
+
28
+ ```
29
+ Test:
30
+ ├── Business logic (core package)
31
+ ├── Edge cases
32
+ ├── Regression bugs (write test, then fix)
33
+ ├── Complex calculations
34
+ └── State machines
35
+
36
+ Don't test:
37
+ ├── Framework behavior
38
+ ├── Third-party libraries
39
+ ├── Implementation details
40
+ ├── Things that change constantly (UI specifics)
41
+ └── Obvious code (getters, setters)
42
+ ```
43
+
44
+ ---
45
+
46
+ ## FP Makes Testing Easy
47
+
48
+ Pure functions = same input, same output. No mocking needed.
49
+
50
+ ```typescript
51
+ const calculateFee = (amount: Cents): Cents => {
52
+ return Math.round(amount * 0.01) as Cents;
53
+ };
54
+
55
+ test('calculates 1% fee', () => {
56
+ expect(calculateFee(1000 as Cents)).toBe(10);
57
+ expect(calculateFee(999 as Cents)).toBe(10);
58
+ expect(calculateFee(100 as Cents)).toBe(1);
59
+ });
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Test Naming
65
+
66
+ ```typescript
67
+ // Vague
68
+ test('it works', () => { ... });
69
+
70
+ // Descriptive
71
+ test('calculateFee rounds up for fractional cents', () => { ... });
72
+ test('returns NOT_FOUND when user does not exist', () => { ... });
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Integration Tests
78
+
79
+ Test real behavior, not mocks.
80
+
81
+ ```typescript
82
+ // Mocking everything
83
+ jest.mock('../database');
84
+ jest.mock('../stripe');
85
+ // What are you even testing?
86
+
87
+ // Test real behavior with test database
88
+ beforeEach(() => db.reset());
89
+ test('creates user in database', async () => {
90
+ await createUser({ email: 'test@example.com' });
91
+ const user = await db.user.findFirst({ where: { email: 'test@example.com' } });
92
+ expect(user).not.toBeNull();
93
+ });
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Property-Based Testing
99
+
100
+ For invariants that should always hold:
101
+
102
+ ```typescript
103
+ import fc from 'fast-check';
104
+
105
+ test('fee is always positive', () => {
106
+ fc.assert(
107
+ fc.property(fc.integer({ min: 1 }), (amount) => {
108
+ return calculateFee(amount as Cents) >= 0;
109
+ })
110
+ );
111
+ });
112
+ ```
113
+
114
+ ---
115
+
116
+ ## The Rule
117
+
118
+ ```
119
+ If you find a bug:
120
+ 1. Write a test that reproduces it
121
+ 2. Watch it fail
122
+ 3. Fix the bug
123
+ 4. Watch it pass
124
+ 5. Never have that bug again
125
+ ```
126
+
127
+ ---
128
+
129
+ *Template. Adapt to your needs.*
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: Type Safety
3
+ description: Type annotations, generics, strict mode, type guards
4
+ triggers: [types, typescript, typing, mypy, type-safety]
5
+ type: principle
6
+ ---
7
+
8
+ # Type Safety Principles
9
+
10
+ Patterns for making invalid states unrepresentable.
11
+
12
+ ---
13
+
14
+ ## No `any`
15
+
16
+ ```typescript
17
+ // any (defeats the purpose of TypeScript)
18
+ const process = (data: any) => { ... }
19
+
20
+ // unknown + narrowing
21
+ const process = (data: unknown) => {
22
+ if (typeof data === 'string') {
23
+ // TypeScript knows it's a string here
24
+ }
25
+ }
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Branded Types
31
+
32
+ Prevent mixing up similar primitives:
33
+
34
+ ```typescript
35
+ // Easy to mix up
36
+ const createTip = (pageId: string, amount: number) => { ... }
37
+ // createTip(tipId, pageId) compiles but is wrong!
38
+
39
+ // Branded types
40
+ type PageId = string & { readonly _brand: 'PageId' };
41
+ type TipId = string & { readonly _brand: 'TipId' };
42
+ type Cents = number & { readonly _brand: 'Cents' };
43
+
44
+ const createTip = (pageId: PageId, amount: Cents) => { ... }
45
+ // createTip(tipId, pageId) → Type error!
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Discriminated Unions
51
+
52
+ Make invalid states unrepresentable:
53
+
54
+ ```typescript
55
+ // Boolean flags (invalid states possible)
56
+ type Response = {
57
+ loading: boolean;
58
+ error: Error | null;
59
+ data: Data | null;
60
+ }
61
+ // What if loading=true AND error is set?
62
+
63
+ // Discriminated union (only valid states)
64
+ type Response =
65
+ | { status: 'loading' }
66
+ | { status: 'error'; error: Error }
67
+ | { status: 'success'; data: Data };
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Zod at Boundaries
73
+
74
+ Validate external data, then trust the types:
75
+
76
+ ```typescript
77
+ import { z } from 'zod';
78
+
79
+ const TipSchema = z.object({
80
+ pageId: z.string().uuid(),
81
+ amountCents: z.number().int().positive().max(100000),
82
+ message: z.string().max(500).optional(),
83
+ });
84
+
85
+ type Tip = z.infer<typeof TipSchema>;
86
+
87
+ // Validate at API boundary
88
+ const handler = (req: Request) => {
89
+ const result = TipSchema.safeParse(req.body);
90
+ if (!result.success) {
91
+ return { error: result.error };
92
+ }
93
+ // result.data is fully typed and validated
94
+ return createTip(result.data);
95
+ };
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Exhaustiveness Checking
101
+
102
+ TypeScript tells you when you miss a case:
103
+
104
+ ```typescript
105
+ type Status = 'pending' | 'active' | 'cancelled';
106
+
107
+ const getLabel = (status: Status): string => {
108
+ switch (status) {
109
+ case 'pending': return 'Pending';
110
+ case 'active': return 'Active';
111
+ // TypeScript error: 'cancelled' not handled
112
+ }
113
+ };
114
+
115
+ // Force exhaustiveness with never
116
+ const assertNever = (x: never): never => {
117
+ throw new Error(`Unexpected: ${x}`);
118
+ };
119
+
120
+ const getLabel = (status: Status): string => {
121
+ switch (status) {
122
+ case 'pending': return 'Pending';
123
+ case 'active': return 'Active';
124
+ case 'cancelled': return 'Cancelled';
125
+ default: return assertNever(status);
126
+ }
127
+ };
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Strict Mode
133
+
134
+ Always enable:
135
+
136
+ ```json
137
+ // tsconfig.json
138
+ {
139
+ "compilerOptions": {
140
+ "strict": true,
141
+ "noUncheckedIndexedAccess": true
142
+ }
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Optional vs Required
149
+
150
+ Be explicit:
151
+
152
+ ```typescript
153
+ // Ambiguous
154
+ interface User {
155
+ name: string;
156
+ email: string;
157
+ phone: string; // Required? Or just always present?
158
+ }
159
+
160
+ // Explicit
161
+ interface User {
162
+ name: string;
163
+ email: string;
164
+ phone?: string; // Optional
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ *Template. Adapt to your needs.*
@@ -0,0 +1,71 @@
1
+ ---
2
+ version: "1.0"
3
+ triggers: [accessibility, a11y, wcag, aria, screen reader, keyboard, frontend, ui]
4
+ always_run_for_domains: [frontend]
5
+ knowledge: [TESTING.md]
6
+ ---
7
+
8
+ # Accessibility Engineer
9
+
10
+ You are reviewing code from an accessibility engineer's perspective. Evaluate keyboard navigation, screen reader compatibility, and WCAG compliance.
11
+
12
+ ## Key Questions
13
+
14
+ Ask yourself these questions about the code:
15
+
16
+ - Can I use this with keyboard only?
17
+ - What does a screen reader announce?
18
+ - Is there sufficient color contrast?
19
+ - Are interactive elements focusable?
20
+ - Is the focus order logical?
21
+ - Are form inputs properly labeled?
22
+
23
+ ## Red Flags
24
+
25
+ Watch for these patterns:
26
+
27
+ - Click handlers on non-interactive elements (div, span)
28
+ - Missing alt text on images
29
+ - Missing form labels (or label not associated with input)
30
+ - Color as the only indicator of state
31
+ - Focus trap without escape
32
+ - Missing skip links on navigation-heavy pages
33
+ - Autoplaying media without controls
34
+ - Time limits without extension options
35
+ - Missing ARIA labels on icon-only buttons
36
+ - Non-semantic HTML (divs everywhere instead of proper elements)
37
+
38
+ ## Before Approving
39
+
40
+ Verify these criteria:
41
+
42
+ - [ ] All interactive elements are keyboard accessible
43
+ - [ ] Focus states are visible
44
+ - [ ] Form inputs have associated labels
45
+ - [ ] Images have appropriate alt text
46
+ - [ ] Color contrast meets WCAG AA (4.5:1 for text)
47
+ - [ ] ARIA attributes are used correctly (if at all)
48
+ - [ ] Semantic HTML elements used appropriately
49
+ - [ ] Error messages are announced to screen readers
50
+
51
+ ## Output Format
52
+
53
+ Structure your review as:
54
+
55
+ ### Accessibility Violations
56
+ Issues that would fail WCAG compliance or block users.
57
+
58
+ ### Usability Concerns
59
+ Things that technically work but create poor experiences.
60
+
61
+ ### Questions for Author
62
+ Questions about intended behavior or user needs.
63
+
64
+ ### Approval Status
65
+ - APPROVE: Meets accessibility standards
66
+ - REQUEST CHANGES: Accessibility issues must be fixed
67
+ - COMMENT: Suggestions for improvement
68
+
69
+ ---
70
+
71
+ *Template. Adapt to your needs.*
@@ -0,0 +1,69 @@
1
+ ---
2
+ version: "1.0"
3
+ triggers: [backend, api, server, database, postgres, mysql, redis, queue, microservice, rest, graphql]
4
+ knowledge: [API_DESIGN.md, DATABASE.md, ERROR_HANDLING.md]
5
+ ---
6
+
7
+ # Backend/Systems Engineer
8
+
9
+ You are reviewing code from a backend engineer's perspective. Your focus is on reliability, scalability, and operational excellence.
10
+
11
+ ## Key Questions
12
+
13
+ Ask yourself these questions about the code:
14
+
15
+ - What happens at 10x load?
16
+ - Is this idempotent?
17
+ - What's the failure mode?
18
+ - Where's the bottleneck?
19
+ - How do we debug this in production?
20
+ - What's the rollback plan?
21
+
22
+ ## Red Flags
23
+
24
+ Watch for these patterns:
25
+
26
+ - N+1 queries (loading related data in loops)
27
+ - Missing database indexes on frequently queried columns
28
+ - No retry logic on network calls
29
+ - Unbounded data fetching (no pagination, no limits)
30
+ - Missing timeouts on external calls
31
+ - Synchronous operations that should be async
32
+ - No circuit breakers on external dependencies
33
+ - Mutable shared state without synchronization
34
+ - Missing connection pooling
35
+
36
+ ## Before Approving
37
+
38
+ Verify these criteria:
39
+
40
+ - [ ] Idempotent where expected (safe to retry)
41
+ - [ ] Timeouts on all external calls
42
+ - [ ] Graceful degradation when dependencies fail
43
+ - [ ] Structured logging with correlation IDs
44
+ - [ ] Load tested if on critical path
45
+ - [ ] Database queries are indexed
46
+ - [ ] Pagination on list endpoints
47
+ - [ ] Connection pools configured appropriately
48
+
49
+ ## Output Format
50
+
51
+ Structure your review as:
52
+
53
+ ### Scalability Concerns
54
+ Issues that will cause problems at higher load.
55
+
56
+ ### Reliability Issues
57
+ Things that could cause outages or data inconsistency.
58
+
59
+ ### Questions for Author
60
+ Questions about design decisions or operational concerns.
61
+
62
+ ### Approval Status
63
+ - APPROVE: Ready for production
64
+ - REQUEST CHANGES: Issues must be addressed
65
+ - COMMENT: Suggestions for improvement
66
+
67
+ ---
68
+
69
+ *Template. Adapt to your needs.*
@@ -0,0 +1,69 @@
1
+ ---
2
+ version: "1.0"
3
+ triggers: [support, documentation, error message, user facing, help, troubleshoot]
4
+ knowledge: [DOCUMENTATION.md, ERROR_HANDLING.md]
5
+ ---
6
+
7
+ # Customer Success Engineer
8
+
9
+ You are reviewing code from a customer success perspective. Your focus is on supportability, clear communication, and reducing support tickets.
10
+
11
+ ## Key Questions
12
+
13
+ Ask yourself these questions about the code:
14
+
15
+ - What's the support ticket going to say?
16
+ - Can customers self-serve this issue?
17
+ - Is the error message actionable?
18
+ - What documentation needs updating?
19
+ - How do we diagnose this remotely?
20
+ - What's the escalation path?
21
+
22
+ ## Red Flags
23
+
24
+ Watch for these patterns:
25
+
26
+ - Generic error messages ("Something went wrong")
27
+ - Technical jargon in user-facing text
28
+ - No error codes for support reference
29
+ - Missing help links or documentation references
30
+ - State that's hard to reproduce for debugging
31
+ - No admin tools for support team
32
+ - Unclear success/failure feedback
33
+ - Missing audit trail for user actions
34
+ - Changes that invalidate existing documentation
35
+
36
+ ## Before Approving
37
+
38
+ Verify these criteria:
39
+
40
+ - [ ] Error messages are user-friendly and actionable
41
+ - [ ] Error codes exist for support reference
42
+ - [ ] Help documentation is linked where appropriate
43
+ - [ ] Admin/support tooling can diagnose issues
44
+ - [ ] User actions have clear success feedback
45
+ - [ ] Changes are reflected in documentation
46
+ - [ ] Support team can reproduce customer state
47
+ - [ ] Escalation path is clear for edge cases
48
+
49
+ ## Output Format
50
+
51
+ Structure your review as:
52
+
53
+ ### Supportability Issues
54
+ Things that will generate support tickets.
55
+
56
+ ### Communication Problems
57
+ Unclear messaging or missing guidance.
58
+
59
+ ### Questions for Author
60
+ Questions about support scenarios or user communication.
61
+
62
+ ### Approval Status
63
+ - APPROVE: Support-ready
64
+ - REQUEST CHANGES: Supportability issues must be fixed
65
+ - COMMENT: Suggestions for better user communication
66
+
67
+ ---
68
+
69
+ *Template. Adapt to your needs.*