@sassoftware/sas-score-mcp-serverjs 1.0.1-0 → 1.0.1-3

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.
Files changed (31) hide show
  1. package/.skills_claude/README.md +303 -0
  2. package/.skills_claude/TESTING_GUIDE.md +252 -0
  3. package/.skills_claude/claude-desktop-config.json +16 -0
  4. package/.skills_claude/claude-desktop-system-prompt.md +127 -0
  5. package/{.skills → .skills_claude}/copilot-instructions.md +1 -1
  6. package/.skills_claude/instructions.md +184 -0
  7. package/{.skills → .skills_claude}/skills/sas-find-library-smart/SKILL.md +11 -8
  8. package/.skills_claude/skills/sas-find-resource-strategy/SKILL.md +105 -0
  9. package/.skills_claude/skills/sas-list-resource-strategy/SKILL.md +124 -0
  10. package/{.skills → .skills_claude}/skills/sas-list-tables-smart/SKILL.md +2 -3
  11. package/{.skills → .skills_claude}/skills/sas-read-and-score/SKILL.md +4 -3
  12. package/{.skills → .skills_claude}/skills/sas-read-strategy/SKILL.md +11 -13
  13. package/{.skills → .skills_claude}/skills/sas-request-classifier/SKILL.md +1 -1
  14. package/.skills_claude/skills/sas-score-workflow/SKILL.md +200 -0
  15. package/.skills_claude/skills-index.md +345 -0
  16. package/.skills_github/agents/sas-viya-scoring-expert.md +58 -0
  17. package/.skills_github/copilot-instructions.md +177 -0
  18. package/.skills_github/skills/sas-find-library-smart/SKILL.md +155 -0
  19. package/.skills_github/skills/sas-find-resource-strategy/SKILL.md +105 -0
  20. package/.skills_github/skills/sas-list-resource-strategy/SKILL.md +124 -0
  21. package/.skills_github/skills/sas-list-tables-smart/SKILL.md +128 -0
  22. package/.skills_github/skills/sas-read-and-score/SKILL.md +113 -0
  23. package/.skills_github/skills/sas-read-strategy/SKILL.md +154 -0
  24. package/.skills_github/skills/sas-request-classifier/SKILL.md +74 -0
  25. package/{.skills → .skills_github}/skills/sas-score-workflow/SKILL.md +5 -5
  26. package/README.md +72 -207
  27. package/cli.js +34 -66
  28. package/package.json +3 -2
  29. package/scripts/setup-skills.js +2 -2
  30. package/src/setupSkills.js +26 -15
  31. /package/{.skills → .skills_claude}/agents/sas-viya-scoring-expert.md +0 -0
@@ -0,0 +1,184 @@
1
+ # .claude Directory — Usage Instructions
2
+
3
+ This directory contains a complete, unified configuration for the SAS agent across **Claude Desktop**, **GitHub Copilot**, and other Claude clients.
4
+
5
+ ## Directory Structure
6
+
7
+ ```
8
+ .claude/
9
+ ├── copilot-instructions.md # Core SAS agent instructions
10
+ ├── claude-desktop-system-prompt.md # Claude Desktop system prompt
11
+ ├── claude-desktop-config.json # MCP server configuration template
12
+ ├── instructions.md # This file — usage guide
13
+ ├── skills-index.md # Quick reference of all skills
14
+ ├── README.md # Setup & deployment guide
15
+ ├── agents/
16
+ │ └── sas-viya-scoring-expert.md # SAS Viya expert agent definition
17
+ └── skills/
18
+ ├── sas-request-classifier/SKILL.md # Classify ambiguous requests
19
+ ├── sas-find-library-smart/SKILL.md # Find SAS/CAS libraries
20
+ ├── sas-list-tables-smart/SKILL.md # List tables in a library
21
+ ├── sas-read-and-score/SKILL.md # Read data + score workflow
22
+ ├── sas-read-strategy/SKILL.md # Choose read tool
23
+ └── sas-score-workflow/SKILL.md # Route scoring requests
24
+ ```
25
+
26
+ ## Getting Started
27
+
28
+ ### For Claude Desktop Users
29
+
30
+ 1. **Copy the MCP configuration:**
31
+ - Copy `claude-desktop-config.json` to your Claude Desktop config directory:
32
+ - **macOS/Linux:** `~/.claude/claude_desktop_config.json`
33
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
34
+
35
+ 2. **Configure your SAS Viya environment:**
36
+ - Edit the copied config file with your credentials:
37
+ ```json
38
+ "VIYA_URL": "https://your-sas-viya.example.com",
39
+ "VIYA_CLIENT_ID": "your-oauth-client-id",
40
+ "VIYA_CLIENT_SECRET": "your-oauth-client-secret",//optional
41
+ "VIYA_TLS_CERT": "/path/to/ca-cert.pem" // optional
42
+ ```
43
+
44
+ 3. **Add the system prompt to Claude:**
45
+ - Open Claude Desktop → **Settings** → **Custom Instructions**
46
+ - Copy the contents of `claude-desktop-system-prompt.md`
47
+ - Paste into the custom instructions field
48
+ - Save
49
+
50
+ 4. **Restart Claude Desktop** to activate the MCP connection
51
+
52
+ ### For GitHub Copilot Users
53
+
54
+ - The `.github/` folder already contains the equivalent configuration for Copilot
55
+ - For consistency, you can also copy from `.claude/` if updating across platforms
56
+
57
+ ## How the SAS Agent Works
58
+
59
+ ### 1. Skill-First Behavior
60
+ When you make a request, the agent:
61
+ 1. **Classifies** your request using **sas-request-classifier** if ambiguous
62
+ 2. **Loads the most relevant skill** from `skills/` directory
63
+ 3. **Applies domain-specific guidance** before calling MCP tools
64
+ 4. **Uses MCP tools** to execute the request safely
65
+
66
+ ### 2. Available Skills
67
+
68
+ Quick reference — see `skills-index.md` for full details:
69
+
70
+ | Skill | Purpose | Trigger |
71
+ |-------|---------|---------|
72
+ | **sas-request-classifier** | Disambiguate domain terms | "find my model", "run scoring" |
73
+ | **sas-find-library-smart** | Find CAS or SAS libraries | "find library Public" |
74
+ | **sas-list-tables-smart** | List tables in a library | "list tables in Public" |
75
+ | **sas-read-strategy** | Choose right read tool | "read records from", "aggregate by" |
76
+ | **sas-read-and-score** | Read + score workflow | "score these records" |
77
+ | **sas-score-workflow** | Route scoring by type | "score with model X.job" |
78
+
79
+ ### 3. Example Workflows
80
+
81
+ **Find a library and browse tables:**
82
+ ```
83
+ You: "Find library Public and show me what tables are in it"
84
+ Agent:
85
+ 1. Loads sas-find-library-smart skill
86
+ 2. Checks CAS, then SAS for "Public"
87
+ 3. Finds it in CAS
88
+ 4. Loads sas-list-tables-smart skill
89
+ 5. Returns list of tables
90
+ ```
91
+
92
+ **Read data and score:**
93
+ ```
94
+ You: "Score customers from Public.customers with model churn.mas"
95
+ Agent:
96
+ 1. Loads sas-read-and-score skill
97
+ 2. Loads sas-read-strategy to fetch records
98
+ 3. Loads sas-score-workflow to route to correct scorer
99
+ 4. Returns predictions merged with customer data
100
+ ```
101
+
102
+ ## Tool Usage Policy
103
+
104
+ The agent follows this policy to ensure safety and correctness:
105
+
106
+ - **Read operations first** — Verify libraries, tables, and models exist before executing
107
+ - **Ambiguity resolved** — Classify unclear requests before tool use
108
+ - **No hallucination** — Never invent SAS asset names, job IDs, or model types
109
+ - **Confirmation required** — Ask before running jobs, scoring, deploying, or modifying
110
+
111
+ ## Ambiguous Terms — Always Clarified
112
+
113
+ The agent automatically disambiguates these overloaded terms:
114
+
115
+ | Term | Possible Meanings | Clarification |
116
+ |------|------------------|---------------|
117
+ | **model** | MAS model, SAS job, jobdef, SCR, or repository entry | "Find model X" — which type? |
118
+ | **score/scoring** | Model prediction, not test coverage | "Run scoring" → clarify which model |
119
+ | **job** | SAS job/flow, not CI job | "Run this job" → confirm SAS job |
120
+ | **table** | CAS table or SAS dataset | "Open table" → confirm library & server |
121
+ | **code** | SAS/SQL script, not source code repo | "Show code" → clarify context |
122
+
123
+ ## Response Style
124
+
125
+ The agent responds with:
126
+ - **Precision** — Names the SAS concept being acted on
127
+ - **Clarity** — Explains steps before taking action
128
+ - **Structure** — Short, organized answers with next steps
129
+ - **Honesty** — Never assumes; always verifies
130
+
131
+ ## Configuration Files
132
+
133
+ ### `copilot-instructions.md`
134
+ Core SAS domain guidance shared across all platforms. Contains:
135
+ - Project overview & operating model
136
+ - Request classification targets
137
+ - Skill-first behavior policy
138
+ - Tool usage policy
139
+ - Safety & correctness guidelines
140
+
141
+ ### `claude-desktop-system-prompt.md`
142
+ Claude Desktop-specific system prompt. Includes:
143
+ - MCP tool availability
144
+ - Skill descriptions with file locations
145
+ - Configuration instructions
146
+ - Safety & ambiguity handling
147
+
148
+ ### `claude-desktop-config.json`
149
+ MCP server configuration template. Customize with:
150
+ - Your SAS Viya URL
151
+ - OAuth credentials
152
+ - Path to `cli.js` in this repository
153
+ - TLS certificate path (optional)
154
+
155
+ ## Troubleshooting
156
+
157
+ ### "MCP Server Not Found"
158
+ - Verify the `cli.js` path is absolute and correct
159
+ - Check that Node.js is in your PATH
160
+ - Restart Claude Desktop
161
+
162
+ ### "Authentication Failed"
163
+ - Verify `VIYA_CLIENT_ID` and `VIYA_CLIENT_SECRET`
164
+ - Ensure `VIYA_URL` is accessible
165
+ - Check that credentials are still valid
166
+
167
+ ### "No Tools Available"
168
+ - Restart Claude Desktop after config changes
169
+ - Check MCP server logs for errors
170
+ - Verify SAS Viya connectivity
171
+
172
+ ## Next Steps
173
+
174
+ 1. **Setup Claude Desktop** — Follow README.md
175
+ 2. **Review skills** — Open `skills-index.md` for quick reference
176
+ 3. **Start using** — Try: "Find library Public and list tables in it"
177
+ 4. **Explore agents** — Ask: "/subagent" for available agents
178
+
179
+ ## Support
180
+
181
+ For issues or questions:
182
+ - Check the README.md for detailed setup
183
+ - Review specific skill files in `skills/` for usage patterns
184
+ - See `copilot-instructions.md` for domain guidance
@@ -13,6 +13,8 @@ description: >
13
13
  Intelligently locates a SAS Viya library by checking CAS first, then SAS if the library is not found
14
14
  in CAS. Provides the user with clear information about library availability and location.
15
15
 
16
+ > Primary strategy: use `sas-find-resource-strategy` for all resource existence checks.
17
+
16
18
  **If the user specifies the server explicitly** (e.g., "find library Public in cas"):
17
19
  - Use the specified server: `server: "cas"` or `server: "sas"`
18
20
  - Proceed directly to finding the library
@@ -22,7 +24,7 @@ in CAS. Provides the user with clear information about library availability and
22
24
  2. **If not found in CAS**: Check SAS with uppercase library name (`server: "sas"`)
23
25
  3. **If not found in either**:
24
26
  - Inform user: *"The library '<lib>' was not found in CAS or SAS servers. Please verify the library name."*
25
- - Suggest: *"Would you like to list available libraries?"* (suggest `sas-score-list-libraries`)
27
+ - Ask for corrected library name or explicit server context
26
28
  4. **If found**:
27
29
  - Inform user which server contains the library: *"Found library '<lib>' in CAS"* or *"Found library '<lib>' in SAS"*
28
30
  - Offer next steps: *"Would you like to list tables in this library?"* (suggest `sas-score-list-tables`)
@@ -50,8 +52,9 @@ sas-score-find-library({
50
52
  - **For SAS server: always uppercase the library name** (e.g., "public" → "PUBLIC")
51
53
  - If library name is missing, ask: *"Which library name would you like to find?"*
52
54
  - Return the server where the library was found
53
- - If not found in either server, clearly inform the user and offer to list available libraries
55
+ - If not found in either server, clearly inform the user and request corrected name or server context
54
56
  - Do not proceed with table access until library existence is confirmed
57
+ - Do not use list tools to find whether a library exists
55
58
 
56
59
  ---
57
60
 
@@ -86,7 +89,7 @@ ELSE
86
89
  1. Try CAS: `sas-score-find-library({ name: "Public", server: "cas" })`
87
90
  2. If not found, try SAS with uppercase: `sas-score-find-library({ name: "PUBLIC", server: "sas" })`
88
91
  3. If found in CAS → *"Found library 'Public' in CAS. Would you like to list tables in it?"*
89
- 4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like to list tables in it?"*
92
+ 4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like tPlease confirm the name or specify a server.
90
93
  5. If not found → *"The library 'Public' was not found in CAS or SAS. Would you like to list available libraries?"*
91
94
 
92
95
  **Pattern 2 — Find library with explicit server (CAS)**
@@ -110,9 +113,7 @@ ELSE
110
113
  2. Try SAS: `sas-score-find-library({ name: "STAGING", server: "sas" })` → not found
111
114
  3. Respond:
112
115
  - *"The library 'staging' was not found in CAS or SAS."*
113
- - *"Would you like to:"*
114
- - *"List all available libraries? (use `sas-score-list-libraries`))"*
115
- - *"Check a different library name?"*
116
+ - *"Please confirm the library name or specify the server (CAS or SAS)."*
116
117
 
117
118
  **Pattern 5 — Library found, follow-up action**
118
119
  > "Verify library samples exists"
@@ -143,12 +144,14 @@ Suggestions:
143
144
  • Check the spelling of the library name
144
145
  • List available libraries (use list-libraries tool)
145
146
  • Try a different library name
147
+ ``Specify the intended server (CAS or SAS)
148
+ • Try a different library name
146
149
  ```
147
150
 
148
151
  ---
149
152
 
150
153
  ## Integration with other skills
151
154
 
155
+ - **Primary find strategy**: Use `sas-find-resource-strategy` for existence checks
152
156
  - **After finding library → List tables**: Use `sas-list-tables-smart` skill to browse available tables
153
- - **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tables
154
- - **Library not found → Explore**: Use `sas-score-list-libraries` tool to see all available libraries
157
+ - **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tabl
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: sas-find-resource-strategy
3
+ description: >
4
+ Unified strategy for finding SAS Viya resources using find tools only. Supports library, table,
5
+ model, job, and jobdef lookup with server-aware behavior for CAS/SAS resources. Use this skill
6
+ whenever the task is to verify whether a resource exists.
7
+ ---
8
+
9
+ # SAS Find Resource Strategy
10
+
11
+ Use this skill to verify resource existence without using list tools.
12
+
13
+ ## Scope
14
+
15
+ Supported resource types:
16
+ - library
17
+ - table
18
+ - model
19
+ - job
20
+ - jobdef
21
+
22
+ ## Mandatory rule
23
+
24
+ - Use only find tools to verify existence.
25
+ - Do not use list tools to find a resource.
26
+
27
+ ## Tool mapping
28
+
29
+ - Library -> `sas-score-find-library`
30
+ - Table -> `sas-score-find-table`
31
+ - Model -> `sas-score-find-model`
32
+ - Job -> `sas-score-find-job`
33
+ - Jobdef -> `sas-score-find-jobdef`
34
+
35
+ ## Strategy by resource type
36
+
37
+ ### Find library
38
+
39
+ If server is provided:
40
+ - CAS: `sas-score-find-library({ name: "<lib>", server: "cas" })`
41
+ - SAS: uppercase first, then `sas-score-find-library({ name: "<LIB>", server: "sas" })`
42
+
43
+ If server is not provided:
44
+ 1. Check CAS first.
45
+ 2. If not found, check SAS with uppercase library name.
46
+ 3. Report where found, or report not found in either.
47
+
48
+ ### Find table
49
+
50
+ Required inputs:
51
+ - library name
52
+ - table name
53
+
54
+ If server is provided:
55
+ - CAS: `sas-score-find-table({ lib: "<lib>", name: "<table>", server: "cas" })`
56
+ - SAS: uppercase library first, then `sas-score-find-table({ lib: "<LIB>", name: "<table>", server: "sas" })`
57
+
58
+ If server is not provided:
59
+ 1. Check CAS first.
60
+ 2. If not found, check SAS (uppercase library).
61
+ 3. If found in both, report both and ask user which server to use for follow-up reads.
62
+
63
+ ### Find model
64
+
65
+ Use:
66
+ - `sas-score-find-model({ name: "<model>" })`
67
+
68
+ If a model type suffix is provided (for example `.mas`, `.job`, `.jobdef`, `.scr`):
69
+ - For MAS model discovery, strip suffix and look up base name with `sas-score-find-model`.
70
+ - For `.job` and `.jobdef`, use job and jobdef find tools instead of model find.
71
+
72
+ ### Find job
73
+
74
+ Use:
75
+ - `sas-score-find-job({ name: "<job>" })`
76
+
77
+ ### Find jobdef
78
+
79
+ Use:
80
+ - `sas-score-find-jobdef({ name: "<jobdef>" })`
81
+
82
+ ## Clarifying prompts
83
+
84
+ Ask one focused question if required fields are missing:
85
+ - Library missing for table lookup: "Which library contains the table?"
86
+ - Table name missing: "Which table name should I check?"
87
+ - Resource type ambiguous: "Do you want me to find a library, table, model, job, or jobdef?"
88
+
89
+ ## Output format
90
+
91
+ For found resources:
92
+ - Confirm exact resource name returned by the tool.
93
+ - Confirm server when applicable (CAS/SAS).
94
+
95
+ For not found resources:
96
+ - State that the resource was not found.
97
+ - Ask for corrected name or server context.
98
+
99
+ ## Examples
100
+
101
+ - "find library Samples" -> CAS first, then SAS fallback using uppercase.
102
+ - "find table costchange in Samples" -> CAS first, then SAS fallback using uppercase library.
103
+ - "find model breastcancer" -> `sas-score-find-model`.
104
+ - "find job simplejob" -> `sas-score-find-job`.
105
+ - "find jobdef daily_run" -> `sas-score-find-jobdef`.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: sas-list-resource-strategy
3
+ description: >
4
+ Unified strategy for listing SAS Viya resources using list tools. Supports libraries,
5
+ tables, models, jobs, and jobdefs. Always normalize pagination so start and limit are
6
+ never null: default start=1 and limit=10 when not provided.
7
+ ---
8
+
9
+ # SAS List Resource Strategy
10
+
11
+ Use this skill to list resources with consistent pagination defaults.
12
+
13
+ ## Scope
14
+
15
+ Supported resource types:
16
+ - library
17
+ - table
18
+ - model
19
+ - job
20
+ - jobdef
21
+
22
+ ## Mandatory pagination rule
23
+
24
+ For every list operation:
25
+ - `start` must never be null
26
+ - `limit` must never be null
27
+ - If `start` is missing or null, set `start: 1`
28
+ - If `limit` is missing or null, set `limit: 10`
29
+
30
+ Normalization pattern:
31
+ ```
32
+ start = (start == null) ? 1 : start
33
+ limit = (limit == null) ? 10 : limit
34
+ ```
35
+
36
+ ## Tool mapping
37
+
38
+ - Library -> `sas-score-list-libraries`
39
+ - Table -> `sas-score-list-tables`
40
+ - Model -> `sas-score-list-models`
41
+ - Job -> `sas-score-list-jobs`
42
+ - Jobdef -> `sas-score-list-jobdefs`
43
+
44
+ ## Strategy by resource type
45
+
46
+ ### List libraries
47
+
48
+ Use:
49
+ ```
50
+ sas-score-list-libraries({
51
+ server: "all" | "cas" | "sas", // optional based on user intent
52
+ start: 1,
53
+ limit: 10
54
+ })
55
+ ```
56
+
57
+ If user provides server, honor it. If not, use default server behavior.
58
+
59
+ ### List tables
60
+
61
+ Required input:
62
+ - library name (`lib`)
63
+
64
+ Use:
65
+ ```
66
+ sas-score-list-tables({
67
+ lib: "libraryname",
68
+ server: "cas" | "sas", // optional if strategy/tool supports detection
69
+ start: 1,
70
+ limit: 10
71
+ })
72
+ ```
73
+
74
+ If `lib` is missing, ask: "Which library should I list tables from?"
75
+
76
+ ### List models
77
+
78
+ Use:
79
+ ```
80
+ sas-score-list-models({
81
+ start: 1,
82
+ limit: 10
83
+ })
84
+ ```
85
+
86
+ ### List jobs
87
+
88
+ Use:
89
+ ```
90
+ sas-score-list-jobs({
91
+ start: 1,
92
+ limit: 10
93
+ })
94
+ ```
95
+
96
+ ### List jobdefs
97
+
98
+ Use:
99
+ ```
100
+ sas-score-list-jobdefs({
101
+ start: 1,
102
+ limit: 10
103
+ })
104
+ ```
105
+
106
+ ## Clarifying prompts
107
+
108
+ Ask one focused question if required context is missing:
109
+ - Resource type unclear: "Do you want libraries, tables, models, jobs, or jobdefs?"
110
+ - Listing tables without library: "Which library should I list tables from?"
111
+
112
+ ## Output and paging
113
+
114
+ - Return the listed resources from the selected tool.
115
+ - If result count equals `limit`, suggest next page with `start + limit`.
116
+ - Keep using normalized pagination defaults unless user overrides.
117
+
118
+ ## Examples
119
+
120
+ - "list jobs" -> `sas-score-list-jobs({ start: 1, limit: 10 })`
121
+ - "list models" -> `sas-score-list-models({ start: 1, limit: 10 })`
122
+ - "list jobdefs" -> `sas-score-list-jobdefs({ start: 1, limit: 10 })`
123
+ - "list tables in Public" -> `sas-score-list-tables({ lib: "Public", start: 1, limit: 10 })`
124
+ - "next jobs" after `{ start: 1, limit: 10 }` -> `sas-score-list-jobs({ start: 11, limit: 10 })`
@@ -13,7 +13,7 @@ description: >
13
13
  Intelligently enumerates tables in a SAS Viya library, automatically determining the correct server
14
14
  when not explicitly specified.
15
15
 
16
- > **Pre-flight check**: Before listing tables, verify the library exists using the `sas-find-library-smart` skill.
16
+ > **Pre-flight check**: Before listing tables, verify the library and table context using the `sas-find-resource-strategy` skill.
17
17
  > This ensures consistent server detection across all data operations.
18
18
 
19
19
  **If the user specifies the server explicitly** (e.g., "list tables in Public in cas"):
@@ -25,7 +25,7 @@ when not explicitly specified.
25
25
  2. **If no tables found in CAS**: Check SAS (`server: "sas"`)
26
26
  3. **If no tables found in either**:
27
27
  - Inform user: *"The library '&lt;lib&gt;' was not found in CAS or SAS. Please verify the library name is correct."*
28
- - Ask: *"Would you like to list available libraries?"* (suggest `sas-score-list-libraries`)
28
+ - Ask for corrected library name or explicit server context
29
29
 
30
30
  ---
31
31
 
@@ -124,4 +124,3 @@ ELSE
124
124
  | User specifies invalid server | Return error; ask user to clarify: `"cas"` or `"sas"` |
125
125
  | Missing library name | Ask: *"Which library should I list tables from?"* |
126
126
  | Library verification needed | Use `sas-find-library-smart` skill to verify library exists first |
127
-
@@ -20,9 +20,10 @@ with a deployed MAS model.
20
20
  ## Pre-flight verification
21
21
 
22
22
  **Before attempting to read or score table data:**
23
- 1. **Verify library exists**: Use `sas-find-library-smart` to check the library in CAS first, then SAS if needed
24
- 2. **Verify table exists**: Use `sas-score-find-table` to confirm the table is in the library
25
- 3. **Confirm server location**: Ensure you know which server (CAS or SAS) contains the data
23
+ 1. **Verify library exists**: Use `sas-find-resource-strategy` for library lookup (CAS first, then SAS if needed)
24
+ 2. **Verify table exists**: Use `sas-find-resource-strategy` for table lookup in the selected library/server
25
+ 3. **Verify model exists**: Use `sas-find-resource-strategy` for model lookup before scoring
26
+ 4. **Confirm server location**: Ensure you know which server (CAS or SAS) contains the data
26
27
 
27
28
  This ensures consistent behavior with other data access operations.
28
29
 
@@ -15,15 +15,11 @@ of the data operation. Determines which server contains the data and which retri
15
15
 
16
16
  ## Determine the server location
17
17
 
18
- Before retrieving data, verify the library and determine which server(s) contain the table:
18
+ Before retrieving data, locate the specific table first and determine which server(s) contain it:
19
19
 
20
- **Step 1: Verify library existence**
21
- - Use `sas-find-library-smart` skill to check the library in CAS first, then SAS if needed
22
- - This establishes the correct server and uppercase convention for SAS libraries
23
- - Informs the user which server contains the library
24
-
25
- **Step 2: Locate the specific table**
26
- - Use `sas-score-find-table` to check if the table exists in the library
20
+ **Step 1: Locate the specific table (table-first)**
21
+ - Use `sas-find-resource-strategy` to check if the table exists in CAS first, then SAS if needed
22
+ - Do not perform a separate library-first lookup; table lookup already handles server-aware discovery
27
23
  - Possible outcomes:
28
24
  - If table exists **only in CAS** → set `server: "cas"`
29
25
  - If table exists **only in SAS** → set `server: "sas"`
@@ -58,19 +54,21 @@ Ask yourself: does the user already have the data in hand?
58
54
  sas-score-read-table({
59
55
  table: "tablename",
60
56
  lib: "libraryname",
61
- server: "cas" or "sas", // determined from sas-score-find-table check
57
+ server: "cas" or "sas", // determined from table-first lookup via sas-find-resource-strategy
62
58
  limit: N, // default 10, adjust based on user request
63
59
  where: "..." // optional SQL WHERE clause
64
60
  })
65
61
  ```
66
62
 
67
63
  **Rules:**
68
- - Always determine the server first using `sas-score-find-table`
64
+ - Always determine the server first using `sas-find-resource-strategy`
69
65
  - Keep batch size ≤ 50 rows unless the user explicitly requests more
70
66
  - If table name is missing, ask: *"Which table should I read from? (format: lib.tablename)"*
71
67
  - If library is missing, ask: *"Which library contains the table?"*
68
+ - Prefer table-first lookup (CAS first, then SAS) instead of a separate library lookup step
72
69
  - If table exists in both servers, ask user which to use
73
70
  - Return raw column values; do not transform or aggregate
71
+ - Do not use list tools to determine whether a resource exists
74
72
 
75
73
  ---
76
74
 
@@ -91,7 +89,7 @@ sas-query({
91
89
  ```
92
90
 
93
91
  **Rules:**
94
- - Check which server(s) contain the table using `sas-score-find-table` first
92
+ - Check which server(s) contain the table using `sas-find-resource-strategy` first
95
93
  - If table exists in both CAS and SAS, ask user which to query from
96
94
  - Parse the user's natural language question into a PROC SQL SELECT statement
97
95
  - Ensure SELECT statement is valid SQL syntax
@@ -129,7 +127,7 @@ sas-query({
129
127
 
130
128
  | Problem | Action |
131
129
  |---|---|
132
- | Library not found | Use `sas-find-library-smart` skill to verify the library exists |
130
+ | Library missing or unclear | Ask the user which library contains the table |
133
131
  | Table not found in either server | Inform user and suggest checking the table name |
134
132
  | Table exists in both CAS and SAS | Ask: *"The table exists in both servers. Which would you prefer: CAS or SAS?"* |
135
133
  | Table exists only in one server | Use that server automatically in your request |
@@ -141,7 +139,7 @@ sas-query({
141
139
 
142
140
  ## Integration with other skills
143
141
 
144
- - **Before this skill**: Use `sas-find-library-smart` to verify and locate the library
142
+ - **Before this skill**: Use `sas-find-resource-strategy` for table-first resource lookup
145
143
  - **After this skill**: Use `sas-read-and-score` to score the retrieved data
146
144
 
147
145
  ---
@@ -66,4 +66,4 @@ When you finish classification, state:
66
66
  - the inferred SAS domain
67
67
  - the confidence level
68
68
  - the relevant skill(s) to load
69
- - any remaining ambiguity or clarifying questions needed
69
+ - any remaining ambiguity or clarifying questions needed