axiom-coding-agent-setup 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/.agents/skills/domain-modeling/SKILL.md +74 -0
- package/.agents/skills/domain-modeling/agents/openai.yaml +3 -0
- package/.agents/skills/grill-with-docs/SKILL.md +7 -0
- package/.agents/skills/grill-with-docs/agents/openai.yaml +5 -0
- package/.agents/skills/grilling/SKILL.md +28 -0
- package/.agents/skills/grilling/agents/openai.yaml +3 -0
- package/.agents/skills/huggingface-deployment/SKILL.md +231 -0
- package/.agents/skills/implement/SKILL.md +15 -0
- package/.agents/skills/implement/agents/openai.yaml +5 -0
- package/.agents/skills/setup-matt-pocock-skills/SKILL.md +116 -0
- package/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +5 -0
- package/.agents/skills/setup-matt-pocock-skills/domain.md +51 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/.agents/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/.agents/skills/tdd/SKILL.md +38 -0
- package/.agents/skills/tdd/agents/openai.yaml +3 -0
- package/.agents/skills/tdd/mocking.md +59 -0
- package/.agents/skills/tdd/tests.md +77 -0
- package/.agents/skills/to-spec/SKILL.md +75 -0
- package/.agents/skills/to-spec/agents/openai.yaml +5 -0
- package/.agents/skills/to-tickets/SKILL.md +105 -0
- package/.agents/skills/to-tickets/agents/openai.yaml +5 -0
- package/.agents/skills/triage/AGENT-BRIEF.md +207 -0
- package/.agents/skills/triage/OUT-OF-SCOPE.md +105 -0
- package/.agents/skills/triage/SKILL.md +112 -0
- package/.agents/skills/triage/agents/openai.yaml +5 -0
- package/.agents/skills/wayfinder/SKILL.md +128 -0
- package/.agents/skills/wayfinder/agents/openai.yaml +5 -0
- package/README.md +11 -1
- package/bin/cli.js +22 -0
- package/package.json +1 -1
- package/skills-lock.json +117 -57
- package/error/error.md +0 -57
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ADR Format
|
|
2
|
+
|
|
3
|
+
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
4
|
+
|
|
5
|
+
Create the `docs/adr/` directory lazily: only when the first ADR is needed.
|
|
6
|
+
|
|
7
|
+
## Template
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
# {Short title of the decision}
|
|
11
|
+
|
|
12
|
+
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.
|
|
16
|
+
|
|
17
|
+
## Optional sections
|
|
18
|
+
|
|
19
|
+
Only include these when they add genuine value. Most ADRs won't need them.
|
|
20
|
+
|
|
21
|
+
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited
|
|
22
|
+
- **Considered Options**: only when the rejected alternatives are worth remembering
|
|
23
|
+
- **Consequences**: only when non-obvious downstream effects need to be called out
|
|
24
|
+
|
|
25
|
+
## Numbering
|
|
26
|
+
|
|
27
|
+
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
28
|
+
|
|
29
|
+
## When to offer an ADR
|
|
30
|
+
|
|
31
|
+
All three of these must be true:
|
|
32
|
+
|
|
33
|
+
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
|
34
|
+
2. **Surprising without context**: a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
35
|
+
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
36
|
+
|
|
37
|
+
If a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
|
38
|
+
|
|
39
|
+
### What qualifies
|
|
40
|
+
|
|
41
|
+
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
42
|
+
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
43
|
+
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.
|
|
44
|
+
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
|
45
|
+
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
|
46
|
+
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
|
47
|
+
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# CONTEXT.md Format
|
|
2
|
+
|
|
3
|
+
## Structure
|
|
4
|
+
|
|
5
|
+
```md
|
|
6
|
+
# {Context Name}
|
|
7
|
+
|
|
8
|
+
{One or two sentence description of what this context is and why it exists.}
|
|
9
|
+
|
|
10
|
+
## Language
|
|
11
|
+
|
|
12
|
+
**Order**:
|
|
13
|
+
{A one or two sentence description of the term}
|
|
14
|
+
_Avoid_: Purchase, transaction
|
|
15
|
+
|
|
16
|
+
**Invoice**:
|
|
17
|
+
A request for payment sent to a customer after delivery.
|
|
18
|
+
_Avoid_: Bill, payment request
|
|
19
|
+
|
|
20
|
+
**Customer**:
|
|
21
|
+
A person or organization that places orders.
|
|
22
|
+
_Avoid_: Client, buyer, account
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
|
28
|
+
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
|
29
|
+
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
|
30
|
+
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
|
31
|
+
|
|
32
|
+
## Single vs multi-context repos
|
|
33
|
+
|
|
34
|
+
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
|
35
|
+
|
|
36
|
+
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
# Context Map
|
|
40
|
+
|
|
41
|
+
## Contexts
|
|
42
|
+
|
|
43
|
+
- [Ordering](./src/ordering/CONTEXT.md): receives and tracks customer orders
|
|
44
|
+
- [Billing](./src/billing/CONTEXT.md): generates invoices and processes payments
|
|
45
|
+
- [Fulfillment](./src/fulfillment/CONTEXT.md): manages warehouse picking and shipping
|
|
46
|
+
|
|
47
|
+
## Relationships
|
|
48
|
+
|
|
49
|
+
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
|
50
|
+
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
|
51
|
+
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The skill infers which structure applies:
|
|
55
|
+
|
|
56
|
+
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
|
57
|
+
- If only a root `CONTEXT.md` exists, single context
|
|
58
|
+
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
|
59
|
+
|
|
60
|
+
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-modeling
|
|
3
|
+
description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain Modeling
|
|
7
|
+
|
|
8
|
+
Actively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
|
|
9
|
+
|
|
10
|
+
## File structure
|
|
11
|
+
|
|
12
|
+
Most repos have a single context:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/
|
|
16
|
+
├── CONTEXT.md
|
|
17
|
+
├── docs/
|
|
18
|
+
│ └── adr/
|
|
19
|
+
│ ├── 0001-event-sourced-orders.md
|
|
20
|
+
│ └── 0002-postgres-for-write-model.md
|
|
21
|
+
└── src/
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
/
|
|
28
|
+
├── CONTEXT-MAP.md
|
|
29
|
+
├── docs/
|
|
30
|
+
│ └── adr/ ← system-wide decisions
|
|
31
|
+
├── src/
|
|
32
|
+
│ ├── ordering/
|
|
33
|
+
│ │ ├── CONTEXT.md
|
|
34
|
+
│ │ └── docs/adr/ ← context-specific decisions
|
|
35
|
+
│ └── billing/
|
|
36
|
+
│ ├── CONTEXT.md
|
|
37
|
+
│ └── docs/adr/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Create files lazily: only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
|
41
|
+
|
|
42
|
+
## During the session
|
|
43
|
+
|
|
44
|
+
### Challenge against the glossary
|
|
45
|
+
|
|
46
|
+
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
|
|
47
|
+
|
|
48
|
+
### Sharpen fuzzy language
|
|
49
|
+
|
|
50
|
+
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account': do you mean the Customer or the User? Those are different things."
|
|
51
|
+
|
|
52
|
+
### Discuss concrete scenarios
|
|
53
|
+
|
|
54
|
+
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
|
55
|
+
|
|
56
|
+
### Cross-reference with code
|
|
57
|
+
|
|
58
|
+
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?"
|
|
59
|
+
|
|
60
|
+
### Update CONTEXT.md inline
|
|
61
|
+
|
|
62
|
+
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up: capture them as they happen. Use the format in [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md).
|
|
63
|
+
|
|
64
|
+
`CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
|
|
65
|
+
|
|
66
|
+
### Offer ADRs sparingly
|
|
67
|
+
|
|
68
|
+
Only offer to create an ADR when all three are true:
|
|
69
|
+
|
|
70
|
+
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
|
71
|
+
2. **Surprising without context**: a future reader will wonder "why did they do it this way?"
|
|
72
|
+
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
73
|
+
|
|
74
|
+
If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grilling
|
|
3
|
+
description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
|
|
7
|
+
|
|
8
|
+
Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
|
|
9
|
+
|
|
10
|
+
Format a round like so:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
14
|
+
|
|
15
|
+
➡️ <your recommended answer>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
20
|
+
|
|
21
|
+
➡️ <your recommended answer>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
|
|
25
|
+
|
|
26
|
+
Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
|
|
27
|
+
|
|
28
|
+
The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huggingface-deployment
|
|
3
|
+
description: Deploy and auto-deploy apps to Hugging Face Spaces from a GitHub repository. Use when setting up HF Space deployment pipelines, fixing Space build/CONFIG errors, debugging failed deploys, checking Space state, or diagnosing HF rate-limit failures. Triggers - "deploy to huggingface", "hf space", "huggingface sync", "CONFIG_ERROR", "space rebuild", "429 hub", "git push space".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hugging Face Space Deployment via GitHub
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
How to deploy a project to a Hugging Face Space automatically whenever a GitHub repository is updated, hard lessons learned from a real production failure (rate-limited mid-deploy, broken/emptied Space), and the APIs used to debug Space state.
|
|
11
|
+
|
|
12
|
+
Core deployment strategies (in order of preference):
|
|
13
|
+
|
|
14
|
+
| Strategy | How | Pros | Cons |
|
|
15
|
+
| ------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
16
|
+
| **`git push space`** (recommended) | CI pushes git history directly to the Space's git remote | 1 commit per push; incremental; native deletions; no SDK | Pushes all git-tracked files; needs LFS tracked properly |
|
|
17
|
+
| **Official `huggingface/hub-sync` action** | GitHub Action that mirrors files via the `hf` CLI | Zero-config; auto-excludes `.github/` + `.git/`; handles deletions | Mirror-based (not git-to-git); still commit-per-hook under the hood for large folders |
|
|
18
|
+
| **`hf upload` / `upload_folder` script** | Python API bulk upload with `ignore_patterns` | Full control over ignore list | Easy to trip commit rate limits if implemented as delete-per-file + upload |
|
|
19
|
+
| ~~Wipe-everything-then-upload~~ | `delete_file()` loop + `upload_folder` | (none — anti-pattern) | Burns ~1 commit **per deleted file**; a mid-run failure leaves the Space half-emptied |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## When to Use This Skill
|
|
24
|
+
|
|
25
|
+
- Setting up auto-deployment: GitHub repo → Hugging Face Space (same as Vercel/GH Pages flow)
|
|
26
|
+
- Space shows `CONFIG_ERROR` / "Missing configuration in README"
|
|
27
|
+
- Deploy job fails with `429 Too Many Requests ... commit rate limit`
|
|
28
|
+
- Space state looks wrong after a failed deploy (files missing, only partial tree)
|
|
29
|
+
- Choosing between `git push`, `hub-sync`, and `upload_folder` for a Space
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Prerequisites (What a Working Space Needs)
|
|
34
|
+
|
|
35
|
+
1. **`README.md` with YAML front matter at the very top** — this _is_ the Space's build config. Without it HF shows:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
configuration error
|
|
39
|
+
Missing configuration in README
|
|
40
|
+
Base README.md template:
|
|
41
|
+
---
|
|
42
|
+
title: {{title}}
|
|
43
|
+
emoji: {{emoji}}
|
|
44
|
+
colorFrom: {{colorFrom}}
|
|
45
|
+
colorTo: {{colorTo}}
|
|
46
|
+
sdk: {{sdk}}
|
|
47
|
+
sdk_version: "{{sdkVersion}}"
|
|
48
|
+
{{#pythonVersion}}
|
|
49
|
+
python_version: "{{pythonVersion}}"
|
|
50
|
+
{{/pythonVersion}}
|
|
51
|
+
app_file: app.py
|
|
52
|
+
pinned: false
|
|
53
|
+
---
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- `sdk`: `gradio` | `streamlit` | `static` | `docker` | `panel` | etc.
|
|
57
|
+
- The error above is ALSO shown when `README.md` is missing entirely (e.g. failed deploy) — don't assume the front matter is malformed; check whether the file exists on the Space first (see Debugging).
|
|
58
|
+
|
|
59
|
+
2. **`requirements.txt` at repo root** — HF Spaces installs from this (it does NOT read `pyproject.toml`/`uv.lock` unless visible; keep `requirements.txt` authoritative).
|
|
60
|
+
|
|
61
|
+
3. **App file in repo root** matching `app_file` (usually `app.py`).
|
|
62
|
+
|
|
63
|
+
4. **GitHub secret `HF_TOKEN`** — a HF access token with write access to the Space, added in GitHub repo Settings → Secrets and variables → Actions.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Recommended Setup: GitHub Workflow
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# .github/workflows/deploy.yml
|
|
71
|
+
name: Deploy to Hugging Face Space
|
|
72
|
+
|
|
73
|
+
on:
|
|
74
|
+
push:
|
|
75
|
+
branches: [main]
|
|
76
|
+
workflow_dispatch: # manual re-run after rate-limit recovery
|
|
77
|
+
|
|
78
|
+
jobs:
|
|
79
|
+
deploy-to-hf:
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
steps:
|
|
82
|
+
- name: Checkout repository
|
|
83
|
+
uses: actions/checkout@v4
|
|
84
|
+
with:
|
|
85
|
+
fetch-depth: 0 # full history — HF's pre-receive hook scans every pushed commit
|
|
86
|
+
lfs: true # required whenever any tracked file matches .gitattributes LFS patterns
|
|
87
|
+
|
|
88
|
+
- name: Push to HF Space
|
|
89
|
+
env:
|
|
90
|
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
91
|
+
SPACE_REPO: <HF_USERNAME>/<SPACE_NAME>
|
|
92
|
+
run: |
|
|
93
|
+
git lfs install
|
|
94
|
+
git remote add space "https://user:${HF_TOKEN}@huggingface.co/spaces/${SPACE_REPO}"
|
|
95
|
+
git push space main --force
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Key mechanics:
|
|
99
|
+
|
|
100
|
+
- `git push --force` to the Space is **reconciling**: adds, updates, AND deletes files to match the repo — no wipe step needed, and a failed run can't half-emptied the Space (unlike a delete-all-then-upload script).
|
|
101
|
+
- **1 git push = 1 commit on HF** — the entire commit-rate-limit problem disappears. There is no need to delete per file. Delete files in git; push; they're deleted on the Space.
|
|
102
|
+
- LFS objects (assets, PDFs, models under `.gitattributes` tracking) upload automatically with the push because the Space remote supports Git LFS natively. `checkout` with `lfs: true` ensures the runner has the objects.
|
|
103
|
+
- `fetch-depth: 0`: HF scans history on push; shallow pushes with binary blobs in parents can be rejected — full history + LFS avoids surprises.
|
|
104
|
+
|
|
105
|
+
### Deployment scope is defined by git tracking, not an ignore list
|
|
106
|
+
|
|
107
|
+
The workflow deploys exactly what `git ls-files` outputs. Before wiring it up, run:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git ls-files # everything that will land on the Space
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- Sensitive files (`.env`) must be `gitignored` — never rely on a deploy ignore list to catch them.
|
|
114
|
+
- Data/runtime dirs (`data/output/*`, uploaded user files, model outputs) belong in `.gitignore`.
|
|
115
|
+
- Non-needed extras (agent docs, local tool configs) may ride along harmlessly if you prefer parity-by-tracking over extra ignores — decide consciously.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Alternative: Official Action
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
steps:
|
|
123
|
+
- uses: actions/checkout@v6
|
|
124
|
+
- uses: huggingface/hub-sync@v0.1.0
|
|
125
|
+
with:
|
|
126
|
+
github_repo_id: ${{ github.repository }}
|
|
127
|
+
huggingface_repo_id: username/my-space
|
|
128
|
+
hf_token: ${{ secrets.HF_TOKEN }}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Mirrors file contents (not git history), excludes `.github/` and `.git/` automatically, and removes Hub files that were removed from GitHub. Files >10MB must be tracked with Git LFS. Use this when you don't want the Space to share your git history at all.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Rate Limits (Failure Mode That Took Down a Real Space)
|
|
136
|
+
|
|
137
|
+
Hub commit quota is a **user-action rate limit** (not part of the published 5-minute-window API/resolver tiers). Empirically observed on a free account:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
429 Too Many Requests — You have exceeded the rate limit for repository commits
|
|
141
|
+
(128 per hour). You can retry this action in about 1 hour.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Key facts:
|
|
145
|
+
|
|
146
|
+
- The limit counts **commits regardless of success/failure**, including retried failed ones — a failed upload mid-run still spent budget.
|
|
147
|
+
- `delete_file()` is **one commit per file**. Wiping a 70-file Space ≈ 70 commits.
|
|
148
|
+
- `upload_folder` splits into multiple commits (auto-splits at ~50–100 files per commit for large folders).
|
|
149
|
+
- Three deploys in one hour ≈ far over budget → mid-upload 429 → Space left empty → rebuild error.
|
|
150
|
+
|
|
151
|
+
Recovery from a 429:
|
|
152
|
+
|
|
153
|
+
1. Wait for the window to reset (the error message states the cooldown, usually ~1 hour).
|
|
154
|
+
2. Re-run the workflow via `workflow_dispatch` (Actions tab → Run workflow) — no new commit needed if `main` is already correct.
|
|
155
|
+
3. Local runs (running the same script locally with the HF token) hit the **same account-level** quota.
|
|
156
|
+
|
|
157
|
+
If you must clean a repo where per-file deletes are otherwise unavoidable, batch them into a single commit:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from huggingface_hub import HfApi
|
|
161
|
+
from huggingface_hub.hf_api import CommitOperationDelete
|
|
162
|
+
|
|
163
|
+
api.create_commit(
|
|
164
|
+
repo_id="user/space", repo_type="space", token=token,
|
|
165
|
+
operations=[CommitOperationDelete(path=f) for f in existing_files],
|
|
166
|
+
commit_message="Clear existing files",
|
|
167
|
+
)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Debugging a Space
|
|
173
|
+
|
|
174
|
+
### State inspection (works even when the UI is confusing)
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import os, requests
|
|
178
|
+
from dotenv import load_dotenv
|
|
179
|
+
load_dotenv()
|
|
180
|
+
h = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"}
|
|
181
|
+
|
|
182
|
+
# Files currently on the Space
|
|
183
|
+
r = requests.get("https://huggingface.co/api/spaces/<USER>/<SPACE>/tree/main", headers=h)
|
|
184
|
+
print(r.status_code, [f["path"] for f in r.json()])
|
|
185
|
+
|
|
186
|
+
# Space runtime/config status (runtime stage: RUNNING | BUILDING | CONFIG_ERROR | ...)
|
|
187
|
+
s = requests.get("https://huggingface.co/api/spaces/<USER>/<SPACE>", headers=h)
|
|
188
|
+
print(s.json().get("runtime", {}).get("stage"))
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- `CONFIG_ERROR` + tree missing `README.md`/`app.py` → deploy died mid-run; find the failing workflow run's log (`gh run view <run-id> --log-failed`) — usually a 429 or upload exception — then fix root cause and re-run.
|
|
192
|
+
- `CONFIG_ERROR` + `README.md` present → front matter is actually malformed; the template block above tells you exactly what HF expects.
|
|
193
|
+
|
|
194
|
+
### Workflow failures
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
gh run list -R <OWNER>/<REPO> --limit 3 # history
|
|
198
|
+
gh run view <id> --log-failed -R <OWNER>/<REPO> # the exception
|
|
199
|
+
gh workflow run deploy.yml -R <OWNER>/<REPO> # manual rerun (workflow_dispatch)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Space runtime issues
|
|
203
|
+
|
|
204
|
+
- **Logs tab** on the Space page is the only source of runtime (build/runtime) errors — config errors surface in the Space UI, not the GitHub Action log.
|
|
205
|
+
- Wrong `app_file` / missing root entry file → build succeeds, app fails. `app_file` must match exactly.
|
|
206
|
+
|
|
207
|
+
### After any Space-altering change
|
|
208
|
+
|
|
209
|
+
Check: file tree is complete (`tree/main` shows expected set), README front matter intact, and the Space's runtime stage becomes `RUNNING` after build.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Gotchas
|
|
214
|
+
|
|
215
|
+
- **Rate limit is per account/token across everything**, so a local test run and a CI run share the same budget.
|
|
216
|
+
- The Hub's pre-receive hook scans **every commit in the push**, not just the tip — and since the move to Xet storage it **rejects raw binary files** not stored via Xet/LFS anywhere in that history, even if the current tree is clean (symptom: `remote: Your push was rejected because it contains binary files` + `Offending files:` list). If that bites, push a single **orphan commit** of the current tree minus raw binaries instead of raw history. Historic binaries committed before an LFS rule was added to `.gitattributes` stay raw in ancestors — adding the LFS rule only changes future commits.
|
|
217
|
+
- **LFS pointer vs file content**: if the runner checks out with `lfs: true`, files in the working copy are real content; pushing to the Space via `git push` uploads the real LFS objects over the remote's LFS endpoint. Without LFS checkout, the Space receives pointer files → 404 on the asset.
|
|
218
|
+
- `upload_folder` failures mid-run are **not transactional** — partial state persists (this is what emptied a real Space down to one directory).
|
|
219
|
+
- Deleting LFS files only frees guardrail-level storage after history is rewritten (`super_squash_history`), but for Spaces the OPPOSITE pattern is fine: force-push resets history, so old Storage-deleted files aren't a top concern.
|
|
220
|
+
- Secrets on the Space come from Space Settings → Variables and secrets (HF side), NOT from GitHub secrets; a `.env` excluded from the repo is still not present at runtime unless you set it in HF Space settings too.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Checklist (Per Deployment Change)
|
|
225
|
+
|
|
226
|
+
- `README.md` front matter exists and matcher (`sdk`, `app_file`) targets the actual entrypoint and SDK version
|
|
227
|
+
- `requirements.txt` authoritatively lists runtime deps (Free HF Spaces reads only it)
|
|
228
|
+
- GitHub secret `HF_TOKEN` present and has write scope to the Space
|
|
229
|
+
- All Space-relevant files tracked in git; private/user-data files gitignored
|
|
230
|
+
- Workflow file under `.github/workflows/` with `push: branches: [main]` and `workflow_dispatch`
|
|
231
|
+
- Trigger one deploy and watch it complete; verify Space tree completeness and rerun if throttled
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implement
|
|
3
|
+
description: "Implement a piece of work based on a spec or set of tickets."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Implement the work described by the user in the spec or tickets.
|
|
8
|
+
|
|
9
|
+
Use /tdd where possible, at pre-agreed seams.
|
|
10
|
+
|
|
11
|
+
Run typechecking regularly, single test files regularly, and the full test suite once at the end.
|
|
12
|
+
|
|
13
|
+
Once done, use /code-review to review the work.
|
|
14
|
+
|
|
15
|
+
Commit your work to the current branch.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-matt-pocock-skills
|
|
3
|
+
description: "Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Setup Matt Pocock's Skills
|
|
8
|
+
|
|
9
|
+
Scaffold the per-repo configuration that the engineering skills assume:
|
|
10
|
+
|
|
11
|
+
- **Issue tracker**: where issues live (GitHub by default; local markdown is also supported out of the box)
|
|
12
|
+
- **Triage labels**: the strings used for the five canonical triage roles
|
|
13
|
+
- **Domain docs**: where `CONTEXT.md` and ADRs live, and the consumer rules for reading them
|
|
14
|
+
|
|
15
|
+
This is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### 1. Explore
|
|
20
|
+
|
|
21
|
+
Look at the current repo to understand its starting state. Read whatever exists; don't assume:
|
|
22
|
+
|
|
23
|
+
- `git remote -v` and `.git/config`: is this a GitHub repo? Which one?
|
|
24
|
+
- `AGENTS.md` and `CLAUDE.md` at the repo root: does either exist? Is there already an `## Agent skills` section in either?
|
|
25
|
+
- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root
|
|
26
|
+
- `docs/adr/` and any `src/*/docs/adr/` directories
|
|
27
|
+
- `docs/agents/`: does this skill's prior output already exist?
|
|
28
|
+
- `.scratch/`: a sign that a local-markdown issue tracker convention is already in use
|
|
29
|
+
- Is the `triage` skill installed? (a `triage` skill folder alongside this one, or `triage` in your available skills.) This decides whether Section B runs at all.
|
|
30
|
+
- Monorepo signals: a `pnpm-workspace.yaml`, a `workspaces` field in `package.json`, or a populated `packages/*` with its own `src/`. These are present only in a genuinely large multi-package repo; their absence means single-context, which is almost every repo.
|
|
31
|
+
|
|
32
|
+
### 2. Present findings and ask
|
|
33
|
+
|
|
34
|
+
Summarise what's present and what's missing. Then take the sections in order. One section, one answer, then the next.
|
|
35
|
+
|
|
36
|
+
Lead each section with the recommended answer so the user can accept it in a word. Give a one-line explainer only when the choice genuinely branches; skip the section entirely when exploration already settled it (Section B when `triage` isn't installed, Section C when there's no monorepo).
|
|
37
|
+
|
|
38
|
+
**Section A: Issue tracker.**
|
|
39
|
+
|
|
40
|
+
> Explainer: The "issue tracker" is where issues live for this repo. Skills like `to-tickets`, `triage`, and `to-spec` read from and write to it. They need to know whether to call `gh issue create`, write a markdown file under `.scratch/`, or follow some other workflow you describe. Pick the place you actually track work for this repo.
|
|
41
|
+
|
|
42
|
+
Default posture: these skills were designed for GitHub. If a `git remote` points at GitHub, propose that. If a `git remote` points at GitLab (`gitlab.com` or a self-hosted host), propose GitLab. Otherwise (or if the user prefers), offer:
|
|
43
|
+
|
|
44
|
+
- **GitHub**: issues live in the repo's GitHub Issues (uses the `gh` CLI)
|
|
45
|
+
- **GitLab**: issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)
|
|
46
|
+
- **Local markdown**: issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)
|
|
47
|
+
- **Other** (Jira, Linear, etc.): ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose
|
|
48
|
+
|
|
49
|
+
Record the choice in `docs/agents/issue-tracker.md`. The GitHub and GitLab templates carry a "PRs as a request surface" flag, defaulted **off**. Leave it off and don't raise it: a user who wants external PRs in the triage queue can flip the flag in the file later.
|
|
50
|
+
|
|
51
|
+
**Section B: Triage label vocabulary.** Skip this section entirely if the `triage` skill isn't installed (exploration told you), since an uninstalled skill needs no labels.
|
|
52
|
+
|
|
53
|
+
If it is installed, ask exactly one question:
|
|
54
|
+
|
|
55
|
+
> Do you want to keep the default triage labels? (recommended: **yes**)
|
|
56
|
+
|
|
57
|
+
The defaults are the five canonical roles, each label string equal to its name: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. On **yes**, write them as-is. Only if the user says no, usually because their tracker already uses other names (e.g. `bug:triage` for `needs-triage`), collect the overrides so `triage` applies existing labels instead of creating duplicates.
|
|
58
|
+
|
|
59
|
+
**Section C: Domain docs.** Default to **single-context** (one `CONTEXT.md` + `docs/adr/` at the repo root). This fits almost every repo; write it without asking.
|
|
60
|
+
|
|
61
|
+
Offer **multi-context** (a root `CONTEXT-MAP.md` pointing to per-context `CONTEXT.md` files) only when exploration found monorepo signals. Then confirm which layout they want.
|
|
62
|
+
|
|
63
|
+
### 3. Confirm and edit
|
|
64
|
+
|
|
65
|
+
Show the user a draft of:
|
|
66
|
+
|
|
67
|
+
- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)
|
|
68
|
+
- The contents of `docs/agents/issue-tracker.md`, `docs/agents/domain.md`, and `docs/agents/triage-labels.md` (the last only when `triage` is installed)
|
|
69
|
+
|
|
70
|
+
Let them edit before writing.
|
|
71
|
+
|
|
72
|
+
### 4. Write
|
|
73
|
+
|
|
74
|
+
**Pick the file to edit:**
|
|
75
|
+
|
|
76
|
+
- If `CLAUDE.md` exists, edit it.
|
|
77
|
+
- Else if `AGENTS.md` exists, edit it.
|
|
78
|
+
- If neither exists, ask the user which one to create; don't pick for them.
|
|
79
|
+
|
|
80
|
+
Never create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa); always edit the one that's already there.
|
|
81
|
+
|
|
82
|
+
If an `## Agent skills` block already exists in the chosen file, update its contents in-place rather than appending a duplicate. Don't overwrite user edits to the surrounding sections.
|
|
83
|
+
|
|
84
|
+
The block:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## Agent skills
|
|
88
|
+
|
|
89
|
+
### Issue tracker
|
|
90
|
+
|
|
91
|
+
[one-line summary of where issues are tracked]. See `docs/agents/issue-tracker.md`.
|
|
92
|
+
|
|
93
|
+
### Triage labels
|
|
94
|
+
|
|
95
|
+
[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.
|
|
96
|
+
|
|
97
|
+
### Domain docs
|
|
98
|
+
|
|
99
|
+
[one-line summary of layout: "single-context" or "multi-context"]. See `docs/agents/domain.md`.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Include the `### Triage labels` sub-block, and write `docs/agents/triage-labels.md`, only when `triage` is installed and Section B ran. When it isn't, both are omitted.
|
|
103
|
+
|
|
104
|
+
Then write the docs files using the seed templates in this skill folder as a starting point:
|
|
105
|
+
|
|
106
|
+
- [issue-tracker-github.md](./issue-tracker-github.md): GitHub issue tracker
|
|
107
|
+
- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md): GitLab issue tracker
|
|
108
|
+
- [issue-tracker-local.md](./issue-tracker-local.md): local-markdown issue tracker
|
|
109
|
+
- [triage-labels.md](./triage-labels.md): label mapping (only if `triage` is installed)
|
|
110
|
+
- [domain.md](./domain.md): domain doc consumer rules + layout
|
|
111
|
+
|
|
112
|
+
For "other" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.
|
|
113
|
+
|
|
114
|
+
### 5. Done
|
|
115
|
+
|
|
116
|
+
Tell the user the setup is complete and which engineering skills will now read from these files. Mention they can edit `docs/agents/*.md` directly later; re-running this skill is only necessary if they want to switch issue trackers or restart from scratch.
|