npcpy-prompting
npcpy LLM prompting and JSON formatting patterns.
Skill by NPC-Worldwide
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/npc-worldwide-npcpy-prompting
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml, prompt-engineering
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/npcpy-prompting
What's inside
- Skill name
npcpy-prompting- Description
- npcpy LLM prompting and JSON formatting patterns.
- License
- MIT
- Instructions
- 75 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# npcpy-prompting
npcpy LLM prompting and JSON formatting patterns.
## Imports
Always import at module level:
- `from npcpy.llm_funcs import get_llm_response`
- `from npcpy.npc_compiler import NPC`
- `from npcpy.gen.response import get_litellm_response` (only for streaming)
## Basic-Call
`get_llm_response(prompt, model, provider, **kwargs)` — first arg is POSITIONAL.
Do NOT write `prompt=prompt`. Do NOT use `NPC.call()`. The function is module-level.
## Json-Mode
Pass `format="json"` for structured output.
npcpy parses internally. Access via `response["response"]`.
Never call `json.loads()` manually.
## Npc-Object
Create an `NPC` to hold model, provider, and primary_directive.
Pass it as `npc=npc_instance` so npcpy reads those values:
```python
npc = NPC(name="...", primary_directive="...", model="...", provider="...")
response = get_llm_response(prompt, npc=npc, format="json", temperature=0.7)
data = response["response"]
```
## Messages
Pass conversation history as `messages=[{"role": "system", "content": msg}]`.
This is a kwarg like any other. It does not persist between calls.
## Parameters
Sampling kwargs to `get_llm_response`:
- `temperature`, `top_p`, `top_k`, `max_tokens`
- `stream=True` returns a generator in `response["response"]`
## Streaming
For token-level streaming use `get_litellm_response` with `stream=True`.
For segment-level use `get_llm_response(..., stream=True)` and iterate `response["response"]`.
## Anti-Patterns
- Do NOT use `json.loads(response["response"])`.
- Do NOT call `response.get("response")` and then parse it again.
- Do NOT assume `response` is a string when `format="json"` is used.
## Prompt-Formatting
When constructing prompt strings in Python:
- Use `f"""..."""` for all multiline prompts. Do NOT use implicit string concatenation.
- Do NOT put multiline strings directly in a `return` statement. Assign to a variable first, then return it.
- The closing `"""` must be at the same indentation as the variable assignment.
- Do NOT escape braces as `{{` inside f-strings. If you need literal curly braces in the prompt output, use explicit string concatenation:
```python
prompt = f"""Write a JSON response like this:""" + """\n{'key': 'value'}\n"""
```
- Never use `f"..." f"..."` on adjacent lines or in parentheses expecting the parser to concatenate them.From NPC-Worldwide/npcsh, MIT.
More from NPC-Worldwide/npcsh
- 0.800score
technical-writing
NPC-Worldwide
Patterns for clear technical writing in documentation, READMEs, API references, and design documents.
SkillAFreshness: A★ 496Claude Code +9 - 0.798score
weak-writing-generator
NPC-Worldwide
Generate paired weak/strong technical writing examples for training and preference optimization.
SkillAFreshness: A★ 496Claude Code +9 - 0.387score
git-workflow
NPC-Worldwide
No description from the publisher yet.
SkillAFreshness: A★ 496Claude Code +9
Signals
- Stars
- 496
- Forks
- 34
- Open issues
- 9
- Last commit (this folder)
- Jul 22, 2026 (3 months ago)
- Last release
- Oct 21, 2026 (7 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/NPC-Worldwide/npcsh
- Website
- npc-shell.readthedocs.com
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from NPC-Worldwide
- 0.823score
natural
NPC-Worldwide
Render the provided prompt template with Jinja context and send it to the active NPC's LLM.
SkillAFreshness: A★ 1.5KClaude Code +9 - 0.822score
run_jinx
NPC-Worldwide
Execute a jinx by name (already loaded on the team) or by filesystem path (e.g.
SkillAFreshness: A★ 1.5KClaude Code +9 - 0.822score
create_jinx
NPC-Worldwide
Write a new .jinx file from inputs (name, description, inputs spec as JSON list of strings, python body).
SkillAFreshness: A★ 1.5KClaude Code +9 - 0.817score
knowledge_store_skill
NPC-Worldwide
Skill for working with local .knowledge.yaml files via KnowledgeStore.
SkillAFreshness: A★ 1.5KClaude Code +9 - 0.817score
knowledge_sememolution_skill
NPC-Worldwide
Skill for population-based Knowledge Graph evolution via Sememolution.
SkillAFreshness: A★ 1.5KClaude Code +9 - 0.817score
knowledge_graph_skill
NPC-Worldwide
Skill for searching and evolving the SQLite-backed Knowledge Graph.
SkillAFreshness: A★ 1.5KClaude Code +9
Cite this page
npcpy-prompting skill. Agent Mart. https://agentmart.dev/skills/npc-worldwide-npcpy-prompting (last updated 2026-10-24)