@ifi/oh-pi-prompts 0.2.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ifiok Jr.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@ifi/oh-pi-prompts",
3
+ "version": "0.2.1",
4
+ "description": "Prompt templates for pi: review, fix, explain, refactor, test, commit, and more.",
5
+ "keywords": [
6
+ "pi-package"
7
+ ],
8
+ "pi": {
9
+ "prompts": [
10
+ "./prompts"
11
+ ]
12
+ },
13
+ "files": [
14
+ "prompts",
15
+ "README.md"
16
+ ],
17
+ "license": "MIT"
18
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Generate a Conventional Commit message for staged changes
3
+ ---
4
+
5
+ Generate a commit message for the current staged changes (`git diff --cached`).
6
+
7
+ Follow Conventional Commits format:
8
+
9
+ ```
10
+ type(scope): description
11
+
12
+ [optional body]
13
+ ```
14
+
15
+ Types: feat, fix, refactor, docs, test, chore, perf, ci, style, build
16
+
17
+ - Keep the subject line under 72 characters
18
+ - Use imperative mood ("add" not "added")
19
+ - Body explains WHY, not WHAT (the diff shows what)
20
+
21
+ $@
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Generate or update documentation
3
+ ---
4
+
5
+ Generate documentation for the following code. Include:
6
+
7
+ 1. **Overview** — What it does and why it exists
8
+ 2. **API** — Functions/methods with parameters, return types, examples
9
+ 3. **Usage** — How to use it with code examples
10
+ 4. **Configuration** — Available options and defaults
11
+ 5. **Error handling** — What errors can occur and how to handle them
12
+
13
+ Match the project's existing documentation style. Use JSDoc/docstrings as appropriate.
14
+
15
+ $@
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Explain code or concept clearly, from simple to detailed
3
+ ---
4
+
5
+ Explain the following code or concept. Structure your explanation as:
6
+
7
+ 1. **One-liner** — What it does in one sentence
8
+ 2. **How it works** — Step-by-step walkthrough
9
+ 3. **Why** — Design decisions and trade-offs
10
+ 4. **Edge cases** — What could go wrong
11
+
12
+ Adjust depth to the complexity. Use analogies when helpful.
13
+
14
+ $@
package/prompts/fix.md ADDED
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Fix the current error or bug with minimal changes
3
+ ---
4
+
5
+ Fix the error/bug described below. Follow these principles:
6
+
7
+ 1. **Minimal change** — Only modify what's necessary to fix the issue
8
+ 2. **Root cause** — Fix the underlying cause, not just the symptom
9
+ 3. **No regressions** — Ensure existing behavior is preserved
10
+ 4. **Explain** — Briefly explain what caused the bug and why your fix works
11
+
12
+ $@
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Optimize code for performance
3
+ ---
4
+
5
+ Optimize the following code for performance. Approach:
6
+
7
+ 1. **Measure first** — Identify the actual bottleneck
8
+ 2. **Algorithm** — Can we use a better data structure or algorithm?
9
+ 3. **I/O** — Reduce network calls, disk reads, unnecessary allocations
10
+ 4. **Caching** — What can be memoized or cached?
11
+ 5. **Concurrency** — Can work be parallelized?
12
+
13
+ Show before/after with expected improvement. Don't sacrifice readability for micro-optimizations.
14
+
15
+ $@
package/prompts/pr.md ADDED
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Generate a pull request description
3
+ ---
4
+
5
+ Generate a PR description based on the changes in this branch (`git log --oneline main..HEAD` and
6
+ `git diff main`).
7
+
8
+ Structure:
9
+
10
+ ## What
11
+
12
+ Brief description of the change.
13
+
14
+ ## Why
15
+
16
+ Motivation and context.
17
+
18
+ ## How
19
+
20
+ Implementation approach and key decisions.
21
+
22
+ ## Testing
23
+
24
+ How this was tested.
25
+
26
+ ## Checklist
27
+
28
+ - [ ] Tests added/updated
29
+ - [ ] Documentation updated
30
+ - [ ] No breaking changes (or documented)
31
+
32
+ $@
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Refactor code while preserving behavior
3
+ ---
4
+
5
+ Refactor the following code. Goals:
6
+
7
+ 1. **Preserve behavior** — No functional changes
8
+ 2. **Reduce complexity** — Simplify logic, extract functions if needed
9
+ 3. **Improve naming** — Clear, descriptive names
10
+ 4. **Remove duplication** — DRY without over-abstracting
11
+ 5. **Follow conventions** — Match the project's existing style
12
+
13
+ Show the refactored code with a brief explanation of each change.
14
+
15
+ $@
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Review code for bugs, security issues, and improvements
3
+ ---
4
+
5
+ Review the code I'm about to share (or the current file). Focus on:
6
+
7
+ 1. **Bugs & Logic Errors** — Off-by-one, null/undefined, race conditions
8
+ 2. **Security** — Injection, auth bypass, data exposure, hardcoded secrets
9
+ 3. **Error Handling** — Missing try/catch, unhandled promises, silent failures
10
+ 4. **Performance** — N+1 queries, unnecessary re-renders, memory leaks
11
+ 5. **Readability** — Naming, complexity, dead code
12
+
13
+ For each issue found, provide:
14
+
15
+ - Severity (🔴 Critical / 🟡 Warning / 🔵 Info)
16
+ - Location (file:line)
17
+ - Problem description
18
+ - Suggested fix
19
+
20
+ $@
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Security audit following OWASP guidelines
3
+ ---
4
+
5
+ Perform a security audit on the following code. Check for:
6
+
7
+ 1. **Injection** — SQL, XSS, command injection, path traversal
8
+ 2. **Authentication** — Weak auth, missing checks, session issues
9
+ 3. **Authorization** — Privilege escalation, IDOR, missing access control
10
+ 4. **Data Exposure** — Sensitive data in logs/responses, hardcoded secrets
11
+ 5. **Configuration** — Debug mode, default credentials, CORS misconfiguration
12
+ 6. **Dependencies** — Known vulnerable packages
13
+
14
+ Rate each finding: 🔴 Critical / 🟠 High / 🟡 Medium / 🔵 Low Provide remediation for each.
15
+
16
+ $@
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Generate tests for the specified code
3
+ ---
4
+
5
+ Write tests for the following code. Requirements:
6
+
7
+ 1. **Detect framework** — Use the project's existing test framework (Jest, Vitest, pytest, Go test,
8
+ etc.)
9
+ 2. **Cover** — Happy path, edge cases, error cases
10
+ 3. **Naming** — Descriptive test names that explain the scenario
11
+ 4. **Isolation** — Mock external dependencies
12
+ 5. **Assertions** — Specific assertions, not just "no error"
13
+
14
+ $@