@esreekarreddy/ai-prompts 1.0.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.
- package/LICENSE +21 -0
- package/README.md +361 -0
- package/chains/_index.md +33 -0
- package/chains/bug-fix.md +222 -0
- package/chains/new-feature.md +216 -0
- package/chains/production-launch.md +291 -0
- package/chains/refactor.md +210 -0
- package/chains/security-hardening.md +242 -0
- package/contexts/guides/api-design.md +229 -0
- package/contexts/guides/error-handling.md +219 -0
- package/contexts/patterns/agentic-coding.md +368 -0
- package/contexts/patterns/mcp-server-patterns.md +267 -0
- package/contexts/patterns/repository-pattern.md +163 -0
- package/contexts/patterns/service-layer.md +185 -0
- package/contexts/stacks/fastapi.md +187 -0
- package/contexts/stacks/nextjs-14.md +149 -0
- package/contexts/stacks/prisma.md +228 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/examples/architecture-docs/sample-architecture.md +270 -0
- package/examples/code-reviews/sample-review.md +232 -0
- package/examples/prds/sample-prd.md +179 -0
- package/instructions/_index.md +57 -0
- package/instructions/personas/code-reviewer.md +83 -0
- package/instructions/personas/devops-engineer.md +90 -0
- package/instructions/personas/security-expert.md +69 -0
- package/instructions/personas/senior-engineer.md +243 -0
- package/instructions/personas/ux-engineer.md +88 -0
- package/instructions/standards/fastapi.md +241 -0
- package/instructions/standards/go.md +427 -0
- package/instructions/standards/nextjs.md +350 -0
- package/instructions/standards/nodejs.md +284 -0
- package/instructions/standards/python.md +245 -0
- package/instructions/standards/react.md +227 -0
- package/instructions/standards/rust.md +318 -0
- package/instructions/standards/typescript-react.md +822 -0
- package/instructions/standards/typescript.md +294 -0
- package/instructions/workflows/feature-development.md +222 -0
- package/instructions/workflows/incident-response.md +192 -0
- package/instructions/workflows/pr-review.md +149 -0
- package/instructions/workflows/tdd.md +160 -0
- package/package.json +84 -0
- package/prompts/_index.md +70 -0
- package/prompts/agentic/agentic-loop.md +83 -0
- package/prompts/agentic/context-manager.md +37 -0
- package/prompts/agentic/test-driven-fix.md +41 -0
- package/prompts/analysis/deep-debugger.md +488 -0
- package/prompts/design/design-system-extractor.md +147 -0
- package/prompts/development/code-cleaner.md +119 -0
- package/prompts/development/debugger.md +64 -0
- package/prompts/development/tech-debt-audit.md +88 -0
- package/prompts/planning/architecture-analyzer.md +72 -0
- package/prompts/planning/implementation-plan.md +98 -0
- package/prompts/planning/prd-generator.md +66 -0
- package/prompts/planning/scope-killer.md +74 -0
- package/prompts/quality/critical-path-tester.md +133 -0
- package/prompts/quality/pre-launch-checklist.md +137 -0
- package/prompts/quality/security-audit.md +115 -0
- package/prompts/quality/security-fixer.md +117 -0
- package/prompts/quality/security-hardening.md +157 -0
- package/prompts/system/master-system-prompt.md +252 -0
- package/skills/_index.md +60 -0
- package/skills/code-review-advanced.md +435 -0
- package/skills/code-review.md +86 -0
- package/skills/debugging.md +86 -0
- package/skills/documentation.md +97 -0
- package/skills/pr-description.md +116 -0
- package/skills/project-setup.md +123 -0
- package/skills/refactoring.md +93 -0
- package/skills/testing.md +134 -0
- package/snippets/_index.md +57 -0
- package/snippets/constraints/mvp-only.md +50 -0
- package/snippets/constraints/no-external-deps.md +45 -0
- package/snippets/constraints/read-only.md +45 -0
- package/snippets/constraints/security-first.md +50 -0
- package/snippets/modifiers/be-ruthless.md +52 -0
- package/snippets/modifiers/be-thorough.md +50 -0
- package/snippets/modifiers/effort-high.md +56 -0
- package/snippets/modifiers/explain-reasoning.md +50 -0
- package/snippets/modifiers/megathink.md +314 -0
- package/snippets/modifiers/meta-cot.md +101 -0
- package/snippets/modifiers/no-code-yet.md +55 -0
- package/snippets/modifiers/step-by-step.md +50 -0
- package/snippets/modifiers/ultrathink.md +359 -0
- package/snippets/output-formats/checklist.md +61 -0
- package/snippets/output-formats/json.md +53 -0
- package/snippets/output-formats/markdown-table.md +44 -0
- package/snippets/output-formats/numbered-list.md +44 -0
- package/templates/_index.md +101 -0
- package/templates/claude-md/auto-enhance.md +258 -0
- package/templates/claude-md/cli-tool.md +243 -0
- package/templates/claude-md/full.md +449 -0
- package/templates/claude-md/minimal.md +52 -0
- package/templates/claude-md/nextjs-app.md +207 -0
- package/templates/claude-md/nodejs-service.md +251 -0
- package/templates/claude-md/python-api.md +236 -0
- package/templates/copilot/instructions.md +33 -0
- package/templates/cursor-rules/fullstack.txt +98 -0
- package/templates/cursor-rules/minimal.txt +20 -0
- package/templates/cursor-rules/nextjs.txt +61 -0
- package/templates/cursor-rules/python.txt +79 -0
- package/templates/docs/adr-template.md +119 -0
- package/templates/docs/api-spec-template.md +277 -0
- package/templates/docs/prd-template.md +140 -0
- package/templates/docs/runbook-template.md +238 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Skill: PR Description
|
|
2
|
+
|
|
3
|
+
> Writing clear, helpful pull request descriptions
|
|
4
|
+
|
|
5
|
+
## When to Activate
|
|
6
|
+
|
|
7
|
+
- Creating a pull request
|
|
8
|
+
- Asked to write PR description
|
|
9
|
+
- Summarizing code changes
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
1. **Summarize the Change**
|
|
14
|
+
- What does this PR do?
|
|
15
|
+
- Why is it needed?
|
|
16
|
+
- What's the impact?
|
|
17
|
+
|
|
18
|
+
2. **Provide Context**
|
|
19
|
+
- Link to issue/ticket
|
|
20
|
+
- Reference related PRs
|
|
21
|
+
- Note any dependencies
|
|
22
|
+
|
|
23
|
+
3. **Guide Reviewers**
|
|
24
|
+
- Highlight key changes
|
|
25
|
+
- Note areas needing attention
|
|
26
|
+
- Explain non-obvious decisions
|
|
27
|
+
|
|
28
|
+
4. **Document Testing**
|
|
29
|
+
- What was tested?
|
|
30
|
+
- How to test locally?
|
|
31
|
+
- Any edge cases to verify?
|
|
32
|
+
|
|
33
|
+
## PR Description Template
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
## Summary
|
|
37
|
+
|
|
38
|
+
[1-2 sentence description of what this PR does]
|
|
39
|
+
|
|
40
|
+
## Changes
|
|
41
|
+
|
|
42
|
+
- [Change 1]
|
|
43
|
+
- [Change 2]
|
|
44
|
+
- [Change 3]
|
|
45
|
+
|
|
46
|
+
## Why
|
|
47
|
+
|
|
48
|
+
[Explain the motivation - link to issue if applicable]
|
|
49
|
+
|
|
50
|
+
## Testing
|
|
51
|
+
|
|
52
|
+
- [ ] Unit tests added/updated
|
|
53
|
+
- [ ] Manual testing performed
|
|
54
|
+
- [ ] Edge cases considered
|
|
55
|
+
|
|
56
|
+
### How to Test
|
|
57
|
+
|
|
58
|
+
1. [Step 1]
|
|
59
|
+
2. [Step 2]
|
|
60
|
+
3. [Expected result]
|
|
61
|
+
|
|
62
|
+
## Screenshots
|
|
63
|
+
|
|
64
|
+
[If UI changes, include before/after screenshots]
|
|
65
|
+
|
|
66
|
+
## Notes for Reviewers
|
|
67
|
+
|
|
68
|
+
- [Any specific areas to focus on]
|
|
69
|
+
- [Known limitations]
|
|
70
|
+
- [Follow-up work planned]
|
|
71
|
+
|
|
72
|
+
## Checklist
|
|
73
|
+
|
|
74
|
+
- [ ] Code follows project conventions
|
|
75
|
+
- [ ] Self-review completed
|
|
76
|
+
- [ ] Documentation updated
|
|
77
|
+
- [ ] No console.logs or debug code
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
|
|
82
|
+
### Good Summary
|
|
83
|
+
```
|
|
84
|
+
Add rate limiting to authentication endpoints
|
|
85
|
+
|
|
86
|
+
Implements rate limiting on /auth/* endpoints to prevent brute force attacks.
|
|
87
|
+
Limits: 5 attempts per 15 minutes per IP.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Bad Summary
|
|
91
|
+
```
|
|
92
|
+
Updates
|
|
93
|
+
|
|
94
|
+
Fixed stuff and added some features
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Commit Message Convention
|
|
98
|
+
|
|
99
|
+
If using conventional commits:
|
|
100
|
+
```
|
|
101
|
+
feat: add user authentication
|
|
102
|
+
fix: resolve login redirect issue
|
|
103
|
+
docs: update API documentation
|
|
104
|
+
refactor: extract validation logic
|
|
105
|
+
test: add user service tests
|
|
106
|
+
chore: update dependencies
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Size Guidelines
|
|
110
|
+
|
|
111
|
+
| PR Size | Lines Changed | Review Time |
|
|
112
|
+
|---------|---------------|-------------|
|
|
113
|
+
| Small | < 100 | < 30 min |
|
|
114
|
+
| Medium | 100-300 | 30-60 min |
|
|
115
|
+
| Large | 300-500 | 1-2 hours |
|
|
116
|
+
| Too Large | > 500 | Consider splitting |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Skill: Project Setup
|
|
2
|
+
|
|
3
|
+
> Setting up new projects with best practices
|
|
4
|
+
|
|
5
|
+
## When to Activate
|
|
6
|
+
|
|
7
|
+
- Starting a new project
|
|
8
|
+
- Setting up development environment
|
|
9
|
+
- Configuring tooling
|
|
10
|
+
- Initializing repository
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Understand Requirements First**
|
|
15
|
+
- What type of project? (web app, API, CLI, library)
|
|
16
|
+
- What's the tech stack?
|
|
17
|
+
- Who will work on this?
|
|
18
|
+
- What's the deployment target?
|
|
19
|
+
|
|
20
|
+
2. **Choose Minimal Dependencies**
|
|
21
|
+
- Start with essentials only
|
|
22
|
+
- Add dependencies as needed
|
|
23
|
+
- Prefer maintained, popular packages
|
|
24
|
+
- Consider bundle size (frontend)
|
|
25
|
+
|
|
26
|
+
3. **Set Up for Success**
|
|
27
|
+
- TypeScript/type checking
|
|
28
|
+
- Linting and formatting
|
|
29
|
+
- Pre-commit hooks
|
|
30
|
+
- Testing framework
|
|
31
|
+
- CI/CD basics
|
|
32
|
+
|
|
33
|
+
4. **Document from Day One**
|
|
34
|
+
- README with quick start
|
|
35
|
+
- Environment setup
|
|
36
|
+
- Development workflow
|
|
37
|
+
- CLAUDE.md for AI assistance
|
|
38
|
+
|
|
39
|
+
## Project Checklist
|
|
40
|
+
|
|
41
|
+
### Repository
|
|
42
|
+
- [ ] `.gitignore` appropriate for stack
|
|
43
|
+
- [ ] `README.md` with quick start
|
|
44
|
+
- [ ] `LICENSE` file
|
|
45
|
+
- [ ] `.env.example` for environment vars
|
|
46
|
+
|
|
47
|
+
### Code Quality
|
|
48
|
+
- [ ] TypeScript or type hints configured
|
|
49
|
+
- [ ] ESLint/Pylint/formatter configured
|
|
50
|
+
- [ ] Prettier/Black for formatting
|
|
51
|
+
- [ ] Pre-commit hooks (Husky/pre-commit)
|
|
52
|
+
|
|
53
|
+
### Development
|
|
54
|
+
- [ ] Package manager lockfile
|
|
55
|
+
- [ ] Development server script
|
|
56
|
+
- [ ] Build script
|
|
57
|
+
- [ ] Test script
|
|
58
|
+
|
|
59
|
+
### CI/CD
|
|
60
|
+
- [ ] GitHub Actions / GitLab CI setup
|
|
61
|
+
- [ ] Lint check in CI
|
|
62
|
+
- [ ] Test run in CI
|
|
63
|
+
- [ ] Build verification
|
|
64
|
+
|
|
65
|
+
## Stack-Specific Setup
|
|
66
|
+
|
|
67
|
+
### TypeScript/Node.js
|
|
68
|
+
```bash
|
|
69
|
+
npm init -y
|
|
70
|
+
npm install typescript @types/node -D
|
|
71
|
+
npx tsc --init
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Essential configs:
|
|
75
|
+
- `tsconfig.json` with strict mode
|
|
76
|
+
- `.eslintrc` with TypeScript parser
|
|
77
|
+
- `.prettierrc` for formatting
|
|
78
|
+
|
|
79
|
+
### Next.js
|
|
80
|
+
```bash
|
|
81
|
+
npx create-next-app@latest --typescript --tailwind --app
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Add:
|
|
85
|
+
- Path aliases in `tsconfig.json`
|
|
86
|
+
- Environment validation
|
|
87
|
+
- CLAUDE.md from templates
|
|
88
|
+
|
|
89
|
+
### Python
|
|
90
|
+
```bash
|
|
91
|
+
python -m venv venv
|
|
92
|
+
pip install ruff pytest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Add:
|
|
96
|
+
- `pyproject.toml` with tool configs
|
|
97
|
+
- `requirements.txt` and `requirements-dev.txt`
|
|
98
|
+
- Type hints throughout
|
|
99
|
+
|
|
100
|
+
## Output Format
|
|
101
|
+
|
|
102
|
+
When setting up a project, provide:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
## Project Setup Complete
|
|
106
|
+
|
|
107
|
+
### Created Files
|
|
108
|
+
- [list of files created]
|
|
109
|
+
|
|
110
|
+
### Installed Dependencies
|
|
111
|
+
- [production deps]
|
|
112
|
+
- [dev deps]
|
|
113
|
+
|
|
114
|
+
### Next Steps
|
|
115
|
+
1. [First thing to do]
|
|
116
|
+
2. [Second thing]
|
|
117
|
+
3. [Third thing]
|
|
118
|
+
|
|
119
|
+
### Development Commands
|
|
120
|
+
- `npm run dev` - Start development server
|
|
121
|
+
- `npm test` - Run tests
|
|
122
|
+
- `npm run build` - Build for production
|
|
123
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Skill: Refactoring
|
|
2
|
+
|
|
3
|
+
> Safe, incremental code improvement
|
|
4
|
+
|
|
5
|
+
## When to Activate
|
|
6
|
+
|
|
7
|
+
- Code needs restructuring
|
|
8
|
+
- Duplicate code should be consolidated
|
|
9
|
+
- Performance optimization needed
|
|
10
|
+
- Technical debt cleanup
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Assess Before Changing**
|
|
15
|
+
- What's the current state?
|
|
16
|
+
- What tests exist?
|
|
17
|
+
- What depends on this code?
|
|
18
|
+
- What's the risk?
|
|
19
|
+
|
|
20
|
+
2. **Plan the Refactor**
|
|
21
|
+
- Define the target state
|
|
22
|
+
- Break into small, safe steps
|
|
23
|
+
- Identify rollback points
|
|
24
|
+
- Consider feature flags for big changes
|
|
25
|
+
|
|
26
|
+
3. **Refactor Incrementally**
|
|
27
|
+
- One change at a time
|
|
28
|
+
- Run tests after each change
|
|
29
|
+
- Commit at stable points
|
|
30
|
+
- Don't mix refactoring with features
|
|
31
|
+
|
|
32
|
+
4. **Verify Behavior Preservation**
|
|
33
|
+
- Same inputs → same outputs
|
|
34
|
+
- Performance not degraded
|
|
35
|
+
- No breaking changes to API
|
|
36
|
+
|
|
37
|
+
## Refactoring Principles
|
|
38
|
+
|
|
39
|
+
- **No behavior changes**: Refactoring changes structure, not behavior
|
|
40
|
+
- **Small steps**: Each step should be safe to revert
|
|
41
|
+
- **Tests first**: Ensure tests exist before refactoring
|
|
42
|
+
- **One thing at a time**: Don't rename AND restructure in same commit
|
|
43
|
+
|
|
44
|
+
## Common Refactoring Patterns
|
|
45
|
+
|
|
46
|
+
| Pattern | When to Use |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| Extract Function | Repeated code, long functions |
|
|
49
|
+
| Extract Component | Repeated UI patterns |
|
|
50
|
+
| Rename | Names don't reflect purpose |
|
|
51
|
+
| Move | Code in wrong module/file |
|
|
52
|
+
| Replace Conditional with Polymorphism | Complex if/switch chains |
|
|
53
|
+
| Introduce Parameter Object | Too many parameters |
|
|
54
|
+
|
|
55
|
+
## Output Format
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
## Refactoring Plan
|
|
59
|
+
|
|
60
|
+
### Current State
|
|
61
|
+
[Description of current code structure]
|
|
62
|
+
|
|
63
|
+
### Target State
|
|
64
|
+
[What we want to achieve]
|
|
65
|
+
|
|
66
|
+
### Steps
|
|
67
|
+
1. [ ] [First safe step]
|
|
68
|
+
- Risk: Low
|
|
69
|
+
- Verify: [how to verify]
|
|
70
|
+
2. [ ] [Second step]
|
|
71
|
+
- Risk: [level]
|
|
72
|
+
- Verify: [how to verify]
|
|
73
|
+
|
|
74
|
+
### Rollback Plan
|
|
75
|
+
[How to undo if something goes wrong]
|
|
76
|
+
|
|
77
|
+
### Testing
|
|
78
|
+
[What tests to run at each step]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Safety Checklist
|
|
82
|
+
|
|
83
|
+
Before refactoring:
|
|
84
|
+
- [ ] Tests exist and pass
|
|
85
|
+
- [ ] Understand all callers/consumers
|
|
86
|
+
- [ ] Have a rollback plan
|
|
87
|
+
- [ ] Scope is well-defined
|
|
88
|
+
|
|
89
|
+
After refactoring:
|
|
90
|
+
- [ ] All tests still pass
|
|
91
|
+
- [ ] No performance regression
|
|
92
|
+
- [ ] Code is cleaner/simpler
|
|
93
|
+
- [ ] Documentation updated if needed
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Skill: Testing
|
|
2
|
+
|
|
3
|
+
> Writing effective, maintainable tests
|
|
4
|
+
|
|
5
|
+
## When to Activate
|
|
6
|
+
|
|
7
|
+
- Writing new tests
|
|
8
|
+
- Reviewing test coverage
|
|
9
|
+
- Setting up testing infrastructure
|
|
10
|
+
- Improving existing tests
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Test Behavior, Not Implementation**
|
|
15
|
+
- Focus on what code does, not how
|
|
16
|
+
- Tests should survive refactoring
|
|
17
|
+
- Avoid testing private methods directly
|
|
18
|
+
|
|
19
|
+
2. **Follow AAA Pattern**
|
|
20
|
+
```typescript
|
|
21
|
+
it('should do something', () => {
|
|
22
|
+
// Arrange - set up test data
|
|
23
|
+
const input = createTestData();
|
|
24
|
+
|
|
25
|
+
// Act - perform the action
|
|
26
|
+
const result = doSomething(input);
|
|
27
|
+
|
|
28
|
+
// Assert - verify outcome
|
|
29
|
+
expect(result).toEqual(expected);
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. **Write Independent Tests**
|
|
34
|
+
- No shared mutable state
|
|
35
|
+
- Each test can run alone
|
|
36
|
+
- Order doesn't matter
|
|
37
|
+
|
|
38
|
+
4. **Name Tests Clearly**
|
|
39
|
+
- Describe the scenario
|
|
40
|
+
- State the expected outcome
|
|
41
|
+
- `should [do X] when [condition]`
|
|
42
|
+
|
|
43
|
+
## Test Types
|
|
44
|
+
|
|
45
|
+
| Type | Purpose | Speed | Scope |
|
|
46
|
+
|------|---------|-------|-------|
|
|
47
|
+
| Unit | Test single functions/classes | Fast | Narrow |
|
|
48
|
+
| Integration | Test component interactions | Medium | Medium |
|
|
49
|
+
| E2E | Test full user flows | Slow | Wide |
|
|
50
|
+
|
|
51
|
+
## Test Pyramid
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
/\
|
|
55
|
+
/E2E\ Few - critical paths only
|
|
56
|
+
/------\
|
|
57
|
+
/Integration\ Some - key integrations
|
|
58
|
+
/--------------\
|
|
59
|
+
/ Unit \ Many - all logic branches
|
|
60
|
+
/------------------\
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## What to Test
|
|
64
|
+
|
|
65
|
+
### Always Test
|
|
66
|
+
- Happy path (main success scenario)
|
|
67
|
+
- Edge cases (empty, null, max values)
|
|
68
|
+
- Error handling
|
|
69
|
+
- Authorization/authentication
|
|
70
|
+
- Data validation
|
|
71
|
+
|
|
72
|
+
### Consider Testing
|
|
73
|
+
- Error messages are correct
|
|
74
|
+
- Logging happens appropriately
|
|
75
|
+
- Performance-critical paths
|
|
76
|
+
|
|
77
|
+
### Avoid Testing
|
|
78
|
+
- Third-party library internals
|
|
79
|
+
- Simple getters/setters
|
|
80
|
+
- Framework code
|
|
81
|
+
|
|
82
|
+
## Test Quality Checklist
|
|
83
|
+
|
|
84
|
+
- [ ] Tests are independent (no order dependency)
|
|
85
|
+
- [ ] Tests are deterministic (same result every time)
|
|
86
|
+
- [ ] Tests are fast (unit tests < 100ms)
|
|
87
|
+
- [ ] Tests have clear names
|
|
88
|
+
- [ ] Tests have single assertion focus
|
|
89
|
+
- [ ] Mocks are minimal and justified
|
|
90
|
+
|
|
91
|
+
## Example Test Structure
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
describe('UserService', () => {
|
|
95
|
+
describe('createUser', () => {
|
|
96
|
+
it('should create user with valid data', async () => {
|
|
97
|
+
// Arrange
|
|
98
|
+
const userData = { email: 'test@example.com', name: 'Test' };
|
|
99
|
+
|
|
100
|
+
// Act
|
|
101
|
+
const user = await userService.createUser(userData);
|
|
102
|
+
|
|
103
|
+
// Assert
|
|
104
|
+
expect(user.id).toBeDefined();
|
|
105
|
+
expect(user.email).toBe(userData.email);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should throw when email already exists', async () => {
|
|
109
|
+
// Arrange
|
|
110
|
+
await createExistingUser('taken@example.com');
|
|
111
|
+
|
|
112
|
+
// Act & Assert
|
|
113
|
+
await expect(
|
|
114
|
+
userService.createUser({ email: 'taken@example.com', name: 'Test' })
|
|
115
|
+
).rejects.toThrow('Email already exists');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should hash password before storing', async () => {
|
|
119
|
+
// Arrange
|
|
120
|
+
const plainPassword = 'password123';
|
|
121
|
+
|
|
122
|
+
// Act
|
|
123
|
+
const user = await userService.createUser({
|
|
124
|
+
email: 'test@example.com',
|
|
125
|
+
password: plainPassword
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Assert
|
|
129
|
+
expect(user.password).not.toBe(plainPassword);
|
|
130
|
+
expect(await verifyHash(user.password, plainPassword)).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Snippets Index
|
|
2
|
+
|
|
3
|
+
> Small, composable pieces to enhance any prompt
|
|
4
|
+
|
|
5
|
+
## How to Use
|
|
6
|
+
|
|
7
|
+
Append these snippets to any prompt to modify behavior or output format.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Example: Combine debugger with ultrathink
|
|
11
|
+
cat prompts/development/debugger.md snippets/modifiers/ultrathink.md | pbcopy
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Modifiers
|
|
15
|
+
|
|
16
|
+
Change how the AI approaches the task.
|
|
17
|
+
|
|
18
|
+
| Snippet | Effect | When to Use |
|
|
19
|
+
|---------|--------|-------------|
|
|
20
|
+
| [ultrathink.md](modifiers/ultrathink.md) | Deeper analysis | Complex problems |
|
|
21
|
+
| [step-by-step.md](modifiers/step-by-step.md) | Methodical approach | Need visibility |
|
|
22
|
+
| [no-code-yet.md](modifiers/no-code-yet.md) | Planning only | Before implementation |
|
|
23
|
+
| [be-thorough.md](modifiers/be-thorough.md) | Exhaustive analysis | Can't miss anything |
|
|
24
|
+
| [be-ruthless.md](modifiers/be-ruthless.md) | Aggressive cuts | Scope creep |
|
|
25
|
+
| [explain-reasoning.md](modifiers/explain-reasoning.md) | Show logic | Learning/verification |
|
|
26
|
+
|
|
27
|
+
## Output Formats
|
|
28
|
+
|
|
29
|
+
Specify how you want the response structured.
|
|
30
|
+
|
|
31
|
+
| Snippet | Output | When to Use |
|
|
32
|
+
|---------|--------|-------------|
|
|
33
|
+
| [markdown-table.md](output-formats/markdown-table.md) | Tables | Comparisons |
|
|
34
|
+
| [json.md](output-formats/json.md) | JSON | Programmatic use |
|
|
35
|
+
| [checklist.md](output-formats/checklist.md) | Checklists | Actionable items |
|
|
36
|
+
| [numbered-list.md](output-formats/numbered-list.md) | Numbered list | Ordered steps |
|
|
37
|
+
|
|
38
|
+
## Constraints
|
|
39
|
+
|
|
40
|
+
Add boundaries and limitations.
|
|
41
|
+
|
|
42
|
+
| Snippet | Effect | When to Use |
|
|
43
|
+
|---------|--------|-------------|
|
|
44
|
+
| [mvp-only.md](constraints/mvp-only.md) | Minimal scope | Ship fast |
|
|
45
|
+
| [read-only.md](constraints/read-only.md) | No changes | Analysis only |
|
|
46
|
+
| [no-external-deps.md](constraints/no-external-deps.md) | No new packages | Keep simple |
|
|
47
|
+
| [security-first.md](constraints/security-first.md) | Security priority | Sensitive code |
|
|
48
|
+
|
|
49
|
+
## Common Combinations
|
|
50
|
+
|
|
51
|
+
| Task | Snippets |
|
|
52
|
+
|------|----------|
|
|
53
|
+
| Security audit | `be-thorough` + `ultrathink` + `checklist` |
|
|
54
|
+
| Planning | `no-code-yet` + `step-by-step` |
|
|
55
|
+
| Scope cutting | `be-ruthless` + `mvp-only` |
|
|
56
|
+
| Learning | `explain-reasoning` + `step-by-step` |
|
|
57
|
+
| Quick analysis | `read-only` + `markdown-table` |
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# MVP Only
|
|
2
|
+
|
|
3
|
+
> Constrain to minimum viable scope
|
|
4
|
+
|
|
5
|
+
## Snippet
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
MVP only. No nice-to-haves. What's the absolute minimum to deliver value?
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Use when:
|
|
14
|
+
- Time is limited
|
|
15
|
+
- Scope is creeping
|
|
16
|
+
- Need to validate fast
|
|
17
|
+
- Resources are constrained
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Feature Design
|
|
22
|
+
```
|
|
23
|
+
Design a user authentication system.
|
|
24
|
+
|
|
25
|
+
MVP only. No nice-to-haves. What's the absolute minimum to deliver value?
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Implementation
|
|
29
|
+
```
|
|
30
|
+
Implement file upload.
|
|
31
|
+
|
|
32
|
+
MVP only. No nice-to-haves. What's the absolute minimum to deliver value?
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Variations
|
|
36
|
+
|
|
37
|
+
### Time-Boxed
|
|
38
|
+
```
|
|
39
|
+
I have 4 hours. What's the MVP I can ship in that time?
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### V1 Only
|
|
43
|
+
```
|
|
44
|
+
This is v1. What do we absolutely need? Everything else is v2.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 80/20
|
|
48
|
+
```
|
|
49
|
+
Apply the 80/20 rule. What 20% of features deliver 80% of value?
|
|
50
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# No External Dependencies
|
|
2
|
+
|
|
3
|
+
> Avoid adding new dependencies
|
|
4
|
+
|
|
5
|
+
## Snippet
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Do not add new external dependencies. Use only what's already in the project.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Use when:
|
|
14
|
+
- Minimizing bundle size
|
|
15
|
+
- Security concerns about new deps
|
|
16
|
+
- Keeping project simple
|
|
17
|
+
- Vendor restrictions
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Feature Implementation
|
|
22
|
+
```
|
|
23
|
+
Implement date formatting.
|
|
24
|
+
|
|
25
|
+
Do not add new external dependencies. Use only what's already in the project.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Utility Functions
|
|
29
|
+
```
|
|
30
|
+
Create a debounce function.
|
|
31
|
+
|
|
32
|
+
Do not add new external dependencies. Use only what's already in the project.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Variations
|
|
36
|
+
|
|
37
|
+
### Prefer Native
|
|
38
|
+
```
|
|
39
|
+
Use native APIs where possible. Only suggest dependencies as last resort.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Justify Dependencies
|
|
43
|
+
```
|
|
44
|
+
If you recommend a new dependency, explain why it's essential and what alternatives exist.
|
|
45
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Read Only
|
|
2
|
+
|
|
3
|
+
> Analysis only, no changes
|
|
4
|
+
|
|
5
|
+
## Snippet
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Read only. Analyze and report. Do not make any changes to files.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Use when:
|
|
14
|
+
- You want analysis before action
|
|
15
|
+
- Learning about unfamiliar code
|
|
16
|
+
- Need to understand before modifying
|
|
17
|
+
- Review before approval
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Code Review
|
|
22
|
+
```
|
|
23
|
+
Review this pull request.
|
|
24
|
+
|
|
25
|
+
Read only. Analyze and report. Do not make any changes to files.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Codebase Analysis
|
|
29
|
+
```
|
|
30
|
+
Understand this codebase structure.
|
|
31
|
+
|
|
32
|
+
Read only. Analyze and report. Do not make any changes to files.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Variations
|
|
36
|
+
|
|
37
|
+
### Explain Only
|
|
38
|
+
```
|
|
39
|
+
Explain what this code does. Do not modify anything.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Audit Mode
|
|
43
|
+
```
|
|
44
|
+
Audit this code. Report findings only. No fixes yet.
|
|
45
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Security First
|
|
2
|
+
|
|
3
|
+
> Prioritize security in all decisions
|
|
4
|
+
|
|
5
|
+
## Snippet
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Security first. At every decision point, choose the more secure option. Flag any security tradeoffs.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Use when:
|
|
14
|
+
- Building auth/payment features
|
|
15
|
+
- Handling sensitive data
|
|
16
|
+
- Security-critical systems
|
|
17
|
+
- Pre-production review
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Feature Implementation
|
|
22
|
+
```
|
|
23
|
+
Implement user authentication.
|
|
24
|
+
|
|
25
|
+
Security first. At every decision point, choose the more secure option. Flag any security tradeoffs.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Code Review
|
|
29
|
+
```
|
|
30
|
+
Review this API endpoint.
|
|
31
|
+
|
|
32
|
+
Security first. At every decision point, choose the more secure option. Flag any security tradeoffs.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Variations
|
|
36
|
+
|
|
37
|
+
### Paranoid Mode
|
|
38
|
+
```
|
|
39
|
+
Assume attackers are actively trying to exploit this. How do we defend?
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Defense in Depth
|
|
43
|
+
```
|
|
44
|
+
Apply defense in depth. What happens if each security layer fails?
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Security Review
|
|
48
|
+
```
|
|
49
|
+
Review this with a security mindset. What could go wrong? How could this be exploited?
|
|
50
|
+
```
|