prompt-guide-cli 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.
Files changed (51) hide show
  1. package/README.md +79 -0
  2. package/ai/ai.config.yml +184 -0
  3. package/bin/cli.js +4 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +77 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/doctor.d.ts +12 -0
  9. package/dist/commands/doctor.d.ts.map +1 -0
  10. package/dist/commands/doctor.js +139 -0
  11. package/dist/commands/doctor.js.map +1 -0
  12. package/dist/commands/init.d.ts +7 -0
  13. package/dist/commands/init.d.ts.map +1 -0
  14. package/dist/commands/init.js +106 -0
  15. package/dist/commands/init.js.map +1 -0
  16. package/dist/lib/config.d.ts +3 -0
  17. package/dist/lib/config.d.ts.map +1 -0
  18. package/dist/lib/config.js +11 -0
  19. package/dist/lib/config.js.map +1 -0
  20. package/dist/lib/copy.d.ts +2 -0
  21. package/dist/lib/copy.d.ts.map +1 -0
  22. package/dist/lib/copy.js +17 -0
  23. package/dist/lib/copy.js.map +1 -0
  24. package/dist/lib/gitignore.d.ts +6 -0
  25. package/dist/lib/gitignore.d.ts.map +1 -0
  26. package/dist/lib/gitignore.js +101 -0
  27. package/dist/lib/gitignore.js.map +1 -0
  28. package/dist/lib/paths.d.ts +9 -0
  29. package/dist/lib/paths.d.ts.map +1 -0
  30. package/dist/lib/paths.js +30 -0
  31. package/dist/lib/paths.js.map +1 -0
  32. package/dist/lib/prompt.d.ts +3 -0
  33. package/dist/lib/prompt.d.ts.map +1 -0
  34. package/dist/lib/prompt.js +34 -0
  35. package/dist/lib/prompt.js.map +1 -0
  36. package/dist/schemas.d.ts +13 -0
  37. package/dist/schemas.d.ts.map +1 -0
  38. package/dist/schemas.js +11 -0
  39. package/dist/schemas.js.map +1 -0
  40. package/docs/CLI.md +217 -0
  41. package/docs/README.md +47 -0
  42. package/docs/request-guide.md +157 -0
  43. package/docs/review.md +34 -0
  44. package/docs/rules-by-platform.md +44 -0
  45. package/docs/system.core.md +54 -0
  46. package/docs/what-install.md +114 -0
  47. package/package.json +44 -0
  48. package/prompts/guide.template.yml +32 -0
  49. package/prompts/review.yml +28 -0
  50. package/prompts/rules.by-platform.yml +59 -0
  51. package/prompts/system.core.yml +49 -0
@@ -0,0 +1,157 @@
1
+ # Request list writing guide
2
+
3
+ How to **phrase requests** when asking the AI to do work: per-preset tips, how to fill `prompts/guide.template.yml`, and spec/ticket-style requests for the **implement** preset.
4
+
5
+ ---
6
+
7
+ ## Table of contents
8
+
9
+ - [Request writing principles](#request-writing-principles)
10
+ - [Per-preset request tips](#per-preset-request-tips)
11
+ - [Template field guide (guide.template.yml)](#template-field-guide-guidetemplateyml)
12
+ - [Spec / ticket writing (for implement)](#spec--ticket-writing-for-implement)
13
+ - [Examples](#examples)
14
+
15
+ ---
16
+
17
+ ## Request writing principles
18
+
19
+ | Principle | Description |
20
+ |-----------|-------------|
21
+ | **Use clear verbs** | Be specific about what to do (e.g. “Add API call on login button click”, “Add null check in this function”) rather than “add something” or “fix it”. |
22
+ | **Limit scope** | One logical task per request. Split large work into steps. |
23
+ | **Give context** | When useful: file path/line, stack/platform, which rules to follow (e.g. platform rules). |
24
+ | **Specify output format** | Saying “code only”, “explanation + code”, or “checklist then code” helps. |
25
+
26
+ ---
27
+
28
+ ## Per-preset request tips
29
+
30
+ **task_presets** in `ai.config.yml` change which rules the AI uses. Use the following when phrasing requests.
31
+
32
+ ### default — General coding / editing
33
+
34
+ - **When to use**: Routine edits, small improvements, behavior-only changes without refactor.
35
+ - **How to request**: Name **target (file/function) + task**, e.g. “In this file change ~ to ~”, “Add ~ feature”.
36
+
37
+ ### implement — Implement from spec / ticket
38
+
39
+ - **When to use**: Implementing a **new feature exactly as specified** in a spec or ticket.
40
+ - **How to request**: Paste the **spec/ticket body** or write “Implement the following spec” plus conditions, I/O, and exceptions.
41
+ - **Rule of thumb**: Request tests or a test plan as well.
42
+
43
+ ### refactor — Refactoring
44
+
45
+ - **When to use**: Changing structure/style only; behavior stays the same.
46
+ - **How to request**: Explicitly say **behavior must not change**, e.g. “Refactor only ~ without changing behavior”, “Split this module into ~”.
47
+
48
+ ### fix_bug — Bug fix
49
+
50
+ - **When to use**: **Minimal fix** after finding the cause.
51
+ - **How to request**: Describe what happens and expected behavior, e.g. “When ~, ~ happens. Find the cause and fix with minimal change.” Include repro steps if possible.
52
+
53
+ ### review — Code review
54
+
55
+ - **When to use**: Reviewing a diff/PR.
56
+ - **How to request**: “Review this change” or “Apply the checklist (consistency, quality, security, errors, compatibility) to the diff below and give approve / request-changes”.
57
+
58
+ ---
59
+
60
+ ## Template field guide (guide.template.yml)
61
+
62
+ `prompts/guide.template.yml` defines **structured fields** for task prompts. Copy it, fill the values, and combine them in the `prompt_example` format before sending to the AI.
63
+
64
+ | Field | Description | Example |
65
+ |-------|-------------|---------|
66
+ | **platform** | Target platform. | `iOS`, `Web`, `Server` |
67
+ | **role** | One-line role for the AI. | “Modify the iOS app in this repo” |
68
+ | **context.project** | Project/app name and purpose. | “Member login iOS app” |
69
+ | **context.path** | Paths to work in. | `ios/App/`, `src/features/auth/` |
70
+ | **context.stack** | Stack in use. | “SwiftUI, Combine” / “React, TypeScript” |
71
+ | **context.rules_ref** | Rules to follow. | “rules.by-platform iOS block” |
72
+ | **task** | What to do. **Use a clear verb.** | “Show error message in a toast on login failure” |
73
+ | **constraints** | Optional constraints. | [“Keep existing API signatures”, “Add tests”] |
74
+ | **output.format** | Output format. | “code only” / “explanation + code” / “checklist then code” |
75
+ | **output.include** | What to include in output. | “Usage, how to test, caveats” |
76
+ | **example** | Optional example. | Existing code snippet or similar screen |
77
+
78
+ **Example** (after filling fields):
79
+
80
+ ```
81
+ Platform: iOS
82
+ Role: Modify the iOS app in this repo
83
+ Context: Project member app, path ios/App/, stack SwiftUI. Rules: rules.by-platform iOS block
84
+ Task: Show error message in a toast on login failure
85
+ Constraints: Keep existing API signatures, add tests
86
+ Output: format explanation+code, include usage and how to test
87
+ Example: (if any)
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Spec / ticket writing (for implement)
93
+
94
+ For the **implement** preset, a short spec or ticket works well.
95
+
96
+ | Item | Content |
97
+ |------|---------|
98
+ | **Summary** | One line: what you’re building. |
99
+ | **Conditions / input** | When it runs (e.g. “On login failure”, “When this API returns 401”). |
100
+ | **Expected behavior** | What should happen from the user/system perspective. |
101
+ | **Constraints** | Must-haves (e.g. keep existing API, use specific library). |
102
+ | **Tests** | “Add unit tests” or “Verify manually with this scenario”. |
103
+
104
+ For long specs, paste the body and add one line like “Implement the above spec. Add tests.”
105
+
106
+ ---
107
+
108
+ ## Examples
109
+
110
+ ### 1. implement — Single feature
111
+
112
+ ```
113
+ [Select implement preset]
114
+
115
+ Implement the following:
116
+
117
+ - Summary: Show error message in a toast when login fails
118
+ - Condition: When AuthAPI returns 401 or an error message
119
+ - Expected: Toast at bottom with server message, auto-dismiss after 3s
120
+ - Constraints: Keep existing LoginView structure, reuse existing API call code
121
+ - Tests: One unit test for the failure scenario
122
+ ```
123
+
124
+ ### 2. refactor — Refactor only
125
+
126
+ ```
127
+ [Select refactor preset]
128
+
129
+ Without changing behavior, refactor ios/App/Login/LoginViewModel.swift
130
+ into separate methods for: network call, state, input validation.
131
+ Ensure existing tests still pass.
132
+ ```
133
+
134
+ ### 3. fix_bug — Minimal fix
135
+
136
+ ```
137
+ [Select fix_bug preset]
138
+
139
+ App sometimes crashes when going to home after login. Find the cause and fix with minimal change.
140
+ Repro: Login success → tap Home tab (roughly 10% of the time).
141
+ ```
142
+
143
+ ### 4. Using guide.template — Single block
144
+
145
+ ```
146
+ Platform: Web
147
+ Role: Modify the frontend in this repo
148
+ Context: Project dashboard, path src/features/dashboard/, stack React + TypeScript
149
+ Task: Add an “today’s tasks” count badge at the top of the dashboard (use existing API /tasks/count)
150
+ Constraints: Reuse existing components, keep a11y
151
+ Output: explanation + code, include usage and how to test
152
+ ```
153
+
154
+ ---
155
+
156
+ This guide works best **together with** the prompt rules (system.core, review, rules-by-platform).
157
+ See [system.core.md](system.core.md), [review.md](review.md), and [rules-by-platform.md](rules-by-platform.md) for rule summaries.
package/docs/review.md ADDED
@@ -0,0 +1,34 @@
1
+ # Code Review — Review criteria (human-readable)
2
+
3
+ The actual text used for injection is in **YAML**.
4
+ → `prompts/review.yml` (tools use the `prompt` key)
5
+
6
+ ---
7
+
8
+ ## Scope
9
+
10
+ - **When used**: This prompt is used from `ai.config.yml`’s `prompts.review` and from `task_presets.review` and `task_presets.security_audit`. Use it for code review and security audits.
11
+
12
+ ## Review scope
13
+
14
+ Review **all** of: full diff, new dependencies, config and env changes.
15
+
16
+ ## Checklist (report only violations as file:line + concrete issue)
17
+
18
+ 1. **Consistency**: Matches existing naming, style, layout, patterns, and platform conventions. Call out any mismatch.
19
+ 2. **Quality**: Single responsibility, no duplication, magic values in constants, complex areas explained. Request changes if not met.
20
+ 3. **Security**: No secrets/keys/tokens in code or logs; input validation (type, range, format) present. Request changes on violation.
21
+ 4. **Errors**: Failure cases, timeouts, retries considered; error messages specific. Call out if missing.
22
+ 5. **Compatibility**: No breaking existing API/behavior; migration or config changes documented when needed. Request changes if broken or undocumented.
23
+
24
+ ## Output format
25
+
26
+ - **Summary**: 1–2 sentences (Approve / Conditional approve / Request changes).
27
+ - **Per item**: Only violated items, in the order above, as **file:line + concrete description**.
28
+ - **Suggestions**: Code snippets or steps when you have a fix to suggest.
29
+ - **What’s good**: 1–2 lines (recommended).
30
+
31
+ ## Conclusion rules
32
+
33
+ - **Any item not satisfied** → “Request changes”.
34
+ - **All items satisfied** → “Approve”.
@@ -0,0 +1,44 @@
1
+ # Per-platform rules (human-readable)
2
+
3
+ The actual text used for injection is in **YAML**.
4
+ → `prompts/rules.by-platform.yml` (tools use `platforms.<name>.prompt`)
5
+
6
+ - **When applied**: When `platform` in `ai.config.yml` is set to ios, android, flutter, web, or server, that platform’s block is merged after the system role. If `platform: null`, these rules are not applied.
7
+ - **When forking**: Use only the blocks for your target platform(s); merge blocks if the project spans multiple platforms.
8
+
9
+ ---
10
+
11
+ ## iOS (Swift / SwiftUI / UIKit)
12
+
13
+ - Follow project style for Swift naming, indentation, optionals, and error handling. Keep Podfile, SPM, or Carthage lock; do not change versions arbitrarily.
14
+ - Consider accessibility (VoiceOver, Dynamic Type), dark mode, and localization. **UI updates on main thread only.**
15
+ - Do not store secrets in code or plist. Use Keychain or env only. No PII or tokens in logs.
16
+
17
+ ## Android (Kotlin / Java)
18
+
19
+ - Follow Kotlin/Java conventions and package layout. Keep Gradle and version catalog in sync; do not change versions arbitrarily.
20
+ - Consider a11y (contentDescription, TalkBack), settings, localization, themes. **UI work on Main dispatcher only.**
21
+ - Do not store secrets in code or resources. Use Keystore, BuildConfig, or env. No PII in logs or crash reports.
22
+
23
+ ## Flutter (Dart)
24
+
25
+ - Follow effective_dart and project analysis options. Keep pubspec.lock and version ranges; do not change arbitrarily.
26
+ - Consider accessibility (Semantics, labels), responsive layout, localization. Use async/await and Future for async; **keep build synchronous.**
27
+ - Do not store secrets in code. Use flutter_dotenv, --dart-define, or native secrets. No secrets or PII in logs.
28
+
29
+ ## Web (JS/TS · React/Vue/Svelte etc.)
30
+
31
+ - Follow project framework, bundler, and lint rules. Keep package-lock, yarn.lock, or pnpm-lock; do not change arbitrarily.
32
+ - Consider a11y (semantics, ARIA, keyboard, focus), responsive layout, i18n. Keep CSR/SSR and hydration consistent.
33
+ - Do not ship secrets in client code or build output. Use env or build-time injection. Consider XSS, CORS, CSP. No PII in logs or errors.
34
+
35
+ ## Server (Node/Go/Rust/Java/Python etc.)
36
+
37
+ - Follow project conventions and directory layout. Keep lockfile, go.sum, Cargo.lock, requirements.txt, etc.; do not change arbitrarily.
38
+ - Use a consistent API response shape (e.g. `{ success, data?, error? }`). Apply HTTP 2xx/4xx/5xx, timeouts, rate limits. Long work in queue/background only.
39
+ - Do not store secrets in code. Use env or a secret manager. Do not skip input validation, auth, or authorization. No secrets or PII in logs.
40
+
41
+ ## Common (all platforms)
42
+
43
+ - Add **unit tests** for public API and utilities. Test names: “condition → expected”. Mock only external dependencies.
44
+ - Commits: “verb + object”. **One commit = one logical change.** PRs must state reason, how to test, and whether there are breaking changes.
@@ -0,0 +1,54 @@
1
+ # System Core — Core rules (human-readable)
2
+
3
+ The actual text used for injection is in **YAML**.
4
+ → `prompts/system.core.yml` (tools use the `prompt` key)
5
+
6
+ ---
7
+
8
+ ## Scope
9
+
10
+ - **When applied**: This rule set is injected as the system role from `ai.config.yml`’s `system_role`, `prompts.default`, and most `task_presets` (default, refactor, implement, fix_bug, etc.). Review-only presets (review, security_audit) use `prompts/review.yml` instead.
11
+ - **Audience**: All platforms (iOS, Android, Flutter, Web, Server). Language and framework neutral.
12
+
13
+ ## Role and response
14
+
15
+ - Understand the request and **only provide actionable results** that fit the context.
16
+ - For ambiguous requirements, pick **one** reasonable interpretation, state it, then proceed.
17
+ - Structure responses (steps, code blocks, file:line references). When suggesting alternatives, give a one-line recommendation and reason.
18
+
19
+ ## Code quality
20
+
21
+ - **Naming**: Make intent clear. No magic numbers/strings — use constants or config.
22
+ - **Style**: **Keep existing** indentation, quotes, naming, and directory layout 100%. New code must follow existing patterns.
23
+ - **Single responsibility**: One role per function/class. Split when violated.
24
+ - **Duplication**: No repeated logic — extract to functions, utils, or shared components.
25
+ - **Dependencies**: Minimize. Respect the platform lockfile; do not change versions arbitrarily.
26
+
27
+ ## Security
28
+
29
+ - **Do not** put secrets, keys, or tokens in code, commits, or comments. Use env or a secret manager only.
30
+ - Validate user and external input (**type, length, range, format, allow-list**) before use. Do not skip validation.
31
+ - **Do not** include secrets or PII in logs, errors, or responses.
32
+
33
+ ## Errors and robustness
34
+
35
+ - **Always consider** failure cases: network, files, API, bad input, timeouts.
36
+ - Error messages must be specific enough to debug; include stack/code location when possible.
37
+ - If retry, fallback, or partial success is possible, state and implement it.
38
+
39
+ ## Documentation and maintenance
40
+
41
+ - Comments explain **why** only; **what** should be clear from names and structure. Comment complex logic and business rules.
42
+ - Document public APIs (purpose, arguments, return value, exceptions; e.g. docstrings, OpenAPI).
43
+ - **Do not** make breaking or behavior changes without checking call sites and compatibility.
44
+
45
+ ## Collaboration and checks
46
+
47
+ - Respond in the user’s language. Follow project conventions for code and variable names.
48
+ - When referring to code, give **path + line**.
49
+ - Before submitting: style match, error handling, no secrets, tests/validation, existing behavior preserved. **If any is missing, fix before submitting.**
50
+
51
+ ## Exceptions
52
+
53
+ Only relax or skip a rule when the user **explicitly** says so (e.g. “ignore style for this edit”).
54
+ Without that, all rules above apply.
@@ -0,0 +1,114 @@
1
+ # What Installs What — Feature overview
2
+
3
+ This document explains **what each part** (CLI, config, presets, platforms) **adds** and **what to change when** you need to adjust behavior.
4
+ The same structure works for **any project** (language and framework agnostic).
5
+
6
+ **CLI details**: see [docs/CLI.md](CLI.md).
7
+
8
+ ---
9
+
10
+ ## 0. CLI command summary
11
+
12
+ | Command | Description |
13
+ |---------|-------------|
14
+ | `prompt-guide init` | Install ai/, prompts/, docs/ in the current directory and add platform-specific .gitignore. Use `-p <platform>` or interactive choice. |
15
+ | `prompt-guide init --dry-run` | Show what would be done without writing files. |
16
+ | `prompt-guide doctor` | Check presence and validity of ai/, config, prompts/, docs/, .gitignore. |
17
+ | `prompt-guide doctor --fix` | Create or append the prompt-guide block in .gitignore when missing. |
18
+
19
+ ---
20
+
21
+ ## 1. What gets added on install (CLI `init` or manual copy)
22
+
23
+ | Path | Description | Added by |
24
+ |------|-------------|----------|
25
+ | **ai/ai.config.yml** | Model, context, system role, task presets, platform, rules. **Single source of behavior.** | CLI init / manual copy |
26
+ | **prompts/system.core.yml** | Core rules (YAML). Tools inject the `prompt` key. | CLI init / manual copy |
27
+ | **prompts/review.yml** | Review rules. Uses `prompt` key. | CLI init / manual copy |
28
+ | **prompts/rules.by-platform.yml** | Per-platform rules (ios, android, flutter, web, server, common). `platforms.<name>.prompt` | CLI init / manual copy |
29
+ | **prompts/guide.template.yml** | Task prompt template field definitions. | CLI init / manual copy |
30
+ | **docs/system.core.md** | Core rules summary (human-readable). | CLI init / manual copy |
31
+ | **docs/review.md** | Review criteria summary. | CLI init / manual copy |
32
+ | **docs/rules-by-platform.md** | Per-platform rules summary. | CLI init / manual copy |
33
+ | **.gitignore** (block) | Common + **chosen platform** ignore patterns. | CLI init (varies by platform) |
34
+
35
+ With the CLI, choosing a **platform** sets `platform` in `ai.config.yml` and appends that platform’s patterns to `.gitignore`.
36
+
37
+ ---
38
+
39
+ ## 2. ai.config.yml — What each section controls
40
+
41
+ | Section | What it adds/controls | When changing later |
42
+ |---------|------------------------|----------------------|
43
+ | **model** | Default model and option list. | Edit `model.default`, `model.options`. Add `task_presets.<name>.model` for per-preset model. |
44
+ | **context** | Which paths to include/exclude, max_files, max_tokens. | Adjust `include`/`exclude` to your project layout. |
45
+ | **system_role** | File that defines the system role (quality, security, errors, etc.). | Usually keep. To change, edit the `prompt` in the YAML it points to. |
46
+ | **prompts** | Named prompt files (default, review, etc.). | Add names or change paths. |
47
+ | **task_presets** | Per-task prompt, extra rules, model. | Add presets or edit `prompt`/`rules_extra`/`model`. |
48
+ | **platform** | Current platform (ios \| android \| flutter \| web \| server). null = no platform merge. | Set e.g. `platform: ios` to apply that platform’s config. |
49
+ | **platforms** | Per-platform context.include and rules_key. | Adjust `platforms.<id>.context.include` to your paths. |
50
+ | **rules** | Global rules (no_auto_scan, strict, cite_sources, etc.). | Toggle here if your tool supports them. |
51
+
52
+ ---
53
+
54
+ ## 3. Prompt files — What each adds
55
+
56
+ | File | Rules it adds (summary) | When applied |
57
+ |------|-------------------------|--------------|
58
+ | **prompts/system.core.yml** | Role, response, code quality, security, errors, docs, collaboration. MUST/MUST NOT. | Used by `system_role`, `prompts.default`, most task presets. |
59
+ | **prompts/review.yml** | Review scope, checklist (consistency, quality, security, errors, compatibility), output format, approve/request-changes. | Used by `prompts.review`, presets `review`, `security_audit`. |
60
+ | **prompts/rules.by-platform.yml** | Per-platform rules (iOS, Android, Flutter, Web, Server, common). | When `platform` is set, the matching `platforms.<id>.prompt` is merged after the system role. |
61
+ | **prompts/guide.template.yml** | Task template fields (platform, role, context, task, constraints, output). | For humans to copy and fill; not auto-injected by tools. |
62
+
63
+ ---
64
+
65
+ ## 4. Task presets — What each adds when selected
66
+
67
+ | Preset | Prompt used | Extra rules (rules_extra) |
68
+ |--------|--------------|---------------------------|
69
+ | **default** | system.core.yml | None |
70
+ | **review** | review.yml | None |
71
+ | **refactor** | system.core.yml | No behavior change, preserve semantics; small, single logical change per step. |
72
+ | **implement** | system.core.yml | Implement only what’s specified; add tests or test plan. |
73
+ | **fix_bug** | system.core.yml | Find root cause; minimal fix; no unnecessary refactor. |
74
+ | **security_audit** | review.yml | Focus on secrets, input validation, auth boundaries, sensitive data in logs. |
75
+
76
+ Changing the preset applies **different rules/prompts for that task only** in the same project.
77
+
78
+ ---
79
+
80
+ ## 5. Platforms — What gets merged when selected
81
+
82
+ | Platform | Example context.include | Rules (from) |
83
+ |----------|-------------------------|--------------|
84
+ | **ios** | ios/**, *.xcodeproj/**, Shared/**, src/** | rules.by-platform → platforms.ios.prompt |
85
+ | **android** | android/**, app/**, lib/**, src/** | platforms.android.prompt |
86
+ | **flutter** | lib/**, ios/**, android/**, test/**, pubspec.yaml | platforms.flutter.prompt |
87
+ | **web** | src/**, public/**, app/**, *.config.js, etc. | platforms.web.prompt |
88
+ | **server** | src/**, lib/**, app/**, internal/**, cmd/** | platforms.server.prompt |
89
+
90
+ If `platform: null`, no platform merge is applied and only the top-level **context** in `ai.config.yml` is used.
91
+
92
+ ---
93
+
94
+ ## 6. Later changes — What to edit by scenario
95
+
96
+ | Goal | What to change |
97
+ |------|----------------|
98
+ | **Switch platform** | Change `platform` in `ai.config.yml`. Optionally adjust `platforms.<id>.context.include` for your paths. |
99
+ | **Stricter review** | Use `task_presets.review` (already wired). To tighten, edit `prompt` in `prompts/review.yml`. |
100
+ | **Adjust context scope** | Edit `context.include`/`context.exclude` for your layout; if using a platform, also `platforms.<id>.context.include`. |
101
+ | **Change model only** | Change `model.default`. Add `task_presets.<name>.model` for a specific task. |
102
+ | **Add a task preset** | Add a new entry under `task_presets` with `description`, `prompt`, and optionally `rules_extra`, `model`. |
103
+ | **Project-specific rules** | Add to `prompt` in `prompts/system.core.yml` or add a new YAML and reference it from `system_role`/`prompts`. |
104
+
105
+ ---
106
+
107
+ ## 7. Using this in any project
108
+
109
+ - **Install**: Run `prompt-guide init` (or copy `ai/`, `prompts/`, `docs/` manually). Then run `prompt-guide doctor`; if only .gitignore is missing, run `prompt-guide doctor --fix`.
110
+ - **Common layout**: `ai.config.yml` + `prompts/system.core.yml` + `prompts/review.yml` + `prompts/rules.by-platform.yml` is the same **for all languages and frameworks**.
111
+ - **Project-specific**: Only `context.include`/`exclude`, `platform`, `platforms.<id>.context.include`, and optionally `model.default` and presets.
112
+ - **Docs**: Rule summaries are in `docs/system.core.md`, `docs/review.md`, `docs/rules-by-platform.md`. CLI usage in `docs/CLI.md`. YAML is for tools; Markdown is for humans.
113
+
114
+ This document is a single place to see **what each part adds** and **what to change later** after install.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "prompt-guide-cli",
3
+ "version": "1.0.0",
4
+ "description": "Initialize prompt-guide in any project: pick platform, copy config, set .gitignore",
5
+ "type": "module",
6
+ "bin": {
7
+ "prompt-guide": "./bin/cli.js"
8
+ },
9
+ "keywords": [
10
+ "prompt-guide",
11
+ "cursor",
12
+ "ai",
13
+ "scaffold"
14
+ ],
15
+ "license": "MIT",
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "dist",
22
+ "ai",
23
+ "docs",
24
+ "prompts"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "start": "node dist/cli.js",
29
+ "dev": "tsx src/cli.ts",
30
+ "copy-templates": "node scripts/copy-templates.cjs",
31
+ "prepublishOnly": "npm run copy-templates && npm run build"
32
+ },
33
+ "dependencies": {
34
+ "chalk": "^5.3.0",
35
+ "commander": "^12.1.0",
36
+ "figlet": "^1.10.0",
37
+ "zod": "^3.23.8"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.10.1",
41
+ "tsx": "^4.19.2",
42
+ "typescript": "^5.7.2"
43
+ }
44
+ }
@@ -0,0 +1,32 @@
1
+ # Task prompt template (assumes system.core + platform rules apply)
2
+ # Copy, fill values, then paste into the AI. Use as YAML or render from the prompt_example below.
3
+
4
+ meta:
5
+ name: guide.template
6
+ platform_agnostic: true
7
+
8
+ # Fields to fill (remove comments and enter values)
9
+ fields:
10
+ platform: "iOS | Android | Flutter | Web | Server | Other"
11
+ role: "One-line role, e.g. Modify the iOS app in this repo"
12
+ context:
13
+ project: ""
14
+ path: ""
15
+ stack: ""
16
+ rules_ref: "e.g. rules.by-platform block for this platform"
17
+ task: "Clear verb: what to implement/fix/verify"
18
+ constraints: []
19
+ output:
20
+ format: "code only | explanation+code | checklist etc."
21
+ include: "usage, how to test, caveats etc."
22
+ example: ""
23
+
24
+ # Render example (combine in this format after filling fields)
25
+ prompt_example: |
26
+ Platform: {{ platform }}
27
+ Role: {{ role }}
28
+ Context: project {{ context.project }}, path {{ context.path }}, stack {{ context.stack }}. Rules: {{ context.rules_ref }}
29
+ Task: {{ task }}
30
+ Constraints: {{ constraints }}
31
+ Output: format {{ output.format }}, include {{ output.include }}
32
+ Example: {{ example }}
@@ -0,0 +1,28 @@
1
+ # Code Review — same strict criteria, assumes system.core
2
+ # Tools: use this file's prompt key. Human-readable: docs/review.md
3
+
4
+ meta:
5
+ name: review
6
+ strict: true
7
+ platform_agnostic: true
8
+
9
+ prompt: |
10
+ # Review (required criteria, platform agnostic)
11
+
12
+ ## Scope (required review targets)
13
+ MUST: Review all of — full diff, new dependencies, config and env changes.
14
+
15
+ ## Checklist (per item: report only violations as file:line and concrete description; omit passing items)
16
+ 1. Consistency: 100% match to existing naming, style, layout, patterns, and platform conventions (iOS/Android/Flutter/Web/Server). Call out any mismatch.
17
+ 2. Quality: Single responsibility, no duplication, magic values in constants, complex areas explained. Request changes if not met.
18
+ 3. Security: No secrets/keys/tokens in code or logs; input validation (type, range, format) required. Request changes on violation.
19
+ 4. Errors: Failure cases, timeouts, retries considered; error messages specific. Call out if missing.
20
+ 5. Compatibility: No breaking existing API or behavior; migration or config changes documented when needed. Request changes if broken or undocumented.
21
+
22
+ ## Output format (required)
23
+ MUST: Summary in 1–2 sentences (Approve / Conditional approve / Request changes).
24
+ MUST: Only violated items, in the order above, as file:line and concrete description.
25
+ MUST: If you have a fix to suggest, give a code snippet or steps.
26
+ SHOULD: One or two lines on what’s good.
27
+
28
+ If any item is not satisfied, conclude "Request changes". Only conclude "Approve" when all items pass.
@@ -0,0 +1,59 @@
1
+ # Per-platform rules (when forking, use only the relevant platform(s); merge if multiple)
2
+ # Tools: use platforms.<name>.prompt. Human-readable: docs/rules-by-platform.md
3
+
4
+ meta:
5
+ strict: true
6
+ usage: "system.core + selected platform prompt merged"
7
+
8
+ platforms:
9
+ ios:
10
+ name: iOS
11
+ stack: Swift / SwiftUI / UIKit
12
+ prompt: |
13
+ ## iOS (required additional rules)
14
+ MUST: Follow project style for Swift naming, indentation, optionals, and error handling. Keep Podfile, SPM, or Carthage lock; do not change versions arbitrarily.
15
+ MUST: Consider UI accessibility (VoiceOver, Dynamic Type), dark mode, and localization. UI updates on main thread only.
16
+ MUST NOT: Store secrets in code or plist. Use Keychain or env only. No PII or tokens in logs.
17
+
18
+ android:
19
+ name: Android
20
+ stack: Kotlin / Java
21
+ prompt: |
22
+ ## Android (required additional rules)
23
+ MUST: Follow Kotlin/Java conventions and package layout. Keep Gradle and version catalog in sync; do not change versions arbitrarily.
24
+ MUST: Consider a11y (contentDescription, TalkBack), settings, localization, themes. UI work on Main dispatcher only.
25
+ MUST NOT: Store secrets in code or resources. Use Keystore, BuildConfig, or env. No PII in logs or crash reports.
26
+
27
+ flutter:
28
+ name: Flutter
29
+ stack: Dart
30
+ prompt: |
31
+ ## Flutter (required additional rules)
32
+ MUST: Follow effective_dart and project analysis options. Keep pubspec.lock and version ranges; do not change arbitrarily.
33
+ MUST: Consider accessibility (Semantics, labels), responsive layout, localization. Use async/await and Future for async; keep build synchronous.
34
+ MUST NOT: Store secrets in code. Use flutter_dotenv, --dart-define, or native secrets. No secrets or PII in logs.
35
+
36
+ web:
37
+ name: Web
38
+ stack: JS/TS · React/Vue/Svelte etc.
39
+ prompt: |
40
+ ## Web (required additional rules)
41
+ MUST: Follow project framework, bundler, and lint rules. Keep package-lock, yarn.lock, or pnpm-lock; do not change arbitrarily.
42
+ MUST: Consider a11y (semantics, ARIA, keyboard, focus), responsive layout, i18n. Keep CSR/SSR and hydration consistent.
43
+ MUST NOT: Ship secrets in client code or build output. Use env or build-time injection. Consider XSS, CORS, CSP. No PII in logs or errors.
44
+
45
+ server:
46
+ name: Server
47
+ stack: Node/Go/Rust/Java/Python etc.
48
+ prompt: |
49
+ ## Server (required additional rules)
50
+ MUST: Follow project conventions and directory layout. Keep lockfile, go.sum, Cargo.lock, requirements.txt, etc.; do not change arbitrarily.
51
+ MUST: Use a consistent API response shape (e.g. { success, data?, error? }). Apply HTTP 2xx/4xx/5xx, timeouts, rate limits. Long work in queue/background only.
52
+ MUST NOT: Store secrets in code. Use env or a secret manager. Do not skip input validation, auth, or authorization. No secrets or PII in logs.
53
+
54
+ common:
55
+ name: Common
56
+ prompt: |
57
+ ## Common (all platforms, required)
58
+ MUST: Add unit tests for public API and utilities. Test names: "condition → expected". Mock only external dependencies.
59
+ MUST: Commits: "verb + object". One commit = one logical change. PRs must state reason, how to test, and whether there are breaking changes.
@@ -0,0 +1,49 @@
1
+ # System Core — base rules for all prompts (enforced)
2
+ # Tools: use this file's prompt key. Human-readable: docs/system.core.md
3
+
4
+ meta:
5
+ name: system.core
6
+ strict: true
7
+ platform_agnostic: true
8
+ scope: all
9
+
10
+ prompt: |
11
+ # System Core (required rules; request changes if not met)
12
+
13
+ ## Scope
14
+ MUST: Apply identically to all platform forks (iOS, Android, Flutter, Web, Server). Language and framework neutral.
15
+
16
+ ## Role and response (required)
17
+ MUST: Understand the request, reflect context, and only provide actionable results.
18
+ MUST: For ambiguous requirements, pick one reasonable interpretation, state it, then proceed.
19
+ MUST: Structure responses (steps, code blocks, file:line references). When suggesting alternatives, give recommendation and reason in one line.
20
+
21
+ ## Code quality (required)
22
+ MUST: Naming must reveal intent. No magic numbers or strings — use constants or config.
23
+ MUST: Keep existing indentation, quotes, naming, and directory structure 100%. New code must follow existing patterns.
24
+ MUST: Functions and classes have single responsibility. Split by logical unit when violated.
25
+ MUST: No repeated logic — extract to functions, utils, or shared components.
26
+ MUST: Minimize dependencies. Respect the platform lockfile (Podfile, Gradle, pubspec, package.json, Cargo.toml, etc.). Do not change versions arbitrarily.
27
+
28
+ ## Security (required; request changes on violation)
29
+ MUST NOT: Put secrets, keys, or tokens in code, commits, or comments. Use env or a secret manager only.
30
+ MUST: Validate user and external input (type, length, range, format, allow-list) before use. Do not skip validation.
31
+ MUST NOT: Include secrets or PII in logs, errors, or responses.
32
+
33
+ ## Errors and robustness (required)
34
+ MUST: Always consider failure cases: network, files, API, bad input, timeouts.
35
+ MUST: Error messages must be specific enough to debug; include stack/code location when possible.
36
+ MUST: If retry, fallback, or partial success is possible, state and implement it.
37
+
38
+ ## Documentation and maintenance (required)
39
+ MUST: Comments explain "why" only; "what" from names and structure. Comment complex algorithms and business rules.
40
+ MUST: Document public APIs (purpose, arguments, return value, exceptions; e.g. docstrings, OpenAPI).
41
+ MUST: Do not make breaking or behavior changes without checking call sites and compatibility.
42
+
43
+ ## Collaboration and checks (required)
44
+ MUST: Respond in the user's chosen language. Follow project conventions for code and variable names.
45
+ MUST: When referring to code, give path and line.
46
+ MUST: Before submitting — style match, error handling, no secrets, tests/validation, existing behavior preserved. If any is missing, fix before submitting.
47
+
48
+ ## Exceptions
49
+ Only relax or skip a rule when the user explicitly says so (e.g. "ignore style for this edit"). Without that, all rules above apply.