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.
testing
Phase-agent that fixes a failing verify verdict so the pipeline self-heals instead of stalling to needs-human (CTL-653). Reads `${ORCH_DIR}/workers/<ticket>/verify.json`, fixes the `findings[]` (every severity:"high" plus the regression_risk drivers) directly via Edit/Write, commits the remediation, and emits `phase.remediate.complete.<ticket>`. The scheduler's router then re-dispatches `verify` to re-check (the verify⇄remediate cycle, cap 3). Dispatched as a `claude --bg` job by `phase-agent-dispatch`, which invokes it via slash command — hence `user-invocable: true`.
development
Phase agent for the verify step of the 9-phase orchestrator pipeline (CTL-450). NEW skill — has no canonical wrapper. Runs read-only adversarial verification against the implement-phase diff: tsc, tests, lint, security scan, reward-hacking scan, code review, test coverage, silent-failure hunt. Writes ${ORCH_DIR}/workers/<TICKET>/verify.json then emits phase.verify.complete.<ticket>. Reads phase-implement.json as its prior-phase artifact. NEVER writes application code — only test files allowed. Spawned via phase-agent-dispatch via slash command — hence `user-invocable: true`.
tools
--- name: phase-triage description: Phase agent that triages a Linear ticket — expands acronyms, classifies (feature/bug/docs/refactor/chore), identifies dependencies, 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.failed.<TICKET> on error. Dispatched by the phase-agent orchestrator (CTL-452)
testing
Phase agent for the review step of the 9-phase orchestrator pipeline (CTL-450). Wraps the /review skill (gstack) — explicitly skips /ultrareview per user decision. Reads verify.json from the prior phase, runs /review against the diff, writes ${ORCH_DIR}/workers/<TICKET>/review.json, and creates a remediation commit for any HIGH-severity finding that has a deterministic fix. Emits phase.review.complete.<ticket>. Spawned via phase-agent-dispatch via slash command — hence `user-invocable: true`.