aai-pyskills 0.1.0__tar.gz
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.
- aai_pyskills-0.1.0/CHANGELOG.md +7 -0
- aai_pyskills-0.1.0/LICENSE +202 -0
- aai_pyskills-0.1.0/MANIFEST.in +3 -0
- aai_pyskills-0.1.0/PKG-INFO +62 -0
- aai_pyskills-0.1.0/README.md +35 -0
- aai_pyskills-0.1.0/aai_pyskills/__init__.py +1 -0
- aai_pyskills-0.1.0/aai_pyskills/_writing.py +44 -0
- aai_pyskills-0.1.0/aai_pyskills/coding_patterns.py +91 -0
- aai_pyskills-0.1.0/aai_pyskills/llms.py +51 -0
- aai_pyskills-0.1.0/aai_pyskills/nbreview.py +88 -0
- aai_pyskills-0.1.0/aai_pyskills/understand.py +50 -0
- aai_pyskills-0.1.0/aai_pyskills/vision.py +165 -0
- aai_pyskills-0.1.0/aai_pyskills/write_docs.py +93 -0
- aai_pyskills-0.1.0/aai_pyskills/write_llms.py +90 -0
- aai_pyskills-0.1.0/aai_pyskills/write_prose.py +74 -0
- aai_pyskills-0.1.0/aai_pyskills/write_summary.py +50 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/PKG-INFO +62 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/SOURCES.txt +23 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/dependency_links.txt +1 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/entry_points.txt +9 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/requires.txt +13 -0
- aai_pyskills-0.1.0/aai_pyskills.egg-info/top_level.txt +1 -0
- aai_pyskills-0.1.0/pyproject.toml +46 -0
- aai_pyskills-0.1.0/setup.cfg +4 -0
- aai_pyskills-0.1.0/tests/test_vision.py +42 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aai-pyskills
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reusable pyskills for coding, writing, understanding, and vision across harnesses and Solveit
|
|
5
|
+
Author: aai-pyskills contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/AnswerDotAI/aai-pyskills
|
|
8
|
+
Project-URL: Repository, https://github.com/AnswerDotAI/aai-pyskills
|
|
9
|
+
Project-URL: Issues, https://github.com/AnswerDotAI/aai-pyskills/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: fastcore>=2.2.47
|
|
16
|
+
Requires-Dist: pypdfium2>=5
|
|
17
|
+
Requires-Dist: pyvips[binary]>=3
|
|
18
|
+
Requires-Dist: python-fastllm>=0.0.75
|
|
19
|
+
Requires-Dist: pyskills>=0.0.35
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: fastship; extra == "dev"
|
|
22
|
+
Requires-Dist: build; extra == "dev"
|
|
23
|
+
Requires-Dist: twine; extra == "dev"
|
|
24
|
+
Provides-Extra: solveit
|
|
25
|
+
Requires-Dist: dialoghelper>=0.2.55; extra == "solveit"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# aai-pyskills
|
|
29
|
+
|
|
30
|
+
Reusable [pyskills](https://github.com/AnswerDotAI/pyskills) for Answer.AI coding, writing, understanding, and vision workflows across CLI harnesses and Solveit dialogs.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install aai-pyskills
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In a Python kernel with `pyskills` loaded, run `list_pyskills()` to list registered skills and `doc(aai_pyskills.<module>)` to read one.
|
|
39
|
+
|
|
40
|
+
## Modules
|
|
41
|
+
|
|
42
|
+
- `coding_patterns`: Python, Rust, nbdev, and testing conventions.
|
|
43
|
+
- `nbreview`: notebook style review workflow built on `nbdev.skill` and `coding_patterns`.
|
|
44
|
+
- `write_prose`: anti-slop rules for narrative prose, plus optional `check_prose`.
|
|
45
|
+
- `write_docs`: plain reference prose rules for docstrings, READMEs, API docs, PRs, and commits, plus optional `check_docs`.
|
|
46
|
+
- `write_summary`: standalone summaries for human readers.
|
|
47
|
+
- `write_llms`: dense documentation rules for LLM-facing files (`llms.txt`, pyskills, prompts).
|
|
48
|
+
- `understand`: building and testing a Theory (Naur, Socrates, Knoblich et al., Lakatos) before design or review work.
|
|
49
|
+
- `vision`: image and PDF inspection (`look`, `transcribe`, `pdf2pngs`) keeping visual content out of the caller's context.
|
|
50
|
+
- `llms`: short model names (`models`) and one-shot `ask()` helper used by `write_prose`, `write_docs`, and `vision`.
|
|
51
|
+
|
|
52
|
+
## Solveit and harness LLM calls
|
|
53
|
+
|
|
54
|
+
`llms.ask` and `vision.look`/`transcribe` check `JUPYGATE_LAUNCHER == 'rustygate'`. Inside a Solveit kernel, requests route over the `rustygate` comm via `dialoghelper` (`/api/prompt`) using the prompting user's Solve-LP access without direct provider API keys. Outside Solveit, requests go through `fastllm`.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pytest -q
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Live model tests are marked `slow` and skipped by default (`pytest -q -m slow` runs them).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# aai-pyskills
|
|
2
|
+
|
|
3
|
+
Reusable [pyskills](https://github.com/AnswerDotAI/pyskills) for Answer.AI coding, writing, understanding, and vision workflows across CLI harnesses and Solveit dialogs.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install aai-pyskills
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
In a Python kernel with `pyskills` loaded, run `list_pyskills()` to list registered skills and `doc(aai_pyskills.<module>)` to read one.
|
|
12
|
+
|
|
13
|
+
## Modules
|
|
14
|
+
|
|
15
|
+
- `coding_patterns`: Python, Rust, nbdev, and testing conventions.
|
|
16
|
+
- `nbreview`: notebook style review workflow built on `nbdev.skill` and `coding_patterns`.
|
|
17
|
+
- `write_prose`: anti-slop rules for narrative prose, plus optional `check_prose`.
|
|
18
|
+
- `write_docs`: plain reference prose rules for docstrings, READMEs, API docs, PRs, and commits, plus optional `check_docs`.
|
|
19
|
+
- `write_summary`: standalone summaries for human readers.
|
|
20
|
+
- `write_llms`: dense documentation rules for LLM-facing files (`llms.txt`, pyskills, prompts).
|
|
21
|
+
- `understand`: building and testing a Theory (Naur, Socrates, Knoblich et al., Lakatos) before design or review work.
|
|
22
|
+
- `vision`: image and PDF inspection (`look`, `transcribe`, `pdf2pngs`) keeping visual content out of the caller's context.
|
|
23
|
+
- `llms`: short model names (`models`) and one-shot `ask()` helper used by `write_prose`, `write_docs`, and `vision`.
|
|
24
|
+
|
|
25
|
+
## Solveit and harness LLM calls
|
|
26
|
+
|
|
27
|
+
`llms.ask` and `vision.look`/`transcribe` check `JUPYGATE_LAUNCHER == 'rustygate'`. Inside a Solveit kernel, requests route over the `rustygate` comm via `dialoghelper` (`/api/prompt`) using the prompting user's Solve-LP access without direct provider API keys. Outside Solveit, requests go through `fastllm`.
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pytest -q
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Live model tests are marked `slow` and skipped by default (`pytest -q -m slow` runs them).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"Text that `write_docs` and `write_prose` share. Each module calls `fill` on its docstring at import, replacing each `{name}` placeholder with the matching `SHARED` entry."
|
|
2
|
+
|
|
3
|
+
SHARED = dict(
|
|
4
|
+
markers = r'''`[n]` marks tells; in both passages, 2nd=problem, 1st=fix.''',
|
|
5
|
+
new_tells = r'''New tell: next number; mark 2nd passage if short.''',
|
|
6
|
+
tacked_on = r'''Tacked-on clauses & consequence glue: em dash (` - `,` -- `), `;`, `:`, `, and`, `, which`, or trailing `, so` / same-sense `, and` ("cache is warm, and calls are fast") restating/implying prior clause (list/example `:` OK; label+list=restatement). Rebuild from reader needs, never split or swap `, because`.''',
|
|
7
|
+
hedging = r'''Hedging: "may/might/potentially/in some cases/should generally". State truth or direct uncertainty ("undefined with concurrent writers").''',
|
|
8
|
+
filler = r'''Filler: noting ("note that", "worth/important to note", "notably/importantly/interestingly", "keep in mind"->delete); transitions ("Furthermore/Moreover/Additionally/In conclusion/To summarize/When it comes to/In the realm of"->use "and"/"also" or lead with subject).''',
|
|
9
|
+
restatement = r'''Restatement: heading echoed by line 1; lead/closing paragraph summary. State once; summaries at doc scale only (abstract/TL;DR/README p1).''',
|
|
10
|
+
decorative_verbs = r'''Decorative verbs: verb not naming event or impossible for inanimate subject. Colorful ("ids ride", "note lands"->appear); impossible plain ("dfn names arg", "count takes items", "settings load"->actor/imperative/passive); mental (`want/need/decide/respect/rely on/invent`); ownership/comms (`own/assign/carry/ship/record/respond`, structural `reads as`). OK: real action ("holds value", "`watch` polls"), perceptual ("read as bright"), whiteboard idioms ("walk tree", "goes stale", "costs O(n)"). Whiteboard test. (`land`/`shape` below.)''',
|
|
11
|
+
audience = r'''Audience misjudged: name audience; cut knowns; define local terms or use plain words. Explaining known: daily terms ("air conditioning, a technology that cools air"), instant inferences, obvious practices. Undefined jargon: local coinages ("glidepath", "carrier", "wisp", codenames); terms of art (CFRunLoop, kqueue, monad) OK.''',
|
|
12
|
+
throat_clearing = r'''Throat-clearing: openers announcing doc ("This section describes...", "Purpose of...", "In this piece...", "Let's dive into...") or today's-world ("In today's [fast-paced/digital/modern] world...", "...AI landscape..."). Delete; start with subject.''',
|
|
13
|
+
advertising = r'''Metadiscourse/advertising: stub+`:` ("Core mechanism: `watch`.", "Fix: retry."->full sentence); teaser pivot ("here's where it gets interesting", "X, but main event is Y", "real story is..."->facts in order); appraisal preamble ("worth being precise", "key point", "what's interesting", "crucially"->delete).''',
|
|
14
|
+
not_x_but_y = r'''Not-X-but-Y: "It's not X, it's Y", "isn't just X, it's Y", "not X, but Y". State directly.''',
|
|
15
|
+
symmetry = r'''Forced symmetry & over-structuring: 3 adjectives, 3 pros/cons, 5 steps, equal sections, matching openers (distrust 3/5); headers/tables/bullets on 1-screen doc (headers=navigation; bullets for parallel facts only).''',
|
|
16
|
+
agent_defocusing = r'''Agent defocusing: artifact-as-agent hides person ("tests shaped", "PR introduces", "design lets you"->person "I added..." or behavior "`connect` retries"; UI: "override `--x` on `[ui]`", not "`[ui]` can change `--x`"); recipient-as-subject puts beneficiary with `gets/gains/receives` + doer in `via/through/thanks to` or dropped->name actor or new state ("new process listens on fresh ports").''',
|
|
17
|
+
decoration = r'''Decoration: emoji/ornamental unicode. ASCII unless asked (`->`, words).''',
|
|
18
|
+
false_depth = r'''False depth: fancier restatement, obvious points, "it depends". Give specifics: identifiers, numbers, edge cases, failures.''',
|
|
19
|
+
plain_words = r'''Plain: utilize/leverage->use; enhance/optimize (unless literally optimizing)->improve; comprehensive->complete; robust->strong; facilitate->help; seamless->smooth; empower->let/help; foster->encourage.''',
|
|
20
|
+
banned_words = r'''Banned: streamline, pivotal, "a testament to", realm, landscape (metaphorical), navigate (metaphorical), delve, myriad, plethora, paradigm, synergy, holistic, catalyze, juxtapose, tapestry, embark, endeavor, encompass, multifaceted, elucidate, nuanced (filler), minted (metaphorical).''',
|
|
21
|
+
hidden_words = r'''Hidden jargon: land/landed->merged/committed/pushed/released/appears; shape/shaped (OK geometry/array/tensor)->structure/format/adapted/copied/informed; invariant->rule/guarantee unless none plainer; `-bearing`->plainer form.''',
|
|
22
|
+
formatting = r'''Formatting: 1 line/para (soft-wrap). Backtick code: functions, params, paths, packages (`fastcore`), literal syntax (`to_html`, `{=html}`).''')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def fill(doc):
|
|
26
|
+
"`doc` with each `{name}` placeholder replaced by `SHARED[name]`"
|
|
27
|
+
for k,v in SHARED.items(): doc = doc.replace('{'+k+'}', v)
|
|
28
|
+
return doc
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def charter(
|
|
32
|
+
kind, # The checker's register, e.g. 'prose' or 'reference-prose'
|
|
33
|
+
verb_tells, # The guide's numbers for the decorative-verb and agent-defocusing tells, e.g. '10 and 17'
|
|
34
|
+
audience_tells, # The guide's audience tell, e.g. 'tell 11'
|
|
35
|
+
):
|
|
36
|
+
"System prompt for a subagent that checks text against a writing guide"
|
|
37
|
+
return f"""You are a {kind} checker called as a subagent: your output is parsed by another model, and no human reads it. Praise, hedging, overall verdicts, and commentary on the text's quality therefore serve nobody; emit flags or "Clean" and nothing else. The user message contains prose-style rules, an AUDIENCE line naming the intended readers, then the text to review under "TEXT UNDER REVIEW".
|
|
38
|
+
- Sweep per tell: for each numbered tell, scan the ENTIRE text for it before moving to the next. Do not substitute one general pass.
|
|
39
|
+
- Report each candidate violation as: the tell name and number, and the offending span quoted verbatim. Also flag banned words, em dashes, and hard-wrapped paragraphs.
|
|
40
|
+
- Give extra attention to the two verb tells, {verb_tells}: they are the subtlest and the most commonly missed. Question every verb whose subject is an artifact.
|
|
41
|
+
- Judge {audience_tells} against the stated audience.
|
|
42
|
+
- Err on the side of flagging: the caller applies judgment to your flags, so a missed tell costs more than a false positive. When a span merely resembles a tell, flag it and append "borderline".
|
|
43
|
+
- Where the fix is not obvious from the flag itself, append a suggested replacement for the quoted span; never rewrite beyond that.
|
|
44
|
+
- "Clean" is a valid answer when nothing matches. Never append a verdict to it, and never summarize or soften a flag list."""
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
r'''Jeremy's coding style and conventions: read before writing, reviewing, or assessing any code.
|
|
2
|
+
|
|
3
|
+
notation: /why
|
|
4
|
+
|
|
5
|
+
- applies: all Jeremy's projects; from fastai style guide, his three decades' experience
|
|
6
|
+
- libraries: his sibling-editable ecosystem (`fastcore`, `fasthtml`, `fastlite`, ...) over heavier alternatives
|
|
7
|
+
|
|
8
|
+
## Design
|
|
9
|
+
|
|
10
|
+
- improving a tool > finishing one task /helps future tasks, sessions, team
|
|
11
|
+
- ergonomics: matter as much as capability
|
|
12
|
+
- friction: fix or raise; never quietly work around /workarounds are the learned default; our tools are one edit away
|
|
13
|
+
- APIs, upstream too: private names, cloned dep logic, gap-bridging helpers = workaround signs; fix or discuss the upstream API
|
|
14
|
+
- right owner > fewer files/repos: no wrong-layer shortcuts or workarounds to leave siblings or deps untouched /leaks boundaries
|
|
15
|
+
- omit: constructs whose need you can't explain (redundant `str(x)` or other coercions, unmutated `list(x)` copies, just-in-case try/excepts, unused parameters); weightless type hints, docstrings, boilerplate; prefer concise readable code /readers infer necessity: useless constructs cost confusion, doubled in nbdev where tests document code
|
|
16
|
+
- useful features: needn't await request; judge by design needs, user expectations /open-source users meeting gaps assume incapability, leave
|
|
17
|
+
- comments: only what code can't show, next to that code; never provenance, next-line narration, change justification /those address reviewers, not future readers
|
|
18
|
+
- bugs, mess, refactors (our repos): priority, never ignore; clear → fix now; design/complexity → discuss
|
|
19
|
+
- one home per fact, constant or piece of logic; noticed duplication: remove all of it together, templates, tests and docs too; never fix copies singly; new duplication: explicit agreement only
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
- defaults (CLI flags, Python arguments, tool options): trust unless a task requirement can't otherwise be met; never override habitually or for assumed gains; noisy or wrong output: report as tool bug /defaults target correct, readable output
|
|
24
|
+
|
|
25
|
+
## Python
|
|
26
|
+
|
|
27
|
+
- docments (fastcore trailing parameter comments): NEVER remove in refactors
|
|
28
|
+
- docmented or long signature:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
@delegates(start_kernel)
|
|
32
|
+
async def run_kernel(
|
|
33
|
+
kernel_name='python3', # Kernelspec name to launch
|
|
34
|
+
manager_cls=KernelManager, # Manager class, e.g. a subclass customizing launch
|
|
35
|
+
**kwargs
|
|
36
|
+
):
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- `**kwargs` forwarded to known callee: `@delegates(callee)`, exposing its options; skip if callee's signature is only `**kwargs`; collector MUST be `kwargs`, not `kw`
|
|
40
|
+
- raw strings for ANY nontrivial literal: regexes, tool text, code, markup, multiline, backslashes /plain `\n` `\d` can error or silently corrupt text; raw costs nothing when escapes absent
|
|
41
|
+
- one-line bodies:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
if not x: return default
|
|
45
|
+
try: return run("cmd").strip() or default
|
|
46
|
+
except Exception: return default
|
|
47
|
+
for i in range(n): result[i] = 0
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- imports combined: `import os, re, sys, shutil`; `from fastcore.utils import *` supplies `os`, `Path`, much of stdlib: don't re-import them
|
|
51
|
+
|
|
52
|
+
## Projects
|
|
53
|
+
|
|
54
|
+
- `chkstyle {path}` (path only if needed): hint, not gospel; nbdev: on notebooks (`chkstyle nbs/00_core.ipynb`), not exported `.py` /notebooks include unexported examples, tests
|
|
55
|
+
- standard config: read, don't duplicate (`.github/release.yml` release notes; `pyproject.toml` `[tool.yourpkg]`); infer values when possible, e.g. package name from `[project].name`
|
|
56
|
+
- bundled data: inside package, read via `importlib.resources`
|
|
57
|
+
- layout: prefer flat (`myproject/mypkg/`, `tests/`, `pyproject.toml`) over `src/`
|
|
58
|
+
- Python versions: Jeremy bumps right AFTER release, as part of it, never during changes /tree holds next release version
|
|
59
|
+
- sibling floors may name unreleased local versions (`foo>=<foo's local version>`)
|
|
60
|
+
- new dependency, or sibling API/behavior added this session: update consumers' pins same session, never at release; pre-existing APIs: leave pins alone
|
|
61
|
+
- other artifacts: version at change time
|
|
62
|
+
- runtime, toolchain, CI action versions: floating channels (`lts/*`, `stable`), or verify active workspace/latest; older pin (from sibling config or prior too): NEVER without explicit discussion /stale pins propagate and break builds
|
|
63
|
+
|
|
64
|
+
## Testing
|
|
65
|
+
|
|
66
|
+
- MUST read `testing` skill before writing, editing, or requesting any test
|
|
67
|
+
- nbdev (most projects): no test cells; tests ARE documentation; revise lesson cells
|
|
68
|
+
- MUST NOT add tests for trivial logic or tests longer than the implementation without explicit agreement
|
|
69
|
+
- add tests only for meaningful uncertainty or substantive logic, never for coverage: logic needing careful thought (edge cases, parsing, arithmetic, tricky conditionals open to silent breakage); somewhat-likely-to-break external assumption (file format, API response shape, another tool's behavior): exercise REAL system, usually slow-marked /mocks merely restate assumptions
|
|
70
|
+
- wiring and orchestration (re-exports, delegation, one-line glue, functions ONLY sequencing tool calls): zero tests /they assert Python works, constrain changeable internals
|
|
71
|
+
- reaching code needs recording fakes or mock collaborators: strongly suggests testing implementation transcripts, not logic; extract and test a small pure function, or don't test
|
|
72
|
+
- red-green: only for assertions actually added or revised, to check the test works (`doc(nbdev.skill)`)
|
|
73
|
+
- pytest: checks that fit no readable notebook lesson AND are too complex or distracting even for `#|hide`; as few as possible, combined into readable, faster stories
|
|
74
|
+
- one-off checks: verify in `clikernel` and discard; permanent pytest only under criteria above (nbdev: keep exploration cells that double as readable narrative) /smoke checks belong in the kernel, not test files
|
|
75
|
+
- assert logic and guarantees, not incidental renderings, reprs or field order (content in Markdown display block, not exact text); NEVER lock in behavior unless essential logic or contract guaranteed forever
|
|
76
|
+
- Rust: no inline `#[cfg(test)]` tests; set `test = false` (and `doctest = false` on libs) on `[lib]`/`[[bin]]`, put Rust tests in `tests/` /inline tests push testing internals over real external behavior, hide useful APIs instead of making them public, and don't play well with fastws
|
|
77
|
+
## CLI harness
|
|
78
|
+
|
|
79
|
+
- **IMPORTANT**: this section applies to CLI coding harnesses only; inside an interactive dialog, follow the dialog skills instead
|
|
80
|
+
- documented build and test commands: MUST run exactly, no added flags unless explicitly requested; read output before working around expected problems
|
|
81
|
+
- flag wanted every run: into config, back to bare command (recurring `pytest --timeout 300` → `timeout = 60` under `[tool.pytest.ini_options]`)
|
|
82
|
+
- applying is the goal: `cargo fmt`, not `cargo fmt --check` then `cargo fmt`; `--check`: final no-mutation verification, e.g. CI
|
|
83
|
+
- never truncate (`| tail -20`, `| grep PASS`) or merge stderr (`2>&1`) /unseen output hides problems; separate stderr makes crashes unmissable
|
|
84
|
+
- shell output redirect (`>`, `>>`): ASK separately (stdin `<`, `<<` fine) /breaks harness approvals
|
|
85
|
+
- real one-off flag: give reason; use once; drop next call
|
|
86
|
+
- run: `pytest -q`, not `python -m pytest` (prompts for permission); nbdev: `nbdev-test` on changed notebook
|
|
87
|
+
- ask first only if runs (`eval: false` cells too) may take >~2min or reach authenticated external services
|
|
88
|
+
- slow-marked tests: only at session finish or after changes likely to affect them directly
|
|
89
|
+
'''
|
|
90
|
+
|
|
91
|
+
__all__ = []
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Short model names and one-shot completion helpers for aai-pyskills.
|
|
2
|
+
|
|
3
|
+
`models` maps short names to full `'vendor/model'` specs (built from `fastllm.types`).
|
|
4
|
+
`ask` runs a one-shot completion: pass a short name or any full spec, and get the response text back.
|
|
5
|
+
Inside a Solveit `rustygate` kernel (`in_solveit()`), `ask` routes through `dialoghelper.core.prompt` (`/api/prompt`); outside Solveit it uses `fastllm`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__all__ = ['models', 'in_solveit', 'response_text', 'ask']
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
from fastllm.acomplete import acomplete
|
|
12
|
+
from fastllm.chat import contents, mk_msgs
|
|
13
|
+
from fastllm.types import (haik, sonn, opus, fable, luna, terra, sol, astra, flashlite, flash, hydrogen, neon, carbon, argon,
|
|
14
|
+
muse, muse_contrib, qwen, minimax, kimi, glmflash, glm, dsflash)
|
|
15
|
+
|
|
16
|
+
models = dict(haiku=f'anthropic/{haik}', sonnet=f'anthropic/{sonn}', opus=f'anthropic/{opus}', fable=f'anthropic/{fable}',
|
|
17
|
+
luna=f'openai/{luna}', terra=f'openai/{terra}', sol=f'openai/{sol}', astra=f'openai/{astra}',
|
|
18
|
+
flashlite=f'gemini/{flashlite}', flash=f'gemini/{flash}', hydrogen=f'gemini/{hydrogen}', neon=f'gemini/{neon}',
|
|
19
|
+
carbon=f'gemini/{carbon}', argon=f'gemini/{argon}', muse=f'meta/{muse}', musecontrib=f'meta/{muse_contrib}',
|
|
20
|
+
qwen=f'fireworks_ai/{qwen}', minimax=f'fireworks_ai/{minimax}', kimi=f'fireworks_ai/{kimi}',
|
|
21
|
+
glmflash=f'fireworks_ai/{glmflash}', glm=f'fireworks_ai/{glm}', dsflash=f'fireworks_ai/{dsflash}',
|
|
22
|
+
codexluna=f'codex/{luna}', codexterra=f'codex/{terra}', codexsol=f'codex/{sol}', codexastra=f'codex/{astra}')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def in_solveit():
|
|
26
|
+
"Whether running inside a Solveit `rustygate` kernel."
|
|
27
|
+
return os.environ.get('JUPYGATE_LAUNCHER') == 'rustygate'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def response_text(res):
|
|
31
|
+
"The visible text of an `acomplete` result: its message's text parts joined (thinking parts skipped)."
|
|
32
|
+
m = contents(res)
|
|
33
|
+
return '' if not m else ''.join(p.text for p in m.content if p.type == 'text' and p.text)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def ask(
|
|
37
|
+
prompt, # The user message
|
|
38
|
+
model='sonnet', # A `models` short name, or any full 'vendor/model' spec
|
|
39
|
+
system=None, # Optional system prompt
|
|
40
|
+
effort=None, # Reasoning effort where the model supports it: 'low'/'medium'/'high'
|
|
41
|
+
max_tokens=8192, # Response cap; fastllm's own defaults are small
|
|
42
|
+
**kwargs, # Passed through to `dialoghelper.core.prompt` in Solveit, else `acomplete`
|
|
43
|
+
):
|
|
44
|
+
"One-shot completion returning the response text."
|
|
45
|
+
spec = models.get(model, model)
|
|
46
|
+
if in_solveit():
|
|
47
|
+
from dialoghelper.core import prompt as dh_prompt
|
|
48
|
+
return await dh_prompt(prompt, model=spec, instructions=system,
|
|
49
|
+
max_output_tokens=max_tokens, reasoning=effort, **kwargs)
|
|
50
|
+
res = await acomplete(mk_msgs([prompt]), spec, system=system, reasoning_effort=effort, max_tokens=max_tokens, **kwargs)
|
|
51
|
+
return response_text(res)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
r'''Review and improve nbdev notebooks using chkstyle findings. Read before a notebook style review. Start with `chkstyle --fix path/to/notebook.ipynb` on notebooks without substantial intentionally formatted code, such as aligned matrices or tables. Inspect the notebook and existing changes before applying it.
|
|
2
|
+
|
|
3
|
+
notation: /why
|
|
4
|
+
|
|
5
|
+
- read first: `nbdev.skill`, `aai_pyskills.coding_patterns` (they own authorship, execution, coding style, testing policy); `aai_pyskills.write_docs` before revising prose; host workflow's notebook tools: use them, reading their APIs first
|
|
6
|
+
- aim: understanding, maintainability; not zero warnings or more coverage; adding or moving lessons, simplifying implementation, removing tests: all possible
|
|
7
|
+
- one coherent change set within agreed scope, not separate work per finding
|
|
8
|
+
|
|
9
|
+
## Scope and mechanical fixes
|
|
10
|
+
|
|
11
|
+
- read repo instructions, Git status, existing diff; identify source notebooks; preserve work in progress and unrelated work throughout
|
|
12
|
+
- dirty checkout: snapshot scoped notebooks AND generated files to a temp dir before editing; compare changes with it AND full Git diff /tells pre-existing work apart
|
|
13
|
+
- relevant sections: read in full, examples included; note intentional formatting before the fixer; read fixer's diff before further changes
|
|
14
|
+
- informative layout (matrix rows, aligned cases, literal protocol examples), or formatting that's a test input (source-inspection or formatting notebooks: signatures, comments, docstrings): never unrestricted fixer; protect the statement or block, pick `--fix-rule` options (`chkstyle -h`), or edit by hand; keep useful formatting, docments, meaningful comments
|
|
15
|
+
- remaining findings: `chkstyle --show-rule path/to/notebook.ipynb`, on notebooks, not generated Python; unfamiliar rule: checker README; finding unexpectedly absent: check effective project config
|
|
16
|
+
- separate mechanical (imports, spacing, wrapping) from structural findings needing narrative, purpose
|
|
17
|
+
- index without exported implementation: outside implementation-between-lessons review; a changed file alone isn't grounds to include it; its prose or other style: only when in scope
|
|
18
|
+
|
|
19
|
+
## Diagnose findings
|
|
20
|
+
|
|
21
|
+
- finding = question, never an instruction to insert cells blindly; judge readability apart from scores
|
|
22
|
+
- `long-implementation-run` (scoring: checker README): read the whole passage through later cells to next lesson; judge how much implementation reader must absorb; coherent operation may exceed threshold with no extraction or intervening lesson; small helpers need no lesson of their own; merging cells doesn't change score, and cell counts aren't a goal
|
|
23
|
+
- `long-exported-cell`, `too-many-defs`: several ideas? class to develop with patches? abstraction hidden in a large function? split by concept, not lines; related helpers can share a lesson; separate helper cells when clearer
|
|
24
|
+
- `long-example-cell`: several lessons, excess setup, dense tests, or naturally long useful example? split only when each part teaches; consider moving the check out of the notebook, or removing it
|
|
25
|
+
- `example-run`: can reader grasp each idea before the next? add or relocate explanations where they teach; empty transitions don't fix it
|
|
26
|
+
- `comment-in-example`: new idea may merit markdown + separate example; keep comments saying what code can't show; don't turn every inline comment into a paragraph
|
|
27
|
+
- `mixed-imports`, `exported-import-nonexport`: dedicated import cells, library vs lesson-only dependencies; before moving or removing imports, check known downstream imports and re-exports in Python AND notebooks; execution implications: `nbdev.skill` /local usage can't reveal compatibility imports
|
|
28
|
+
- valid markdown and code pair may still teach nothing about the implementation before it: read it before accepting checker result
|
|
29
|
+
|
|
30
|
+
## Improve implementation
|
|
31
|
+
|
|
32
|
+
- long class: may mix construction, independent operations, policy; small shared setup together; independently explained methods: `@patch` cells; dependent methods together when splitting hides their relationship; no cell-per-method quota
|
|
33
|
+
- moving a method: keep signature, docments, decorators, async, public behavior; add `@patch` receiver annotation; check decorator order, delegated signatures, class-scope assumptions; zero-argument `super()` can't move unchanged: keep dispatch, e.g. `super(TheClass, self)`
|
|
34
|
+
- extract a helper when it names a coherent decision or transformation a reader understands alone (retry loop: stop, refresh or wait decision apart from requests and sleeping; the decision can get a short lesson with real inputs)
|
|
35
|
+
- don't extract: whole body when that brings awkward sentinels, mutable state shuttling, elaborate result types; helpers merely hiding mock setup or long blocks; public APIs invented for the checker /shorter ≠ clearer
|
|
36
|
+
- style refactors preserve behavior, but fix clear local bugs, pre-existing ones too
|
|
37
|
+
- new assertion fails: check existing behavior AND callers before calling it a bug, not a new requirement
|
|
38
|
+
- validate in proportion to risk; broader redesign or unclear intended behavior: ask first
|
|
39
|
+
|
|
40
|
+
## Choose lessons
|
|
41
|
+
|
|
42
|
+
- good candidates: external data formats, non-obvious distinctions, ordering guarantees, failure boundaries, useful public calling patterns (rate-limit vs permission errors, both 403: a distinction; HTTP date → delay: a format); constructor storing a value: usually teaches little
|
|
43
|
+
- find the reader's operation (e.g. start a container, wait for it) and existing and shared lessons before treating functions separately; one lesson follows the operation, asserts its meaningful result, cleans up resources it creates; no call or test per helper needed; implementations before that one markdown and example pair
|
|
44
|
+
- e.g. `_run` creates a real container, `is_running` waits for it: one start-and-wait lesson; fake-container demo, lesson per startup helper: not needed; then `_is_ready`, `make` as convenience operation adding port readiness
|
|
45
|
+
- follow objects through nearby functions: one result may supply another's real input; isolated example needs fakes or elaborate setup: check whether preceding implementation provides it
|
|
46
|
+
- move or adapt a good existing lesson when possible; moving implementation beside an integration lesson can beat a local demonstration; extend a lesson for a small distinction without muddying its purpose; add a concise pair for an undemonstrated useful concept; trivial glue: no standalone lesson needed
|
|
47
|
+
- dependencies, both directions: no lesson using a later-defined class; no enabled cell depending on disabled setup; authenticated usage may belong after client and credentials are introduced
|
|
48
|
+
- end-to-end notebook elsewhere alone doesn't justify omitting a useful local lesson
|
|
49
|
+
- lesson: introduce the fact illustrated; constraints and guarantees, not code line by line; end with informative display when useful, and READ it /escaped text walls, huge reprs, unlabelled numbers obscure lessons
|
|
50
|
+
- orchestration: no demos with fake clients, patched clocks, sleeps, credentials or network calls; pure decision helper, small real local object, authorized read-only integration may be clearer
|
|
51
|
+
- external services: check prerequisites, execution authority before assuming examples can run here; use suitable authorization and execution controls; style review does NOT authorize messages, remote mutations, exercising credentials
|
|
52
|
+
|
|
53
|
+
## Assertions and complex checks
|
|
54
|
+
|
|
55
|
+
- lesson: ≥1 assertion of taught behavior + useful display (nested value, classification, calculated delay, preserved order, documented failure); conventions: `nbdev.skill`, `coding_patterns`
|
|
56
|
+
- test the central claim, not a count: one assertion can be too few; setup and purely illustrative displays need no token assertions
|
|
57
|
+
- assertion and display about the same idea /testing one resource while displaying another can hide an untested claim
|
|
58
|
+
- don't split a concise example into a pair per assertion
|
|
59
|
+
- docs-rendering lessons: check relevant symbol and source docs are included, not incidental wording
|
|
60
|
+
- new or corrected behavior: `nbdev.skill` lesson-first red-green; meaningful assertions added to correct examples may pass at once; never invent wrong expectations or change production code to manufacture failure
|
|
61
|
+
- behavior-preserving extraction: exercise the decision; keep behavioral checks
|
|
62
|
+
- relocated passing checks: verify before AND after, no manufactured failure /moving isn't new behavior
|
|
63
|
+
- preserve guarantees; clean up temp files, imported example modules, process-wide state, on failure too
|
|
64
|
+
- understandable, instructive checks: keep as lessons; pytest (per `coding_patterns`): checks whose setup or case analysis distracts even hidden; awkwardness alone is no reason to move a check there
|
|
65
|
+
- wiring-only checks (delegation, re-exports, trivial storage, Python behavior, implementation transcripts): remove, after extracting and testing any meaningful logic; no substitute trivial check to keep counts
|
|
66
|
+
- before deleting: identify what the check protects; keep meaningful guarantees in existing lessons or justified pytests; repeated assertions, exact-repr snapshots, scaffolding with no independent behavioral claim may need no replacement
|
|
67
|
+
|
|
68
|
+
## Exemptions
|
|
69
|
+
|
|
70
|
+
- for a genuine mismatch between rule and best presentation; not the first answer to a long class, missing explanation, mock-heavy example, long implementation passage: revisit structure first (concise shared operation; patching a method or extracting a decision may reveal a lesson)
|
|
71
|
+
- substantive operation needing distracting safe setup (e.g. installing or deleting user config): not trivial glue; state actual reason
|
|
72
|
+
- coherent, safely isolated example: keep intact when splitting obscures cleanup or central idea
|
|
73
|
+
- skips (checker README "Opting Out", `chkstyle -h`): narrowest that fits an intentional flagged construct, not rewrites or recurring noise; whole-cell `skip` also hides unrelated findings; inline pragma would change a test input: cell-level skip
|
|
74
|
+
- no broad config ignores hiding problems elsewhere; never `#| hide` to conceal substantive implementation or lessons to silence narrative checks
|
|
75
|
+
- don't pad toward zero warnings; never silently weaken rules or turn review into a checker rewrite
|
|
76
|
+
|
|
77
|
+
## Validate and report
|
|
78
|
+
|
|
79
|
+
- reread changed sections in notebook order, stored outputs and stderr too; code, prose, assertion, display agree? /rich reprs can fail despite successful execution
|
|
80
|
+
- moving cells: follow display-method dependencies AND explicit calls; confirm method signatures and behavior kept; no exemption hides unresolved structure
|
|
81
|
+
- regenerated exports and outputs, changed-notebook runs: `nbdev.skill`; relevant pytests if implementation changed or checks moved there
|
|
82
|
+
- unfamiliar notebook execution: inspect external operations first
|
|
83
|
+
- notebook mixing safe, paid, authenticated or mutating cells: select safe cells AND prerequisites explicitly; save only executed cells' outputs /selected execution is NOT a whole-notebook pass
|
|
84
|
+
- parallel dependency exports settled: rerun relevant dependent checks in fresh processes
|
|
85
|
+
- rerun chkstyle; inspect final diff, generated files too; no commit, push or release without authorization
|
|
86
|
+
- report: what became clearer; corrections, apart from presentation changes; meaningful tests added or removed, with reasons; exemptions, with reasons; concrete checker false positives; sections run, what wasn't run, unrefreshed outputs; unresolved issues; judgments, not just warning counts
|
|
87
|
+
- parallel reviews requested: one explicit repo or notebook scope per agent (needed exports, pytest moves included); each reads this skill + referenced guidance; coordinate exports for live dependencies; each returns this report before further repos or cross-repo changes are authorized
|
|
88
|
+
'''
|