agentleFS
dream-horizon-orgdream-horizon-org/pulse/.agents/skills/add-api-endpoint/SKILL.md

add-api-endpoint

Skill44 starsChanged 5 months agoApache-2.0View on GitHub

Step-by-step workflow for adding a new REST API endpoint to pulse-server. Use when creating a new backend endpoint, route, resource, or API in backend/server/.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add to ServiceError.java enum if new failure cases exist.

    line 104
  2. Very specific:

    Add bind(MyService.class).to(MyServiceImpl.class) in the appropriate module.

    line 108

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add API Endpoint

Workflow

Copy this checklist and track progress:

- [ ] Step 1: Create/update DTO
- [ ] Step 2: Create/update Service interface
- [ ] Step 3: Create/update Service implementation
- [ ] Step 4: Create/update DAO + Queries
- [ ] Step 5: Create MapStruct mapper
- [ ] Step 6: Create REST resource (controller)
- [ ] Step 7: Add ServiceError codes
- [ ] Step 8: Register in Guice module
- [ ] Step 9: Write unit tests
- [ ] Step 10: Verify build

Step 1: Create/Update DTO

Location: backend/server/src/main/java/org/dreamhorizon/pulseserver/dto/

@Data
public class MyRequest {
    private String name;
    private String description;
}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class MyResponse {
    private String id;
    private String name;
}

Step 2: Service Interface

Location: backend/server/src/main/java/org/dreamhorizon/pulseserver/service/<domain>/

public interface MyService {
    Single<MyResponse> create(MyRequest request);
    Single<List<MyResponse>> list();
}

Step 3: Service Implementation

Location: service/<domain>/impl/

@RequiredArgsConstructor(onConstructor = @__({@Inject}))
public class MyServiceImpl implements MyService {
    private final MyDao myDao;
    // Implementation using RxJava
}

Step 4: DAO + Queries

public class MyQueries {
    public static final String INSERT = "INSERT INTO ...";
    public static final String SELECT_ALL = "SELECT ...";
}

Step 5: MapStruct Mapper

@Mapper
public interface MyMapper {
    MyMapper INSTANCE = Mappers.getMapper(MyMapper.class);
    MyResponse toResponse(MyModel model);
}

Step 6: REST Resource

Location: resources/

@Path("/v1/my-resource")
public class MyResource {
    @Inject private MyService service;

    @GET
    public void list(RoutingContext ctx) {
        RestResponse.jaxrsRestHandler(ctx, service.list());
    }
}

Step 7: ServiceError Codes

Add to ServiceError.java enum if new failure cases exist.

Step 8: Guice Binding

Add bind(MyService.class).to(MyServiceImpl.class) in the appropriate module.

Step 9: Tests

JUnit 5 + Mockito + AssertJ, @Nested grouping, should* naming.

Step 10: Verify

cd backend/server && mvn clean install

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.