Skip to content

Build better skills

Build an instruction inspector for your agent runs. Select a recommendation and see which parts of the loaded skill, user request, and retrieved context Prism attributes it to.

Consider a code-review skill that says, “Treat nanosecond-scale overhead in hot paths as a release blocker.” An agent reviewing a loop then recommends, “Replace the readable implementation with the packed version before shipping.” The recommendation repeats none of the distinctive wording in the skill. Looking for that sentence in your skill files will not explain the choice.

The following illustrative transcript includes the skill as the agent received it, the review request, and a completed recommendation. In your integration, load these from the recorded run rather than reconstructing what you think the agent saw.

Use the attribute function from Quickstart. Save this as inspect_skill.py and run python inspect_skill.py:

from prism import attribute
skill = (
"Review changes for correctness and maintainability. "
"Treat nanosecond-scale overhead in hot paths as a release blocker."
)
answer = "Replace the readable implementation with the packed version before shipping."
messages = [
{"role": "system", "content": skill},
{"role": "user", "content": (
"Review a proposed loop change. Both implementations return the same values. "
"The readable version takes 42 ns per item; the packed version takes 39 ns. "
"The endpoint otherwise spends 180 ms waiting for a remote service."
)},
{"role": "assistant", "content": answer},
]
result = attribute(
{"messages": messages},
{
"ref": {"message_index": 2, "field": "content"},
"span": {"start": 0, "end": len(answer)},
},
)
for excerpt in result["excerpts"]:
index = excerpt["ref"]["message_index"]
print(f"Message {index} ({messages[index]['role']}):")
print(excerpt["text"])
for highlight in excerpt["highlights"]:
print(" →", highlight["text"])

This makes a live attribution request for a constructed example. No measured ranking is asserted here: display the passages actually returned, including those from the user request rather than only the skill.

Give each recorded message a source label, such as Review skill, User request, or Retrieved document. Use the returned ref to display that label beside each highlighted excerpt and link back to the exact skill version loaded during the run.

The developer can then investigate whether the performance instruction contributed to a recommendation that ignores the wider latency budget. Semantic search may retrieve performance-related instructions; attribution asks about their influence on this specific recommendation.

Show the current skill text next to an editable revision. A candidate change for this case is:

Prioritize changes that materially affect end-to-end latency or resource cost.
Explain the expected impact before recommending a readability tradeoff.

Save the edit as a new skill version. Offer Run again to generate a fresh answer for the same task, then let the developer inspect either run. Keep the original answer and evidence available; applying the new skill retroactively to an old transcript would misrepresent what influenced that answer.

The inspector supports an evidence-backed edit, not an automatic claim that the new skill is better. Assess the new recommendation itself and check other tasks before adopting the revision. Missing attribution to an instruction is not proof that it had no effect.

The packaged agent-skill workflow is coming soon. This recipe uses the HTTP API directly; hosted MCP and installation details will appear in Quickstart.