Skills and Subagents for a Spring Boot Project: One File of Steps, One Helper per Job
An add-endpoint SKILL.md holds the house steps once, and the agent loads it when a short ask matches its description. A refactorer subagent on sonnet moves the task list into a TaskRepository in its own session and reports back in five lines.
What you will learn
- Write a SKILL.md whose description tells the agent when to use it
- Explain why only a skill's name and description sit in the context until it matches
- Read a subagent file line by line: name, description, tools, model, instructions
- Hand a refactor to a subagent so only a short report comes back
Before you start
- The Project Context File: AGENTS.md and CLAUDE.md
- Plan Before Code
Two simple ideas. A skill is one small file of steps you write once. A subagent is a helper that does one job, in its own session, on the model that fits the job. Both are plain files in the project, so you can review them, commit them and share them.
A skill is one small file
It lives at .claude/skills/add-endpoint/SKILL.md. You can write it yourself, or ask the agent to draft one from your house steps.
---
name: add-endpoint
description: Adds an endpoint the house way. Use when asked to add or create an endpoint.
---
# Add an endpoint
1. Read AGENTS.md, the task controller and the task service first.
2. Put the logic in the service. The controller only maps the request.
3. Map the new URL under /api/tasks.
4. Add two tests: the normal case, and the empty or 404 case.
5. Run the tests. If one fails, fix the code, not the test.
6. Reply with the URL, the files you changed and the test result.
Do not commit.
The name is how you call it directly, as /add-endpoint. The description is the most important line: it tells the agent when to use the skill. Below it are the steps, written once, so you never type them into a prompt again.
How a skill gets used
Type one short line: "Add an endpoint that lists the open tasks." You never say the word skill. Until now the agent holds only each skill's name and description. This description matches, so it loads add-endpoint, and only then do the steps come into the context. It reads AGENTS.md, the controller and the service, puts the logic in the service, maps the URL under /api/tasks, adds the normal-case and the empty-case tests, runs them, and replies with the URL, the files and the result, without committing.
A vague description ("helps with code") never matches anything; a description that names the trigger ("use when asked to add or create an endpoint") does.
Inside a subagent file
---
name: refactorer
description: Long, mechanical refactors across several files. Reports back in five lines.
tools: Read, Edit, Write, Grep, Glob, Bash
model: sonnet
---
You refactor task-api without changing what it does.
- Read AGENTS.md first and follow its house rules.
- Change the structure only. The tests must pass, unchanged.
- Run the tests before you start and again at the end.
- Reply in at most five lines: what moved where,
the files you changed and the test result. Do not commit.
name: how you call it, as in "use the refactorer subagent".description: tells the main agent when to hand work to this helper.tools: what it may use. Read, edit, search, and Bash to run the tests.model:sonnet, good enough for long mechanical edits.- The body: its own instructions, ending with the five-line report.
The second helper in the project is smaller, with fewer tools and a cheaper model:
---
name: test-runner
description: Runs the test suite and reports only the failures.
tools: Read, Bash
model: haiku
---
You run the tests of task-api and report what fails.
- Run `mvn test` at the project root.
- Reply in at most three lines: the summary line and each failing test.
- Change no files. Never commit.
It can read and run, but it can't edit, and it runs on haiku because running tests and reading a summary line doesn't need a big model.
Handing a job to a subagent
"Use the refactorer subagent to move the task list out of TaskService into a new TaskRepository class." The main agent hands the job over. Refactorer works in its own session on sonnet, so all its reading and editing stays out of your chat. In the project tree TaskRepository shows up as added and TaskService as modified, the tests pass (5 run, 0 failures), and only the short report comes back to the main conversation. (For why that keeps the main context small, see context isolation with subagents.)
Skill or subagent?
| Skill | Subagent | |
|---|---|---|
| File | .claude/skills/<name>/SKILL.md | .claude/agents/<name>.md |
| Runs in | your session | its own session |
| Model | the one you're using | its own, set in the file |
| Good for | a recipe you repeat: add an endpoint | a long job you don't want in your chat: a refactor, a test run |
SKILL.md is an open standard, so the same skill folder works with other agents that support it. For more detail on writing the file itself, see authoring a Claude skill.
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
Related course on Udemy
FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE
Java 25, JSP, Hibernate, Spring Boot 4, REST APIs, React and Spring AI.View on Udemy ↗: FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE (paid course, opens in a new tab)Related posts
CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
Three needs in one repo: a test command, a rule that Claude must never read .env, and a shared deploy skill. See which file each belongs in, how the settings layers merge, and what a plugin manifest carries.
Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
Pack a support team's ticket-triage routine into one skill folder, then watch three requests load one, two or all three levels: the catalog, the SKILL.md body, and a script whose code never enters the context.
One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
Change one line in a repo and ask where it lands. A small resolver for bookshop-bot shows that a new model id in settings.json reaches only CI, a prompt bump reaches dev and CI, and a prod block edit reaches only prod.
Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
Follow one prompt edit from a branch to a merge: version prompts and the model pin like code, keep the API key in GitHub Secrets, gate changes by path, let Claude review the diff, and leave the merge to a person.
