plugins/dev/skills/code-first-draft/SKILL.md
Initial feature implementation from a PRD or feature description. **ALWAYS use when** the user wants to build a new feature, implement a PRD, create a first draft of code, or says things like 'build this feature', 'implement this PRD', 'code this up', 'create the initial implementation'. Also use when there's no existing codebase and user needs a standalone reference prototype.
npx skillsauth add coalesce-labs/catalyst code-first-draftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Example: "Build the user preferences feature from thoughts/shared/prds/preferences.md"
Output: Code in your codebase + summary saved to thoughts/shared/prototypes/[feature]-first-draft.md
Time: 1-3 hours depending on feature complexity
Connect to codebase and build initial implementation of a feature. Single-pass development with manual iteration.
/code-first-draft - Build feature from PRD/code-first-draft [prd-name] - Build specific PRD/code-first-draft --explore-only - Just explore codebase, don't write code yetCheck first:
thoughts/shared/prds/ - PRD for requirements (if available).git directory, source files)Detect codebase:
# Check if in codebase directory
ls -la | grep ".git"
If not in codebase:
gh repo clone)Explore codebase:
# Detect framework
ls package.json || ls requirements.txt || ls Gemfile || ls go.mod
# Find key directories
find . -type d -name "components" -o -name "src" -o -name "app" | head -10
# Understand structure
tree -L 2 -I 'node_modules|__pycache__|.git'
Read PRD and extract:
Map to code:
Before writing code, create plan:
# Implementation Plan: [Feature]
## Files to Create
- `tests/feature.test.ts` - Unit tests (written FIRST)
- `tests/feature.integration.test.ts` - Integration tests (written FIRST)
- `src/components/NewFeature.tsx` - Main component
- `src/api/feature.ts` - API routes
## Files to Modify
- `src/components/Dashboard.tsx` - Add new feature entry point
- `src/api/index.ts` - Register new routes
- `src/types/index.ts` - Add type definitions
## API Endpoints
- `POST /api/feature` - Create new item
- `GET /api/feature/:id` - Fetch item
- `PUT /api/feature/:id` - Update item
## Database Changes
- Add `features` table with columns: id, user_id, data, created_at
## Testing Approach (TDD)
Tests are written BEFORE implementation using Red → Green → Refactor:
1. **Red** — Write failing tests describing expected behavior
2. **Green** — Implement minimum code to make tests pass
3. **Refactor** — Clean up while keeping tests green
- Unit tests for core business logic (written first)
- Integration tests for API endpoints (written first)
- Edge case tests for error states (written first)
- E2E test for happy path
Ask user for approval: "This is my plan. Approve before I write code?"
Follow Test-Driven Development for each unit of work:
Step 4a: Write Failing Tests (Red)
Step 4b: Implement to Pass (Green)
Step 4c: Refactor (Clean)
Add inline comments for:
TDD rhythm per feature unit:
1. Write test → run → see it fail (Red)
2. Write implementation → run → see it pass (Green)
3. Clean up → run → still passing (Refactor)
4. Repeat for next unit
Save to thoughts/shared/prototypes/[feature]-first-draft.md:
# First Draft Implementation: [Feature]
**Date:** [Date]
**PRD:** [Link]
## What Was Built
**Files created:** [X]
**Files modified:** [Y]
**Tests added:** [Z]
## Implementation Approach
[Brief description of technical approach]
## Testing
**Coverage:** [%]
**Tests passing:** [Y/N]
**Manual testing needed:** [What to test]
## Known Issues / TODOs
- [ ] [Issue 1]
- [ ] [TODO 1]
## Next Steps
- Run tests
- Manual QA
- For complex features: Consider `/catalyst-dev:create-plan` + `/catalyst-dev:implement-plan` for structured iteration
If no codebase is detected (no .git directory, no package.json, no source files in the workspace), switch to Prototype Mode automatically.
Infer the tech stack from the user's request or use sensible defaults:
What changes:
README.md with setup instructions (npm install && npm run dev or equivalent)// Reference prototype - not production code.Output: Save all files to thoughts/shared/prototypes/[feature]-reference-impl/
When presenting:
"No codebase detected, so I built a standalone reference prototype using [stack]. This is not production code — adapt it to your actual codebase patterns, auth system, and infrastructure."
For UI features, include basic accessibility in all generated code:
Required accessibility patterns:
<nav>, <main>, <section>, <button>)outline)aria-describedbyCheck for additional accessibility requirements in project documentation (e.g., WCAG AAA, specific assistive technology support).
In code comments:
// a11y: Label describes the action for screen readers
<button aria-label="Save user preferences">Save</button>
// a11y: Error message linked to input for screen readers
<input aria-describedby="email-error" />
<span id="email-error" role="alert">Please enter a valid email</span>
All tests are written BEFORE implementation code using the detected testing framework. If no testing framework is detected, default to the standard for the stack (Jest for React/Node, Pytest for Python, Vitest for Vite-based projects).
TDD workflow per test tier:
Target: 80% coverage of new code. Always include test data fixtures.
Test file naming:
[feature].test.ts for unit tests[feature].integration.test.ts for integration tests__fixtures__/[feature]-data.ts for test dataIn the summary document, report:
## Testing
**Framework:** [Jest/Vitest/Pytest]
**Tests written:** [X] unit, [Y] integration, [Z] edge case
**Coverage:** [%] (of new code)
**All passing:** [Yes/No]
**Manual testing needed:** [List specific flows to test manually]
Before:
/catalyst-dev:create-plan - Create a detailed implementation plan first (for complex features)/catalyst-dev:research-codebase - Research existing patterns before buildingAfter:
/catalyst-dev:commit - Commit the implementation/catalyst-dev:create-pr - Create a pull request for review/catalyst-dev:validate-plan - Verify implementation matches requirementsBefore delivering the first draft, verify:
thoughts/shared/prototypes/[feature]-first-draft.md, not thoughts/shared/development/If any check fails, fix it before delivering. A first draft with failing tests or missing accessibility is not ready to share.
development
Migrate a single-harness repo to the dual-harness layout so both Claude Code and Codex load the same instructions and skills — AGENTS.md as the portable canonical doc, a thin CLAUDE.md `@AGENTS.md` bridge, and a `.agents/skills` dir with a `.claude/skills` symlink onto it. Use when asked to migrate to dual-harness, make this repo work in both Claude and Codex, or for agent metadata cleanup.
tools
Goal-driven senior-engineer pipeline-unstick sweep (CTL-1176 rung 3). Given the stuck/failed/needs-human set (or ONE ticket handed by the recovery router), its GOAL is to get the pipeline MOVING again — not to fix one ticket's review findings (that is phase-remediate). It runs AFTER the eyes (diagnostician evidence) and the hands (deterministic unstuck-sweep seams) have already tried, and it CONSUMES their output from a recovery-pass.json brief rather than re-diagnosing or redoing their narrow work. It acts like a senior engineer with full tool access — it resolves merge conflicts, rebases, force-pushes, merges green PRs, and re-dispatches stalled phases AUTONOMOUSLY — and escalates to the operator ONLY for a genuine value judgment / something that degrades other functionality / a real cost-benefit trade-off / a serious architecture change / an ADR conflict. On escalation it AUTHORS the operator inbox row + the push notification (executive-voiced). Dispatched as a `claude --bg` job by phase-agent-dispatch via slash command, AND invocable bare by the operator as a sweep — hence `user-invocable: true`. Ships behind CATALYST_RECOVERY_PASS (off by default — no live behavior change until shadow/enforce).
tools
Diagnose and fix Catalyst setup issues. Validates tools, database, config, OTel, direnv, and thoughts. Automatically fixes what it can — creates directories, initializes the database, sets WAL mode, runs migrations. Use for new installs, upgrades, or when something isn't working.
tools
--- name: phase-triage description: Phase agent that triages a Linear ticket — expands acronyms, classifies (feature/bug/docs/refactor/chore), identifies genuine blockers (a semantic second-pass over the backlog — NOT a prose scrape; CTL-838), estimates scope, writes triage.json, and posts a triage analysis comment to Linear. Triage completion is signaled by that comment plus the local triage.json — there is no `triaged` label. Emits phase.triage.complete.<TICKET> on success and phase.triage.fai