claude-code-kit 0.7.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 (209) hide show
  1. claude_code_kit-0.7.0.dist-info/METADATA +384 -0
  2. claude_code_kit-0.7.0.dist-info/RECORD +209 -0
  3. claude_code_kit-0.7.0.dist-info/WHEEL +4 -0
  4. claude_code_kit-0.7.0.dist-info/entry_points.txt +4 -0
  5. claude_code_kit-0.7.0.dist-info/licenses/LICENSE +21 -0
  6. claude_kit/__init__.py +10 -0
  7. claude_kit/__main__.py +8 -0
  8. claude_kit/_payload/agents/acceptance-reviewer.md +60 -0
  9. claude_kit/_payload/agents/auditor.md +76 -0
  10. claude_kit/_payload/agents/dependency-scanner.md +84 -0
  11. claude_kit/_payload/agents/developer.md +187 -0
  12. claude_kit/_payload/agents/devils-advocate.md +62 -0
  13. claude_kit/_payload/agents/devops-engineer.md +134 -0
  14. claude_kit/_payload/agents/e2e-tester.md +152 -0
  15. claude_kit/_payload/agents/em-reviewer.md +105 -0
  16. claude_kit/_payload/agents/incident-responder.md +64 -0
  17. claude_kit/_payload/agents/merge-reviewer.md +194 -0
  18. claude_kit/_payload/agents/observability-engineer.md +94 -0
  19. claude_kit/_payload/agents/orchestrator.md +551 -0
  20. claude_kit/_payload/agents/owasp-reviewer.md +76 -0
  21. claude_kit/_payload/agents/policy-validator.md +63 -0
  22. claude_kit/_payload/agents/pr-raiser.md +138 -0
  23. claude_kit/_payload/agents/risk-classifier.md +50 -0
  24. claude_kit/_payload/agents/sdlc-code-reviewer.md +196 -0
  25. claude_kit/_payload/agents/secret-scanner.md +70 -0
  26. claude_kit/_payload/agents/security-reviewer.md +80 -0
  27. claude_kit/_payload/agents/senior-backend-dev.md +199 -0
  28. claude_kit/_payload/agents/senior-frontend-dev.md +181 -0
  29. claude_kit/_payload/agents/senior-tester.md +206 -0
  30. claude_kit/_payload/agents/spec-doc-writer.md +331 -0
  31. claude_kit/_payload/agents/story-planner.md +56 -0
  32. claude_kit/_payload/agents/technical-architect.md +139 -0
  33. claude_kit/_payload/agents/tester.md +193 -0
  34. claude_kit/_payload/agents/ui-designer.md +73 -0
  35. claude_kit/_payload/agents/unit-tester.md +119 -0
  36. claude_kit/_payload/catalog/mcp.yaml +54 -0
  37. claude_kit/_payload/catalog/org.yaml +145 -0
  38. claude_kit/_payload/catalog/profiles.yaml +96 -0
  39. claude_kit/_payload/catalog/stacks.yaml +96 -0
  40. claude_kit/_payload/commands/init.md +36 -0
  41. claude_kit/_payload/commands/sdlc.md +18 -0
  42. claude_kit/_payload/commands/status.md +20 -0
  43. claude_kit/_payload/hooks/hooks.json +58 -0
  44. claude_kit/_payload/hooks/scripts/audit-log.sh +18 -0
  45. claude_kit/_payload/hooks/scripts/guard-secrets.sh +26 -0
  46. claude_kit/_payload/hooks/scripts/lint-fix.sh +38 -0
  47. claude_kit/_payload/hooks/scripts/load-continuity.sh +32 -0
  48. claude_kit/_payload/hooks/scripts/load-learnings.sh +40 -0
  49. claude_kit/_payload/hooks/scripts/type-check.sh +23 -0
  50. claude_kit/_payload/hooks/scripts/validate-frontmatter.sh +34 -0
  51. claude_kit/_payload/hooks/scripts/validate-settings.sh +21 -0
  52. claude_kit/_payload/hooks/scripts/warn-large-edits.sh +24 -0
  53. claude_kit/_payload/hooks/scripts/warn-missing-tests.sh +24 -0
  54. claude_kit/_payload/hooks/scripts/warn-sensitive-files.sh +30 -0
  55. claude_kit/_payload/hooks/scripts/warn-shared-modules.sh +33 -0
  56. claude_kit/_payload/rules/agent-guardrails.md +83 -0
  57. claude_kit/_payload/rules/agent-memory.md +106 -0
  58. claude_kit/_payload/rules/agent-resilience.md +61 -0
  59. claude_kit/_payload/rules/autonomy-levels.md +30 -0
  60. claude_kit/_payload/rules/code-organization.md +312 -0
  61. claude_kit/_payload/rules/continuity.md +84 -0
  62. claude_kit/_payload/rules/design-patterns.md +422 -0
  63. claude_kit/_payload/rules/devops-observability.md +57 -0
  64. claude_kit/_payload/rules/documentation.md +326 -0
  65. claude_kit/_payload/rules/evals.md +62 -0
  66. claude_kit/_payload/rules/frontend-best-practices.md +157 -0
  67. claude_kit/_payload/rules/goal-setting-and-monitoring.md +72 -0
  68. claude_kit/_payload/rules/human-in-the-loop.md +64 -0
  69. claude_kit/_payload/rules/linting-and-formatting.md +220 -0
  70. claude_kit/_payload/rules/mandatory-workflow.md +309 -0
  71. claude_kit/_payload/rules/model-tiers.md +34 -0
  72. claude_kit/_payload/rules/quality-gates.md +107 -0
  73. claude_kit/_payload/rules/rarv-cycle.md +31 -0
  74. claude_kit/_payload/rules/reasoning-techniques.md +62 -0
  75. claude_kit/_payload/rules/responsive-and-accessibility.md +353 -0
  76. claude_kit/_payload/rules/risk-classification.md +36 -0
  77. claude_kit/_payload/rules/testing.md +417 -0
  78. claude_kit/_payload/rules/tool-design.md +66 -0
  79. claude_kit/_payload/skills/_references/accessibility-checklist.md +160 -0
  80. claude_kit/_payload/skills/_references/orchestration-patterns.md +405 -0
  81. claude_kit/_payload/skills/_references/performance-checklist.md +153 -0
  82. claude_kit/_payload/skills/_references/security-checklist.md +134 -0
  83. claude_kit/_payload/skills/_references/testing-patterns.md +236 -0
  84. claude_kit/_payload/skills/accessibility-review/SKILL.md +56 -0
  85. claude_kit/_payload/skills/api-and-interface-design/SKILL.md +294 -0
  86. claude_kit/_payload/skills/api-integration/SKILL.md +348 -0
  87. claude_kit/_payload/skills/archive-sprint/SKILL.md +31 -0
  88. claude_kit/_payload/skills/backlog/SKILL.md +41 -0
  89. claude_kit/_payload/skills/backlog/item-template.md +20 -0
  90. claude_kit/_payload/skills/browser-testing-with-devtools/SKILL.md +302 -0
  91. claude_kit/_payload/skills/ci-cd-and-automation/SKILL.md +402 -0
  92. claude_kit/_payload/skills/code-review-and-quality/SKILL.md +347 -0
  93. claude_kit/_payload/skills/code-simplification/SKILL.md +331 -0
  94. claude_kit/_payload/skills/component-design/SKILL.md +171 -0
  95. claude_kit/_payload/skills/consolidate-learnings/SKILL.md +55 -0
  96. claude_kit/_payload/skills/context-engineering/SKILL.md +321 -0
  97. claude_kit/_payload/skills/debugging-and-error-recovery/SKILL.md +300 -0
  98. claude_kit/_payload/skills/decision/SKILL.md +46 -0
  99. claude_kit/_payload/skills/decision/adr-template.md +36 -0
  100. claude_kit/_payload/skills/deprecation-and-migration/SKILL.md +207 -0
  101. claude_kit/_payload/skills/documentation-and-adrs/SKILL.md +299 -0
  102. claude_kit/_payload/skills/doubt-driven-development/SKILL.md +243 -0
  103. claude_kit/_payload/skills/execute/SKILL.md +27 -0
  104. claude_kit/_payload/skills/frontend-ui-engineering/SKILL.md +328 -0
  105. claude_kit/_payload/skills/git-workflow-and-versioning/SKILL.md +300 -0
  106. claude_kit/_payload/skills/idea-refine/SKILL.md +178 -0
  107. claude_kit/_payload/skills/idea-refine/examples.md +238 -0
  108. claude_kit/_payload/skills/idea-refine/frameworks.md +99 -0
  109. claude_kit/_payload/skills/idea-refine/refinement-criteria.md +113 -0
  110. claude_kit/_payload/skills/idea-refine/scripts/idea-refine.sh +15 -0
  111. claude_kit/_payload/skills/incident-postmortem/SKILL.md +74 -0
  112. claude_kit/_payload/skills/incremental-implementation/SKILL.md +245 -0
  113. claude_kit/_payload/skills/interview-me/SKILL.md +221 -0
  114. claude_kit/_payload/skills/load-testing/SKILL.md +83 -0
  115. claude_kit/_payload/skills/manual-test/SKILL.md +516 -0
  116. claude_kit/_payload/skills/performance-optimization/SKILL.md +277 -0
  117. claude_kit/_payload/skills/planning-and-task-breakdown/SKILL.md +223 -0
  118. claude_kit/_payload/skills/playwright-verification/SKILL.md +205 -0
  119. claude_kit/_payload/skills/refresh-docs/SKILL.md +63 -0
  120. claude_kit/_payload/skills/remember/SKILL.md +96 -0
  121. claude_kit/_payload/skills/scope/SKILL.md +52 -0
  122. claude_kit/_payload/skills/scope/scope-template.md +82 -0
  123. claude_kit/_payload/skills/sdlc/SKILL.md +83 -0
  124. claude_kit/_payload/skills/security-and-hardening/SKILL.md +368 -0
  125. claude_kit/_payload/skills/security-verification/SKILL.md +209 -0
  126. claude_kit/_payload/skills/shipping-and-launch/SKILL.md +309 -0
  127. claude_kit/_payload/skills/smoke-test/SKILL.md +78 -0
  128. claude_kit/_payload/skills/source-driven-development/SKILL.md +195 -0
  129. claude_kit/_payload/skills/spec-driven-development/SKILL.md +200 -0
  130. claude_kit/_payload/skills/sprint/SKILL.md +67 -0
  131. claude_kit/_payload/skills/sprint/sprint-template.md +90 -0
  132. claude_kit/_payload/skills/test-driven-development/SKILL.md +383 -0
  133. claude_kit/_payload/skills/threat-model/SKILL.md +60 -0
  134. claude_kit/_payload/skills/triage/SKILL.md +87 -0
  135. claude_kit/_payload/skills/ui-ux-design/SKILL.md +71 -0
  136. claude_kit/_payload/skills/unit-test/SKILL.md +237 -0
  137. claude_kit/_payload/skills/using-agent-skills/SKILL.md +180 -0
  138. claude_kit/_payload/templates/CLAUDE.md +238 -0
  139. claude_kit/_payload/templates/CLAUDE.stack.md.tmpl +53 -0
  140. claude_kit/_payload/templates/CONTINUITY.template.md +35 -0
  141. claude_kit/_payload/templates/README.claude-sdlc.md.tmpl +219 -0
  142. claude_kit/_payload/templates/agent-memory/MEMORY.md +30 -0
  143. claude_kit/_payload/templates/agent-memory/api/.gitkeep +0 -0
  144. claude_kit/_payload/templates/agent-memory/architecture/.gitkeep +0 -0
  145. claude_kit/_payload/templates/agent-memory/debugging/.gitkeep +0 -0
  146. claude_kit/_payload/templates/agent-memory/gotchas/.gitkeep +0 -0
  147. claude_kit/_payload/templates/agent-memory/patterns/.gitkeep +0 -0
  148. claude_kit/_payload/templates/agent-memory/performance/.gitkeep +0 -0
  149. claude_kit/_payload/templates/artifacts/adr.md +18 -0
  150. claude_kit/_payload/templates/artifacts/feature-spec.md +29 -0
  151. claude_kit/_payload/templates/artifacts/release-plan.md +23 -0
  152. claude_kit/_payload/templates/artifacts/runbook.md +24 -0
  153. claude_kit/_payload/templates/artifacts/security-review.md +23 -0
  154. claude_kit/_payload/templates/artifacts/test-plan.md +22 -0
  155. claude_kit/_payload/templates/org/README.md +53 -0
  156. claude_kit/_payload/templates/org/agents/data-workflow-agent.md +59 -0
  157. claude_kit/_payload/templates/org/agents/founder-prototype-agent.md +61 -0
  158. claude_kit/_payload/templates/org/agents/internal-tools-builder.md +63 -0
  159. claude_kit/_payload/templates/org/agents/pm-copilot.md +60 -0
  160. claude_kit/_payload/templates/org/agents/support-ticket-engineer.md +63 -0
  161. claude_kit/_payload/templates/org/packs/devops-and-release/README.md +46 -0
  162. claude_kit/_payload/templates/org/packs/devops-and-release/pack.yaml +32 -0
  163. claude_kit/_payload/templates/org/packs/engineering-core/README.md +46 -0
  164. claude_kit/_payload/templates/org/packs/engineering-core/pack.yaml +44 -0
  165. claude_kit/_payload/templates/org/packs/non-engineer-builder/README.md +53 -0
  166. claude_kit/_payload/templates/org/packs/non-engineer-builder/pack.yaml +39 -0
  167. claude_kit/_payload/templates/org/packs/onboarding-and-docs/README.md +49 -0
  168. claude_kit/_payload/templates/org/packs/onboarding-and-docs/pack.yaml +26 -0
  169. claude_kit/_payload/templates/org/packs/product-to-code/README.md +50 -0
  170. claude_kit/_payload/templates/org/packs/product-to-code/pack.yaml +34 -0
  171. claude_kit/_payload/templates/org/packs/quality-and-review/README.md +53 -0
  172. claude_kit/_payload/templates/org/packs/quality-and-review/pack.yaml +40 -0
  173. claude_kit/_payload/templates/org/packs/security-and-compliance/README.md +50 -0
  174. claude_kit/_payload/templates/org/packs/security-and-compliance/pack.yaml +36 -0
  175. claude_kit/_payload/templates/org/rules/ai-working-agreement.md +45 -0
  176. claude_kit/_payload/templates/org/rules/ambiguity-resolution.md +36 -0
  177. claude_kit/_payload/templates/org/rules/branch-and-pr-policy.md +41 -0
  178. claude_kit/_payload/templates/org/rules/compliance-policy.md +50 -0
  179. claude_kit/_payload/templates/org/rules/non-engineer-safe-coding.md +37 -0
  180. claude_kit/_payload/templates/org/rules/pii-policy.md +46 -0
  181. claude_kit/_payload/templates/org/rules/production-data-policy.md +35 -0
  182. claude_kit/_payload/templates/org/rules/prompt-to-task-conversion.md +30 -0
  183. claude_kit/_payload/templates/org/rules/prototype-boundaries.md +40 -0
  184. claude_kit/_payload/templates/org/rules/secrets-policy.md +34 -0
  185. claude_kit/_payload/templates/org/skills/customer-issue-to-fix/SKILL.md +61 -0
  186. claude_kit/_payload/templates/org/skills/feature-from-idea/SKILL.md +56 -0
  187. claude_kit/_payload/templates/org/skills/prompt-to-safe-task/SKILL.md +59 -0
  188. claude_kit/_payload/templates/org/skills/prototype-to-production/SKILL.md +61 -0
  189. claude_kit/_payload/templates/org/skills/repo-onboarding/SKILL.md +60 -0
  190. claude_kit/_payload/templates/settings.json +53 -0
  191. claude_kit/_payload/templates/stacks/backend/python/fastapi/rules/fastapi-patterns.md +64 -0
  192. claude_kit/_payload/templates/stacks/db/mongodb/agents/migration-specialist.md +61 -0
  193. claude_kit/_payload/templates/stacks/db/mongodb/agents/mongodb-specialist.md +59 -0
  194. claude_kit/_payload/templates/stacks/db/mongodb/rules/mongodb-patterns.md +39 -0
  195. claude_kit/_payload/templates/stacks/db/postgres/agents/db-performance-reviewer.md +66 -0
  196. claude_kit/_payload/templates/stacks/db/postgres/agents/migration-specialist.md +56 -0
  197. claude_kit/_payload/templates/stacks/db/postgres/agents/postgres-specialist.md +58 -0
  198. claude_kit/_payload/templates/stacks/db/postgres/rules/database-performance.md +64 -0
  199. claude_kit/_payload/templates/stacks/db/postgres/rules/postgres-patterns.md +43 -0
  200. claude_kit/_payload/templates/stacks/frontend/react/rules/react-patterns.md +63 -0
  201. claude_kit/catalog.py +476 -0
  202. claude_kit/cli.py +327 -0
  203. claude_kit/hooks.py +246 -0
  204. claude_kit/models.py +205 -0
  205. claude_kit/prompts.py +209 -0
  206. claude_kit/render.py +146 -0
  207. claude_kit/scaffold.py +492 -0
  208. claude_kit/upgrader.py +294 -0
  209. claude_kit/validator.py +197 -0
@@ -0,0 +1,134 @@
1
+ # Security Checklist
2
+
3
+ Quick reference for web application security. Use alongside the `security-and-hardening` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Pre-Commit Checks](#pre-commit-checks)
8
+ - [Authentication](#authentication)
9
+ - [Authorization](#authorization)
10
+ - [Input Validation](#input-validation)
11
+ - [Security Headers](#security-headers)
12
+ - [CORS Configuration](#cors-configuration)
13
+ - [Data Protection](#data-protection)
14
+ - [Dependency Security](#dependency-security)
15
+ - [Error Handling](#error-handling)
16
+ - [OWASP Top 10 Quick Reference](#owasp-top-10-quick-reference)
17
+
18
+ ## Pre-Commit Checks
19
+
20
+ - [ ] No secrets in code (`git diff --cached | grep -i "password\|secret\|api_key\|token"`)
21
+ - [ ] `.gitignore` covers: `.env`, `.env.local`, `*.pem`, `*.key`
22
+ - [ ] `.env.example` uses placeholder values (not real secrets)
23
+
24
+ ## Authentication
25
+
26
+ - [ ] Passwords hashed with bcrypt (≥12 rounds), scrypt, or argon2
27
+ - [ ] Session cookies: `httpOnly`, `secure`, `sameSite: 'lax'`
28
+ - [ ] Session expiration configured (reasonable max-age)
29
+ - [ ] Rate limiting on login endpoint (≤10 attempts per 15 minutes)
30
+ - [ ] Password reset tokens: time-limited (≤1 hour), single-use
31
+ - [ ] Account lockout after repeated failures (optional, with notification)
32
+ - [ ] MFA supported for sensitive operations (optional but recommended)
33
+
34
+ ## Authorization
35
+
36
+ - [ ] Every protected endpoint checks authentication
37
+ - [ ] Every resource access checks ownership/role (prevents IDOR)
38
+ - [ ] Admin endpoints require admin role verification
39
+ - [ ] API keys scoped to minimum necessary permissions
40
+ - [ ] JWT tokens validated (signature, expiration, issuer)
41
+
42
+ ## Input Validation
43
+
44
+ - [ ] All user input validated at system boundaries (API routes, form handlers)
45
+ - [ ] Validation uses allowlists (not denylists)
46
+ - [ ] String lengths constrained (min/max)
47
+ - [ ] Numeric ranges validated
48
+ - [ ] Email, URL, and date formats validated with proper libraries
49
+ - [ ] File uploads: type restricted, size limited, content verified
50
+ - [ ] SQL queries parameterized (no string concatenation)
51
+ - [ ] HTML output encoded (use framework auto-escaping)
52
+ - [ ] URLs validated before redirect (prevent open redirect)
53
+
54
+ ## Security Headers
55
+
56
+ ```
57
+ Content-Security-Policy: default-src 'self'; script-src 'self'
58
+ Strict-Transport-Security: max-age=31536000; includeSubDomains
59
+ X-Content-Type-Options: nosniff
60
+ X-Frame-Options: DENY
61
+ X-XSS-Protection: 0 (disabled, rely on CSP)
62
+ Referrer-Policy: strict-origin-when-cross-origin
63
+ Permissions-Policy: camera=(), microphone=(), geolocation=()
64
+ ```
65
+
66
+ ## CORS Configuration
67
+
68
+ ```typescript
69
+ // Restrictive (recommended)
70
+ cors({
71
+ origin: ['https://yourdomain.com', 'https://app.yourdomain.com'],
72
+ credentials: true,
73
+ methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
74
+ allowedHeaders: ['Content-Type', 'Authorization'],
75
+ })
76
+
77
+ // NEVER use in production:
78
+ cors({ origin: '*' }) // Allows any origin
79
+ ```
80
+
81
+ ## Data Protection
82
+
83
+ - [ ] Sensitive fields excluded from API responses (`passwordHash`, `resetToken`, etc.)
84
+ - [ ] Sensitive data not logged (passwords, tokens, full CC numbers)
85
+ - [ ] PII encrypted at rest (if required by regulation)
86
+ - [ ] HTTPS for all external communication
87
+ - [ ] Database backups encrypted
88
+
89
+ ## Dependency Security
90
+
91
+ ```bash
92
+ # Audit dependencies
93
+ npm audit
94
+
95
+ # Fix automatically where possible
96
+ npm audit fix
97
+
98
+ # Check for critical vulnerabilities
99
+ npm audit --audit-level=critical
100
+
101
+ # Keep dependencies updated
102
+ npx npm-check-updates
103
+ ```
104
+
105
+ ## Error Handling
106
+
107
+ ```typescript
108
+ // Production: generic error, no internals
109
+ res.status(500).json({
110
+ error: { code: 'INTERNAL_ERROR', message: 'Something went wrong' }
111
+ });
112
+
113
+ // NEVER in production:
114
+ res.status(500).json({
115
+ error: err.message,
116
+ stack: err.stack, // Exposes internals
117
+ query: err.sql, // Exposes database details
118
+ });
119
+ ```
120
+
121
+ ## OWASP Top 10 Quick Reference
122
+
123
+ | # | Vulnerability | Prevention |
124
+ |---|---|---|
125
+ | 1 | Broken Access Control | Auth checks on every endpoint, ownership verification |
126
+ | 2 | Cryptographic Failures | HTTPS, strong hashing, no secrets in code |
127
+ | 3 | Injection | Parameterized queries, input validation |
128
+ | 4 | Insecure Design | Threat modeling, spec-driven development |
129
+ | 5 | Security Misconfiguration | Security headers, minimal permissions, audit deps |
130
+ | 6 | Vulnerable Components | `npm audit`, keep deps updated, minimal deps |
131
+ | 7 | Auth Failures | Strong passwords, rate limiting, session management |
132
+ | 8 | Data Integrity Failures | Verify updates/dependencies, signed artifacts |
133
+ | 9 | Logging Failures | Log security events, don't log secrets |
134
+ | 10 | SSRF | Validate/allowlist URLs, restrict outbound requests |
@@ -0,0 +1,236 @@
1
+ # Testing Patterns Reference
2
+
3
+ Quick reference for common testing patterns across the stack. Use alongside the `test-driven-development` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Test Structure (Arrange-Act-Assert)](#test-structure-arrange-act-assert)
8
+ - [Test Naming Conventions](#test-naming-conventions)
9
+ - [Common Assertions](#common-assertions)
10
+ - [Mocking Patterns](#mocking-patterns)
11
+ - [React/Component Testing](#reactcomponent-testing)
12
+ - [API / Integration Testing](#api--integration-testing)
13
+ - [E2E Testing (Playwright)](#e2e-testing-playwright)
14
+ - [Test Anti-Patterns](#test-anti-patterns)
15
+
16
+ ## Test Structure (Arrange-Act-Assert)
17
+
18
+ ```typescript
19
+ it('describes expected behavior', () => {
20
+ // Arrange: Set up test data and preconditions
21
+ const input = { title: 'Test Task', priority: 'high' };
22
+
23
+ // Act: Perform the action being tested
24
+ const result = createTask(input);
25
+
26
+ // Assert: Verify the outcome
27
+ expect(result.title).toBe('Test Task');
28
+ expect(result.priority).toBe('high');
29
+ expect(result.status).toBe('pending');
30
+ });
31
+ ```
32
+
33
+ ## Test Naming Conventions
34
+
35
+ ```typescript
36
+ // Pattern: [unit] [expected behavior] [condition]
37
+ describe('TaskService.createTask', () => {
38
+ it('creates a task with default pending status', () => {});
39
+ it('throws ValidationError when title is empty', () => {});
40
+ it('trims whitespace from title', () => {});
41
+ it('generates a unique ID for each task', () => {});
42
+ });
43
+ ```
44
+
45
+ ## Common Assertions
46
+
47
+ ```typescript
48
+ // Equality
49
+ expect(result).toBe(expected); // Strict equality (===)
50
+ expect(result).toEqual(expected); // Deep equality (objects/arrays)
51
+ expect(result).toStrictEqual(expected); // Deep equality + type matching
52
+
53
+ // Truthiness
54
+ expect(result).toBeTruthy();
55
+ expect(result).toBeFalsy();
56
+ expect(result).toBeNull();
57
+ expect(result).toBeDefined();
58
+ expect(result).toBeUndefined();
59
+
60
+ // Numbers
61
+ expect(result).toBeGreaterThan(5);
62
+ expect(result).toBeLessThanOrEqual(10);
63
+ expect(result).toBeCloseTo(0.3, 5); // Floating point
64
+
65
+ // Strings
66
+ expect(result).toMatch(/pattern/);
67
+ expect(result).toContain('substring');
68
+
69
+ // Arrays / Objects
70
+ expect(array).toContain(item);
71
+ expect(array).toHaveLength(3);
72
+ expect(object).toHaveProperty('key', 'value');
73
+
74
+ // Errors
75
+ expect(() => fn()).toThrow();
76
+ expect(() => fn()).toThrow(ValidationError);
77
+ expect(() => fn()).toThrow('specific message');
78
+
79
+ // Async
80
+ await expect(asyncFn()).resolves.toBe(value);
81
+ await expect(asyncFn()).rejects.toThrow(Error);
82
+ ```
83
+
84
+ ## Mocking Patterns
85
+
86
+ ### Mock Functions
87
+
88
+ ```typescript
89
+ const mockFn = jest.fn();
90
+ mockFn.mockReturnValue(42);
91
+ mockFn.mockResolvedValue({ data: 'test' });
92
+ mockFn.mockImplementation((x) => x * 2);
93
+
94
+ expect(mockFn).toHaveBeenCalled();
95
+ expect(mockFn).toHaveBeenCalledWith('arg1', 'arg2');
96
+ expect(mockFn).toHaveBeenCalledTimes(3);
97
+ ```
98
+
99
+ ### Mock Modules
100
+
101
+ ```typescript
102
+ // Mock an entire module
103
+ jest.mock('./database', () => ({
104
+ query: jest.fn().mockResolvedValue([{ id: 1, title: 'Test' }]),
105
+ }));
106
+
107
+ // Mock specific exports
108
+ jest.mock('./utils', () => ({
109
+ ...jest.requireActual('./utils'),
110
+ generateId: jest.fn().mockReturnValue('test-id'),
111
+ }));
112
+ ```
113
+
114
+ ### Mock at Boundaries Only
115
+
116
+ ```
117
+ Mock these: Don't mock these:
118
+ ├── Database calls ├── Internal utility functions
119
+ ├── HTTP requests ├── Business logic
120
+ ├── File system operations ├── Data transformations
121
+ ├── External API calls ├── Validation functions
122
+ └── Time/Date (when needed) └── Pure functions
123
+ ```
124
+
125
+ ## React/Component Testing
126
+
127
+ ```tsx
128
+ import { render, screen, fireEvent, waitFor } from '@testing-library/react';
129
+
130
+ describe('TaskForm', () => {
131
+ it('submits the form with entered data', async () => {
132
+ const onSubmit = jest.fn();
133
+ render(<TaskForm onSubmit={onSubmit} />);
134
+
135
+ // Find elements by accessible role/label (not test IDs)
136
+ await screen.findByRole('textbox', { name: /title/i });
137
+ fireEvent.change(screen.getByRole('textbox', { name: /title/i }), {
138
+ target: { value: 'New Task' },
139
+ });
140
+ fireEvent.click(screen.getByRole('button', { name: /create/i }));
141
+
142
+ await waitFor(() => {
143
+ expect(onSubmit).toHaveBeenCalledWith({ title: 'New Task' });
144
+ });
145
+ });
146
+
147
+ it('shows validation error for empty title', async () => {
148
+ render(<TaskForm onSubmit={jest.fn()} />);
149
+
150
+ fireEvent.click(screen.getByRole('button', { name: /create/i }));
151
+
152
+ expect(await screen.findByText(/title is required/i)).toBeInTheDocument();
153
+ });
154
+ });
155
+ ```
156
+
157
+ ## API / Integration Testing
158
+
159
+ ```typescript
160
+ import request from 'supertest';
161
+ import { app } from '../src/app';
162
+
163
+ describe('POST /api/tasks', () => {
164
+ it('creates a task and returns 201', async () => {
165
+ const response = await request(app)
166
+ .post('/api/tasks')
167
+ .send({ title: 'Test Task' })
168
+ .set('Authorization', `Bearer ${testToken}`)
169
+ .expect(201);
170
+
171
+ expect(response.body).toMatchObject({
172
+ id: expect.any(String),
173
+ title: 'Test Task',
174
+ status: 'pending',
175
+ });
176
+ });
177
+
178
+ it('returns 422 for invalid input', async () => {
179
+ const response = await request(app)
180
+ .post('/api/tasks')
181
+ .send({ title: '' })
182
+ .set('Authorization', `Bearer ${testToken}`)
183
+ .expect(422);
184
+
185
+ expect(response.body.error.code).toBe('VALIDATION_ERROR');
186
+ });
187
+
188
+ it('returns 401 without authentication', async () => {
189
+ await request(app)
190
+ .post('/api/tasks')
191
+ .send({ title: 'Test' })
192
+ .expect(401);
193
+ });
194
+ });
195
+ ```
196
+
197
+ ## E2E Testing (Playwright)
198
+
199
+ ```typescript
200
+ import { test, expect } from '@playwright/test';
201
+
202
+ test('user can create and complete a task', async ({ page }) => {
203
+ // Navigate and authenticate
204
+ await page.goto('/');
205
+ await page.fill('[name="email"]', 'test@example.com');
206
+ await page.fill('[name="password"]', 'testpass123');
207
+ await page.click('button:has-text("Log in")');
208
+
209
+ // Create a task
210
+ await page.click('button:has-text("New Task")');
211
+ await page.fill('[name="title"]', 'Buy groceries');
212
+ await page.click('button:has-text("Create")');
213
+
214
+ // Verify task appears
215
+ await expect(page.locator('text=Buy groceries')).toBeVisible();
216
+
217
+ // Complete the task
218
+ await page.click('[aria-label="Complete Buy groceries"]');
219
+ await expect(page.locator('text=Buy groceries')).toHaveCSS(
220
+ 'text-decoration-line', 'line-through'
221
+ );
222
+ });
223
+ ```
224
+
225
+ ## Test Anti-Patterns
226
+
227
+ | Anti-Pattern | Problem | Better Approach |
228
+ |---|---|---|
229
+ | Testing implementation details | Breaks on refactor | Test inputs/outputs |
230
+ | Snapshot everything | No one reviews snapshot diffs | Assert specific values |
231
+ | Shared mutable state | Tests pollute each other | Setup/teardown per test |
232
+ | Testing third-party code | Wastes time, not your bug | Mock the boundary |
233
+ | Skipping tests to pass CI | Hides real bugs | Fix or delete the test |
234
+ | Using `test.skip` permanently | Dead code | Remove or fix it |
235
+ | Overly broad assertions | Doesn't catch regressions | Be specific |
236
+ | No async error handling | Swallowed errors, false passes | Always `await` async tests |
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: accessibility-review
3
+ description: Use when reviewing or building UI to check accessibility (WCAG) — keyboard operability, focus management, semantics/ARIA, color contrast, touch-target size, motion, and screen-reader labels. Produces prioritized findings with concrete fixes. Distinct from performance/visual review.
4
+ ---
5
+
6
+ # Accessibility Review
7
+
8
+ Review a UI change (or a whole view) for accessibility and return prioritized, concrete fixes mapped to
9
+ WCAG. Design-and-review companion to `frontend-ui-engineering` and `ui-ux-design`.
10
+
11
+ **Risk tier:** low–medium (raise to high if it gates a legally-required compliance surface — see
12
+ `.claude/rules/risk-classification.md`).
13
+
14
+ ## When to use
15
+ - Reviewing any frontend/UI change, or auditing an existing view before release.
16
+ - The `responsive-and-accessibility.md` rule sets the standards; this skill is the review procedure.
17
+
18
+ ## Who should use it
19
+ Frontend engineers, the `ui-designer` agent, QA. Designers/PMs can run it for a first pass.
20
+
21
+ ## Required inputs
22
+ The component/view (file paths or a running URL) and which states matter (loading, empty, error, modal).
23
+
24
+ ## Ordered questions to ask
25
+ 1. Is everything **operable by keyboard** (tab order, visible focus, no traps, Esc closes overlays)?
26
+ 2. Is the **semantics** right (native elements over `div` soup, headings in order, landmarks, labels
27
+ for every control, `alt` for images)?
28
+ 3. Do interactive states expose **name/role/value** to assistive tech (ARIA only where native won't do)?
29
+ 4. Does **color contrast** meet WCAG AA (text ≥ 4.5:1, large text/UI ≥ 3:1) and is color not the only
30
+ signal?
31
+ 5. Are **touch targets** ≥ 44×44px and is motion reduced under `prefers-reduced-motion`?
32
+ 6. Are **dynamic updates** announced (live regions) and **forms** clear (labels, errors tied to inputs)?
33
+
34
+ ## Agents to delegate to
35
+ `ui-designer` for design-spec gaps; `sdlc-code-reviewer` to land fixes. Reference
36
+ `.claude/skills/_references/accessibility-checklist.md` if present.
37
+
38
+ ## Quality gates
39
+ No keyboard trap; every control has an accessible name; AA contrast on text/UI; focus visible and
40
+ managed across route/modal changes; target sizes met.
41
+
42
+ ## Expected outputs
43
+ Prioritized findings (P0 blocks release → P3 polish), each with the element, the WCAG criterion, and the
44
+ exact fix.
45
+
46
+ ## Stop conditions
47
+ Stop and flag if a fix requires a design change (hand to `ui-designer`) or if a compliance obligation
48
+ makes a P0 a release blocker that needs human sign-off.
49
+
50
+ ## Example
51
+ ```
52
+ /accessibility-review the invite-teammate modal
53
+ → P0: focus not trapped in modal + Esc doesn't close → add focus trap + Esc handler (WCAG 2.1.2/2.4.3)
54
+ → P1: "✕" close button has no accessible name → aria-label="Close" (4.1.2)
55
+ → P2: error text only red → add icon/text prefix (1.4.1); contrast 3.9:1 → darken to ≥4.5:1 (1.4.3)
56
+ ```