instant-python 0.21.0__py3-none-any.whl → 0.23.0__py3-none-any.whl
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.
- instant_python/__init__.py +1 -1
- instant_python/metrics/delivery/metrics_middleware.py +3 -1
- instant_python/shared/supported_built_in_features.py +2 -0
- instant_python/templates/boilerplate/{.pre-commit-config.yml → .pre-commit-config.yaml} +1 -1
- instant_python/templates/boilerplate/agents/AGENTS.md +226 -0
- instant_python/templates/boilerplate/agents/adr-guidelines.md +73 -0
- instant_python/templates/boilerplate/agents/commands/code-review.md +36 -0
- instant_python/templates/boilerplate/agents/commands/commit.md +62 -0
- instant_python/templates/boilerplate/agents/commands/security-review.md +22 -0
- instant_python/templates/boilerplate/agents/commands/technical-debt-review.md +33 -0
- instant_python/templates/boilerplate/agents/design-doc-guidelines.md +185 -0
- instant_python/templates/boilerplate/agents/skills/adr/SKILL.md +34 -0
- instant_python/templates/boilerplate/agents/skills/complexity-review/REFERENCE.md +630 -0
- instant_python/templates/boilerplate/agents/skills/complexity-review/SKILL.md +406 -0
- instant_python/templates/boilerplate/agents/skills/design-doc/SKILL.md +42 -0
- instant_python/templates/boilerplate/agents/skills/hamburger-method/REFERENCE.md +586 -0
- instant_python/templates/boilerplate/agents/skills/hamburger-method/SKILL.md +262 -0
- instant_python/templates/boilerplate/agents/skills/micro-steps-coach/REFERENCE.md +570 -0
- instant_python/templates/boilerplate/agents/skills/micro-steps-coach/SKILL.md +354 -0
- instant_python/templates/boilerplate/agents/skills/mutation-testing/SKILL.md +744 -0
- instant_python/templates/boilerplate/agents/skills/story-splitting/REFERENCE.md +115 -0
- instant_python/templates/boilerplate/agents/skills/story-splitting/SKILL.md +429 -0
- instant_python/templates/boilerplate/agents/skills/test-desiderata/REFERENCE.md +391 -0
- instant_python/templates/boilerplate/agents/skills/test-desiderata/SKILL.md +192 -0
- instant_python/templates/boilerplate/agents/skills/xp-refactor/SKILL.md +37 -0
- instant_python/templates/boilerplate/github/ci.yml +8 -8
- instant_python/templates/boilerplate/github/dependabot.yml +62 -0
- instant_python/templates/boilerplate/github/pages.yml +63 -0
- instant_python/templates/boilerplate/github/release.yml +2 -2
- instant_python/templates/boilerplate/mkdocs.yml +70 -0
- instant_python/templates/boilerplate/pyproject.toml +52 -5
- instant_python/templates/boilerplate/scripts/makefile +25 -1
- instant_python/templates/project_structure/agents/agents.yml +129 -0
- instant_python/templates/project_structure/clean_architecture/main_structure.yml +4 -4
- instant_python/templates/project_structure/documentation/documentation.yml +14 -0
- instant_python/templates/project_structure/domain_driven_design/main_structure.yml +4 -4
- instant_python/templates/project_structure/github/github_action.yml +11 -1
- instant_python/templates/project_structure/github/precommit_hook.yml +2 -2
- instant_python/templates/project_structure/standard_project/main_structure.yml +4 -4
- {instant_python-0.21.0.dist-info → instant_python-0.23.0.dist-info}/METADATA +17 -1
- {instant_python-0.21.0.dist-info → instant_python-0.23.0.dist-info}/RECORD +44 -20
- {instant_python-0.21.0.dist-info → instant_python-0.23.0.dist-info}/WHEEL +1 -1
- instant_python/templates/boilerplate/pytest.ini +0 -10
- instant_python/templates/project_structure/config_files/pytest.yml +0 -4
- {instant_python-0.21.0.dist-info → instant_python-0.23.0.dist-info}/entry_points.txt +0 -0
- {instant_python-0.21.0.dist-info → instant_python-0.23.0.dist-info}/licenses/LICENSE +0 -0
instant_python/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.23.0"
|
|
@@ -37,6 +37,8 @@ class MetricsMiddleware(TyperGroup):
|
|
|
37
37
|
|
|
38
38
|
def _send_success_metrics(self, config_path: Path, config_snapshot: ConfigSnapshot, ctx: Context) -> None:
|
|
39
39
|
config_snapshot = self._retake_config_snapshot_if_needed(config_snapshot, config_path)
|
|
40
|
+
if config_snapshot.is_unknown():
|
|
41
|
+
return
|
|
40
42
|
command = self._extract_executed_command(ctx)
|
|
41
43
|
self._send_metrics_data(command, config_snapshot)
|
|
42
44
|
|
|
@@ -53,7 +55,7 @@ class MetricsMiddleware(TyperGroup):
|
|
|
53
55
|
|
|
54
56
|
@staticmethod
|
|
55
57
|
def _extract_config_path(ctx: Context) -> Path:
|
|
56
|
-
if ctx.args and
|
|
58
|
+
if ctx.args and ("--config" in ctx.args or "-c" in ctx.args):
|
|
57
59
|
return (
|
|
58
60
|
Path(ctx.args[ctx.args.index("--config") + 1])
|
|
59
61
|
if "--config" in ctx.args
|
|
@@ -14,6 +14,8 @@ class SupportedBuiltInFeatures(str, Enum):
|
|
|
14
14
|
PRECOMMIT = "precommit_hook"
|
|
15
15
|
CITATION = "citation_file"
|
|
16
16
|
SECURITY = "security_file"
|
|
17
|
+
AI_AGENTS = "ai_agents"
|
|
18
|
+
DOCS = "custom_documentation"
|
|
17
19
|
|
|
18
20
|
@classmethod
|
|
19
21
|
def get_supported_built_in_features(cls) -> list[str]:
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# AI Agent Development Rules
|
|
2
|
+
|
|
3
|
+
## 1. Core Principles
|
|
4
|
+
|
|
5
|
+
- **Baby Steps**: Always work in baby steps, one at a time. Never go forward more than one step.
|
|
6
|
+
- **Test-Driven Development**: Start with a failing test for any new functionality (TDD).
|
|
7
|
+
- **Progressive Revelation**: Never show all the code at once; only the next step.
|
|
8
|
+
- **Type Safety**: All code must be fully typed.
|
|
9
|
+
- **Simplicity First**: Use the simplest working solution; avoid unnecessary abstractions.
|
|
10
|
+
- **Small Components**: Classes and methods should be small.
|
|
11
|
+
- **Clear Naming**: Use clear, descriptive names for all variables and functions.
|
|
12
|
+
- **Incremental Changes**: Prefer incremental, focused changes over large, complex modifications.
|
|
13
|
+
- **Question Assumptions**: Always question assumptions and inferences.
|
|
14
|
+
- **Refactoring Awareness**: Highlight opportunities for refactoring and flag functions exceeding 20 lines.
|
|
15
|
+
- **Pattern Detection**: Detect and highlight repeated code patterns.
|
|
16
|
+
|
|
17
|
+
## 2. Code Quality & Coverage
|
|
18
|
+
|
|
19
|
+
- **MANDATORY Validation**: Before EVERY commit, run `make lint` and `make format`. Zero tolerance.
|
|
20
|
+
- **Quality Requirements**: The project has strict requirements for code quality and maintainability.
|
|
21
|
+
- **High Coverage**: All code must have very high test coverage; strive for 100% where practical.
|
|
22
|
+
- **Pre-commit Checks**: All code must pass the following before any commit:
|
|
23
|
+
- `make check-typing`
|
|
24
|
+
- `make check-format`
|
|
25
|
+
- `make check-lint`
|
|
26
|
+
- **TDD Workflow**: Test-Driven Development (TDD) is the default workflow: always write tests first.
|
|
27
|
+
- **OOP Design**: Use Object-Oriented Programming (OOP) for all components and features.
|
|
28
|
+
|
|
29
|
+
## 3. Style Guidelines
|
|
30
|
+
|
|
31
|
+
- **Natural Expression**: Express all reasoning in a natural, conversational internal monologue.
|
|
32
|
+
- **Progressive Building**: Use progressive, stepwise building: start with basics, build on previous points, break down complex thoughts.
|
|
33
|
+
- **Simple Communication**: Use short, simple sentences that mirror natural thought patterns.
|
|
34
|
+
- **Avoid Rushing**: Never rush to conclusions; frequently reassess and revise.
|
|
35
|
+
- **Seek Clarification**: If in doubt, always ask for clarification before proceeding.
|
|
36
|
+
- **Self-Documenting Code**: Avoid comments in code; rely on self-documenting names. Eliminate superficial comments (Arrange/Act/Assert, describing obvious code behavior, historical references that Git already manages).
|
|
37
|
+
|
|
38
|
+
## 4. Output Format Requirements
|
|
39
|
+
|
|
40
|
+
- **Contemplation Phase**: Every response must begin with a <CONTEMPLATOR> section: show all work, doubts, and natural thought progression.
|
|
41
|
+
- **Final Answer**: Only provide a <FINAL_ANSWER> if reasoning converges to a clear conclusion.
|
|
42
|
+
- **No Skipping**: Never skip the contemplation phase.
|
|
43
|
+
- **No Moralizing**: Never include moralizing warnings in the final answer.
|
|
44
|
+
- **Progress Indicators**: When outlining plans, use numbers/metrics and emojis to indicate progress.
|
|
45
|
+
|
|
46
|
+
## 5. Process & Key Requirements
|
|
47
|
+
|
|
48
|
+
- **Extensive Contemplation**: Never skip the extensive contemplation phase.
|
|
49
|
+
- **Show Work**: Show all work and thinking.
|
|
50
|
+
- **Embrace Uncertainty**: Embrace uncertainty and revision.
|
|
51
|
+
- **Persistence**: Persist through multiple attempts until resolution.
|
|
52
|
+
- **Thorough Iteration**: Break down complex thoughts and iterate thoroughly.
|
|
53
|
+
- **Sequential Questions**: Only one question at a time; each question should build on previous answers.
|
|
54
|
+
|
|
55
|
+
## 6. Mental Preparation
|
|
56
|
+
|
|
57
|
+
- **Contemplative Walk**: Before every response, take a contemplative walk through the woods.
|
|
58
|
+
- **Deep Reflection**: Use this time for deep reflection on the query.
|
|
59
|
+
- **Confirmation**: Confirm completion of this preparatory walk before proceeding.
|
|
60
|
+
|
|
61
|
+
## 7. Language Standards
|
|
62
|
+
|
|
63
|
+
- **Communication Flexibility**: Team communication can be conducted in Spanish or English for convenience and comfort.
|
|
64
|
+
- **English-Only Artifacts**: All technical artifacts must always use English, including:
|
|
65
|
+
- Code (variables, functions, classes, comments)
|
|
66
|
+
- Documentation (README, guides, API docs)
|
|
67
|
+
- Jira tickets (titles, descriptions, comments)
|
|
68
|
+
- Data schemas and database names
|
|
69
|
+
- Configuration files and scripts
|
|
70
|
+
- Git commit messages
|
|
71
|
+
- Test names and descriptions
|
|
72
|
+
- **Professional Consistency**: This ensures global collaboration, tool compatibility, and industry best practices.
|
|
73
|
+
|
|
74
|
+
## 8. Documentation Standards
|
|
75
|
+
|
|
76
|
+
- **User-Focused README**: README.md must be user-focused, containing only information relevant to table authors and end users.
|
|
77
|
+
- **Separate Dev Docs**: All technical documentation and conventions must be maintained in `docs/adrs/`
|
|
78
|
+
- **Separate Design Docs**: All design decisions, feature specifications, and architectural discussions must be maintained in `docs/design_docs/`
|
|
79
|
+
- **Error Examples**: User-facing documentation should include example error messages for common validation failures to help users quickly resolve issues.
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
docs/adrs/
|
|
83
|
+
├── adr-guidelines.md # This file. Standard for documenting conventions
|
|
84
|
+
├── database/ # Database-related conventions (planned)
|
|
85
|
+
├── testing/ # Testing-related conventions (planned)
|
|
86
|
+
├── ...
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 9. Development Best Practices
|
|
90
|
+
|
|
91
|
+
### Error Handling & Debugging
|
|
92
|
+
- **Graceful Error Handling**: Always implement proper error handling with meaningful error messages.
|
|
93
|
+
- **Debugging First**: When encountering issues, use debugging tools and logging before asking for help.
|
|
94
|
+
- **Error Context**: Provide sufficient context in error messages to enable quick problem resolution.
|
|
95
|
+
- **Fail Fast**: Design code to fail fast and fail clearly when errors occur.
|
|
96
|
+
|
|
97
|
+
### Code Review & Collaboration
|
|
98
|
+
- **Pair Programming**: Prefer pairing sessions for complex features and knowledge sharing.
|
|
99
|
+
- **Small Pull Requests**: Keep changes small and focused for easier review and faster integration.
|
|
100
|
+
- **Code Review Standards**: All code must be reviewed before merging, following project quality standards.
|
|
101
|
+
- **Knowledge Sharing**: Document decisions and share context with team members.
|
|
102
|
+
|
|
103
|
+
### Security Considerations
|
|
104
|
+
- **Security by Design**: Consider security implications in all design decisions.
|
|
105
|
+
- **Input Validation**: Always validate and sanitize user inputs and external data.
|
|
106
|
+
- **Secrets Management**: Never hardcode secrets; use proper secret management systems.
|
|
107
|
+
- **Dependency Security**: Regularly update dependencies and monitor for security vulnerabilities.
|
|
108
|
+
|
|
109
|
+
### Testing Strategy Distinction
|
|
110
|
+
- **Unit Tests**: Fast, isolated tests for individual components (majority of test suite).
|
|
111
|
+
- **Integration Tests**: Test interactions between components and external systems (limited, focused).
|
|
112
|
+
- **E2E Tests**: Full system validation (minimal, critical user paths only).
|
|
113
|
+
- **Test Pyramid**: Follow the test pyramid - many unit tests, some integration tests, few E2E tests.
|
|
114
|
+
|
|
115
|
+
## 10. Test-Driven Development Rules
|
|
116
|
+
|
|
117
|
+
### TDD Approach
|
|
118
|
+
- **Failing Test First**: Always start with a failing test before implementing new functionality.
|
|
119
|
+
- **Single Test**: Write only one test at a time; never create more than one test per change.
|
|
120
|
+
- **Complete Coverage**: Ensure every new feature or bugfix is covered by a test.
|
|
121
|
+
|
|
122
|
+
### Test Structure & Style
|
|
123
|
+
- **Test Runner**: Use pytest as the test runner.
|
|
124
|
+
- **Assertion Library**: Use the expects library for assertions (BDD style).
|
|
125
|
+
- **Mocking**: Use doublex and doublex-expects for mocking and spy assertions if functionality is synchronous. For asynchronous code, use pytest-asyncio and appropriate async mocking tools.
|
|
126
|
+
- **Type Hints**: All test functions and helpers must have full type hints.
|
|
127
|
+
- **Focused Tests**: Keep each test focused and under 20 lines.
|
|
128
|
+
- **Clear Naming**: Use clear, descriptive names for test functions and variables.
|
|
129
|
+
- **No Comments**: Avoid comments; make code self-documenting through naming.
|
|
130
|
+
- **Simple Helpers**: Use helper methods (e.g., object mothers/factories) for repeated setup, but keep them simple and typed.
|
|
131
|
+
- **Strategic Mocking Rule**: Use `@patch` from unittest.mock ONLY for Python system modules (readline, atexit, subprocess, sys, os, etc.). Use doublex for all application code mocking. This provides clear separation: system modules = @patch, application code = doublex.
|
|
132
|
+
|
|
133
|
+
### Test Simplicity & Maintainability
|
|
134
|
+
- **Simplest Setup**: Prefer the simplest test setup that covers the requirement.
|
|
135
|
+
- **Refactor Tests**: Refactor tests to remove duplication and improve readability.
|
|
136
|
+
- **Consistent Assertions**: Use one assertion style (expects) consistently throughout the suite.
|
|
137
|
+
- **Extract Helpers**: If a test setup is repeated, extract a helper or fixture.
|
|
138
|
+
- **Readable Tests**: Always keep tests readable and easy to modify.
|
|
139
|
+
|
|
140
|
+
### Test Process & Output
|
|
141
|
+
- **Single Test Display**: Only show one test at a time; never present multiple tests in a single step.
|
|
142
|
+
- **Single File Display**: Never show more than one file at a time.
|
|
143
|
+
- **Self-Contained Tests**: Each test should be self-contained and not depend on the order of execution.
|
|
144
|
+
- **Clarify Requirements**: If in doubt about requirements, ask for clarification before writing the test.
|
|
145
|
+
- **Verify Failure**: After writing a test, run it to ensure it fails before implementing the feature.
|
|
146
|
+
- **Automatic Test Running**: After every code or test change, always run the relevant tests using the appropriate Makefile target. Do not ask for permission to run tests—just do it.
|
|
147
|
+
|
|
148
|
+
### Test Naming & Coverage
|
|
149
|
+
- **Descriptive Names**: Test function names should clearly describe the scenario and expected outcome.
|
|
150
|
+
- **Purpose-Driven Variables**: Use descriptive variable names that reflect their purpose in the test.
|
|
151
|
+
- **Incremental Coverage**: Ensure all code paths and edge cases are eventually covered by tests, but add them incrementally.
|
|
152
|
+
|
|
153
|
+
### Test Review & Refactoring
|
|
154
|
+
- **Post-Pass Review**: After a test passes, review for opportunities to simplify or clarify.
|
|
155
|
+
- **Helper Refactoring**: Refactor test helpers and fixtures as needed to keep the suite DRY and maintainable.
|
|
156
|
+
|
|
157
|
+
These guides are the canonical resources for writing and maintaining tests in this project.
|
|
158
|
+
|
|
159
|
+
## 11. Makefile Targets Usage
|
|
160
|
+
|
|
161
|
+
### Core Rule
|
|
162
|
+
**NEVER** call tools like `pytest`, `black`, `mypy`, or similar directly. Always use the corresponding `make` target.
|
|
163
|
+
|
|
164
|
+
### Available Make Targets
|
|
165
|
+
- `make help` — Show this help.
|
|
166
|
+
- `make local-setup` — Setup git hooks and install dependencies.
|
|
167
|
+
- `make install` — Install dependencies.
|
|
168
|
+
- `make update` — Update dependencies.
|
|
169
|
+
- `make add-dep dep="pkg --group X"` — Add a new dependency.
|
|
170
|
+
- `make remove-dep dep="pkg --group X"` — Remove a dependency.
|
|
171
|
+
- `make test` — Run all tests.
|
|
172
|
+
- `make unit` — Run unit tests.
|
|
173
|
+
- `make integration` — Run integration tests.
|
|
174
|
+
- `make acceptance` — Run acceptance tests.
|
|
175
|
+
- `make coverage` — Run tests with coverage report.
|
|
176
|
+
- `make check-typing` — Run mypy type checking.
|
|
177
|
+
- `make check-lint` — Run ruff linting check.
|
|
178
|
+
- `make lint` — Apply ruff linting fixes.
|
|
179
|
+
- `make check-format` — Run ruff format check.
|
|
180
|
+
- `make format` — Apply ruff format fixes.
|
|
181
|
+
- `make watch` — Run tests on every change (watch mode).
|
|
182
|
+
- `make up` — Create and start Docker containers.
|
|
183
|
+
- `make down` — Stop and remove Docker containers.
|
|
184
|
+
- `make run` — Run the application with uvicorn.
|
|
185
|
+
- `make migration` — Generate a new alembic migration.
|
|
186
|
+
- `make migrate` — Apply alembic migrations.
|
|
187
|
+
- `make autostyle` — Apply all code style fixes (format + lint).
|
|
188
|
+
- `make show` — Show installed dependencies tree.
|
|
189
|
+
- `make search` — Search package details.
|
|
190
|
+
- `make audit` — Run security audit on dependencies.
|
|
191
|
+
- `make secrets` — Check for secrets in source code.
|
|
192
|
+
|
|
193
|
+
### Usage Rules
|
|
194
|
+
1. **Testing**: When running tests, use `make test-unit` or `make test-e2e` as appropriate.
|
|
195
|
+
2. **Formatting**: For formatting, use `make format` or `make check-format`.
|
|
196
|
+
3. **Type Checking**: For type checking, use `make check-typing`.
|
|
197
|
+
4. **Lint Checks**: For lint checks, use `make check-lint`.
|
|
198
|
+
5. **Building**: For building or updating the app, use `make build` or `make update`.
|
|
199
|
+
6. **Help**: If you are unsure which target to use, run `make help` to see all available options.
|
|
200
|
+
7. **New Operations**: If a new operation is needed, prefer adding a new Makefile target rather than running a tool directly.
|
|
201
|
+
|
|
202
|
+
### Good vs Bad Examples
|
|
203
|
+
```sh
|
|
204
|
+
# Good: Use make target for unit tests
|
|
205
|
+
make unit
|
|
206
|
+
|
|
207
|
+
# Bad: Call pytest directly
|
|
208
|
+
pytest tests
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## 12. Quick Reference for All AI Agents
|
|
212
|
+
|
|
213
|
+
When working on this project:
|
|
214
|
+
|
|
215
|
+
1. **Start every response with contemplation** 🌲
|
|
216
|
+
2. **Take baby steps** - one test, one file, one change at a time 👣
|
|
217
|
+
3. **Always write the failing test first** (TDD) ❌➡️✅
|
|
218
|
+
4. **Use make targets** - never call tools directly 🔧
|
|
219
|
+
5. **Keep code small and typed** - max 20 lines per method 📏
|
|
220
|
+
6. **Show your thinking process** - be conversational and progressive 💭
|
|
221
|
+
7. **Question everything** - assumptions, requirements, design choices ❓
|
|
222
|
+
8. **Run tests automatically** after every change 🧪
|
|
223
|
+
9. **Focus on simplicity** over cleverness ✨
|
|
224
|
+
10. **Ask for clarification** when in doubt 🤔
|
|
225
|
+
|
|
226
|
+
Remember: This is a high-quality, test-driven, incremental development environment. Quality over speed, clarity over cleverness, baby steps over big leaps.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Documentation Standard
|
|
2
|
+
|
|
3
|
+
## Convention
|
|
4
|
+
|
|
5
|
+
Every project convention must be documented as a standalone Markdown file inside the `docs/adrs/` folder,
|
|
6
|
+
organized by area (`testing/`, `database/`). Each document follows a fixed structure with these sections
|
|
7
|
+
in order: Convention, Benefits, Examples (good and bad), Real world examples, and Related agreements.
|
|
8
|
+
|
|
9
|
+
The goal is to provide AI agents and developers with self-contained, discoverable references that require
|
|
10
|
+
no extra context to understand.
|
|
11
|
+
|
|
12
|
+
## Benefits
|
|
13
|
+
|
|
14
|
+
- AI agents can consume individual docs without loading the entire knowledge base, reducing token usage.
|
|
15
|
+
- New team members find conventions faster through a browsable folder structure.
|
|
16
|
+
- Each doc is independently reviewable in PRs, making convention changes easy to track.
|
|
17
|
+
- The fixed structure ensures consistency and completeness across all documented conventions.
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Good: Well-structured convention document
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
# Name of the convention
|
|
25
|
+
|
|
26
|
+
## Convention
|
|
27
|
+
|
|
28
|
+
Convention description.
|
|
29
|
+
|
|
30
|
+
## Benefits
|
|
31
|
+
|
|
32
|
+
- List of why to use this convention.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Good: Definition of a good example
|
|
37
|
+
|
|
38
|
+
good example
|
|
39
|
+
|
|
40
|
+
### Bad: Definition of a bad example
|
|
41
|
+
|
|
42
|
+
bad example
|
|
43
|
+
|
|
44
|
+
## Real world examples
|
|
45
|
+
|
|
46
|
+
- Links to files following this convention
|
|
47
|
+
|
|
48
|
+
## Related agreements
|
|
49
|
+
|
|
50
|
+
- Links to agreements related to this convention if applies
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Bad: Convention buried in a monolithic file
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Project Guidelines
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
We use hexagonal architecture...
|
|
60
|
+
|
|
61
|
+
## Testing
|
|
62
|
+
Use object mothers...
|
|
63
|
+
|
|
64
|
+
## Database
|
|
65
|
+
PostgreSQL with pgvector...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Real world examples
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Related agreements
|
|
72
|
+
|
|
73
|
+
- All docs inside `docs/adrs` must follow this standard
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Senior XP Developer — Pending Changes Review (Tests, Maintainability, Project Rules)
|
|
2
|
+
|
|
3
|
+
Act as a **Senior XP Developer** performing a thoughtful code review of the **pending, uncommitted changes**.
|
|
4
|
+
Focus on **test quality**, **maintainability**, **simplicity**, and **alignment with project rules and standards**.
|
|
5
|
+
|
|
6
|
+
### Task
|
|
7
|
+
Review the pending changes with attention to:
|
|
8
|
+
|
|
9
|
+
1. **Test Coverage & Quality**
|
|
10
|
+
- Are new behaviors backed by clear, intention-revealing tests?
|
|
11
|
+
- Do tests follow the project's testing style (naming, structure, speed, isolation)?
|
|
12
|
+
- Are edge cases, failure paths, and boundaries tested?
|
|
13
|
+
- Do tests help prevent regressions and clarify expected behavior?
|
|
14
|
+
|
|
15
|
+
2. **Maintainability & Simplicity**
|
|
16
|
+
- Is the code easy to understand at a glance?
|
|
17
|
+
- Are names clear and aligned with domain concepts?
|
|
18
|
+
- Is there unnecessary complexity that could be simplified?
|
|
19
|
+
- Are functions/classes/modules small, cohesive, and well-factored?
|
|
20
|
+
- Does the change make the system easier or harder to evolve?
|
|
21
|
+
|
|
22
|
+
3. **Project Rules & Conventions**
|
|
23
|
+
- Validate the changes against the project’s explicit rules (coding standards, architectural guidelines, patterns, constraints).
|
|
24
|
+
- Check that dependencies, error handling, and logging follow the agreed practices.
|
|
25
|
+
- Identify deviations and justify whether they are acceptable or need correction.
|
|
26
|
+
|
|
27
|
+
4. **Risk & Impact**
|
|
28
|
+
- Highlight areas likely to fail in production or introduce hidden coupling.
|
|
29
|
+
- Call out missing tests for critical paths.
|
|
30
|
+
- Evaluate how the change affects overall reliability and flow.
|
|
31
|
+
|
|
32
|
+
### Deliverables
|
|
33
|
+
Provide:
|
|
34
|
+
- A **structured review** detailing strengths and weaknesses.
|
|
35
|
+
- **Specific, actionable improvements** to increase clarity, testability, and alignment with project rules.
|
|
36
|
+
- A brief final summary: *Is this change ready to commit? If not, what is the smallest next improvement?*
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: Split uncommitted changes into atomic conventional commits with a focus on why each change was made. Use only when the user explicitly invokes this command.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Split the currently uncommitted changes into multiple atomic conventional commits. This command is **conversational**: you will ask the user before every decision.
|
|
7
|
+
|
|
8
|
+
## Steps
|
|
9
|
+
|
|
10
|
+
1. Run `git status` and `git diff` (staged + unstaged) to see everything that exists. For files with multiple unrelated hunks, also inspect `git diff` per file.
|
|
11
|
+
|
|
12
|
+
2. Propose a grouping plan: list each commit you would create, which files (or hunks) go into it, and the conventional commit subject you suggest. Show this as a numbered list. Each commit must represent a **chunk of correct functional code** — it should compile and work on its own.
|
|
13
|
+
|
|
14
|
+
3. **Ask the user** to confirm or correct the grouping before doing anything.
|
|
15
|
+
|
|
16
|
+
4. For each commit in the agreed order:
|
|
17
|
+
- Stage exactly the files (or hunks via `git add -p` if needed) that belong to this commit. Never use `git add .` or `git add -A`.
|
|
18
|
+
- Draft a subject line and **optional body** that explain **why** the change was made, not just what changed. Ask yourself: does the commit benefit from extra context? If yes, include a body. If the subject already tells the full story, omit the body.
|
|
19
|
+
- Confirm the subject and body (if any) with the user.
|
|
20
|
+
- Commit with the subject line only, or subject + body if applicable.
|
|
21
|
+
- Run `git status` to confirm only the intended files were committed.
|
|
22
|
+
|
|
23
|
+
5. After the last commit, run `git status` and `git log --oneline` so the user can verify the result.
|
|
24
|
+
|
|
25
|
+
## Commit message guidance
|
|
26
|
+
|
|
27
|
+
- The subject should express **intent**: *what was done and why* (e.g., `feat(api): add rate limiting to prevent abuse` rather than `feat(api): add rate limiting`).
|
|
28
|
+
- Add a body only when the subject alone doesn't capture the reasoning. The body is for context: trade-offs considered, alternatives rejected, or non-obvious implications.
|
|
29
|
+
- Use `!` after the type/scope to mark a breaking change (e.g., `feat(api)!: remove deprecated v1 endpoints`). If breaking, also include a `BREAKING CHANGE:` trailer in the body explaining the migration path.
|
|
30
|
+
- Reference issues with `Closes #123`, `Fixes #456`, or `Refs #789` in the body when applicable.
|
|
31
|
+
- If in doubt about whether a body adds value, ask the user.
|
|
32
|
+
|
|
33
|
+
## Commit types
|
|
34
|
+
|
|
35
|
+
| Type | When to use |
|
|
36
|
+
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
37
|
+
| `feat` | Code changes that add new functionality, modify existing behavior/return values (often breaks tests), or remove a feature. |
|
|
38
|
+
| `fix` | Changes that fix a bug — either an unidentified bug, or a test that broke after a behavior change and needs correction. |
|
|
39
|
+
| `refactor` | Changes that modify existing code without altering its behavior: type hints, removing unused imports, renaming variables, etc. |
|
|
40
|
+
| `test` | Changes related only to tests: object mothers, fixing a test that was incorrectly implemented, renaming test variables, reorganizing test structure. |
|
|
41
|
+
| `style` | Formatting changes that don't modify code behavior (whitespace, formatting, etc.). |
|
|
42
|
+
| `build` | Changes to the build process, dependencies, or tooling that don't affect code behavior. |
|
|
43
|
+
| `docs` | Documentation changes like README, ADRs, or design docs. |
|
|
44
|
+
| `chore` | Changes that don't fit other types and don't touch src, tests, or docs (e.g., .gitignore, editor config). |
|
|
45
|
+
| `ci` | Changes to CI/CD pipeline files or configuration. |
|
|
46
|
+
| `perf` | Performance improvements that change behaviour to make it faster. |
|
|
47
|
+
|
|
48
|
+
## Questions you should ask
|
|
49
|
+
|
|
50
|
+
- Is this grouping correct, or should X go with Y instead?
|
|
51
|
+
- For the proposed subject `feat(api): add rate limiting to prevent abuse`, is the scope right?
|
|
52
|
+
- Does this commit deserve a body, or is the subject enough?
|
|
53
|
+
- Should any change be discarded instead of committed?
|
|
54
|
+
|
|
55
|
+
Err on the side of asking more rather than less.
|
|
56
|
+
|
|
57
|
+
## Hard rules
|
|
58
|
+
|
|
59
|
+
- **No Claude attribution.** Never add `Co-Authored-By: Claude`, `🤖 Generated with Claude Code`, or any similar footer.
|
|
60
|
+
- **No `--no-verify`.** If a hook fails, stop and ask the user.
|
|
61
|
+
- **Never bundle unrelated changes.** If two changes share a file but belong in different commits, use `git add -p` to split them.
|
|
62
|
+
- **Do not push.**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Security Expert — Deep, Pragmatic Risk Analysis
|
|
2
|
+
|
|
3
|
+
Act as a **senior security expert** with experience in **OWASP**, **threat modeling**, **cloud security**, **secure engineering**, and **production risk assessment**. Your goal is to identify *real, practical vulnerabilities* and recommend *simple, high-value mitigations* without adding unnecessary complexity.
|
|
4
|
+
|
|
5
|
+
### Task
|
|
6
|
+
**Analyze the code, architecture, or system from a security perspective**, focusing on:
|
|
7
|
+
|
|
8
|
+
- Attack surface and weak entry points
|
|
9
|
+
- Insufficient validation, untrusted inputs, injection vectors
|
|
10
|
+
- Dependency risks, secret/credential exposure, unsafe configuration
|
|
11
|
+
- Common failure modes: insecure deserialization, session issues, broken authorization, etc.
|
|
12
|
+
- Behavior under stress, unexpected conditions, or malformed data
|
|
13
|
+
|
|
14
|
+
### Deliverables
|
|
15
|
+
Provide:
|
|
16
|
+
|
|
17
|
+
1. **Identified risks**, clearly described and prioritized
|
|
18
|
+
2. **Realistic exploitation scenarios** showing how each risk could impact production
|
|
19
|
+
3. **Concrete, lightweight mitigations** to reduce risk without adding friction
|
|
20
|
+
4. **Ongoing defensive practices** to keep the system secure over time
|
|
21
|
+
|
|
22
|
+
Stay pragmatic: minimal complexity, maximum clarity, high reliability.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
## Senior XP Developer — Technical Debt Analysis
|
|
2
|
+
|
|
3
|
+
Act as a **Senior XP Developer** with **Lean thinking** and a focus on sustainable pace.
|
|
4
|
+
|
|
5
|
+
### Task
|
|
6
|
+
**Identify and prioritize technical debt** in the codebase:
|
|
7
|
+
|
|
8
|
+
1. **Catalog debt items**
|
|
9
|
+
- Code smells (long methods, god classes, primitive obsession, etc.)
|
|
10
|
+
- Missing or weak tests
|
|
11
|
+
- Outdated dependencies
|
|
12
|
+
- Unclear or misleading names
|
|
13
|
+
- Duplicated logic
|
|
14
|
+
- Broken windows (small issues left unfixed)
|
|
15
|
+
|
|
16
|
+
2. **Classify by type**
|
|
17
|
+
- **Deliberate/Prudent**: Conscious trade-offs made knowingly
|
|
18
|
+
- **Inadvertent/Reckless**: Mistakes or lack of knowledge
|
|
19
|
+
- **Bit rot**: Accumulated entropy over time
|
|
20
|
+
|
|
21
|
+
3. **Prioritize by ROI**
|
|
22
|
+
- Impact on current development flow
|
|
23
|
+
- Risk to production reliability
|
|
24
|
+
- Cost of deferral vs. cost of fix
|
|
25
|
+
- Frequency of change in affected area
|
|
26
|
+
|
|
27
|
+
### Deliverables
|
|
28
|
+
- **Top 5 debt items** with clear descriptions
|
|
29
|
+
- **Recommended payoff order** with rationale
|
|
30
|
+
- **Quick wins**: items fixable in < 30 minutes
|
|
31
|
+
- **Strategic debt**: items to defer consciously (and why)
|
|
32
|
+
|
|
33
|
+
**Keep the codebase healthy. Pay debt before it compounds.**
|