nuskills 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.
- nuskills-0.1.0/.gitignore +7 -0
- nuskills-0.1.0/LICENSE.md +201 -0
- nuskills-0.1.0/PKG-INFO +151 -0
- nuskills-0.1.0/README.md +132 -0
- nuskills-0.1.0/pyproject.toml +151 -0
- nuskills-0.1.0/src/nuskills/__init__.py +105 -0
- nuskills-0.1.0/src/nuskills/build.py +205 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/composition.md +106 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/control.md +130 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/crashcourse.md +118 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/errors.md +120 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/examples.md +168 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/host.md +75 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/inspect.md +47 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/pitfalls.md +68 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/reactive.md +83 -0
- nuskills-0.1.0/src/nuskills/corpus/nu/thesis.md +60 -0
- nuskills-0.1.0/src/nuskills/corpus/nuspace/brackets.md +178 -0
- nuskills-0.1.0/src/nuskills/corpus/nuspace/drawing.md +191 -0
- nuskills-0.1.0/src/nuskills/corpus/nuspace/model.md +124 -0
- nuskills-0.1.0/src/nuskills/corpus/nuspace/ops.md +161 -0
- nuskills-0.1.0/src/nuskills/corpus/nuspace/snippets.md +189 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/fabrics.md +78 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/kv.md +220 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/service.md +100 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/ui-app.md +236 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/ui-layout.md +163 -0
- nuskills-0.1.0/src/nuskills/corpus/nustd/ui-refs.md +189 -0
- nuskills-0.1.0/src/nuskills/headers/nu.md +16 -0
- nuskills-0.1.0/src/nuskills/headers/nuspace.md +17 -0
- nuskills-0.1.0/src/nuskills/skills.py +87 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Gor Arakelyan
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
nuskills-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: nuskills
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tested prompt pieces and agent skills for Nu and nuspace.
|
|
5
|
+
Project-URL: Repository, https://github.com/nustackdev/nuskills
|
|
6
|
+
Author-email: Gor Arakelyan <gorarkln@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Keywords: agents,llm,nu,nuspace,nustack,prompt,skills
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# nuskills
|
|
21
|
+
|
|
22
|
+
Prompt text about Nu and nuspace, in one place, tested against the current code.
|
|
23
|
+
|
|
24
|
+
- **nuagent** loads pieces into its system prompt.
|
|
25
|
+
- **Outside agents** (Claude Code, Codex) get skills built from the same pieces.
|
|
26
|
+
- Every fenced Python block in the corpus is built against the latest nucore, nustd and nuspace, so a piece cannot go stale without a red test.
|
|
27
|
+
|
|
28
|
+
## Layout
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/nuskills/
|
|
32
|
+
__init__.py loader: pieces(), load(), read(), __version__
|
|
33
|
+
corpus/
|
|
34
|
+
nu/ the kernel: thesis, crashcourse, composition, ...
|
|
35
|
+
nustd/ fabrics: kv, mem, ui, ...
|
|
36
|
+
nuspace/ the space model, ops, snippets, drawing a cell
|
|
37
|
+
skills.py which pieces each built skill carries, in order
|
|
38
|
+
headers/ per skill SKILL.md frontmatter and a few lines of when-to-use
|
|
39
|
+
build.py assembles skills/ from headers + pieces
|
|
40
|
+
skills/ built skills, committed, never edited by hand
|
|
41
|
+
.claude-plugin/ plugin.json + marketplace.json: the repo is a Claude Code plugin
|
|
42
|
+
tests/ the block harness, the loader tests, the skills checks
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Using it from Python
|
|
46
|
+
|
|
47
|
+
```python fragment
|
|
48
|
+
import nuskills
|
|
49
|
+
|
|
50
|
+
nuskills.pieces("nu") # ["nu/crashcourse", ...]
|
|
51
|
+
nuskills.read("nu/crashcourse") # markdown, frontmatter stripped
|
|
52
|
+
nuskills.load("nu/crashcourse") # Piece(id, title, summary, body)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Each consumer picks its pieces and decides their order. nuagent pins `nuskills` and assembles its system prompt from them, adding its own agent-specific text (role, protocol, finish) and the generated parts (the `nu.inspect` catalogue, the app surface). The pieces are package data, so `importlib.resources.files("nuskills") / "corpus" / "nu" / "crashcourse.md"` reaches the raw file too; the loader is the supported way.
|
|
56
|
+
|
|
57
|
+
## Skills
|
|
58
|
+
|
|
59
|
+
A skill is a header plus an ordered list of pieces, defined in `src/nuskills/skills.py`:
|
|
60
|
+
|
|
61
|
+
| Skill | For |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `nu` | building Nu programs and apps (kernel + nustd fabrics, kv, service, ui) |
|
|
64
|
+
| `nuspace` | programming a running nuspace (cell progs, ops, brackets, state, drawing, snippets) |
|
|
65
|
+
|
|
66
|
+
Each one is built in Claude Code's progressive disclosure layout. `SKILL.md` holds the header, a table of the reference files with each piece's summary, and the pieces every task needs (`inline`). The rest (`reference`) are files next to it, read only when the task needs one, so they cost no context until then. A piece's mention of another piece (`nustd/ui-refs`) becomes a link to wherever it landed.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
skills/<name>/
|
|
70
|
+
SKILL.md
|
|
71
|
+
reference/<group>/<piece>.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The skills carry no catalogue. They tell the agent to render the API with `nu.inspect` in its own environment, so a skill is right for whatever version is installed.
|
|
75
|
+
|
|
76
|
+
Rebuild after editing a piece, a header or `skills.py`, and commit the result. `tests/test_skills.py` fails while `skills/` is out of date.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv run python -m nuskills.build # write skills/
|
|
80
|
+
uv run python -m nuskills.build --check # exit 1 if skills/ is out of date
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Installing in Claude Code
|
|
84
|
+
|
|
85
|
+
The repo is a plugin marketplace (`nustack`) holding one plugin (`nuskills`):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
claude plugin marketplace add nustackdev/nuskills
|
|
89
|
+
claude plugin install nuskills@nustack
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Inside a session, `/plugin marketplace add nustackdev/nuskills` then `/plugin install nuskills@nustack` do the same. The skills show up as `/nuskills:nu` and `/nuskills:nuspace`, and Claude also loads them on its own when a task matches their description. To try a local checkout without installing: `claude --plugin-dir path/to/nuskills`. Validate after editing the manifests: `claude plugin validate .`.
|
|
93
|
+
|
|
94
|
+
## Writing a piece
|
|
95
|
+
|
|
96
|
+
A piece is one markdown file, `corpus/<group>/<name>.md`, its id is `<group>/<name>`. Keep it small enough to be picked on its own. Store only text that can't be generated: the catalogue (`nu.inspect`) and an app's surface are built at prompt time, never written here.
|
|
97
|
+
|
|
98
|
+
Optional frontmatter, `title` and `summary` only:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
---
|
|
102
|
+
title: Crash course
|
|
103
|
+
summary: The ten things you write in every Nu program.
|
|
104
|
+
---
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Fences
|
|
108
|
+
|
|
109
|
+
The info string on the opening fence says what the harness does with the block.
|
|
110
|
+
|
|
111
|
+
| Fence | Meaning | Checked by |
|
|
112
|
+
| --- | --- | --- |
|
|
113
|
+
| ```` ```python ```` | a whole program | loaded, `out` called, `nu.validate(nu.compile(term))` |
|
|
114
|
+
| ```` ```python run ```` | a whole program that finishes quickly in memory | the above, then evaluated with `nu.arun` (10s cap) |
|
|
115
|
+
| ```` ```python fragment ```` | a few lines, not a program | Python `compile()` only |
|
|
116
|
+
| anything else (`text`, `bash`, ...) | prose | skipped |
|
|
117
|
+
|
|
118
|
+
Any other word after `python` fails the test, so a typo can't turn a program into prose.
|
|
119
|
+
|
|
120
|
+
A whole program is a module with an entry point `out`, loaded by `nu.prog`'s own loader (the one nuspace uses for a cell):
|
|
121
|
+
|
|
122
|
+
- `out` is a function returning a Nu term, or a term itself.
|
|
123
|
+
- `out` takes only what its signature asks for, by name.
|
|
124
|
+
- In `nu/` and `nustd/` pieces nothing is offered: write `def out():`.
|
|
125
|
+
- In `nuspace/` pieces the block is a cell program. It is stored as a cell on a plane in an in-memory space and loaded the way the kernel loads it. `out` may ask for `plane` and `cell`, the ids as plain `str`. `CellState` and `PlaneState` slots land under that cell and plane. Store access needs its own bracket, as in a real cell (`ops.atomic_state(...)`, `ops.snapshot(...)`). A `run` block runs inside the cell's `ops.Here` frame against that space. There is no browser session, so a block that draws should not be marked `run`.
|
|
126
|
+
- A string literal in a block that contains `def out(` is another program's source (eg the cell an `ops.add_cell` adds) and is built the same way, under the same group's rules.
|
|
127
|
+
|
|
128
|
+
Mark `run` only on programs that finish and touch nothing outside memory. A program that subscribes, waits or serves stays unmarked: built and validated, not run.
|
|
129
|
+
|
|
130
|
+
## Checking a piece
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uv sync # once: Python 3.10 .venv with the sibling repos editable
|
|
134
|
+
uv run pytest -k nuspace/model # every block in one piece
|
|
135
|
+
uv run pytest -k "nu/crashcourse:42" # one block: piece and the fence's line
|
|
136
|
+
uv run pytest # everything
|
|
137
|
+
uv run ruff check
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Each block is its own test, id `<piece>:<line>`, the line of its opening fence, so a failure points at the exact block. The dev env installs `../nu`, `../nu/pkgs/nustd[all]`, `../nuspace` and `../nuverse/pkgs/nuverse` editable, so it tests against main.
|
|
141
|
+
|
|
142
|
+
## CI
|
|
143
|
+
|
|
144
|
+
`.github/workflows/test.yml` runs ruff, the skills check and pytest against two stacks: **main** (nu, nuspace and nuverse checked out next to this repo, as `[tool.uv.sources]` expects) and **released** (the latest `nustd[all]`, `nuspace`, `nuverse` from PyPI). It runs on push and PR, nightly, by hand, and on a `repository_dispatch` (`nu-release`, `nuspace-release`, `nuverse-release`) a sibling release fires; the header of the workflow has the step a sibling adds.
|
|
145
|
+
|
|
146
|
+
## Versions
|
|
147
|
+
|
|
148
|
+
`nuskills` versions on its own, not in step with nu. CI tests the corpus against both current main and the latest released stack, so a version only says what changed in the text. `.claude-plugin/plugin.json` carries the same version as `pyproject.toml` (a test checks it), so installed plugins update when it moves.
|
|
149
|
+
|
|
150
|
+
Release: bump `version` in `pyproject.toml` and `.claude-plugin/plugin.json`, rename the CHANGELOG's `Unreleased` heading to the version + date, commit and push, then `git tag nuskills@X.Y.Z && git push origin nuskills@X.Y.Z`. `.github/workflows/publish.yml` publishes to PyPI (trusted publisher) and cuts a GitHub Release.
|
|
151
|
+
|
nuskills-0.1.0/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# nuskills
|
|
2
|
+
|
|
3
|
+
Prompt text about Nu and nuspace, in one place, tested against the current code.
|
|
4
|
+
|
|
5
|
+
- **nuagent** loads pieces into its system prompt.
|
|
6
|
+
- **Outside agents** (Claude Code, Codex) get skills built from the same pieces.
|
|
7
|
+
- Every fenced Python block in the corpus is built against the latest nucore, nustd and nuspace, so a piece cannot go stale without a red test.
|
|
8
|
+
|
|
9
|
+
## Layout
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/nuskills/
|
|
13
|
+
__init__.py loader: pieces(), load(), read(), __version__
|
|
14
|
+
corpus/
|
|
15
|
+
nu/ the kernel: thesis, crashcourse, composition, ...
|
|
16
|
+
nustd/ fabrics: kv, mem, ui, ...
|
|
17
|
+
nuspace/ the space model, ops, snippets, drawing a cell
|
|
18
|
+
skills.py which pieces each built skill carries, in order
|
|
19
|
+
headers/ per skill SKILL.md frontmatter and a few lines of when-to-use
|
|
20
|
+
build.py assembles skills/ from headers + pieces
|
|
21
|
+
skills/ built skills, committed, never edited by hand
|
|
22
|
+
.claude-plugin/ plugin.json + marketplace.json: the repo is a Claude Code plugin
|
|
23
|
+
tests/ the block harness, the loader tests, the skills checks
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Using it from Python
|
|
27
|
+
|
|
28
|
+
```python fragment
|
|
29
|
+
import nuskills
|
|
30
|
+
|
|
31
|
+
nuskills.pieces("nu") # ["nu/crashcourse", ...]
|
|
32
|
+
nuskills.read("nu/crashcourse") # markdown, frontmatter stripped
|
|
33
|
+
nuskills.load("nu/crashcourse") # Piece(id, title, summary, body)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Each consumer picks its pieces and decides their order. nuagent pins `nuskills` and assembles its system prompt from them, adding its own agent-specific text (role, protocol, finish) and the generated parts (the `nu.inspect` catalogue, the app surface). The pieces are package data, so `importlib.resources.files("nuskills") / "corpus" / "nu" / "crashcourse.md"` reaches the raw file too; the loader is the supported way.
|
|
37
|
+
|
|
38
|
+
## Skills
|
|
39
|
+
|
|
40
|
+
A skill is a header plus an ordered list of pieces, defined in `src/nuskills/skills.py`:
|
|
41
|
+
|
|
42
|
+
| Skill | For |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `nu` | building Nu programs and apps (kernel + nustd fabrics, kv, service, ui) |
|
|
45
|
+
| `nuspace` | programming a running nuspace (cell progs, ops, brackets, state, drawing, snippets) |
|
|
46
|
+
|
|
47
|
+
Each one is built in Claude Code's progressive disclosure layout. `SKILL.md` holds the header, a table of the reference files with each piece's summary, and the pieces every task needs (`inline`). The rest (`reference`) are files next to it, read only when the task needs one, so they cost no context until then. A piece's mention of another piece (`nustd/ui-refs`) becomes a link to wherever it landed.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
skills/<name>/
|
|
51
|
+
SKILL.md
|
|
52
|
+
reference/<group>/<piece>.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The skills carry no catalogue. They tell the agent to render the API with `nu.inspect` in its own environment, so a skill is right for whatever version is installed.
|
|
56
|
+
|
|
57
|
+
Rebuild after editing a piece, a header or `skills.py`, and commit the result. `tests/test_skills.py` fails while `skills/` is out of date.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv run python -m nuskills.build # write skills/
|
|
61
|
+
uv run python -m nuskills.build --check # exit 1 if skills/ is out of date
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Installing in Claude Code
|
|
65
|
+
|
|
66
|
+
The repo is a plugin marketplace (`nustack`) holding one plugin (`nuskills`):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude plugin marketplace add nustackdev/nuskills
|
|
70
|
+
claude plugin install nuskills@nustack
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Inside a session, `/plugin marketplace add nustackdev/nuskills` then `/plugin install nuskills@nustack` do the same. The skills show up as `/nuskills:nu` and `/nuskills:nuspace`, and Claude also loads them on its own when a task matches their description. To try a local checkout without installing: `claude --plugin-dir path/to/nuskills`. Validate after editing the manifests: `claude plugin validate .`.
|
|
74
|
+
|
|
75
|
+
## Writing a piece
|
|
76
|
+
|
|
77
|
+
A piece is one markdown file, `corpus/<group>/<name>.md`, its id is `<group>/<name>`. Keep it small enough to be picked on its own. Store only text that can't be generated: the catalogue (`nu.inspect`) and an app's surface are built at prompt time, never written here.
|
|
78
|
+
|
|
79
|
+
Optional frontmatter, `title` and `summary` only:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
---
|
|
83
|
+
title: Crash course
|
|
84
|
+
summary: The ten things you write in every Nu program.
|
|
85
|
+
---
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Fences
|
|
89
|
+
|
|
90
|
+
The info string on the opening fence says what the harness does with the block.
|
|
91
|
+
|
|
92
|
+
| Fence | Meaning | Checked by |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| ```` ```python ```` | a whole program | loaded, `out` called, `nu.validate(nu.compile(term))` |
|
|
95
|
+
| ```` ```python run ```` | a whole program that finishes quickly in memory | the above, then evaluated with `nu.arun` (10s cap) |
|
|
96
|
+
| ```` ```python fragment ```` | a few lines, not a program | Python `compile()` only |
|
|
97
|
+
| anything else (`text`, `bash`, ...) | prose | skipped |
|
|
98
|
+
|
|
99
|
+
Any other word after `python` fails the test, so a typo can't turn a program into prose.
|
|
100
|
+
|
|
101
|
+
A whole program is a module with an entry point `out`, loaded by `nu.prog`'s own loader (the one nuspace uses for a cell):
|
|
102
|
+
|
|
103
|
+
- `out` is a function returning a Nu term, or a term itself.
|
|
104
|
+
- `out` takes only what its signature asks for, by name.
|
|
105
|
+
- In `nu/` and `nustd/` pieces nothing is offered: write `def out():`.
|
|
106
|
+
- In `nuspace/` pieces the block is a cell program. It is stored as a cell on a plane in an in-memory space and loaded the way the kernel loads it. `out` may ask for `plane` and `cell`, the ids as plain `str`. `CellState` and `PlaneState` slots land under that cell and plane. Store access needs its own bracket, as in a real cell (`ops.atomic_state(...)`, `ops.snapshot(...)`). A `run` block runs inside the cell's `ops.Here` frame against that space. There is no browser session, so a block that draws should not be marked `run`.
|
|
107
|
+
- A string literal in a block that contains `def out(` is another program's source (eg the cell an `ops.add_cell` adds) and is built the same way, under the same group's rules.
|
|
108
|
+
|
|
109
|
+
Mark `run` only on programs that finish and touch nothing outside memory. A program that subscribes, waits or serves stays unmarked: built and validated, not run.
|
|
110
|
+
|
|
111
|
+
## Checking a piece
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uv sync # once: Python 3.10 .venv with the sibling repos editable
|
|
115
|
+
uv run pytest -k nuspace/model # every block in one piece
|
|
116
|
+
uv run pytest -k "nu/crashcourse:42" # one block: piece and the fence's line
|
|
117
|
+
uv run pytest # everything
|
|
118
|
+
uv run ruff check
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Each block is its own test, id `<piece>:<line>`, the line of its opening fence, so a failure points at the exact block. The dev env installs `../nu`, `../nu/pkgs/nustd[all]`, `../nuspace` and `../nuverse/pkgs/nuverse` editable, so it tests against main.
|
|
122
|
+
|
|
123
|
+
## CI
|
|
124
|
+
|
|
125
|
+
`.github/workflows/test.yml` runs ruff, the skills check and pytest against two stacks: **main** (nu, nuspace and nuverse checked out next to this repo, as `[tool.uv.sources]` expects) and **released** (the latest `nustd[all]`, `nuspace`, `nuverse` from PyPI). It runs on push and PR, nightly, by hand, and on a `repository_dispatch` (`nu-release`, `nuspace-release`, `nuverse-release`) a sibling release fires; the header of the workflow has the step a sibling adds.
|
|
126
|
+
|
|
127
|
+
## Versions
|
|
128
|
+
|
|
129
|
+
`nuskills` versions on its own, not in step with nu. CI tests the corpus against both current main and the latest released stack, so a version only says what changed in the text. `.claude-plugin/plugin.json` carries the same version as `pyproject.toml` (a test checks it), so installed plugins update when it moves.
|
|
130
|
+
|
|
131
|
+
Release: bump `version` in `pyproject.toml` and `.claude-plugin/plugin.json`, rename the CHANGELOG's `Unreleased` heading to the version + date, commit and push, then `git tag nuskills@X.Y.Z && git push origin nuskills@X.Y.Z`. `.github/workflows/publish.yml` publishes to PyPI (trusted publisher) and cuts a GitHub Release.
|
|
132
|
+
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
# Text only: the corpus of prompt pieces about Nu and nuspace, plus a tiny
|
|
6
|
+
# loader. Every fenced block in it is built against the current nucore, nustd
|
|
7
|
+
# and nuspace by tests/test_blocks.py. Versioned on its own, not in step with nu.
|
|
8
|
+
[project]
|
|
9
|
+
name = "nuskills"
|
|
10
|
+
version = "0.1.0"
|
|
11
|
+
description = "Tested prompt pieces and agent skills for Nu and nuspace."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
authors = [{ name = "Gor Arakelyan", email = "gorarkln@gmail.com" }]
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
# No runtime dependencies: the package ships text. Consumers read pieces
|
|
17
|
+
# through `nuskills.load` / `importlib.resources`.
|
|
18
|
+
dependencies = []
|
|
19
|
+
keywords = [
|
|
20
|
+
"nu",
|
|
21
|
+
"nustack",
|
|
22
|
+
"nuspace",
|
|
23
|
+
"prompt",
|
|
24
|
+
"skills",
|
|
25
|
+
"agents",
|
|
26
|
+
"llm",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
30
|
+
"License :: OSI Approved :: Apache Software License",
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Repository = "https://github.com/nustackdev/nuskills"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/nuskills"]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
only-include = [
|
|
46
|
+
"src/nuskills",
|
|
47
|
+
"README.md",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
# =============================================================================
|
|
51
|
+
# Dev env: the corpus is tested against the stack as it is on main
|
|
52
|
+
# =============================================================================
|
|
53
|
+
# Sibling checkouts, editable, the same wiring the nuverse workspace uses.
|
|
54
|
+
# `[tool.uv.sources]` never reaches published metadata.
|
|
55
|
+
[tool.uv.sources]
|
|
56
|
+
nucore = { path = "../nu", editable = true }
|
|
57
|
+
nustd = { path = "../nu/pkgs/nustd", editable = true }
|
|
58
|
+
nuspace = { path = "../nuspace", editable = true }
|
|
59
|
+
nuspace-ui = { path = "../nuspace/pkgs/ts/nuspace-ui", editable = true }
|
|
60
|
+
nuverse = { path = "../nuverse/pkgs/nuverse", editable = true }
|
|
61
|
+
|
|
62
|
+
[tool.uv]
|
|
63
|
+
default-groups = ["dev"]
|
|
64
|
+
|
|
65
|
+
[dependency-groups]
|
|
66
|
+
dev = [
|
|
67
|
+
# What the blocks are built against: the kernel, every fabric, nuspace,
|
|
68
|
+
# and nuverse's std snippets a nuspace piece may name.
|
|
69
|
+
"nucore",
|
|
70
|
+
"nustd[all]",
|
|
71
|
+
"nuspace",
|
|
72
|
+
"nuverse",
|
|
73
|
+
"ruff>=0.8.0",
|
|
74
|
+
"pytest>=7.0.0",
|
|
75
|
+
"pytest-asyncio>=1.3.0",
|
|
76
|
+
"pytest-timeout>=2.1.0",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.pytest.ini_options]
|
|
80
|
+
testpaths = [
|
|
81
|
+
"tests",
|
|
82
|
+
]
|
|
83
|
+
# `tests/_lib` is the only test directory on sys.path, and `_support` the only
|
|
84
|
+
# thing in it.
|
|
85
|
+
pythonpath = [
|
|
86
|
+
"tests/_lib",
|
|
87
|
+
]
|
|
88
|
+
python_files = ["test_*.py"]
|
|
89
|
+
python_classes = ["Test*"]
|
|
90
|
+
python_functions = ["test_*"]
|
|
91
|
+
addopts = ["-ra", "--strict-markers", "--strict-config", "--import-mode=importlib"]
|
|
92
|
+
asyncio_mode = "auto"
|
|
93
|
+
xfail_strict = true
|
|
94
|
+
timeout = 60
|
|
95
|
+
|
|
96
|
+
[tool.ruff]
|
|
97
|
+
line-length = 100
|
|
98
|
+
target-version = "py310"
|
|
99
|
+
src = [
|
|
100
|
+
"src",
|
|
101
|
+
]
|
|
102
|
+
# Corpus blocks live in markdown and are checked by the harness, not ruff.
|
|
103
|
+
extend-exclude = [".venv", "build", "dist", "*.egg-info", "_archive"]
|
|
104
|
+
|
|
105
|
+
[tool.ruff.lint]
|
|
106
|
+
select = [
|
|
107
|
+
"E",
|
|
108
|
+
"W",
|
|
109
|
+
"F",
|
|
110
|
+
"I",
|
|
111
|
+
"B",
|
|
112
|
+
"C4",
|
|
113
|
+
"UP",
|
|
114
|
+
"N",
|
|
115
|
+
"YTT",
|
|
116
|
+
"S",
|
|
117
|
+
"T20",
|
|
118
|
+
"D",
|
|
119
|
+
"ANN",
|
|
120
|
+
"TC",
|
|
121
|
+
"RUF",
|
|
122
|
+
"PTH",
|
|
123
|
+
]
|
|
124
|
+
ignore = [
|
|
125
|
+
"E501",
|
|
126
|
+
"D105",
|
|
127
|
+
"D107",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[tool.ruff.lint.pydocstyle]
|
|
131
|
+
convention = "google"
|
|
132
|
+
|
|
133
|
+
[tool.ruff.lint.per-file-ignores]
|
|
134
|
+
"**/tests/**/*.py" = [
|
|
135
|
+
"S101", "S108", "T20", "D", "E711", "E712", "ANN", "N806",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[tool.ruff.lint.isort]
|
|
139
|
+
known-first-party = [
|
|
140
|
+
"nuskills",
|
|
141
|
+
"nuspace",
|
|
142
|
+
"nuverse",
|
|
143
|
+
"nu",
|
|
144
|
+
"nustd",
|
|
145
|
+
]
|
|
146
|
+
force-single-line = false
|
|
147
|
+
lines-after-imports = 2
|
|
148
|
+
|
|
149
|
+
[tool.ruff.format]
|
|
150
|
+
quote-style = "double"
|
|
151
|
+
indent-style = "space"
|