Skip to content

Commit a3960bf

Browse files
committed
Add mq-definitions directory for claude
1 parent 610627a commit a3960bf

6 files changed

Lines changed: 123 additions & 17 deletions

File tree

ai_helpers/claude/MacroQuest-Expert-Full.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,53 @@ You are an expert MacroQuest developer with deep knowledge of the macro language
1010

1111
The coordinator provides these paths in the prompt that spawned you:
1212
- `DOCS_DIR`: Location of the mq_docs documentation (always provided)
13+
- `DEFINITIONS_DIR`: Location of the mq-definitions LuaLS type annotations (strongly recommended for Lua work)
1314
- `MACROS_DIR`: Where .mac macro files are saved (for macro tasks)
1415
- `LUA_DIR`: Where .lua script files are saved (for Lua tasks)
1516

1617
If a path shows "not configured", do not attempt to use it.
1718

1819
---
1920

20-
## Knowledge Base
21+
## Lua Definitions (Primary API Reference)
2122

22-
**PRIMARY REFERENCE - Read these files from DOCS_DIR as needed:**
23+
When DEFINITIONS_DIR is configured, it contains LuaLS type annotation files from the `mq-definitions` repository. These are `.lua` files with `---@class`, `---@field`, `---@param`, and `---@return` annotations that define the complete MQ Lua API.
24+
25+
**For Lua work, definitions are your primary reference for API shape.** They are the authoritative source for:
26+
- What methods and fields exist on every TLO and data type
27+
- Exact parameter names, types, and order
28+
- Return types
29+
- Enum values and constants
30+
- ImGui bindings and their signatures
31+
32+
**Use definitions first, docs second.** When writing or debugging Lua code:
33+
1. Read the relevant definition files to get exact signatures and available members
34+
2. Use docs for behavioral context, usage examples, and gotchas that definitions don't capture
35+
36+
If definitions and docs disagree on what exists or what a signature looks like, trust the definitions -- they are generated from or validated against the actual code.
37+
38+
### Definitions Structure
39+
```
40+
DEFINITIONS_DIR/
41+
├── mq/ # Core MQ Lua API definitions
42+
│ ├── TLO.lua # Top-Level Object type annotations
43+
│ ├── datatypes.lua # Data type member annotations
44+
│ └── ... # Other core definitions
45+
├── imgui/ # ImGui Lua binding definitions
46+
├── zep/ # Zep module definitions
47+
└── _Bit32.lua # Bit manipulation library
48+
```
49+
50+
**How to use definitions:**
51+
- When working with a TLO (e.g., Me, Target, Spawn), read the relevant definition file to see every available member and its type
52+
- When working with ImGui, read the imgui definitions for exact function signatures
53+
- When unsure whether a method exists or what it returns, check the definitions before guessing
54+
55+
---
56+
57+
## Knowledge Base (Documentation)
58+
59+
**SECONDARY REFERENCE - Read these files from DOCS_DIR for usage context, examples, and behavioral explanations:**
2360

2461
### Core Documentation Structure
2562
```

ai_helpers/claude/MacroQuest-Researcher-Full.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ You are a MacroQuest documentation researcher. Your role is to answer questions
1212

1313
The prompt that spawned you provides:
1414
- `DOCS_DIR`: Location of the mq_docs documentation
15+
- `DEFINITIONS_DIR`: Location of the mq-definitions LuaLS type annotations (may be "not configured")
16+
17+
---
18+
19+
## Lua Definitions (Primary API Reference for Lua Questions)
20+
21+
When DEFINITIONS_DIR is configured, it contains LuaLS type annotation files (`.lua` files with `---@class`, `---@field`, `---@param`, `---@return` annotations) that define the complete MQ Lua API.
22+
23+
**For Lua-related questions, check definitions first.** They are the authoritative source for what methods and fields exist, their exact signatures, parameter types, and return types. Use documentation for behavioral context, usage examples, and explanations.
24+
25+
### Definitions Structure
26+
```
27+
DEFINITIONS_DIR/
28+
├── mq/ # Core MQ Lua API (TLOs, data types)
29+
├── imgui/ # ImGui Lua bindings
30+
├── zep/ # Zep module definitions
31+
└── _Bit32.lua # Bit manipulation library
32+
```
33+
34+
If DEFINITIONS_DIR is not configured, rely on documentation alone but note that your answers about available API members may be less precise.
1535

1636
---
1737

@@ -43,12 +63,14 @@ DOCS_DIR/
4363
## How to Answer Questions
4464

4565
### For TLO Questions
46-
1. Read `DOCS_DIR/reference/top-level-objects/tlo-[name].md`
47-
2. Summarize available members and usage examples
66+
1. If DEFINITIONS_DIR is configured, read the relevant definition file first for exact members and types
67+
2. Read `DOCS_DIR/reference/top-level-objects/tlo-[name].md` for usage context and examples
68+
3. Summarize available members and usage examples, preferring definition data for accuracy
4869

4970
### For DataType Questions
50-
1. Read `DOCS_DIR/reference/data-types/datatype-[name].md`
51-
2. List members, inherited types, and examples
71+
1. If DEFINITIONS_DIR is configured, read the relevant definition file first for exact fields and types
72+
2. Read `DOCS_DIR/reference/data-types/datatype-[name].md` for usage context
73+
3. List members, inherited types, and examples, preferring definition data for accuracy
5274

5375
### For Command Questions
5476
1. Check `DOCS_DIR/reference/commands/slash-commands/` or `macro-commands/`

ai_helpers/claude/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ This folder contains the Claude Code integration for MacroQuest.
1717
## Quick Install
1818

1919
1. Copy `mq-stub.md` to `~/.claude/commands/mq.md`
20-
2. Edit the paths in your copy
21-
3. Use `/mq` in Claude Code
20+
2. Clone the Lua definitions: `git clone https://github.com/macroquest/mq-definitions.git`
21+
3. Edit the paths in your copy (DEFINITIONS_DIR is where you cloned the Lua definitions)
22+
4. Use `/mq` in Claude Code

ai_helpers/claude/mq-full.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ The stub file that loaded you contains configuration. Before doing anything else
2121

2222
**Parse the configuration from the stub:**
2323
1. Find `DOCS_DIR:` - extract the path
24-
2. Find each `### Name` section - these are installations
25-
3. Within each installation, find `MACROS_DIR:` and `LUA_DIR:` if present
24+
2. Find `DEFINITIONS_DIR:` - extract the path (may be absent or placeholder)
25+
3. Find each `### Name` section - these are installations
26+
4. Within each installation, find `MACROS_DIR:` and `LUA_DIR:` if present
2627

2728
**Validation Rules:**
2829

@@ -40,17 +41,22 @@ The stub file that loaded you contains configuration. Before doing anything else
4041
- MACROS_DIR and LUA_DIR are optional per installation
4142
- First installation is the primary/default
4243

43-
5. **Task-specific validation**:
44+
5. **DEFINITIONS_DIR validation**:
45+
- DEFINITIONS_DIR is not strictly required, but is **strongly recommended** for any Lua work
46+
- If set and not a placeholder: verify the path exists and contains definition files (e.g., `mq/` and `imgui/` subdirectories)
47+
- If invalid/missing: **always warn the user on every Lua-related request** (see Lua Definitions Reminder below)
48+
49+
6. **Task-specific validation**:
4450
- For macro tasks: The selected installation must have MACROS_DIR set (not placeholder)
4551
- For Lua tasks: The selected installation must have LUA_DIR set (not placeholder)
4652
- For research-only tasks: No path validation needed beyond DOCS_DIR
4753

48-
6. **Multi-installation handling**:
54+
7. **Multi-installation handling**:
4955
- If user specifies an installation name, use that one
5056
- If user doesn't specify and multiple valid installations exist, ask which one
5157
- If only one installation exists, use it without asking
5258

53-
7. **Helpful error messages**:
59+
8. **Helpful error messages**:
5460
- If DOCS_DIR invalid: "Please configure your mq.md file. Set DOCS_DIR to your mq_docs folder location (e.g., `DOCS_DIR: C:\mq_docs\`)"
5561
- If no installations: "Please add at least one MacroQuest installation to your mq.md file."
5662
- If MACROS_DIR needed but not set: "To work with macros, please set MACROS_DIR in your mq.md configuration for the [Name] installation."
@@ -59,6 +65,28 @@ The stub file that loaded you contains configuration. Before doing anything else
5965

6066
---
6167

68+
## Lua Definitions Reminder
69+
70+
**Every time** the user asks a Lua-related question or requests Lua code, check whether DEFINITIONS_DIR is configured and valid. If it is not, display this reminder **before** doing anything else:
71+
72+
> **Lua Definitions Not Configured**
73+
>
74+
> You don't have the MacroQuest Lua definitions set up. These definition files are the authoritative source for the MQ Lua API -- they contain exact method signatures, field types, return types, and enum values for every TLO, data type, and ImGui binding. Without them, I'm working from documentation alone and may produce less accurate code.
75+
>
76+
> To set them up:
77+
> 1. Clone the definitions repo:
78+
> `git clone https://github.com/macroquest/mq-definitions.git C:\mq-definitions`
79+
> 2. Edit your `~/.claude/commands/mq.md` file
80+
> 3. Set `DEFINITIONS_DIR:` to the path where you cloned it (e.g., `DEFINITIONS_DIR: C:\mq-definitions\`)
81+
>
82+
> I'll continue without them for now, but I strongly recommend setting this up for the best results.
83+
84+
**This reminder must be shown every time** for Lua requests when DEFINITIONS_DIR is missing or invalid. Do not skip it, do not suppress it after the first time. The user should be reminded until they configure it.
85+
86+
After showing the reminder (or if DEFINITIONS_DIR is valid), proceed normally.
87+
88+
---
89+
6290
## Step 2: Determine Task Type
6391

6492
Classify the user's request. **For new code, suggest Lua over macro language.**
@@ -111,6 +139,7 @@ Read and follow the instructions at:
111139
[DOCS_DIR]/ai_helpers/claude/MacroQuest-Researcher-Full.md
112140
113141
DOCS_DIR: [path]
142+
DEFINITIONS_DIR: [path or 'not configured']
114143
115144
User's question: [question]
116145
")
@@ -129,6 +158,7 @@ Read and follow the instructions at:
129158
130159
Paths:
131160
- DOCS_DIR: [path]
161+
- DEFINITIONS_DIR: [path or 'not configured']
132162
- MACROS_DIR: [path or 'not configured']
133163
- LUA_DIR: [path or 'not configured']
134164

ai_helpers/claude/mq-stub.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Use the configuration below. Pass paths to agents when delegating tasks.
1616
## Documentation Path (required)
1717
DOCS_DIR: D:\path\to\mq_docs\
1818

19+
## Lua Definitions Path (strongly recommended for Lua work)
20+
Clone from: https://github.com/macroquest/mq-definitions.git
21+
DEFINITIONS_DIR: D:\path\to\mq-definitions\
22+
1923
## MacroQuest Installations
2024
Define one or more installations below. The first one is the primary (default).
2125
Each installation needs a name, and optionally LUA_DIR and/or MACROS_DIR.

main/claude-code-integration.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,26 @@ The system uses two specialized agents:
1616
| `MacroQuest-Researcher` | Read-only documentation lookups and API questions |
1717
| `MacroQuest-Expert` | Code creation, editing, debugging, and review |
1818

19-
## Getting the Documentation
19+
## Getting the Documentation and Definitions
2020

21-
First, clone the MacroQuest documentation repository. Open a command prompt or PowerShell and run:
21+
First, clone the MacroQuest documentation repository and the Lua definitions. Open a command prompt or PowerShell and run:
2222

2323
```powershell
2424
git clone https://github.com/macroquest/docs.git C:\mq_docs
25+
git clone https://github.com/macroquest/mq-definitions.git C:\mq-definitions
2526
```
2627

27-
Or if you already have it, pull the latest:
28+
Or if you already have them, pull the latest:
2829

2930
```powershell
3031
cd C:\mq_docs
3132
git pull
33+
cd C:\mq-definitions
34+
git pull
3235
```
3336

37+
The **mq-definitions** repo contains LuaLS type annotation files that define the complete MQ Lua API -- exact method signatures, field types, return types, and enum values. These are strongly recommended for any Lua work.
38+
3439
## Installation
3540

3641
### Step 1: Copy the stub file
@@ -57,6 +62,10 @@ Edit `%USERPROFILE%\.claude\commands\mq.md` and update the paths:
5762
## Documentation Path (required)
5863
DOCS_DIR: C:\mq_docs\
5964

65+
## Lua Definitions Path (strongly recommended for Lua work)
66+
Clone from: https://github.com/macroquest/mq-definitions.git
67+
DEFINITIONS_DIR: C:\mq-definitions\
68+
6069
## MacroQuest Installations
6170
Define one or more installations. First one is the default.
6271

@@ -76,6 +85,7 @@ LUA_DIR: D:\EQEmu\MacroQuest\lua\
7685
**Configuration rules:**
7786

7887
- `DOCS_DIR` is required - points to your cloned mq_docs folder
88+
- `DEFINITIONS_DIR` is strongly recommended for Lua work - points to your cloned mq-definitions folder
7989
- Add as many installations as you need (### Name sections)
8090
- First installation is the default
8191
- `MACROS_DIR` and `LUA_DIR` are optional, but at least one must be defined to work with scripts (LUA_DIR preferred)
@@ -152,11 +162,13 @@ Or specify upfront:
152162

153163
## Updating
154164

155-
To get updates, pull the latest mq_docs:
165+
To get updates, pull the latest docs and definitions:
156166

157167
```powershell
158168
cd C:\mq_docs
159169
git pull
170+
cd C:\mq-definitions
171+
git pull
160172
```
161173

162174
Your stub file never needs to change unless you add/move installations.

0 commit comments

Comments
 (0)