.codex/skills/validate/SKILL.md
Complete validation (type/lint/tests/security)
npx skillsauth add harshanandak/forge .codex/skills/validateInstall 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.
Note: Three things share the "validate" name in Forge:
/validate(this command): Workflow Stage 3 — rebases onto the base branch, then runs type/lint/test/security checksforge-preflight(formerly forge-validate): CLI tool — checks prerequisites before a stagebun run check(scripts/validate.sh): Local quality gate — runs type/lint/test/security checks only (does NOT rebase; assumes branch is already current with the base branch)
Run comprehensive validation including type checking, linting, code review, security review, and tests.
This command validates all code before creating a pull request.
/validate
Or use the validation script (checks only — no rebase):
bun run check # Runs lint/test/security checks only. Does NOT rebase onto the base branch.
# Use /validate for the full workflow (rebase + checks).
<HARD-GATE: /validate entry — rebase onto latest base branch>
Before running ANY validation checks:
0. Resolve the base branch dynamically (do NOT hardcode master or main):
BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
This handles repos using main, master, or any other default branch.
Falls back to "master" when HEAD is unresolved (detached remote, empty repo).
1. Fetch latest base branch:
git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify branch freshness"; exit 1; }
The `|| { ...; exit 1; }` guard ensures fetch failures are never silently skipped.
2. Check if branch is behind:
BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
3. If BEHIND > 0:
a. Run: git rebase origin/"$BASE" || REBASE_FAILED=1
b. If rebase succeeds (REBASE_FAILED unset): print "✓ Rebased onto latest $BASE ($BEHIND commits integrated)"
c. If rebase fails (REBASE_FAILED=1 — conflicts or any other error):
- Capture conflicting files BEFORE aborting: git diff --name-only --diff-filter=U
- Run: git rebase --abort
- Print the captured conflicting file list
- Print: "✗ Rebase conflict — resolve manually, then re-run /validate"
- STOP. Do NOT proceed to any validation checks.
4. If BEHIND = 0:
Print "✓ Branch is up-to-date with $BASE" and continue.
Rationale: Without this step, validation checks run against stale code that doesn't
include recent base branch changes. Integration issues are only caught after the PR is
created, wasting CI cycles and review time. Rebasing here ensures /validate results
reflect the true state of what will be merged.
</HARD-GATE>
Quick Start: Run bun run check to execute the full validation pipeline (implemented in scripts/validate.sh). The npm script is named check; the workflow command is /validate. See individual steps below for details.
# Run your project's type check command
bun run typecheck # or: npm run typecheck, tsc, etc.
any types allowed# Run your project's lint command
bun run lint # or: npm run lint, eslint ., etc.
/code-review:code-review
OWASP Top 10 Checklist:
Automated Security Scan:
# Run your project's security scan
npm audit # or: bun audit, snyk test, etc.
Manual Review:
## Technical Research section)# Run your project's test command
bun test # or: npm run test, jest, vitest, etc.
💭 Plan-Act-Reflect Checkpoint Before declaring validation complete:
- Are all security test scenarios from your design doc actually implemented and passing?
- Did you verify OWASP Top 10 mitigations, not just check a box?
- Are there edge cases or integration scenarios you haven't tested?
If unsure: Re-read the
## Technical Researchsection indocs/plans/YYYY-MM-DD-<slug>-design.md
Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
Every fix attempt without a diagnosed root cause wastes time and masks the real problem.
Confirm the failure is deterministic. Capture the exact error.
Trace to the source, not the symptom. Fix at source, not at symptom.
ONE minimal fix. ONE change at a time.
Re-run full validation from the beginning.
<HARD-GATE: 3+ fix attempts> STOP. Question architecture before Fix #4.
If you have attempted 3+ fixes without resolution:
"Quick fix for now" is not a valid fix strategy. </HARD-GATE>
None of these are evidence. Run the command. Show the output.
If any check fails:
# Create Beads issue for problems
bd create "Fix <issue-description>"
# Mark current issue as blocked
bd update <current-id> --status blocked --comment "Blocked by <new-issue-id>"
# Output what needs fixing
If all pass:
<HARD-GATE: /validate exit>
Do NOT output any variation of "check complete", "ready to ship", or proceed to /ship
until ALL FOUR show fresh output in this session:
1. Type check: [command run] → [actual output] → exit 0 confirmed
2. Lint: [command run] → [actual output] → 0 errors, 0 warnings confirmed
3. Tests: [command run] → [actual output] → N/N passing confirmed
4. Security scan: [command run] → [actual output] → no critical issues confirmed
"Should pass", "was passing earlier", and "I'm confident" are not evidence.
Run the commands. Show the output. THEN declare done.
5. Context check: Run `bash scripts/beads-context.sh validate <id>` and address any warnings
6. Stage transition: Run the following → exit 0 confirmed:
bash scripts/beads-context.sh stage-transition <id> validate ship \
--summary "<all checks pass/fail summary>" \
--decisions "<any failures diagnosed and fixed>" \
--artifacts "<scripts and commands run>" \
--next "<ship readiness notes>"
</HARD-GATE>
✓ Type check: Passed
✓ Lint: Passed
✓ Code review: No issues
✓ Security Review:
- OWASP Top 10: All mitigations verified
- Automated scan: No vulnerabilities
- Manual review: Security tests passing
✓ Tests: 15/15 passing (TDD complete)
Ready for /ship
✗ Tests: 2/15 failing
- validation.test.ts: Assertion failed
- auth.test.ts: Timeout exceeded
✓ Beads issue created: bd-k8m3 "Fix validation test"
✓ Current issue marked: Blocked by bd-k8m3
Fix issues then re-run /validate
Utility: /status → Understand current context before starting
Stage 1: /plan → Design intent → research → branch + worktree + task list
Stage 2: /dev → Implement each task with subagent-driven TDD
Stage 3: /validate → Type check, lint, tests, security — all fresh output (you are here)
Stage 4: /ship → Push + create PR
Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
Stage 6: /premerge → Update docs, hand off PR to user
Stage 7: /verify → Post-merge CI check on main
development
Pull issues, metrics, quality gates, and analysis data from SonarCloud. ALWAYS use this skill when the user mentions SonarCloud, asks about code quality metrics, wants to check PR quality gates, or needs to review security vulnerabilities and technical debt from static analysis. Also trigger during /review workflow when SonarCloud issues need addressing. Trigger on phrases like "SonarCloud", "quality gate", "code quality metrics", "technical debt", "coverage report", "static analysis issues", "security vulnerabilities from scan".
tools
Produces comprehensive research reports that go far beyond what built-in web search can achieve. Sends research tasks to Parallel AI's pro/ultra processors which spend 3-25 minutes autonomously crawling, reading, and synthesizing dozens of sources — returning structured reports with citations. Built-in WebSearch can only run a few queries; this skill runs an entire research pipeline externally. No binary install — requires PARALLEL_API_KEY in .env.local. ALWAYS use this skill instead of doing multiple WebSearch calls when the user needs a comprehensive report, market analysis, competitive landscape, industry deep-dive, strategic recommendations, or multi-source synthesis. This is the RIGHT tool for any research task that would require more than 3-4 web searches to answer properly. Also trigger during /plan Phase 2 research and /research workflows.
testing
Test content
testing
Test content