ai-sprint-kit 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +299 -0
  2. package/bin/cli.js +135 -0
  3. package/lib/installer.js +205 -0
  4. package/lib/scanner.js +341 -0
  5. package/package.json +55 -0
  6. package/templates/.claude/.env.example +13 -0
  7. package/templates/.claude/agents/debugger.md +667 -0
  8. package/templates/.claude/agents/devops.md +727 -0
  9. package/templates/.claude/agents/docs.md +661 -0
  10. package/templates/.claude/agents/implementer.md +235 -0
  11. package/templates/.claude/agents/planner.md +243 -0
  12. package/templates/.claude/agents/researcher.md +448 -0
  13. package/templates/.claude/agents/reviewer.md +610 -0
  14. package/templates/.claude/agents/security.md +202 -0
  15. package/templates/.claude/agents/tester.md +604 -0
  16. package/templates/.claude/commands/auto.md +85 -0
  17. package/templates/.claude/commands/code.md +301 -0
  18. package/templates/.claude/commands/debug.md +449 -0
  19. package/templates/.claude/commands/deploy.md +475 -0
  20. package/templates/.claude/commands/docs.md +519 -0
  21. package/templates/.claude/commands/plan.md +57 -0
  22. package/templates/.claude/commands/review.md +412 -0
  23. package/templates/.claude/commands/scan.md +146 -0
  24. package/templates/.claude/commands/secure.md +88 -0
  25. package/templates/.claude/commands/test.md +352 -0
  26. package/templates/.claude/commands/validate.md +238 -0
  27. package/templates/.claude/settings.json +27 -0
  28. package/templates/.claude/skills/codebase-context/SKILL.md +68 -0
  29. package/templates/.claude/skills/codebase-context/references/reading-context.md +68 -0
  30. package/templates/.claude/skills/codebase-context/references/refresh-triggers.md +82 -0
  31. package/templates/.claude/skills/implementation/SKILL.md +70 -0
  32. package/templates/.claude/skills/implementation/references/error-handling.md +106 -0
  33. package/templates/.claude/skills/implementation/references/security-patterns.md +73 -0
  34. package/templates/.claude/skills/implementation/references/validation-patterns.md +107 -0
  35. package/templates/.claude/skills/memory/SKILL.md +67 -0
  36. package/templates/.claude/skills/memory/references/decisions-format.md +68 -0
  37. package/templates/.claude/skills/memory/references/learning-format.md +74 -0
  38. package/templates/.claude/skills/planning/SKILL.md +72 -0
  39. package/templates/.claude/skills/planning/references/plan-templates.md +81 -0
  40. package/templates/.claude/skills/planning/references/research-phase.md +62 -0
  41. package/templates/.claude/skills/planning/references/solution-design.md +66 -0
  42. package/templates/.claude/skills/quality-assurance/SKILL.md +79 -0
  43. package/templates/.claude/skills/quality-assurance/references/review-checklist.md +72 -0
  44. package/templates/.claude/skills/quality-assurance/references/security-checklist.md +70 -0
  45. package/templates/.claude/skills/quality-assurance/references/testing-strategy.md +85 -0
  46. package/templates/.claude/statusline.sh +126 -0
  47. package/templates/.claude/workflows/development-rules.md +97 -0
  48. package/templates/.claude/workflows/orchestration-protocol.md +194 -0
  49. package/templates/.mcp.json.example +36 -0
  50. package/templates/CLAUDE.md +409 -0
  51. package/templates/README.md +331 -0
  52. package/templates/ai_context/codebase/.gitkeep +0 -0
  53. package/templates/ai_context/memory/active.md +15 -0
  54. package/templates/ai_context/memory/decisions.md +18 -0
  55. package/templates/ai_context/memory/learning.md +22 -0
  56. package/templates/ai_context/plans/.gitkeep +0 -0
  57. package/templates/ai_context/reports/.gitkeep +0 -0
  58. package/templates/docs/user-guide-th.md +454 -0
  59. package/templates/docs/user-guide.md +595 -0
@@ -0,0 +1,74 @@
1
+ # Learning Log Format
2
+
3
+ ## Entry Structure
4
+
5
+ ```markdown
6
+ ## [YYYY-MM-DD] - [Category]
7
+
8
+ **Context**: Brief description of what happened
9
+ **Mistake**: What went wrong or was suboptimal
10
+ **Lesson**: What to do differently
11
+ **Prevention**: How to avoid in future
12
+ ```
13
+
14
+ ## Categories
15
+
16
+ | Category | Use For |
17
+ |----------|---------|
18
+ | Security | Auth bugs, exposed secrets, injection issues |
19
+ | Performance | N+1 queries, slow algorithms, memory leaks |
20
+ | Testing | Test gaps, flaky tests, coverage issues |
21
+ | Architecture | Design decisions that didn't scale |
22
+ | Process | Workflow improvements, communication |
23
+ | Dependencies | Package issues, version conflicts |
24
+
25
+ ## Example Entries
26
+
27
+ ### Security
28
+ ```markdown
29
+ ## 2025-12-24 - Security
30
+
31
+ **Context**: Implemented user registration
32
+ **Mistake**: Initially stored plain text passwords
33
+ **Lesson**: Always hash passwords with bcrypt (cost 12+)
34
+ **Prevention**: Add security checklist to implementation workflow
35
+ ```
36
+
37
+ ### Performance
38
+ ```markdown
39
+ ## 2025-12-24 - Performance
40
+
41
+ **Context**: Built posts API with author info
42
+ **Mistake**: Used N+1 query pattern (1 post query + N author queries)
43
+ **Lesson**: Use eager loading / JOIN for related data
44
+ **Prevention**: Review queries for N+1 before completing
45
+ ```
46
+
47
+ ### Testing
48
+ ```markdown
49
+ ## 2025-12-24 - Testing
50
+
51
+ **Context**: Deployed new payment feature
52
+ **Mistake**: Didn't test edge case where amount = 0
53
+ **Lesson**: Always test boundary conditions (0, negative, max)
54
+ **Prevention**: Create edge case checklist for payments
55
+ ```
56
+
57
+ ## When to Add Entries
58
+
59
+ Add to learning.md when:
60
+ - A bug was introduced and fixed
61
+ - A security issue was found
62
+ - Tests failed unexpectedly
63
+ - Performance degraded
64
+ - A refactor was needed due to poor initial design
65
+ - External dependencies caused issues
66
+ - A code review caught something significant
67
+
68
+ ## Best Practices
69
+
70
+ - Be specific about what went wrong
71
+ - Include enough context to understand later
72
+ - Focus on prevention, not blame
73
+ - Keep entries concise (4 lines max)
74
+ - Add immediately after incident (don't batch)
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: planning
3
+ description: Architecture and implementation planning methodology. Activate when creating feature plans, system designs, or implementation roadmaps. Provides phase-based approach with research, analysis, design, and documentation workflows.
4
+ license: MIT
5
+ ---
6
+
7
+ # Planning Methodology
8
+
9
+ Structured approach to technical planning with research, analysis, and documentation.
10
+
11
+ ## When to Use
12
+
13
+ - Planning new feature implementations
14
+ - Architecting system designs
15
+ - Evaluating technical approaches
16
+ - Creating implementation roadmaps
17
+ - Breaking down complex requirements
18
+
19
+ ## Core Principles
20
+
21
+ - **YAGNI** - Don't plan what you don't need
22
+ - **KISS** - Simple plans are better plans
23
+ - **DRY** - Reference existing patterns
24
+ - **Security-First** - Security in every decision
25
+
26
+ ## Workflow
27
+
28
+ ### Phase 1: Context Gathering
29
+ ```
30
+ 1. Check ai_context/memory/learning.md (avoid past mistakes)
31
+ 2. Read ai_context/codebase/structure.md (project layout)
32
+ 3. Review existing patterns in codebase
33
+ 4. Research external solutions if needed
34
+ ```
35
+
36
+ ### Phase 2: Analysis
37
+ Load: `references/research-phase.md`
38
+
39
+ ### Phase 3: Design
40
+ Load: `references/solution-design.md`
41
+
42
+ ### Phase 4: Documentation
43
+ Load: `references/plan-templates.md`
44
+
45
+ ## Output Structure
46
+
47
+ Plans saved to: `ai_context/plans/{timestamp}-{name}/`
48
+
49
+ ```
50
+ {timestamp}-{name}/
51
+ ├── plan.md # Main plan document
52
+ ├── phase-01-*.md # Phase breakdowns
53
+ └── decisions.md # Key decisions
54
+ ```
55
+
56
+ ## Quality Gates
57
+
58
+ Before completing a plan:
59
+ - [ ] Checked learning.md first
60
+ - [ ] Security addressed in each phase
61
+ - [ ] Success criteria defined
62
+ - [ ] Risks identified with mitigations
63
+ - [ ] Dependencies mapped
64
+ - [ ] Unresolved questions listed
65
+
66
+ ## Date Handling
67
+
68
+ Always use bash for timestamps:
69
+ ```bash
70
+ date "+%y%m%d-%H%M" # For folders: 251225-1430
71
+ date "+%Y-%m-%d" # For docs: 2025-12-25
72
+ ```
@@ -0,0 +1,81 @@
1
+ # Plan Templates
2
+
3
+ ## Main Plan (plan.md)
4
+
5
+ ```markdown
6
+ # Plan: [Feature Name]
7
+
8
+ **Created:** YYYY-MM-DD
9
+ **Status:** Draft
10
+
11
+ ## Context
12
+ [Problem statement, current state, why needed]
13
+
14
+ ## Decision
15
+ [Chosen approach with brief rationale]
16
+
17
+ ## Phases Overview
18
+ 1. Phase 1: [Name] - [One-line goal]
19
+ 2. Phase 2: [Name] - [One-line goal]
20
+
21
+ ## Key Decisions
22
+ | Decision | Options | Choice | Rationale |
23
+ |----------|---------|--------|-----------|
24
+
25
+ ## Security Considerations
26
+ - [ ] Requirement 1
27
+
28
+ ## Success Criteria
29
+ - [ ] Criterion 1
30
+
31
+ ## Risks
32
+ | Risk | Impact | Mitigation |
33
+ |------|--------|------------|
34
+
35
+ ## Dependencies
36
+ - [Dependency 1]
37
+
38
+ ## Unresolved Questions
39
+ - [ ] Question 1
40
+ ```
41
+
42
+ ## Phase Document (phase-XX-*.md)
43
+
44
+ ```markdown
45
+ # Phase N: [Name]
46
+
47
+ ## Objective
48
+ [Clear, measurable goal]
49
+
50
+ ## Prerequisites
51
+ - [Dependency from previous phases]
52
+
53
+ ## Implementation Steps
54
+ 1. Step 1: [Description]
55
+
56
+ ## Files to Create/Modify
57
+ - `path/file.ts` - [Purpose]
58
+
59
+ ## Tests Required
60
+ - [ ] Test case 1
61
+
62
+ ## Security Checklist
63
+ - [ ] Input validation
64
+ - [ ] No hardcoded secrets
65
+
66
+ ## Success Criteria
67
+ - [ ] Criterion 1
68
+ ```
69
+
70
+ ## Naming Convention
71
+
72
+ ```
73
+ ai_context/plans/
74
+ └── YYMMDD-HHMM-feature-name/
75
+ ├── plan.md
76
+ ├── phase-01-setup.md
77
+ ├── phase-02-core.md
78
+ └── phase-03-testing.md
79
+ ```
80
+
81
+ Get timestamp: `date "+%y%m%d-%H%M"`
@@ -0,0 +1,62 @@
1
+ # Research Phase
2
+
3
+ ## Research Strategy
4
+
5
+ ### 1. Understand Requirements
6
+ - What problem are we solving?
7
+ - What are the constraints?
8
+ - Who are the stakeholders?
9
+
10
+ ### 2. Analyze Existing Code
11
+ - Read ai_context/codebase/overview.md
12
+ - Identify relevant patterns
13
+ - Note integration points
14
+
15
+ ### 3. Research External Solutions
16
+ - Check official documentation
17
+ - Review GitHub examples
18
+ - Consider trade-offs
19
+
20
+ ## Research Sources (Priority Order)
21
+
22
+ 1. Existing codebase patterns
23
+ 2. ai_context/memory/decisions.md
24
+ 3. Official documentation (via context7 MCP)
25
+ 4. Web search (via exa or WebSearch)
26
+ 5. GitHub repositories
27
+
28
+ ## Research Output
29
+
30
+ Document findings with:
31
+ - Key findings (bullet points)
32
+ - Trade-offs (table format)
33
+ - Recommendations
34
+ - Sources/links
35
+
36
+ ## Token Efficiency
37
+
38
+ - Use context7 MCP for library docs (token-optimized)
39
+ - Use exa MCP for web search (cleaner results)
40
+ - Avoid fetching entire websites
41
+ - Summarize findings concisely
42
+
43
+ ## Example Research Output
44
+
45
+ ```markdown
46
+ ## Research: Authentication Options
47
+
48
+ ### Key Findings
49
+ - JWT stateless, good for scaling
50
+ - Sessions simpler but need shared storage
51
+ - OAuth delegates to providers
52
+
53
+ ### Trade-offs
54
+ | Option | Pros | Cons |
55
+ |--------|------|------|
56
+ | JWT | Stateless, scalable | Token size, revocation |
57
+ | Sessions | Simple, revocable | Shared storage needed |
58
+ | OAuth | No password storage | Third-party dependency |
59
+
60
+ ### Recommendation
61
+ JWT with refresh tokens - balances security and scalability.
62
+ ```
@@ -0,0 +1,66 @@
1
+ # Solution Design
2
+
3
+ ## Design Process
4
+
5
+ ### 1. Define Architecture
6
+ - High-level components
7
+ - Data flow
8
+ - Integration points
9
+
10
+ ### 2. Identify Decisions
11
+ - Technology choices
12
+ - Pattern selections
13
+ - Trade-offs
14
+
15
+ ### 3. Plan Phases
16
+ - Break into implementable chunks
17
+ - Define dependencies
18
+ - Set milestones
19
+
20
+ ## Architecture Documentation
21
+
22
+ Use simple diagrams (ASCII or Mermaid):
23
+
24
+ ```
25
+ ┌─────────────┐ ┌─────────────┐
26
+ │ Client │────▶│ API │
27
+ └─────────────┘ └──────┬──────┘
28
+
29
+ ┌─────▼─────┐
30
+ │ DB │
31
+ └───────────┘
32
+ ```
33
+
34
+ ## Decision Framework
35
+
36
+ For each decision document:
37
+ 1. What are the options?
38
+ 2. What are the trade-offs?
39
+ 3. What constraints apply?
40
+ 4. What's the recommendation?
41
+
42
+ ## Phase Planning Guidelines
43
+
44
+ Each phase should be:
45
+ - Independently deployable
46
+ - Testable in isolation
47
+ - < 1 day of implementation
48
+ - Have clear success criteria
49
+
50
+ ## Security by Design
51
+
52
+ Every design must address:
53
+ - Authentication requirements
54
+ - Authorization model
55
+ - Data protection
56
+ - Input validation strategy
57
+ - Error handling approach
58
+
59
+ ## Design Checklist
60
+
61
+ - [ ] Components identified
62
+ - [ ] Data flow documented
63
+ - [ ] Decisions justified
64
+ - [ ] Phases are small (<1 day each)
65
+ - [ ] Security addressed
66
+ - [ ] Dependencies mapped
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: quality-assurance
3
+ description: Testing methodology and code review standards. Activate when generating tests, reviewing code quality, or performing security analysis. Combines testing and review for production-grade validation.
4
+ license: MIT
5
+ ---
6
+
7
+ # Quality Assurance
8
+
9
+ Combined testing and review standards for production-grade code.
10
+
11
+ ## When to Use
12
+
13
+ **Testing:**
14
+ - Generating unit/integration/e2e tests
15
+ - Analyzing test coverage
16
+ - Creating security tests
17
+
18
+ **Reviewing:**
19
+ - Reviewing code quality
20
+ - Security analysis
21
+ - Performance review
22
+
23
+ ## Core Principles
24
+
25
+ - **80% Minimum Coverage** - Non-negotiable
26
+ - **Security-First** - Always test security
27
+ - **Constructive** - Actionable feedback
28
+ - **No Nitpicking** - Focus on meaningful issues
29
+
30
+ ## Before Starting
31
+
32
+ ```
33
+ 1. Read ai_context/memory/learning.md (past issues)
34
+ 2. Check existing test patterns in codebase
35
+ 3. Review related code coverage reports
36
+ ```
37
+
38
+ ## Testing Strategy
39
+
40
+ Load: `references/testing-strategy.md`
41
+
42
+ ## Review Checklist
43
+
44
+ Load: `references/review-checklist.md`
45
+
46
+ ## Security Checklist
47
+
48
+ Load: `references/security-checklist.md`
49
+
50
+ ## Output Structure
51
+
52
+ ```
53
+ ai_context/reports/
54
+ ├── YYMMDD-HHMM-test-{feature}.md
55
+ ├── YYMMDD-HHMM-review-{feature}.md
56
+ └── YYMMDD-HHMM-security-{scope}.md
57
+ ```
58
+
59
+ ## Quality Gates
60
+
61
+ **Testing:**
62
+ - [ ] >80% overall coverage
63
+ - [ ] Critical paths 100%
64
+ - [ ] All tests pass
65
+ - [ ] Security tests included
66
+
67
+ **Reviewing:**
68
+ - [ ] Security analysis complete
69
+ - [ ] OWASP Top 10 checked
70
+ - [ ] Actionable suggestions
71
+ - [ ] Severity levels assigned
72
+
73
+ ## Push Back Protocol
74
+
75
+ When feedback is unclear or incorrect:
76
+ 1. Ask for clarification
77
+ 2. Verify technically before implementing
78
+ 3. Push back with reasoning if wrong
79
+ 4. Never just agree to be agreeable
@@ -0,0 +1,72 @@
1
+ # Review Checklist
2
+
3
+ ## Severity Levels
4
+
5
+ | Level | Meaning | Action |
6
+ |-------|---------|--------|
7
+ | 🔴 Critical | Security/data issue | Must fix immediately |
8
+ | 🟠 High | Bug or performance | Fix before merge |
9
+ | 🟡 Medium | Maintainability | Should fix |
10
+ | 🟢 Low | Suggestion | Nice to have |
11
+
12
+ ## Review Categories
13
+
14
+ ### 1. Security (Critical Priority)
15
+ - [ ] No hardcoded secrets
16
+ - [ ] Input validation on all user inputs
17
+ - [ ] Output encoding (XSS prevention)
18
+ - [ ] Parameterized queries (SQL injection)
19
+ - [ ] Proper auth/authz checks
20
+ - [ ] OWASP Top 10 compliance
21
+
22
+ ### 2. Logic & Correctness
23
+ - [ ] Code does what it's supposed to
24
+ - [ ] Edge cases handled
25
+ - [ ] Error handling comprehensive
26
+ - [ ] Race conditions prevented
27
+
28
+ ### 3. Performance
29
+ - [ ] No N+1 queries
30
+ - [ ] Efficient algorithms
31
+ - [ ] Appropriate data structures
32
+ - [ ] Caching where applicable
33
+
34
+ ### 4. Maintainability
35
+ - [ ] Functions < 50 lines
36
+ - [ ] Single responsibility
37
+ - [ ] Clear naming
38
+ - [ ] Low coupling
39
+
40
+ ### 5. Testing
41
+ - [ ] Tests exist and pass
42
+ - [ ] Coverage > 80%
43
+ - [ ] Security tests included
44
+
45
+ ## Code Smells to Flag
46
+
47
+ - ❌ Long methods (>50 lines)
48
+ - ❌ Long parameter lists (>4 params)
49
+ - ❌ Duplicated code
50
+ - ❌ Dead code
51
+ - ❌ Magic numbers
52
+ - ❌ Deep nesting (>3 levels)
53
+
54
+ ## Review Report Format
55
+
56
+ ```markdown
57
+ ## Summary
58
+ **Assessment:** [Excellent/Good/Needs Work/Critical]
59
+ **Recommendation:** [Ship/Fix Critical/Refactor]
60
+
61
+ ## Critical Issues
62
+ [Must fix before merge]
63
+
64
+ ## High Priority
65
+ [Should fix before merge]
66
+
67
+ ## Suggestions
68
+ [Nice to have improvements]
69
+
70
+ ## Positive Observations
71
+ [What's done well]
72
+ ```
@@ -0,0 +1,70 @@
1
+ # Security Checklist
2
+
3
+ ## Authentication
4
+ - [ ] Proper auth on all protected endpoints
5
+ - [ ] Session management secure
6
+ - [ ] Password hashing (bcrypt, argon2)
7
+ - [ ] Secure token storage (httpOnly cookies)
8
+ - [ ] Token expiration and rotation
9
+
10
+ ## Authorization
11
+ - [ ] Role-based access control
12
+ - [ ] Resource ownership verified
13
+ - [ ] No privilege escalation
14
+ - [ ] Least privilege principle
15
+
16
+ ## Input Validation
17
+ - [ ] All inputs validated
18
+ - [ ] Type checking
19
+ - [ ] Length limits
20
+ - [ ] Format validation
21
+ - [ ] Sanitization before use
22
+
23
+ ## Injection Prevention
24
+ - [ ] SQL injection (parameterized queries)
25
+ - [ ] XSS (output encoding)
26
+ - [ ] Command injection (avoid shell)
27
+ - [ ] Path traversal (validate paths)
28
+
29
+ ## Data Protection
30
+ - [ ] No hardcoded secrets
31
+ - [ ] Sensitive data encrypted
32
+ - [ ] HTTPS enforced
33
+ - [ ] Proper error messages (no leaks)
34
+ - [ ] PII handled properly
35
+
36
+ ## OWASP Top 10
37
+
38
+ 1. **Broken Access Control** - Verify auth on every endpoint
39
+ 2. **Cryptographic Failures** - Use TLS 1.2+, strong algorithms
40
+ 3. **Injection** - Parameterize all queries
41
+ 4. **Insecure Design** - Threat model early
42
+ 5. **Security Misconfiguration** - Secure defaults
43
+ 6. **Vulnerable Components** - Keep dependencies updated
44
+ 7. **Authentication Failures** - Strong password policies
45
+ 8. **Data Integrity Failures** - Verify signatures
46
+ 9. **Logging Failures** - Log security events
47
+ 10. **SSRF** - Validate URLs, whitelist hosts
48
+
49
+ ## Quick Security Test Cases
50
+
51
+ ```typescript
52
+ // SQL Injection
53
+ test('prevents SQL injection', async () => {
54
+ const malicious = "'; DROP TABLE users; --";
55
+ await expect(search(malicious)).resolves.not.toThrow();
56
+ });
57
+
58
+ // XSS
59
+ test('sanitizes output', async () => {
60
+ const xss = '<script>alert("xss")</script>';
61
+ const result = await saveComment(xss);
62
+ expect(result.text).not.toContain('<script>');
63
+ });
64
+
65
+ // Auth bypass
66
+ test('rejects unauthenticated requests', async () => {
67
+ const response = await request(app).get('/api/private');
68
+ expect(response.status).toBe(401);
69
+ });
70
+ ```
@@ -0,0 +1,85 @@
1
+ # Testing Strategy
2
+
3
+ ## Test Pyramid
4
+
5
+ ```
6
+ E2E Tests (10%) ← High cost, slow, brittle
7
+
8
+ Integration (20%) ← Medium cost, moderate speed
9
+
10
+ Unit Tests (70%) ← Low cost, fast, reliable
11
+ ```
12
+
13
+ ## Coverage Requirements
14
+
15
+ | Category | Minimum |
16
+ |----------|---------|
17
+ | Overall | 80% |
18
+ | Critical paths (auth, payments) | 100% |
19
+ | Business logic | 95% |
20
+ | Utils/helpers | 90% |
21
+ | UI components | 70% |
22
+
23
+ ## Unit Test Pattern
24
+
25
+ ```typescript
26
+ describe('calculateTotal', () => {
27
+ it('sums items correctly', () => {
28
+ expect(calculateTotal([10, 20, 30])).toBe(60);
29
+ });
30
+
31
+ it('handles empty array', () => {
32
+ expect(calculateTotal([])).toBe(0);
33
+ });
34
+
35
+ it('throws on invalid input', () => {
36
+ expect(() => calculateTotal(null)).toThrow();
37
+ });
38
+ });
39
+ ```
40
+
41
+ ## Integration Test Pattern
42
+
43
+ ```typescript
44
+ describe('POST /api/users', () => {
45
+ it('creates user with valid data', async () => {
46
+ const response = await request(app)
47
+ .post('/api/users')
48
+ .send({ email: 'test@example.com', password: 'Secure123' });
49
+
50
+ expect(response.status).toBe(201);
51
+ expect(response.body).toHaveProperty('id');
52
+ });
53
+
54
+ it('rejects invalid email', async () => {
55
+ const response = await request(app)
56
+ .post('/api/users')
57
+ .send({ email: 'invalid', password: 'Secure123' });
58
+
59
+ expect(response.status).toBe(400);
60
+ });
61
+ });
62
+ ```
63
+
64
+ ## Security Tests Required
65
+
66
+ - [ ] Input validation
67
+ - [ ] SQL injection prevention
68
+ - [ ] XSS prevention
69
+ - [ ] Authentication bypass
70
+ - [ ] Authorization checks
71
+ - [ ] Rate limiting
72
+
73
+ ## Test Quality
74
+
75
+ **Good tests are:**
76
+ - Fast (< 100ms for unit)
77
+ - Isolated (no dependencies between tests)
78
+ - Repeatable (same result every time)
79
+ - Self-validating (clear pass/fail)
80
+
81
+ **Avoid:**
82
+ - Testing implementation details
83
+ - Flaky tests
84
+ - Tests without assertions
85
+ - Manual setup requirements