home / skills / yellinzero / aico / aico-backend-plan

aico-backend-plan skill

/.codex/skills/aico-backend-plan

This skill generates atomic, step-by-step backend task plans with TDD tests, exact code, and verification commands.

npx playbooks add skill yellinzero/aico --skill aico-backend-plan

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.9 KB
---
name: aico-backend-plan
description: |
  Create ATOMIC implementation plan for a single backend task. Each step has TDD, exact code, and verification command.

  IMPORTANT: This skill creates MICRO-LEVEL atomic steps, NOT macro architecture plans.
  For architecture planning or feature scoping, use EnterPlanMode instead.

  Use this skill when:
  - Running /backend.plan command
  - User explicitly asks for "atomic steps", "step-by-step plan with verification"
  - Have a specific task from docs/reference/backend/tasks/ and need implementation steps
  - Need granular TDD steps: Types → DB → Test (failing) → Implementation → Test (passing) → API

  DO NOT use for:
  - Architecture planning (use EnterPlanMode)
  - General development planning
  - Feature scoping or estimation

  Output: Present plan to user (not saved to file), each step includes Files, Action, and Verify command.
---

# Plan

## Language Configuration

Before generating any content, check `aico.json` in project root for `language` field to determine the output language. If not set, default to English.

## Process

1. **Read task**: Get details from `docs/reference/backend/tasks/{story}.md`
2. **Read constraints**: Load `docs/reference/backend/constraints.md`
3. **Break into atomic steps** following this order:
   - Types/interfaces first
   - Database migrations
   - Failing tests (TDD)
   - Implementation to pass tests
   - API routes
   - Verification
4. **Keep steps atomic**: One action per step
5. **Present plan to user** (do not save to file)

## Plan Format

````markdown
# [Task Name] - Implementation Plan

> Project: [project-name]
> Created: YYYY-MM-DD
> Task: [task description]
> Estimated steps: N

## Step 1: [Action]

**Files**:

- Create: `src/types/user.ts`

**Action**:
[Exact code]

**Verify**:

```bash
npx tsc --noEmit
```
````

Expected: No errors

```

## Step Order

| Order | Step Type | Purpose |
|-------|-----------|---------|
| 1 | Types | Define interfaces and DTOs |
| 2 | Database | Create migrations |
| 3 | Test (RED) | Write failing test |
| 4 | Implement (GREEN) | Write code to pass test |
| 5 | API | Add routes |
| 6 | Commit | Stage and commit |

## Step Granularity

| Good Steps | Bad Steps |
|------------|-----------|
| Create type file with interface | Create entire model with methods |
| Write one failing test | Write all tests |
| Implement single method | Implement entire service |
| Add one route | Add all routes |

## Key Rules

- ALWAYS write failing test before implementation (TDD)
- MUST include verification command for each step
- ALWAYS follow order: Types → DB → Test → Impl → API
- NEVER combine multiple actions into one step

## Common Mistakes

- ❌ Steps too large → ✅ One action per step
- ❌ Skip verification → ✅ Every step has verify command
- ❌ Implementation before test → ✅ TDD: test first
- ❌ Vague actions → ✅ Include exact code
```

Overview

This skill generates an ATOMIC, micro-level implementation plan for a single backend task in a TypeScript project. Each step is a single action that includes exact code, the files affected, and a verification command. The plan strictly follows TDD: Types → DB → Test (failing) → Implementation (passing) → API → Verification.

How this skill works

The skill reads the task specification from docs/reference/backend/tasks/{story}.md and constraints from docs/reference/backend/constraints.md, then breaks the task into atomic steps. It emits a numbered plan where each step lists Files, exact code to add or change (one small change only), and a shell command to verify the step. Steps are ordered to ensure tests fail first, then pass, and each step has a single verification command.

When to use it

  • When you run the /backend.plan command for a specific backend task
  • When you need micro-level, code-first steps with TDD verification
  • When you want exact file edits and one-command verification per step
  • When implementing a documented task from docs/reference/backend/tasks/
  • When you must avoid architecture-level or high-level planning

Best practices

  • Keep each step to one atomic change: one file create or one small edit
  • Write a failing test before any implementation step (RED → GREEN)
  • Provide exact TypeScript code and precise file paths in the step
  • Use a single, reproducible verify command per step (e.g., npx tsc --noEmit or npm test -- -t 'name')
  • Follow the rigid step order: Types → Database → Test → Implement → API → Commit

Example use cases

  • Add a new DTO and interface file, then write a failing unit test for a service method
  • Create a DB migration file, write a test expecting migration to expose a column, then implement repository changes
  • Implement a single API route: add request/response types, failing integration test, handler code, then route registration
  • Fix a single service method: add type, failing test, small implementation change, then verification
  • Add validation: define types, failing validation test, implement validator, then update API payload handling

FAQ

Can this skill produce multi-file large refactors?

No. It intentionally produces micro-level steps. For large refactors, run repeated tasks or use architecture planning tools.

What verification commands are expected per step?

A single, deterministic shell command that demonstrates the step succeeded, such as npx tsc --noEmit, npm test -- -t 'test name', or a migration CLI command.