ai-ops-cli 0.1.24 → 0.2.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 (61) hide show
  1. package/README.md +107 -45
  2. package/data/presets.yaml +0 -23
  3. package/data/skills/README.md +157 -0
  4. package/data/skills/reference-skills/ai-llm-python-runtime/SKILL.md +10 -0
  5. package/data/skills/reference-skills/ai-llm-python-runtime/references/reference.md +26 -0
  6. package/data/skills/reference-skills/backend-python-fastapi-runtime/SKILL.md +10 -0
  7. package/data/skills/reference-skills/backend-python-fastapi-runtime/references/reference.md +43 -0
  8. package/data/skills/reference-skills/backend-service-standards/SKILL.md +10 -0
  9. package/data/skills/reference-skills/backend-service-standards/references/reference.md +29 -0
  10. package/data/skills/reference-skills/backend-ts-nestjs-runtime/SKILL.md +10 -0
  11. package/data/skills/reference-skills/backend-ts-nestjs-runtime/references/reference.md +43 -0
  12. package/data/skills/reference-skills/data-pipeline-python-performance/SKILL.md +10 -0
  13. package/data/skills/reference-skills/data-pipeline-python-performance/references/reference.md +24 -0
  14. package/data/skills/reference-skills/db-prisma-postgresql/SKILL.md +10 -0
  15. package/data/skills/reference-skills/db-prisma-postgresql/references/reference.md +25 -0
  16. package/data/skills/reference-skills/db-sqlalchemy-postgresql/SKILL.md +10 -0
  17. package/data/skills/reference-skills/db-sqlalchemy-postgresql/references/reference.md +25 -0
  18. package/data/skills/reference-skills/frontend-app-flutter-runtime/SKILL.md +10 -0
  19. package/data/skills/reference-skills/frontend-app-flutter-runtime/references/reference.md +50 -0
  20. package/data/skills/reference-skills/frontend-web-react-next-runtime/SKILL.md +10 -0
  21. package/data/skills/reference-skills/frontend-web-react-next-runtime/references/reference.md +51 -0
  22. package/data/skills/reference-skills/frontend-web-shadcn-ui/SKILL.md +10 -0
  23. package/data/skills/reference-skills/frontend-web-shadcn-ui/references/reference.md +26 -0
  24. package/data/skills/reference-skills/graphql-client-integration/SKILL.md +10 -0
  25. package/data/skills/reference-skills/graphql-client-integration/references/reference.md +22 -0
  26. package/data/skills/reference-skills/graphql-contract/SKILL.md +10 -0
  27. package/data/skills/reference-skills/graphql-contract/references/reference.md +22 -0
  28. package/data/skills/reference-skills/graphql-server-runtime/SKILL.md +10 -0
  29. package/data/skills/reference-skills/graphql-server-runtime/references/reference.md +40 -0
  30. package/data/skills/reference-skills/python-language/SKILL.md +10 -0
  31. package/data/skills/reference-skills/python-language/references/reference.md +26 -0
  32. package/data/skills/reference-skills/typescript-language/SKILL.md +10 -0
  33. package/data/skills/reference-skills/typescript-language/references/reference.md +23 -0
  34. package/data/skills/skill-registry.json +148 -0
  35. package/data/skills/task-skills/skill-load-check/SKILL.md +8 -0
  36. package/data/skills/task-skills/skill-load-check/scripts/loaded.js +1 -0
  37. package/dist/bin/index.js +1263 -307
  38. package/dist/bin/index.js.map +1 -1
  39. package/package.json +1 -1
  40. package/data/rules/ai-llm-python.yaml +0 -35
  41. package/data/rules/data-pipeline-python.yaml +0 -34
  42. package/data/rules/engineering-standards.yaml +0 -39
  43. package/data/rules/fastapi.yaml +0 -34
  44. package/data/rules/flutter.yaml +0 -40
  45. package/data/rules/graphql-client-app.yaml +0 -29
  46. package/data/rules/graphql-client-web.yaml +0 -30
  47. package/data/rules/graphql-core.yaml +0 -31
  48. package/data/rules/graphql-server.yaml +0 -33
  49. package/data/rules/libs-backend-python.yaml +0 -35
  50. package/data/rules/libs-backend-ts.yaml +0 -36
  51. package/data/rules/libs-frontend-app.yaml +0 -39
  52. package/data/rules/libs-frontend-web.yaml +0 -39
  53. package/data/rules/nestjs-graphql.yaml +0 -31
  54. package/data/rules/nestjs.yaml +0 -26
  55. package/data/rules/nextjs.yaml +0 -34
  56. package/data/rules/prisma-postgresql.yaml +0 -30
  57. package/data/rules/python.yaml +0 -31
  58. package/data/rules/react-typescript.yaml +0 -11
  59. package/data/rules/shadcn-ui.yaml +0 -36
  60. package/data/rules/sqlalchemy.yaml +0 -32
  61. package/data/rules/typescript.yaml +0 -22
package/README.md CHANGED
@@ -1,42 +1,38 @@
1
1
  # ai-ops-cli
2
2
 
3
- CLI for managing AI tool rules and presets across projects.
3
+ CLI for managing core AI tool rules and agent skills across projects.
4
4
 
5
5
  ## Why this exists
6
6
 
7
7
  `ai-ops-cli` reduces configuration drift across AI coding tools.
8
8
 
9
- - Different tools use different file layouts and loading models.
10
- - Manual sync across tools is error-prone over time.
11
- - Teams need a deterministic, repeatable setup for AI pair-programming rules.
9
+ - different tools use different file layouts and loading models
10
+ - manual sync across tools is error-prone over time
11
+ - teams need a deterministic setup for shared core rules and installable skills
12
12
 
13
- The CLI uses centralized YAML rules as SSOT and renders tool-native files into the current project.
13
+ The CLI treats these as separate sources of truth:
14
14
 
15
- > **📌 Core Concept**
16
- >
17
- > Instead of directly managing platform-specific files, manage **abstract metadata** as SSOT and achieve **Asset Centralization** across multiple AI environments.
15
+ - `apps/cli/data/rules/*.yaml`: always-loaded core rules only
16
+ - `apps/cli/data/skills/skill-registry.json`: install/catalog metadata for skills
17
+ - `apps/cli/data/skills/reference-skills/<skill-id>/`: installable reference skills
18
+ - `apps/cli/data/skills/task-skills/<skill-id>/`: installable task skills
19
+ - `apps/cli/data/presets.yaml`: preset-to-core-rule mapping
18
20
 
19
21
  ## What this CLI provides
20
22
 
21
- - Interactive installation (`ai-ops init`)
22
- - Source drift checks (`ai-ops diff`)
23
- - Deterministic re-apply (`ai-ops update`)
24
- - Managed cleanup (`ai-ops uninstall`)
25
- - Project-only operation (no global scope)
26
-
27
- ## What this CLI does not provide
28
-
29
- - Hosted backend or remote state
30
- - In-CLI rule authoring UI
31
- - IDE plugin management
23
+ - interactive project initialization (`ai-ops init`)
24
+ - skill package installation and lifecycle management (`ai-ops skill ...`)
25
+ - source drift checks (`ai-ops diff`)
26
+ - deterministic re-apply (`ai-ops update`)
27
+ - managed cleanup (`ai-ops uninstall`)
32
28
 
33
29
  ## Supported tools and output layout
34
30
 
35
- | Tool | Single project output | Monorepo output |
36
- | --- | --- | --- |
37
- | Claude Code (`claude-code`) | `.claude/rules/<rule-id>.md` | Shared rules in `.claude/rules/*.md`, domain rules in `<workspace>/CLAUDE.md` |
38
- | Codex (`codex`) | `AGENTS.md` and `AGENTS.override.md` | Root `AGENTS.md` and `<workspace>/AGENTS.override.md` |
39
- | Gemini CLI (`gemini`) | `GEMINI.md` | Root `GEMINI.md` and `<workspace>/GEMINI.md` |
31
+ | Tool | Project rules output | Skill output |
32
+ | --------------------------- | ----------------------------------------------------- | ---------------------------- |
33
+ | Claude Code (`claude-code`) | `.claude/rules/<rule-id>.md`, `<workspace>/CLAUDE.md` | `.claude/skills/<skill-id>/` |
34
+ | Codex (`codex`) | `AGENTS.md`, `<workspace>/AGENTS.override.md` | `.agents/skills/<skill-id>/` |
35
+ | Gemini CLI (`gemini`) | `GEMINI.md`, `<workspace>/GEMINI.md` | `.agents/skills/<skill-id>/` |
40
36
 
41
37
  Optional settings files:
42
38
 
@@ -53,27 +49,40 @@ npm install -g ai-ops-cli
53
49
  ## Usage
54
50
 
55
51
  ```bash
56
- # Initialize rules for the current project
52
+ # Initialize the current project
57
53
  ai-ops init
58
54
 
59
- # Check drift against current source hash
55
+ # Install a skill globally (user scope by default)
56
+ ai-ops skill install skill-load-check --tool codex
57
+
58
+ # Install a skill only for the current project
59
+ ai-ops skill install skill-load-check --project --tool codex
60
+
61
+ # Inspect or update installed skills
62
+ ai-ops skill list
63
+ ai-ops skill diff
64
+ ai-ops skill update
65
+ ai-ops skill uninstall skill-load-check
66
+
67
+ # Check project drift
60
68
  ai-ops diff
61
69
 
62
- # Re-apply installed rules (or force)
70
+ # Re-apply current project state
63
71
  ai-ops update
64
72
  ai-ops update --force
65
73
 
66
- # Remove installed files and manifest
74
+ # Remove project-managed files
67
75
  ai-ops uninstall
68
76
  ```
69
77
 
70
- ## CLI surface
78
+ ## CLI Surface
71
79
 
72
80
  ```text
73
81
  ai-ops [command]
74
82
 
75
83
  Commands:
76
84
  init Initialize AI tool rules for a project
85
+ skill Manage agent skills
77
86
  update Update installed rules
78
87
  diff Show diff between installed and current rules
79
88
  uninstall Remove installed rules and manifest
@@ -86,32 +95,46 @@ Options:
86
95
 
87
96
  Notes:
88
97
 
89
- - `--scope` is deprecated and explicitly rejected. The CLI is project-only.
90
- - The installation state is tracked in `.ai-ops-manifest.json` at project root.
98
+ - Project installation state is tracked in `.ai-ops-manifest.json`.
99
+ - User-scope skill state is tracked in `~/.ai-ops/skills-manifest.json`.
100
+ - `ai-ops skill` defaults to user scope. Use `--project` to keep a skill local to the current repo.
91
101
 
92
- ## How install/update/uninstall behave
102
+ ## Install / Update / Uninstall Behavior
93
103
 
94
- - Managed files are wrapped in an `ai-ops` section with metadata (`sourceHash`, `generatedAt`).
95
- - If a file already has an `ai-ops` section, only that section is replaced.
96
- - If a file has no managed section, generated content is appended and user content is preserved.
97
- - `uninstall` removes only managed sections for appended files and keeps user-authored content.
104
+ - Managed project rule files are wrapped in an `ai-ops` section with metadata (`sourceHash`, `generatedAt`).
105
+ - If a rule file already has an `ai-ops` section, only that section is replaced.
106
+ - If a rule file has no managed section, generated content is appended and user content is preserved.
107
+ - Skill packages are written into dedicated directories and replaced as full package trees on update.
108
+ - `uninstall` removes only project-managed rule files and project-installed skill directories.
109
+ - User-scope skills are never removed by `ai-ops uninstall`.
98
110
 
99
- ## Init flow summary
111
+ ## Init Flow Summary
100
112
 
101
113
  `ai-ops init` prompts for:
102
114
 
103
115
  1. Tool selection (`claude-code`, `codex`, `gemini`)
104
116
  2. Monorepo confirmation
105
- 3. Preset selection per workspace
106
- 4. Domain rule fine-tuning per workspace
107
- 5. Optional settings installation
117
+ 3. Workspace selection for monorepos
118
+ 4. Preset selection per workspace
119
+ 5. Locked core rules review
120
+ 6. Preset-linked `reference` skills only:
121
+ - already-installed global skills are shown separately
122
+ - only installable skills can be deselected
123
+ 7. One shared install scope for selected installable skills (`user` default or `project`)
124
+ 8. Optional settings installation
125
+
126
+ Important behavior:
108
127
 
109
- Preset and rules are loaded from:
128
+ - core rules come from the preset directly and are not fine-tuned in `init`
129
+ - `init` shows only preset-linked `reference` skills
130
+ - `task` skills are excluded from `init` and are managed with `ai-ops skill install/uninstall`
131
+ - globally available skills are not reinstalled by default
132
+ - when `user` scope is chosen, selected skills are written only to the global skill registry
133
+ - when `project` scope is chosen, selected skills are recorded in `.ai-ops-manifest.json`
110
134
 
111
- - `apps/cli/data/presets.yaml`
112
- - `apps/cli/data/rules/*.yaml`
135
+ Skill authoring rules live in `apps/cli/data/skills/README.md`.
113
136
 
114
- ## Local development
137
+ ## Local Development
115
138
 
116
139
  From repo root:
117
140
 
@@ -129,7 +152,46 @@ npm run build --workspace=apps/cli
129
152
  npm run test --workspace=apps/cli
130
153
  ```
131
154
 
132
- ## Related docs
155
+ ## Local Skill Loading Check
156
+
157
+ Use the built-in `skill-load-check` task skill before publishing to npm.
158
+
159
+ Recommended local flow:
160
+
161
+ ```bash
162
+ # 1. Build the CLI
163
+ npm run build
164
+
165
+ # 2. Use an isolated user home so you do not pollute your real ~/.agents or ~/.claude
166
+ export AI_OPS_HOME="$(mktemp -d)"
167
+
168
+ # 3. Install the sample skill globally
169
+ node apps/cli/dist/bin/index.js skill install skill-load-check --tool codex
170
+
171
+ # 4. Verify files exist
172
+ find "$AI_OPS_HOME/.agents/skills/skill-load-check" -maxdepth 2 -type f | sort
173
+
174
+ # 5. Run the sample script manually
175
+ node "$AI_OPS_HOME/.agents/skills/skill-load-check/scripts/loaded.js"
176
+ ```
177
+
178
+ Expected output:
179
+
180
+ ```text
181
+ A Skill loaded
182
+ ```
183
+
184
+ Project-scope verification:
185
+
186
+ ```bash
187
+ node apps/cli/dist/bin/index.js skill install skill-load-check --project --tool codex
188
+ find ./.agents/skills/skill-load-check -maxdepth 2 -type f | sort
189
+ node ./.agents/skills/skill-load-check/scripts/loaded.js
190
+ ```
191
+
192
+ After file placement is verified, use a real tool prompt that should trigger `skill-load-check` and confirm the tool discovers the skill metadata. If the tool caches skill discovery, restart that tool session before re-checking.
193
+
194
+ ## Related Docs
133
195
 
134
196
  - Master blueprint: [`docs/plan.md`](../../docs/plan.md)
135
197
  - Implementation playbook: [`docs/implementation-playbook.md`](../../docs/implementation-playbook.md)
package/data/presets.yaml CHANGED
@@ -6,13 +6,6 @@ frontend-web:
6
6
  - code-philosophy
7
7
  - plan-mode
8
8
  - naming-convention
9
- - engineering-standards
10
- - typescript
11
- - react-typescript
12
- - shadcn-ui
13
- - nextjs
14
- - graphql
15
- - libs-frontend-web
16
9
 
17
10
  frontend-app:
18
11
  description: '앱 프론트엔드 프로젝트를 위한 프리셋'
@@ -22,10 +15,6 @@ frontend-app:
22
15
  - code-philosophy
23
16
  - plan-mode
24
17
  - naming-convention
25
- - engineering-standards
26
- - flutter
27
- - graphql
28
- - libs-frontend-app
29
18
 
30
19
  backend-ts:
31
20
  description: 'TypeScript 백엔드 프로젝트를 위한 프리셋'
@@ -35,13 +24,6 @@ backend-ts:
35
24
  - code-philosophy
36
25
  - plan-mode
37
26
  - naming-convention
38
- - engineering-standards
39
- - typescript
40
- - nestjs
41
- - prisma-postgresql
42
- - graphql
43
- - nestjs-graphql
44
- - libs-backend-ts
45
27
 
46
28
  backend-python:
47
29
  description: 'Python 백엔드 프로젝트를 위한 프리셋'
@@ -51,8 +33,3 @@ backend-python:
51
33
  - code-philosophy
52
34
  - plan-mode
53
35
  - naming-convention
54
- - engineering-standards
55
- - python
56
- - fastapi
57
- - sqlalchemy
58
- - libs-backend-python
@@ -0,0 +1,157 @@
1
+ # Skill Authoring Guide
2
+
3
+ This directory is the source of truth for installable agent skills.
4
+
5
+ ## Terms
6
+
7
+ ### Reference Skill
8
+
9
+ A `reference skill` is a lazy-loaded knowledge pack.
10
+
11
+ - Canonical detail lives in `references/reference.md`
12
+ - `SKILL.md` stays thin and tells the agent when to use the skill and what to read first
13
+ - Use it for standards, stack guidance, and large domain references
14
+
15
+ ### Task Skill
16
+
17
+ A `task skill` is a procedural workflow.
18
+
19
+ - Canonical procedure lives in `SKILL.md`
20
+ - `references/` is optional supporting material only
21
+ - Use it for repeatable checks, actions, and guided workflows
22
+
23
+ ## Directory Shape
24
+
25
+ ```text
26
+ apps/cli/data/skills/
27
+ README.md
28
+ skill-registry.json
29
+ reference-skills/
30
+ <skill-name>/
31
+ SKILL.md
32
+ agents/ # optional
33
+ references/ # required for reference skills
34
+ assets/ # optional
35
+ scripts/ # optional
36
+ task-skills/
37
+ <skill-name>/
38
+ SKILL.md
39
+ references/ # optional
40
+ assets/ # optional
41
+ scripts/ # optional
42
+ ```
43
+
44
+ ## Authoring Rules
45
+
46
+ 1. Directory name must exactly match frontmatter `name`.
47
+ 2. `SKILL.md` must start with YAML frontmatter.
48
+ 3. `kind`, `supported_tools`, `install_scopes`, preset grouping, and `source_path` live in `skill-registry.json`.
49
+ 4. A `reference` skill must live under `reference-skills/` and include `references/reference.md`.
50
+ 5. A `task` skill must live under `task-skills/` and keep its executable procedure in `SKILL.md`.
51
+ 6. Do not duplicate the same detailed content across `SKILL.md` and `references/`.
52
+ 7. Tool-specific metadata is authored in the skill source and copied as-is by the CLI.
53
+ 8. Codex and Gemini install to `.agents/skills/<skill-name>`. Claude installs to `.claude/skills/<skill-name>`.
54
+ 9. The CLI copies the whole skill directory tree as-is, so any file under `agents/`, `references/`, `assets/`, or `scripts/` is installed unchanged.
55
+
56
+ ## Frontmatter Fields
57
+
58
+ `SKILL.md` frontmatter is now agent-facing only. The CLI validates the required fields below and ignores extra tool-specific frontmatter fields.
59
+
60
+ | Field | Required | Example | Meaning |
61
+ | ------------- | -------- | --------------------------------------------- | ------------------------------------------- |
62
+ | `name` | Yes | `graphql-contract` | Unique skill name and install directory key |
63
+ | `description` | Yes | `Use when changing GraphQL schema contracts.` | Discovery/autotrigger summary |
64
+
65
+ ## Registry Fields
66
+
67
+ `skill-registry.json` is the install/catalog SSOT.
68
+
69
+ | Field | Required | Example | Meaning |
70
+ | --------------------- | -------- | ------------------------------------ | ------------------------------------------------- |
71
+ | `id` | Yes | `graphql-contract` | Canonical skill id |
72
+ | `kind` | Yes | `reference` / `task` | Skill category |
73
+ | `supported_tools` | Yes | `["claude-code", "codex", "gemini"]` | Where the skill may be installed |
74
+ | `install_scopes` | Yes | `["project", "user"]` | Allowed install scopes |
75
+ | `groups` | Yes | `["frontend-web"]` | Display/discovery grouping |
76
+ | `included_in_presets` | Yes | `["frontend-web", "backend-ts"]` | Presets that surface this skill in `ai-ops init` |
77
+ | `source_path` | Yes | `reference-skills/graphql-contract` | Relative directory that contains the skill source |
78
+
79
+ ## Content Placement
80
+
81
+ ### Reference Skill
82
+
83
+ - `SKILL.md`: short routing note
84
+ - `references/reference.md`: full detailed content
85
+
86
+ ### Task Skill
87
+
88
+ - `SKILL.md`: full actionable procedure
89
+ - `references/`: optional background material
90
+ - `scripts/`: optional executable helpers
91
+
92
+ ## Tool-Specific Invocation Control
93
+
94
+ If a skill must be explicit-only, the skill author must add the tool-specific metadata directly.
95
+
96
+ ### Codex
97
+
98
+ Create `agents/openai.yaml` yourself.
99
+
100
+ ```yaml
101
+ allow_implicit_invocation: false
102
+ ```
103
+
104
+ - Use this when Codex should not auto-trigger the skill from the description.
105
+ - Because the CLI copies the full directory tree, `agents/openai.yaml` is installed as-is.
106
+
107
+ ### Claude Code
108
+
109
+ Add `disable-model-invocation: true` to the `SKILL.md` frontmatter yourself.
110
+
111
+ ```yaml
112
+ ---
113
+ name: deploy-script
114
+ description: Runs the deployment workflow.
115
+ disable-model-invocation: true
116
+ ---
117
+ ```
118
+
119
+ - Use this when Claude should only load the skill through explicit `/skill-name` invocation.
120
+ - The CLI preserves this extra frontmatter field and does not generate it for you.
121
+
122
+ ### Gemini CLI
123
+
124
+ Gemini CLI does not currently provide a skill-level frontmatter flag for disabling implicit invocation.
125
+
126
+ - If you need explicit-only behavior in Gemini, use a custom command instead.
127
+ - Do not add a fake Gemini-only field to `SKILL.md`; Gemini will not interpret it.
128
+
129
+ ## Examples
130
+
131
+ ### Reference Skill Skeleton
132
+
133
+ ```text
134
+ reference-skills/graphql-contract/
135
+ SKILL.md
136
+ agents/
137
+ openai.yaml # optional
138
+ references/
139
+ reference.md
140
+ ```
141
+
142
+ ### Task Skill Skeleton
143
+
144
+ ```text
145
+ task-skills/skill-load-check/
146
+ SKILL.md
147
+ scripts/
148
+ loaded.js
149
+ ```
150
+
151
+ ## Temporary Validation Skills
152
+
153
+ `skill-load-check` is an example of a temporary validation skill.
154
+
155
+ - Keep the description narrow and test-focused
156
+ - Keep the body short and procedural
157
+ - It is acceptable to delete this skill later once the install/load workflow is proven
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: ai-llm-python-runtime
3
+ description: Use when implementing LLM workflows in Python, especially structured outputs, retries, prompt versioning, and cost controls.
4
+ ---
5
+
6
+ # AI LLM Python Runtime
7
+
8
+ Use this skill when building Python LLM workflows or runtime integrations.
9
+
10
+ Read `references/reference.md` before changing prompt storage, structured outputs, retries, or token budgeting.
@@ -0,0 +1,26 @@
1
+ # AI LLM Python Runtime
2
+
3
+ ## Constraints
4
+
5
+ - Do not parse model outputs with regex or string splitting when schema output is required.
6
+ - Do not hardcode prompts inline.
7
+ - Do not call sync SDK methods from async application paths.
8
+ - Do not ignore token limits.
9
+ - Do not log raw responses containing PII.
10
+
11
+ ## Guidelines
12
+
13
+ - Use Pydantic-based structured outputs or provider-native schema modes.
14
+ - Apply retry with exponential backoff for transient provider failures.
15
+ - Centralize provider routing through one abstraction layer.
16
+ - Track model, tokens, and latency per call.
17
+ - Version prompts and include the prompt version in logs.
18
+ - Stream user-facing responses when possible.
19
+ - Define fallback model chains for rate limits or provider outages.
20
+
21
+ ## Decision Rules
22
+
23
+ - When output must match a strict schema, use structured output with schema validation.
24
+ - When selecting a model, prefer the smallest model that meets quality requirements.
25
+ - When input exceeds the context window, chunk with overlap and aggregate.
26
+ - When multiple providers are required, route them through one unified abstraction.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-python-fastapi-runtime
3
+ description: Use when implementing FastAPI routes, dependency injection, Python backend libraries, logging, packaging, or service/runtime boundaries.
4
+ ---
5
+
6
+ # Backend Python FastAPI Runtime
7
+
8
+ Use this skill for Python backend service work built on FastAPI.
9
+
10
+ Read `references/reference.md` before changing routers, models, dependency injection, packaging, logging, or test setup.
@@ -0,0 +1,43 @@
1
+ # Backend Python FastAPI Runtime
2
+
3
+ ## FastAPI Constraints
4
+
5
+ - Do not use plain dict or TypedDict as request or response models.
6
+ - Do not run blocking I/O in async handlers.
7
+ - Do not return ad-hoc error dicts from handlers.
8
+ - Do not place business logic in routers.
9
+ - Do not hardcode CORS origins.
10
+
11
+ ## FastAPI Guidelines
12
+
13
+ - Use reusable `Depends()` providers for DB session, auth context, and services.
14
+ - Use `APIRouter` per domain with clear prefixes and tags.
15
+ - Set `response_model` explicitly.
16
+ - Use `Annotated[T, Depends(...)]` for typed dependency injection.
17
+ - Use Pydantic Settings for startup-time env validation.
18
+ - Use lifespan context managers for startup and shutdown.
19
+
20
+ ## Backend Python Library Constraints
21
+
22
+ - Do not use `requirements.txt` as the primary dependency spec.
23
+ - Do not use `print()` for logging.
24
+ - Do not use `unittest.TestCase`.
25
+ - Do not rely on bare `assert` in production code.
26
+
27
+ ## Backend Python Library Guidelines
28
+
29
+ - Use uv for dependency and environment management.
30
+ - Use pytest with pytest-asyncio and pytest-cov.
31
+ - Use httpx for sync and async HTTP clients.
32
+ - Use structlog and bind request-scoped context.
33
+ - Use ruff for lint and format.
34
+ - Use mypy or pyright in strict mode.
35
+ - Use pydantic-settings for env loading and validation.
36
+ - Use tenacity for retry and backoff around transient external calls.
37
+
38
+ ## Decision Rules
39
+
40
+ - When an endpoint is CPU-bound, use `def` and let FastAPI run it in the threadpool.
41
+ - When an endpoint is I/O-bound, use `async def` with async drivers.
42
+ - When shared resources need setup or teardown, use lifespan context managers.
43
+ - When package management is needed, use uv with `pyproject.toml` and a lock file.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-service-standards
3
+ description: Use when designing backend API contracts, service boundaries, request tracing, idempotency, health checks, or graceful shutdown behavior.
4
+ ---
5
+
6
+ # Backend Service Standards
7
+
8
+ Use this skill when the work touches backend API contracts, identifiers, timestamps, request tracing, idempotency, health and readiness endpoints, or graceful shutdown.
9
+
10
+ Read `references/reference.md` and use it as the primary source of truth for detailed standards.
@@ -0,0 +1,29 @@
1
+ # Backend Service Standards
2
+
3
+ ## Constraints
4
+
5
+ - Do not use floating-point for money. Use minor-unit integers with ISO 4217 currency.
6
+ - Do not expose sequential ids in external APIs. Use UUIDs, preferably UUID v7.
7
+ - Do not store or transmit timezone-naive timestamps.
8
+ - Do not use magic numbers or strings inline when the value is policy or protocol relevant.
9
+ - Do not return inconsistent error shapes.
10
+ - Do not accept unbounded input at API boundaries.
11
+
12
+ ## Guidelines
13
+
14
+ - Use UTC end-to-end across API, logs, and persistence.
15
+ - Wrap API responses in a consistent envelope with `data`, `error`, and `meta`.
16
+ - Propagate `X-Request-Id` across gateway, service, logs, DB comments, and outbound calls.
17
+ - Validate environment variables at startup and fail fast.
18
+ - Use domain-specific error codes in `DOMAIN_ACTION_REASON` format.
19
+ - Support `Idempotency-Key` for POST/PATCH where replay safety matters.
20
+ - Expose `GET /health` and `GET /ready` separately.
21
+ - Return empty collections instead of `null`.
22
+ - Handle `SIGTERM` gracefully by stopping intake, draining in-flight work, closing resources, and then exiting.
23
+
24
+ ## Decision Rules
25
+
26
+ - When a new entity needs a primary key, use UUID v7 and avoid auto-increment ids.
27
+ - When an endpoint returns an error, return the standard error envelope and avoid ad-hoc error fields.
28
+ - When systems exchange timestamps, use ISO 8601 UTC in APIs/logs and timezone-aware DB types.
29
+ - When an API needs versioning, prefer URL versioning over header-only versioning.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-ts-nestjs-runtime
3
+ description: Use when implementing NestJS modules, controllers, DTO validation, logging, HTTP clients, or backend TypeScript service structure.
4
+ ---
5
+
6
+ # Backend TS NestJS Runtime
7
+
8
+ Use this skill for TypeScript backend service work built on NestJS.
9
+
10
+ Read `references/reference.md` before changing controllers, modules, validation, logging, HTTP integrations, or service boundaries.
@@ -0,0 +1,43 @@
1
+ # Backend TS NestJS Runtime
2
+
3
+ ## NestJS Constraints
4
+
5
+ - Do not use `@Res()` or `@Response()` for normal route handling.
6
+ - Do not put business logic in controllers.
7
+ - Do not use `forwardRef()` as a default circular dependency fix.
8
+ - Do not read `process.env` directly in services or controllers.
9
+ - Do not use `console.log` for app logging.
10
+
11
+ ## NestJS Guidelines
12
+
13
+ - Organize by feature module.
14
+ - Use DTO validation at request boundaries.
15
+ - Register global validation, filters, and guards in bootstrap.
16
+ - Use custom `HttpException` types for domain failures.
17
+ - Use Swagger decorators for REST contracts.
18
+
19
+ ## Backend TS Library Constraints
20
+
21
+ - Do not use moment/dayjs.
22
+ - Do not use jsonwebtoken.
23
+ - Do not handle Express req/res directly in NestJS handlers.
24
+ - Do not import lodash as a full bundle.
25
+ - Do not use node-fetch/got in NestJS services.
26
+ - Do not use winston, morgan, or console logging.
27
+
28
+ ## Backend TS Library Guidelines
29
+
30
+ - Use class-validator and class-transformer DTO validation.
31
+ - Use jose for JWT sign/verify and JWKS workflows.
32
+ - Use pino via nestjs-pino for structured logs.
33
+ - Use rxjs operators in interceptors, guards, and event streams.
34
+ - Use Vitest with @nestjs/testing and supertest.
35
+ - Use zod outside DTO boundaries.
36
+ - Keep TypeScript strict mode enabled.
37
+
38
+ ## Decision Rules
39
+
40
+ - When auth or roles depend on handler metadata, use guards.
41
+ - When response transformation or timing is needed, use interceptors.
42
+ - When JWT auth is needed, use jose.
43
+ - When structured logging is needed, use pino via nestjs-pino.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: data-pipeline-python-performance
3
+ description: Use when building Python data pipelines that need Polars, DuckDB, schema control, or out-of-core execution.
4
+ ---
5
+
6
+ # Data Pipeline Python Performance
7
+
8
+ Use this skill for Python ETL, analytics pipelines, large dataset transforms, and out-of-core execution work.
9
+
10
+ Read `references/reference.md` before changing dataframe transforms or data processing architecture.
@@ -0,0 +1,24 @@
1
+ # Data Pipeline Python Performance
2
+
3
+ ## Constraints
4
+
5
+ - Do not iterate DataFrame rows in Python loops for core transformations.
6
+ - Do not use Pandas `.apply(axis=1)` for production-scale transforms.
7
+ - Do not load datasets larger than memory in one shot.
8
+ - Do not rely on implicit dtype inference in production pipelines.
9
+ - Do not mutate DataFrames in place.
10
+
11
+ ## Guidelines
12
+
13
+ - Prefer Polars for new pipelines, especially lazy mode.
14
+ - Use DuckDB for local SQL analytics on Parquet/CSV and out-of-core workloads.
15
+ - Use streaming or chunked reads for large sources.
16
+ - Write partitioned Parquet outputs for downstream pruning.
17
+ - Enforce explicit schemas at I/O boundaries.
18
+
19
+ ## Decision Rules
20
+
21
+ - When transforming medium or large tables, prefer Polars lazy pipelines.
22
+ - When ad-hoc SQL analysis on local files is needed, use DuckDB directly on the source files.
23
+ - When data exceeds available memory, use out-of-core execution.
24
+ - When custom per-row logic is unavoidable, use controlled vectorized or mapped APIs rather than general row iteration.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: db-prisma-postgresql
3
+ description: Use when modifying Prisma schemas, transactions, raw queries, indexes, or PostgreSQL migration safety.
4
+ ---
5
+
6
+ # Prisma PostgreSQL
7
+
8
+ Use this skill before changing Prisma schema, raw SQL usage, migration flow, or PostgreSQL transaction settings.
9
+
10
+ Read `references/reference.md` and use it as the detailed persistence guidance.