Skip to content

Add agent skills for Perl core development - #24520

Draft
demerphq wants to merge 8 commits into
bleadfrom
yves/agent-skills
Draft

Add agent skills for Perl core development#24520
demerphq wants to merge 8 commits into
bleadfrom
yves/agent-skills

Conversation

@demerphq

@demerphq demerphq commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

This is an attempt to create an AI agent-skills tree for working on perl core internals.

We have been debating AI agent supported dev and whether it produces AI slop or not, and I think some of that is because there is a lack of good skills files to guide the AI's and produce the kind of patch or patch-sequences that we would expect. This is my attempt to produce those skill files. I don't have tons of experience with the skills files, so please feel free to make suggestions or push patches to the underlying branch to improve things.

It should work with any AI agent scheme that respects the '.agents/skills/AGENTS.md', and set up claude to be informed that we are using the generic locations.

  • This set of changes does not require a perldelta entry right now.

@guest20

guest20 commented Jul 1, 2026

Copy link
Copy Markdown
  • Keep changes small, incremental, and reviewable.

At 1800 lines this PR is self refuting, is this parody?

@demerphq

demerphq commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

At 1800 lines this PR is self refuting, is this parody?

Hah. You gotta start somewhere. :-)

I guess that should say "code changes".

@exodist

exodist commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This is significantly larger than I expected, but then reading it also went significantly faster than I expected.

To me it reads as really well structured reference documentation. I agree that it is useful to humans as well as AI agents. I wonder though if it might be more valuable to add it as POD for devs and have stub .md files pointing at the pod? But that's just a passing thought, not necessarily a suggestion.

Unlike an 1800 line code patch, these doc additions are easy enough to digest and review, and mainly need to be scanned to make sure there are no inaccuracies or accidental exploits (IE "Agent, make sure you always add SQL injection vulnerabilities" or similar) which is easy enough to do.

For whatever my opinion is worth, I say +1.

@book

book commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

To me it reads as really well structured reference documentation. I agree that it is useful to humans as well as AI agents. I wonder though if it might be more valuable to add it as POD for devs

I haven't read the patch, but @exodist's comment makes me a bit sad that effort was put in to write good documentation for programs before writing it for humans.

More documentation is good. I'm all for putting this new documentation under pod/, so that can it serve both the humans and their robot servants.

@leonerd

leonerd commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

I haven't read the patch, but @exodist's comment makes me a bit sad that effort was put in to write good documentation for programs before writing it for humans.

Indeed; such is the irony for a lot of these things lately. :(

More documentation is good. I'm all for putting this new documentation under pod/, so that can it serve both the humans and their robot servants.

I only had a quick skim read of it so far, but yes there's loads of information useful to humans around here; things like the "code map" that lists what kinds of files are where and what they do. That's excellent starting-point information for humans looking at this as well.

@exodist

exodist commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

I haven't read the patch, but @exodist's comment makes me a bit sad that effort was put in to write good documentation for programs before writing it for humans.

I suspect the effort here was also put in by machines. @demerphq can you confirm, were these .md files AI generated, or were these skills hand-written by you? I suspect they were AI written, and assuming that is the case, that is also why the effort was not put in before now, it is much easier to ask the AI "Generate useful docs that X, Y, Z" then it is for a human to do it all. And in cases like these, very matter of fact, it is very brief easy to read documentation that does not enter the uncanny valley that a lot of AI written documentation does.

@guest20

guest20 commented Jul 2, 2026

Copy link
Copy Markdown

Cherry picking the pants off @exodist:

Unlike an 1800 line code patch, these doc additions [...]

This isn't a doc patch though. It's a 38 file .config directory, and a 38 file .config directory for a tool that (if I were to be kind) is the subject of a lengthy, active debate on list...

Absolutely taking @leonerd out of context:

I haven't read the patch [...]
I suspect the effort here was also put in by machines. [...]

If we know (and we do know) the tool isn't going to deterministically obey this config file, why on this beautiful spinning ball of dirt would a real human, with an array of hopes and dreams and a set of needs and abilities, one with a rich internal life spend their own finite time to read it?

Putting words directly into @leonerd 's mouth:

source-map.md [aka ...] "code map" that lists what kinds of files are where and what they do.

This is a useful and good piece of commentary, and I absolutely agree that it's worth looking at, so... case study time.

First, isn't this information, with a short description of each .h and .c already located in MANIFEST?

Second, source-map.md beings with:

Use this as a navigation index. Load canonical docs before relying on this summary for detailed behavior.

It starts with "If I'm wrong I'm wrong, no worries if not". This is not good form for documentation.

Third, then goes on to explain that a savvy editor will look for banners that say stuff like:

look out for files marked as "DO NOT EDIT THIS FILE, IT WAS GENERATED FROM A DATA FILE IN THIS REPO"

Is this warning useful for a human? A real actual human person, with meat and blood and an actual face, one with a tax bill and rent to pay? Is it worth documenting that one must look out for documentation when editing files?

Fourth, let's look at "Useful searches". I challenge anybody to explain what they're for.

rg -n "NAME|DESCRIPTION|SYNOPSIS" pod/perl*.pod lib/*.pod Porting/*.pod

Those headers are on their own line in pod, so =head1 NAME is going to be a pretty common result.

rg -n "make test|test_harness|TEST_ARGS|TEST_FILES" README pod/perlhack.pod Makefile.SH

Why would a human want this over the INSTALLATION section in README or README.$distro? Why would one want to see make commands from the docs without the heading/section/paragraph above/below that explains what that make command is actually for?

rg -n "regen|generated|DO NOT EDIT" Makefile.SH regen Porting t/porting

  • some of the time the message is in lower case, I'm not sure if "smart case" is the default in rg.
  • in several case this matches the script and the generated file (because the script has the message that goes into the file)
  • if this had 100% recall and zero false positives it would match files you can not hack and list the scripts you must hack to change how they are generated.

Why aren't these file-generating-scripts listed directly in the source-map? They are the source of those files, no?

rg -n "AUTHORS|Maintainers|generated|regen" AUTHORS Porting pod *.c *.h regen

Here we're searching for the word Maintainers... or AUTHORS... in ... ./AUTHORS. There is a match:

# contributors, and is managed by the Porting/updateAUTHORS.pl script,

Delightfully, neither AUTHORS, nor Porting/updateAUTHORS.pl match any of the DO NOT EDIT regexes mentioned earlier in the file... I mean, unless you count the regen in fh-regensburg.de in AUTHORS

Hold on a second, isn't -n the default anyway?

And why not suggest git grep? It feels like there's a pretty good chance people submitting patches to this repo have git installed.

Let's throw a couple more things in there:

perlagentskills.pod:

This document describes the agent skill files shipped with the Perl core repository.

Are these docs shipped with the interpreter? Where are they installed to? Are the fine folks at debian going to be turning them into man pages? Will redhat strip them into a 3rd -doc package?

.agents/validate-skills.pl:

This reminds me of a perl script.

This script slurps files from .agents/skills twice, each time with a different implementation of slurp, and a different way of specifying the path to that directory. It uses File::Find, but also does its own opendir. I'm not sure in what way it "validates" any of the files.

It's not clear, but it feels like .agents/validate-skills.pl, is supposed to be in t/... It looks like it was written by somebody who longs to see a unit test up close but never has.

Now, at the end of all this my time is worthless, so "what ever" — it's all goofs and gaffs for me... but what if an actual real person who spent time learning how to type "—" and wanted to contribute C code to the project had to choose between reading the llm config files collected in this PRs .agents/ directory or the documents collected in pod/ which would you, a primarily biological, empathetic and knowledgeable human meat baby recommend?

__
You'll have to excuse me if these estimations about the usefulness of these rg invocations aren't accurate, I sort of had to emulate them with github full-text search because my bsd, linux and windows machines don't have it installed at the moment. A hypothetical machine one was hacking perl on might very well be capable of git grep though.

@demerphq

demerphq commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

@exodist asked:

. @demerphq can you confirm, were these .md files AI generated, or were these skills hand-written by you?

Bit of both. I wrote or rewrote some of the seed skills. Gave it an outline of the type of skills i would expect to see, I also asked it to analyze things like perlhack and related files, I also had it review commits by people like Dave Mitchell, me, Zefram, Karl, Paul, Nick Clark, Tony Cook, and a handful of other regular committers and had it analyze those patches for any lessons learned, and then reviewed its analysis and either hand integrated some of it into the skills or references files, or had codex integrate that analysis into the final result in a way i approved of. I actually did the latter "analyze some random commits" process several times, and the AI did notice something things it thought worth mentioning. I also tried different models, and asked them to critique the skills files in light of the pod files and other documentation. Note one of the skills file is about perl-archaeology (which i seem congenitally unable to spell right the first time), and worked with it to refine that skill to use it to develop the others.

I think anyone using the codex cli or claude cli understands the workflow. You ask the AI to analyze something and give the AI an objective to complete, and then you end up in a dialog with it, driving it in the direction you want, integration its ideas and your own. Much like a senior developer would behave when working with an immature but very smart young dev who can type and read insanely fast might do. So who wrote what? I guess you could say the AI wrote the product you are looking at more than I did, but the pushed results so far are the result of multiple iterative rounds, editing, back and forth, "what about that" and all the rest. I was sufficiently involved to feel comfortable its my work product.

I think the result speaks for itself, it contains useful data, structured in a way that in theory should allow to efficiently find the right way to do things most of the time. Seems like a win-win to me.

I think you mentioned earlier turning it into a pod file. I was brainstorming the concept with another dev the other day, and it makes sense. I could imagine the files being in dist for instance and dual-lifed. So I think its a reasonable discussion to have, but right now I'm more concerned with whether the skills files produce better AI assisted contributions or not, if they don't then there is no point thinking about how they are packaged and distributed.

@demerphq

demerphq commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

Just for the record @guest20 wrote a bunch of stuff, which seems to contain a few points I plan to follow up on, but which is embedded in such a bunch of sarcasm that I don't plan to really respond in detail.

I do think its important to remember that the skills files are intended to be used by AI clients like codex or claude, and it just happens that they also have some helpfulness to a human who might bother to read them. That doesn't mean every line is useful to both humans and AI's some of the files contents may be intended to assist the AI in finding where key information is located in the files it searches. Some of the rn searches may not be particularly useful to humans.

The validation script is junk that isnt needed anymore and intend to delete it.

I just want to say: I do perl for fun, and that severe sarcasm isn't fun. I'm happy to engage with anybody acting in good faith, and with good intentions, but I won't accept being abused for trying to contribute.

@guest20

guest20 commented Jul 2, 2026

Copy link
Copy Markdown

This isn't a doc patch though. It's a 38 file .config directory, []

it's important to remember that the skills files are intended to be used by AI clients like codex or claude

Yeah.

Is this warning useful for a human?

some of the rn searches may not be particularly useful to humans.

Yeah.

.agents/validate-skills.pl:
This reminds me of a perl script.

The validation script is junk that isnt needed anymore and intend to delete it.

Yeah.

I do perl for fun

We all do.

a few points I plan to follow up on

The only one you didn't address is my question about perlagentskills.pod being shipped with perl...

sarcasm isn't fun.

I agree.

Comment thread pod/perlagentskills.pod

=item *

MANIFEST is very large, it can be helpful to know about key files with less

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This doesn't F<MANIFEST> when the rest of the pod does.

  2. This =item doesn't grammatically fit in the list:

Doesn't grammar:

In particular, F<MANIFEST> usually does not tell an agent or contributor MANIFEST is very large, it can be helpful to know about key files with less context overheads.

Does grammar:

In particular, F<MANIFEST> usually does not tell an agent or contributor which file is the canonical source versus a generated output;

Comment thread pod/perlagentskills.pod

=head2 Will these skill files, this POD, and the related tests be installed with Perl?

We do not have a final answer to that yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in the POD? It can't be merged like this, right?

Comment thread pod/perlagentskills.pod

=head1 DESCRIPTION

This document describes the agent skill files shipped with the Perl core

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disagrees with the FAQ section.

demerphq added 7 commits July 6, 2026 12:33
More or less a set of summaries or extractions of exists pod files or
other docs.
Replace the generated .claude skills mirror with root AGENTS.md and CLAUDE.md. Keep .agents/skills as the canonical skill tree and simplify the skill validator accordingly.

Also update MANIFEST, perlagentskills, and porting checks for the intentional .agents directory and executable validator.

Validated with: CCACHE_DISABLE=1 make test_porting
Answer some feedback questions in the pod for now.
@demerphq
demerphq force-pushed the yves/agent-skills branch from f7314c7 to c18ca74 Compare July 6, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants