
801 N.E.2d 99 (2003)
344 Ill. App.3d 599
279 Ill.Dec. 807
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Aris ETHERLY, Defendant-Appellant.
No. 1-01-4166.
Appellate Court of Illinois, First District, Sixth Division.
November 21, 2003.
Rehearing Denied December 16, 2003.
*102 Michael J. Pelletier, Office of the State Appellate Defender, Chicago (Lisa E. Rousso, of counsel), for Appellant.
Richard A. Devine, Cook County State's Attorney, Chicago (Renee Goldfarb, James E. Fitzgerald and Mari R. Hatzenbuehler, of counsel), for Appellee.
Presiding Justice FROSSARD delivered the opinion of the court:
The issue in the instant case is whether the first-stage post-conviction petition can be dismissed based on res judicata, waiver, or procedural default under the terms of the Post-Conviction Hearing Act (Act) (725 ILCS 5/122-1 et seq. (West 2000)). Defendant alleges in his pro se petition that he was deprived of a fair trial because prospective jurors were not questioned as to their potential bias toward gang members. People v. Strain, 194 Ill.2d 467, 252 Ill.Dec. 65, 742 N.E.2d 315 (2000). The circuit court found the petition frivolous and patently without merit and dismissed defendant's first-stage post-conviction petition based on waiver and res judicata.
In People v. Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002), the Illinois Supreme Court held that the circuit court may not dismiss a first-stage petition as untimely, but it did not address whether waiver or res judicata can provide the basis for first-stage dismissal. People v. McGhee and People v. Blair applied the reasoning in Boclair regarding timeliness to res judicata and waiver and held a firststage petition may not be dismissed based on res judicata or waiver. People v. McGhee, 337 Ill.App.3d 992, 995, 272 Ill. Dec. 509, 787 N.E.2d 324 (2003); People v. Blair, 338 Ill.App.3d 429, 431-32, 272 Ill. Dec. 936, 788 N.E.2d 240 (2003), appeal allowed, No. 96198, 205 Ill.2d 594, 281 Ill.Dec. 82, 803 N.E.2d 486. We follow McGhee and Blair's application of Boclair with modification. We agree that waiver *103 or procedural default cannot provide the basis for first-stage dismissal; however, under certain circumstances res judicata may provide the basis for first-stage dismissal.
We hold when the circuit court engages in fact finding, resolution of disputed facts or consideration of matters outside the record in applying res judicata, first-stage dismissal is precluded by the terms of the Act. 725 ILCS 5/122-2.1(a)(2), (c) (West 2000); People v. Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002); People v. Coleman, 183 Ill.2d 366, 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063 (1998). However, unlike McGhee and Blair, we recognize there are circumstances that, under the terms of the Act, allow for firststage dismissal based on res judicata. We hold that when no fact finding, resolution of disputed facts or consideration of matters outside the record is necessary, the circuit court may dismiss the petition as frivolous or patently without merit at the first stage by application of res judicata if the petition alleges issues previously decided and thereby substantively rebutted by the record, as reflected by the circuit court's consideration of the trial and appellate records in accordance with section 122-2.1(a)(2) and section 122-2.1(c) of the Act.
Res judicata, unlike waiver or procedural default, addresses the substantive merits of the petition, rather than procedural compliance of the petition at the initial pleading stage. "The process at the summary review stage measures a petition's substantive virtue rather than its procedural compliance." People v. Boclair, 202 Ill.2d 89, 102, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002). Determining substantive merit, not procedural compliance, is the purpose of first-stage review. 725 ILCS 5/122-2.1(a)(2), (b) (West 2000); Boclair, 202 Ill.2d at 102, 273 Ill.Dec. 560, 789 N.E.2d 734. Section 122-5 of the Act provides for matters of procedural compliance to be raised by the State at the second stage; section 122-6 provides for resolution of disputed facts to be resolved by an evidentiary hearing at the third stage. 725 ILCS 5/122-5, 122-6 (West 2000); Coleman, 183 Ill.2d at 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063.
Regarding waiver or procedural default, section 122-5 of the Act provides the mechanism by which procedural compliance regarding affirmative matters such as waiver and procedural default can properly be raised by the State at the second stage of the post-conviction process in a motion to dismiss. 725 ILCS 5/122-5 (West 2000). No such mechanism is provided under the terms of the Act at the first stage. 725 ILCS 5/122-2.1(West 2000). We hold when the application of waiver or procedural default raises questions of procedural compliance or requires fact finding, resolution of disputed facts or consideration of matters outside the record, first-stage dismissal based on waiver or procedural default is precluded by the terms of the Act. 725 ILCS 5/122-5, 122-6 (West 2000); see People v. Boclair, 202 Ill.2d 89, 99, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002); see also People v. Coleman, 183 Ill.2d 366, 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063 (1998).
We agree with McGhee and Blair that the doctrine of waiver does not address the question of whether a claim is frivolous or without merit, but constitutes a procedural bar to a defendant's right to prevail on a claim, regardless of its substantive merit. McGhee, 337 Ill.App.3d at 995, 272 Ill.Dec. 509, 787 N.E.2d 324; Blair, 338 Ill.App.3d at 431-32, 272 Ill.Dec. 936, 788 N.E.2d 240. Similarly, procedural default constitutes a procedural bar to a defendant's right to prevail on a claim regardless of its substantive merit.
*104 In the instant case, the gang bias voir dire issue alleged by the pro se defendant states a constitutional deprivation. The circuit court properly considered res judicata because in applying this principle it was not necessary for the circuit court to engage in fact finding, resolution of disputed facts, or consideration of matters outside the record. As noted, res judicata raises questions regarding the substantive merits, not the procedural compliance of the petition. However, the circuit court erred in dismissing the petition based on res judicata because the gang bias voir dire issue was not in fact previously decided; therefore, under the terms of the Act, the record substantively rebuts res judicata as the basis for first-stage dismissal. First-stage dismissal based upon the res judicata principle that an issue that has in fact been raised and ruled upon is frivolous or patently without merit is directly rebutted by the record in the instant case. It is undisputed that the gang bias voir dire issue was not pursued by defense counsel at trial and not raised by defense counsel on appeal, thereby rendering the issue neither frivolous nor patently without merit.
Application of waiver or procedural default to the gang bias voir dire issue raised questions of procedural compliance or required fact finding, resolution of disputed facts or consideration of matters outside the record and, therefore, under the terms of the Act, cannot provide the basis for first-stage dismissal. We reverse and remand for further proceedings consistent with the terms of sections 122-4 through 122-6 of the Act because, in the instant case, res judicata, waiver or procedural default cannot provide the basis for firststage dismissal under the terms of the Act.

I. POST-CONVICTION HEARING ACT
The Post-Conviction Hearing Act (Act) (725 ILCS 5/122-1 et seq. (West 2000)) provides the mechanism by which criminal defendants can assert their convictions were the result of a substantial denial of rights under the United States Constitution and the Illinois Constitution. People v. Mahaffey, 194 Ill.2d 154, 170, 252 Ill.Dec. 1, 742 N.E.2d 251 (2000). In a noncapital case, the Act provides a threestage procedure for post-conviction relief. People v. Boclair, 202 Ill.2d 89, 99, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002). Various sections of the Act provide guidance for each stage. At stage one, the trial court, without input from the State, examines the petition only to determine if the petition pleads a constitutional deprivation unrebutted by the record, rendering the petition neither frivolous nor patently without merit. 725 ILCS 5/122-2.1(a)(2), (b) (West 2000); Boclair, 202 Ill.2d at 99, 273 Ill.Dec. 560, 789 N.E.2d 734. Section 122-2.1 provides guidelines for resolution of a petition at the first stage. 725 ILCS 5/122-2.1 (West 2000).
If the petition is not dismissed at stage one, it proceeds to stage two, where section 122-4 of the Act provides for the appointment of counsel for an indigent defendant who wishes counsel to be appointed. 725 ILCS 5/122-4 (West 2000). At stage two, pursuant to section 122-5, the State has the opportunity to answer or move to dismiss the petition (725 ILCS 5/122-5 (West 2000)) and the circuit court determines whether the petition alleges a substantial showing of a constitutional violation. People v. Coleman, 183 Ill.2d 366, 381, 233 Ill.Dec. 789, 701 N.E.2d 1063 (1998). Sections 122-4 and 122-5 provide guidelines for resolving a second stage post-conviction petition. At stage one and stage two, the circuit court resolves pleading questions. Coleman, 183 Ill.2d at 385, 233 Ill.Dec. 789, 701 N.E.2d 1063. Under first-stage procedure as provided by section *105 122-2.1 or under second-stage procedure as provided by section 122-5, the circuit court is foreclosed from engaging in any fact finding because all well-pleaded facts not rebutted by the record are to be taken as true at stage one and stage two of the post-conviction process. Coleman, 183 Ill.2d at 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063.
If the petition is not dismissed at stage two, it proceeds to stage three for an evidentiary hearing. Section 122-6 provides guidelines for resolution of a petition at the third stage. 725 ILCS 5/122-6 (West 2000). At stage three, the circuit court resolves questions of disputed fact. An evidentiary hearing on the petition is required when the allegations of the petition, supported by the trial record and the accompanying affidavits, demonstrate a substantial violation of a constitutional right unrebutted by the record. People v. Mitchell, 189 Ill.2d 312, 322, 245 Ill.Dec. 1, 727 N.E.2d 254 (2000).

II. BACKGROUND
Defendant was convicted of first degree murder. His conviction and sentence of 40 years' imprisonment were affirmed on direct appeal. The instant case presents a petition dismissed at the first stage of the post-conviction process. At the first stage the trial court must determine whether the petition is frivolous or patently without merit for failure to plead a substantial constitutional deprivation unrebutted by the record. 725 ILCS 5/122-1(a), 5/122-2.1 (West 2000).
On the last page of his pro se petition, defendant alleged the "failure to ask prospective jurors question[s] that would reveal prejudice against gang members is reversible error." See People v. Strain, 194 Ill.2d 467, 252 Ill.Dec. 65, 742 N.E.2d 315 (2000). In dismissing defendant's first-stage petition, the court recognized various reasons alleged by petitioner for relief, but did not specifically address the gang bias voir dire issue. Rather, in a general statement the court concluded as follows:
"From an analysis of the petition, it is clear that the issues raised by petitioner are matters of record which could have been raised on direct appeal. Accordingly, these claims are barred by the doctrine of res judicata and waiver. Thus, the claims raised by petitioner are dismissed. Based upon the foregoing discussion, this Court finds petitioner's claims to be frivolous and patently without merit. As such, the petition is dismissed. Petitioner's request for appointment of counsel and leave to proceed in forma pauperis are denied."
The circuit court concluded the claims were frivolous and patently without merit and found that the issues raised by the post-conviction petition were barred by res judicata and waiver because the issues "could have been raised on direct appeal." We review the circuit court's dismissal de novo. Coleman, 183 Ill.2d 366, 233 Ill.Dec. 789, 701 N.E.2d 1063. The circuit court's order and resolution of the petition predated the Illinois Supreme Court decision in People v. Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002). It also predated the Illinois Appellate Court decisions in People v. McGhee, 337 Ill.App.3d 992, 995-96, 272 Ill.Dec. 509, 787 N.E.2d 324 (2003), and People v. Blair, 338 Ill. App.3d 429, 272 Ill.Dec. 936, 788 N.E.2d 240 (2003), appeal allowed, No. 96198, which held that a first-stage post-conviction petition could not be dismissed based on waiver or res judicata.
At the first stage there are essentially two circumstances that render a petition frivolous or patently without merit: (1) if the petition fails to plead a constitutional *106 deprivation; or (2) if constitutional deprivations are pled, but the record positively rebuts the deprivations alleged. We will address each in turn.

III. PETITION ALLEGES A CONSTITUTIONAL DEPRIVATION
Consistent with the terms of the Act and the purpose of the first stage, we first address whether the petition alleges a constitutional deprivation. 725 ILCS 5/122-2.1 (West 2000); Boclair, 202 Ill.2d at 99, 273 Ill.Dec. 560, 789 N.E.2d 734. If no constitutional deprivation is alleged, further analysis is unnecessary. In his petition, the defendant alleged that he did not receive a fair trial because the prospective jurors were not questioned about their potential bias against gang members. The State informed the trial judge that it planned to question a witness about gang activity, including asking the witness to describe photographs depicting gang graffiti in the area of the shooting to demonstrate that gang rivalry was prevalent. Defense counsel's objections to the testimony and photographs were overruled. Before jury selection, the following exchange occurred between defense counsel and the trial judge:
"THE COURT: Do you want me to ask the question about gangs then?
DEFENSE COUNSEL: Which would be?
THE COURT: There may be some evidence that gang or gang activity may be involved in this case. Would that prevent you from giving either side a fair trial.
DEFENSE COUNSEL: Sure."
Neither that question nor any other question regarding possible gang bias was asked of the jurors by the judge or defense counsel. The judge offered to ask prospective jurors about gang bias because of the gang evidence that would be presented at trial, but failed to do so. The record further reflects that defense counsel failed to remind the judge to ask the potential jurors about gang bias and failed to directly question them about gang bias when she was given the opportunity to do so. The gang bias voir dire issue was not raised by defense counsel on appeal.
Defendant's conviction arose from the fatal shooting of Jeremy Rush on July 13, 1995, at 103 West 112th Street in Chicago. At trial Henry Wingard testified that he was a member of the Vice Lords gang and that the Gangster Disciples were a rival gang. On the night of the shooting, Wingard was standing on his front porch with Rush, wearing a hat turned to the left signifying his affiliation with the Vice Lords. He heard shots being fired and ran into the house. Upon returning to the porch, he saw Rush lying at the bottom of the porch with a bullet in his head.
Wingard was shown various photographs of gang graffiti and explained to the jury the meaning behind the gang graffiti. He testified that the six-pointed star or pitchfork in the photographs symbolized his rival, the Gangster Disciples. He explained the graffiti in the photograph, "VL killer" and "[H]ook killer," could be found in his neighborhood, and would have been placed there by a Gangster Disciple, and that "[H]ooks" meant Vice Lords.
The defendant, in his statement to the police, admitted to being a Gangster Disciple and admitted that on the night of the murder he joined his codefendants in order to "kill some [H]ooks," that "[H]ooks" were rival Vice Lords, and that the area where the victim was killed was "[H]ooks" territory. The defendant's statement to the police, together with the testimony of Wingard offered by the State, interjected *107 gang-related evidence into the trial process. In fact, the State was allowed to call witness Wingard to testify as an expert regarding the meaning of various photographs depicting gang graffiti. Both during trial and on direct appeal defendant challenged this testimony. On direct appeal, the State maintained that Wingard was called as a lay witness to testify about gang rivalry and that the testimony was relevant to corroborate defendant's statement, assist the jury in understanding it, and to show motive.
The United States and Illinois Constitutions guarantee the right to trial by an impartial jury. U.S. Const., amends. VI, XIV; Ill. Const. 1970, art. I, § 13. The purpose of voir dire is to assure the selection of jurors who are free from bias or prejudice. People v. Aleman, 313 Ill.App.3d 51, 59, 246 Ill.Dec. 20, 729 N.E.2d 20 (2000). In People v. Strain, 194 Ill.2d 467, 252 Ill.Dec. 65, 742 N.E.2d 315 (2000), the Illinois Supreme court held that, "when testimony regarding gang membership and gang-related activity is to be an integral part of the defendant's trial, the defendant must be afforded an opportunity to question the prospective jurors, either directly or through questions submitted to the trial court, concerning gang bias." Strain, 194 Ill.2d at 477, 252 Ill. Dec. 65, 742 N.E.2d 315. Based on constitutional safeguards, including article I, sections 8 and 13, of the Illinois Constitution and the United States Constitution, amendments VI and XIV, the court in Strain concluded that defendant, by being precluded from questioning jurors regarding gang bias, was "denied an informed and intelligent basis on which to assert challenges for cause or to exercise peremptory challenges." Strain, 194 Ill.2d at 481, 252 Ill.Dec. 65, 742 N.E.2d 315; U.S. Const., amends. VI, XIV; Ill. Const.1970, art. I, §§ 8, 13.
In the context of the instant case, the gang bias voir dire issue alleges a constitutional deprivation. We next determine whether the record positively rebuts this alleged constitutional deprivation, rendering the allegation frivolous or patently without merit.

IV. CONSTITUTIONAL DEPRIVATION IS NOT REBUTTED BY THE RECORD BASED ON RES JUDCATA; WAIVER OR PROCEDUAL DEFAULT CANNOT PROVIDE BASIS FOR FIRST-STAGE DISMISSAL
In the instant case, the circuit court found the petition frivolous and patently without merit and dismissed defendant's first-stage post-conviction petition based on waiver and res judicata. In the context of a criminal proceeding, any issues that have previously been decided by a reviewing court are barred by res judicata. People v. West, 187 Ill.2d 418, 425, 241 Ill.Dec. 535, 719 N.E.2d 664 (1999). In a civil context, res judicata "extends not only to what was actually decided in the original action, but also to matters which could have been decided in that suit." Rein v. David A. Noyes & Co., 172 Ill.2d 325, 334-35, 216 Ill.Dec. 642, 665 N.E.2d 1199 (1996). The instant petition is the result of a conviction in a criminal case; however, certain provisions of the Act provide for the circuit court to enter orders regarding amendments to the petition, pleading over, filing further pleadings or extending the term of filing, "as is generally provided in civil cases." 725 ILCS 5/122-5 (West 2000). In the context of a criminal proceeding, any issues that could have been raised in the original proceedings, but were not, are procedurally defaulted (People v. West, 187 Ill.2d 418, 434, 241 Ill.Dec. 535, 719 N.E.2d 664 (1999)) or waived (People v. Kubat, 114 Ill.2d 424, *108 436, 103 Ill.Dec. 90, 501 N.E.2d 111 (1986)). We note the terms "waiver" and "procedural default" are in some criminal cases used interchangeably. See People v. Corrie, 294 Ill.App.3d 496, 506, 228 Ill.Dec. 819, 690 N.E.2d 128 (1998) (discussion of confusion caused by imprecise use of "waiver" interchangeably with the term "procedural default").
As a point of clarification, in this opinion we are using the term res judicata to mean any issues that have in fact previously been decided by a reviewing court. People v. West, 187 Ill.2d 418, 426, 241 Ill.Dec. 535, 719 N.E.2d 664 (1999). In this opinion, we are using the term "procedural default," regarding issues that could have been raised, to include a failure to bring an error to the attention of the trial or appellate court, usually related to counsel's failure to comply with certain procedural requirements. See Hill v. Cowan, 202 Ill.2d 151, 156, 269 Ill.Dec. 875, 781 N.E.2d 1065 (2002); see also People v. Free, 122 Ill.2d 367, 379-81, 119 Ill.Dec. 325, 522 N.E.2d 1184 (1988) (Ryan, J., specially concurring.) Any issues that could have been raised on direct appeal, but were not, are procedurally defaulted, and any issues that have previously been decided by a reviewing court are barred by the doctrine of res judicata. West, 187 Ill.2d at 425, 241 Ill.Dec. 535, 719 N.E.2d 664. We are mindful that an allegation based on what ought to have been done by defense counsel may depend on proof of matters that could not have been included in the record as the result of deficient representation precluding procedural default. See People v. Erickson, 161 Ill.2d 82, 88, 204 Ill.Dec. 231, 641 N.E.2d 455 (1994). We use the term "waiver" to mean "voluntary relinquishment of a known right," regarding issues that could have been raised. See Hill v. Cowan, 202 Ill.2d 151, 156, 269 Ill.Dec. 875, 781 N.E.2d 1065 (2002). We recognize that whether a right is "known" or "voluntarily relinquished" can raise fact questions or implicate matters outside the record.

A. Boclair Reasoning Applied to Waiver and Res Judicata

In People v. McCain, 312 Ill.App.3d 529, 245 Ill.Dec. 130, 727 N.E.2d 383 (2000), affd, People v. Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002), the Fifth District of the Appellate Court held that untimeliness, waiver or res judicata could not be the basis for first-stage dismissal of a post-conviction petition. In People v. Boclair, 202 Ill.2d 89, 99, 273 Ill.Dec. 560, 789 N.E.2d 734 (2002), the supreme court reviewed McCain with two other consolidated cases and held that a trial court may not dismiss a post-conviction petition as untimely at the first stage of the proceedings. Boclair did not resolve the question of whether res judicata, waiver or procedural default may provide the basis for first-stage dismissal.
People v. McGhee recently applied the reasoning in Boclair to waiver and res judicata. In People v. McGhee, 337 Ill. App.3d 992, 993-94, 272 Ill.Dec. 509, 787 N.E.2d 324 (2003), the circuit court in dismissing the post-conviction petition found: (1) the petition was untimely; (2) defendant's claims involved issues that were raised or could have been raised on direct appeal; and (3) the issues were frivolous and patently without merit. McGhee recognized that although Boclair addressed timeliness, it did not address the issue of whether a post-conviction petition may be dismissed at the first stage based on res judicata or waiver. McGhee, 337 Ill. App.3d at 995, 272 Ill.Dec. 509, 787 N.E.2d 324. However, McGhee applied Boclair's reasoning regarding timeliness to waiver and res judicata, indicating as follows:
"Based upon its construction of section 122-2.1(a)(2) of the Act (725 ILCS *109 5/122-2.1(a)(2) (West 2000)), the Boclair court concluded that the circuit court may dismiss a postconviction petition at the initial stage `only if the petition is deemed to be "frivolous or * * * patently without merit," not if it is untimely filed.' (Emphasis added.) Boclair, 202 Ill.2d at 100, 273 Ill.Dec. 560, 789 N.E.2d 734. It reasoned, in part, that the fact that a petition is untimely does not necessarily mean that it is without merit. Boclair, 202 Ill.2d at 101, 273 Ill.Dec. 560, 789 N.E.2d 734. Like timeliness, the doctrines of waiver and res judicata do not address the question of whether a claim is frivolous or without merit; rather, they constitute procedural bars to a defendant's right to prevail on a claim, regardless of its substantive merit." McGhee, 337 Ill.App.3d at 995, 272 Ill. Dec. 509, 787 N.E.2d 324.
Based on the reasoning in Boclair regarding timeliness, McGhee held that the circuit court may not rely on res judicata or waiver to summarily dismiss a firststage post-conviction petition because, like timeliness, res judicata and waiver constitute procedural bars and do not address the substantive merit of the defendant's claims. McGhee, 337 Ill.App.3d at 995-96, 272 Ill.Dec. 509, 787 N.E.2d 324. See People v. Stivers, 338 Ill.App.3d 262, 264, 273 Ill.Dec. 86, 788 N.E.2d 395 (2003) (Second District) ("Like timeliness, waiver is in the nature of an affirmative defense that the State may either raise, waive, or forfeit. Whether an issue is waived does not determine whether an issue has merit").
The conclusion reached in People v. McGhee, 337 Ill.App.3d 992, 995, 272 Ill. Dec. 509, 787 N.E.2d 324 (2003), was reaffirmed in People v. Blair, 338 Ill.App.3d 429, 431-32, 272 Ill.Dec. 936, 788 N.E.2d 240 (2003), appeal allowed, No. 96198:
"As we recently held in People v. McGhee, 337 Ill.App.3d 992, 995, 272 Ill.Dec. 509, 787 N.E.2d 324 (2003), we believe that the analysis the supreme court employed in Boclair is equally applicable to first-stage dismissals based on grounds of waiver or res judicata. In McGhee, we concluded that `[l]ike timeliness, the doctrines of waiver and res judicata do not address the question of whether a claim is frivolous or without merit; rather, they constitute procedural bars to defendant's right to prevail on a claim, regardless of its substantive merit.' [Citation.]" Blair, 338 Ill. App.3d at 431-32, 272 Ill.Dec. 936, 788 N.E.2d 240.
In McGhee, however, we note that this court, after finding waiver and res judicata were not proper grounds for first-stage dismissal, went on to consider whether the trial court's summary dismissal was proper on the grounds that the petition was frivolous and patently without merit because, in that case, the trial court had addressed the merits of the defendant's petition. McGhee, 337 Ill.App.3d at 996-98, 272 Ill. Dec. 509, 787 N.E.2d 324. However, unlike McGhee, the circuit court in Blair summarily dismissed the defendant's postconviction petition solely on the grounds of res judicata and waiver without addressing the merits of the claims raised in the defendant's petition. Blair, 338 Ill.App.3d at 432, 272 Ill.Dec. 936, 788 N.E.2d 240. The Blair court on appeal explained its decision not to address the merits of defendant's claims as follows: "In this case, the circuit court never addressed the merits of the claims raised in the defendant's petition, and we deem it inappropriate to address the issue for the first time on appeal." Blair, 338 Ill.App.3d at 432, 272 Ill.Dec. 936, 788 N.E.2d 240. Accordingly, Blair reversed the circuit court's summary dismissal and remanded for the circuit court to address the merits of the claims raised in defendant's petition. Blair, 338 *110 Ill.App.3d at 432, 272 Ill.Dec. 936, 788 N.E.2d 240.
We note that the interpretation of Boclair as articulated in McGhee and Blair will eliminate trial court dismissal of postconviction petitions at the first stage of the post-conviction proceeding based on res judicata and waiver. However, People v. Smith, 341 Ill.App.3d 530, 536-37, 276 Ill. Dec. 472, 794 N.E.2d 367 (2003), in dicta, disagrees with expanding Boclair's reasoning regarding untimeliness to res judicata and waiver. Smith indicates that Boclair's holding is restricted to the defense of untimeliness because res judicata and waiver can involve a determination of the substantive merits of the petition. Smith, 341 Ill.App.3d at 538, 276 Ill.Dec. 472, 794 N.E.2d 367. However, because Smith involved a successive post-conviction petition, Smith relied on People v. Britt-El, 206 Ill.2d 331, 276 Ill.Dec. 309, 794 N.E.2d 204 (2002), which the Illinois Supreme Court decided on the same day as Boclair, and noted it was not necessary to resolve whether "to extrapolate the holding of Boclair to extend to waiver and res judicata." Smith, 341 Ill.App.3d at 538, 276 Ill.Dec. 472, 794 N.E.2d 367. Regarding whether Boclair compels the same treatment for waiver and res judicata as it does for timeliness, the court in Smith stated, in dicta, as follows:
"Timeliness is treated under a separate provision of the Act (see 725 ILCS 5/122-1(c) (West 2000)) and, unlike waiver and res judicata, does not enter into a determination of the substantive merits of the petition as mandated under section 122-2.1(a)(2) (725 ILCS 5/122-2.1(a)(2) (West 2000)). As pointed out, the substantive scope and purpose of the Act was not designed to provide for the retrial of issues that either were previously decided or could have been raised and decided at an earlier time. Consequently, waiver and res judicata, although procedural constructs, are also substantive considerations to the extent that they define and limit the substantive scope and purpose of the Act. Timeliness, on the other hand, is a consideration wholly collateral to the Act's substantive scope and purpose, which is consistent with the fact, as noted, that it is treated under a separate provision. However, we are not compelled here to finally resolve whether to extrapolate the holding of Boclair to extend to waiver and res judicata as well as to timeliness since the holdings in McCain, as affirmed by the supreme court's decision in Boclair, and McGhee, which would prevent summary determinations based on waiver and res judicata as well as untimeliness, involve first petitions and do not purport to deal with successive petitions." Smith, 341 Ill.App.3d at 537-38, 276 Ill.Dec. 472, 794 N.E.2d 367.
Unlike McGhee, Blair, or the instant case, Smith addressed a successive postconviction petition dismissed at stage one based on waiver and res judicata. In affirming that dismissal by the trial court, Smith relied on People v. BrittEl, 206 Ill.2d 331, 276 Ill.Dec. 309, 794 N.E.2d 204 (2002), and stated:
"When dealing with a successive petition, as in this case, we must defer to People v. Brittr-El, 206 Ill.2d 331, 276 Ill.Dec. 309, 794 N.E.2d 204 (2002), which likewise involved a successive petition. Britt-El squarely permits the first-stage dismissal of a successive postconviction petition on the basis of waiver. Britt-El was decided the same day as Boclair and controls the disposition of this case. In Britt-El, the defendant filed a successive post-conviction petition, which was summarily dismissed by the trial court. The supreme court affirmed, concluding that the claims not *111 raised in the defendant's first petition were waived because the defendant could not establish cause for his failure to do so. Britt-El, 206 Ill.2d at 338, 276 Ill.Dec. 309, 794 N.E.2d 204. The claims that were raised in the original petition, and had been asserted for a second time, were also properly summarily dismissed, as the court found the defendant had been afforded the opportunity to `fully and finally litigate[]' those claims in the original proceeding. Britt-El, 206 Ill.2d at 342, 276 Ill.Dec. 309, 794 N.E.2d 204. The court thereby affirmed the trial court's ability to dismiss a successive post-conviction petition on the bases of waiver and res judicata in the first stage of review." Smith, 341 Ill.App.3d at 538, 276 Ill.Dec. 472, 794 N.E.2d 367.
B. Act Precludes First-Stage Dismissal Based on Res Judicata, Waiver or Procedural Default If Circuit Court Fact Finds, Resolves Disputed Facts or Considers Matters Outside Record
We recognize Smith and Britt-El as controlling in the context of successive postconviction petitions. Unlike Smith or Britt-El, the instant case does not involve a successive postconviction petition. In the context of the instant case, we follow Blair's and McGhee's interpretation of Boclair with modification. Whether we characterize res judicata and waiver as "procedural bars" to a defendant's claim as in Blair and McGhee, 337 Ill.App.3d at 995, 272 Ill.Dec. 509, 787 N.E.2d 324, or as "procedural constructs" implicating "substantive considerations to the extent that they define and limit the substantive scope and purpose of the Act," as in Smith, 341 Ill.App.3d at 537, 276 Ill.Dec. 472, 794 N.E.2d 367, to determine if waiver, procedural default, or res judicata can be the basis for first-stage dismissal, we must first examine the substantive and procedural backdrop giving rise to application of these principles. Thus, we consider not only the procedural posture, but we also consider the substantive posture of the case.
Regarding the procedural posture of the instant case, at the first stage, the circuit court sua sponte raised waiver and res judicata, then dismissed the petition as frivolous or patently without merit, based on waiver and res judicata because the issues alleged "could have been raised on direct appeal." (Emphasis added.) The substantive constitutional deprivation at issue in the instant case as alleged by the pro se defendant is that he was deprived of a fair trial because prospective jurors were not questioned as to their potential bias toward gang members. Application of waiver, procedural default or res judicata as the basis for first-stage dismissal requires consideration of whether the substantive constitutional deprivation as alleged in the petition raises a question of law, a question of fact or a mixed question of law and fact. If the circuit court in resolving the petition must assess credibility, weigh facts, draw inferences, fact find, resolve factual disputes or rely on matters outside the record, then application of those principles as the basis for first-stage dismissal is prohibited by the plain language of the Act and the case law interpreting the Act. See Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734; Coleman, 183 Ill.2d at 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063; 725 ILCS 5/122-2.1(a)(2), (c), 122-5, 122-6 (West 2000).
The starting point for answering the question whether the petition was properly dismissed at the first stage based on res judicata, waiver or procedural default is the plain language of the Act. The salient provision for answering this firststage question is section 122-2.1(c), which together with section 122-2.1(a)(2), provides *112 the purpose and the mechanism for resolving first-stage petitions while offering guidance regarding what matters are to be considered by the circuit court consistent with the purpose of the first stage. In construing a statute, courts should consider the statutory language (People v. Hickman, 163 Ill.2d 250, 261, 206 Ill.Dec. 94, 644 N.E.2d 1147 (1994)) and give effect to the language of the Act as written when the language is clear (People v. Rivera, 198 Ill.2d 364, 371, 261 Ill.Dec. 336, 763 N.E.2d 306 (2001)).
Section 122-2.1(a)(2) states the purpose of first-stage review: "If * * * the court determines the petition is frivolous or is patently without merit, it shall dismiss the petition * * *." 725 ILCS 5/122-2.1(a)(2) (West 2000). Section 122-2.1(c) provides the mechanism by which the circuit court at the first stage is to determine whether the petition is frivolous or patently without merit: "In considering a petition pursuant to this Section, the court may examine the court file of the proceeding in which the petitioner was convicted, any action taken by an appellate court in such proceeding and any transcripts of such proceeding." 725 ILCS 5/122-2.1(c) (West 2000). The plain language of the Act limits the determination to be made by the circuit court at the first stage to consideration of the record regarding whether the petition pleads a constitutional deprivation that is substantively rebutted by the record, rendering the petition frivolous or patently without merit. 725 ILCS 5/122-2.1(a)(2), (c) (West 2000).
To prohibit the circuit court from dismissing a first-stage petition based upon res judicata when consideration of the record by the circuit court, in accordance with section 122-2.1(c), reflects the issues in the petition were previously substantively litigated renders consideration of the petition as provided by section 122-2.1(c) meaningless. Such a prohibition also frustrates the very purpose of first-stage review as articulated by section 122-2.1(a)(2), which is to determine whether the petition substantively is frivolous or patently without merit because the alleged constitutional deprivation is rebutted by the record. 725 ILCS 5/122-2.1(a)(2) (West 2000). It is for those reasons that we disagree with the approach taken in McGhee and Blair in precluding first-stage dismissal based on res judicata in every case. Application of res judicata, in the context of a first-stage petition, unlike waiver or procedural default, can resolve the first-stage question of whether a claim is frivolous or without substantive merit.
Res judicata can provide the basis for first-stage dismissal where the facts are undisputed regarding an issue that has in fact been raised and previously ruled upon. If, however, it is necessary for the circuit court to go beyond the petition or beyond the record or resolve factual disputes, then the petition cannot be resolved at the first stage based on principles of res judicata. At the first stage the circuit court is authorized by the Act, without going beyond the petition, to review the record, apply the law to undisputed facts and, based on res judicata, dismiss a petition which alleges a constitutional deprivation substantively rebutted by the record. 725 ILCS 5/122-2.1(a)(2), (c) (West 2000).
Application of res judicata in terms of issues previously litigated substantively does not present questions of procedural compliance, questions of fact or matters outside the record frequently implicated by waiver and procedural default. Rather, application of res judicata in terms of issues previously litigated, substantively addresses the question of whether a petition is frivolous or patently without merit. Regarding whether a first-stage petition is frivolous or patently without merit, section *113 122-2.1(c) specifically provides that the court may examine, not only the court file, but any action taken by an appellate court. Such examination of the record is designed to assist the circuit court in determining whether the petition states a constitutional deprivation substantively unrebutted by the record rendering the petition neither frivolous nor patently without merit as provided by section 122-2.1(a)(2). It is frivolous to raise legal issues previously argued and resolved substantively on their merits. See Boclair, 202 Ill.2d at 101, 273 Ill.Dec. 560, 789 N.E.2d 734. Res judicata addresses precisely that type of frivolous pleading at the first stage. The plain language of the Act provides for first-stage resolution of substantive issues by determining whether those issues are rebutted by the record because they were previously litigated. Thus, first-stage dismissal based on res judicata regarding previously litigated issues is permitted by the Act providing the circuit court does not engage in fact finding, resolution of disputed facts or consideration of matters outside the record.
The plain language of the Act does not provide for first-stage resolution based on waiver or procedural default for issues of procedural compliance or for issues that could have or should have been raised, which require fact finding, resolution of disputed facts or consideration of matters outside the record. See Boclair, 202 Ill.2d at 102, 273 Ill.Dec. 560, 789 N.E.2d 734. As recently recognized in Boclair, regarding the first stage, "At this initial stage of the proceedings, however, the court should only determine whether the petition alleges constitutional deprivations. The process at the summary review stage measures a petition's substantive virtue rather than its procedural compliance." (Emphasis added.) Boclair, 202 Ill.2d at 102, 273 Ill.Dec. 560, 789 N.E.2d 734; see also Boclair, 202 Ill.2d at 129, 273 Ill.Dec. 560, 789 N.E.2d 734 (McMorrow, J., specially concurring) ("`Only' means only").
In measuring the "substantive virtue" of the petition, the issue is whether the petition states a constitutional deprivation that is substantively unrebutted by the record, rendering the petition neither frivolous nor patently without merit. The petition may very well allege a constitutional deprivation; however, if that allegation is rebutted by the record, because the issue has been previously substantively litigated, then the petition lacks "substantive virtue" or merit and first-stage dismissal based on res judicata is allowed under the terms of the Act. Dismissal based on res judicata because issues previously were substantively litigated reflects lack of "substantive virtue," not lack of procedural compliance.
Where application of res judicata does not involve fact finding, resolving disputed facts, or consideration of matters outside the petition, the circuit court by applying the law to the facts can properly dismiss the petition at the first stage with no need for further response from petitioner, providing the issue was in fact previously litigated. In that context, the petition presents a substantive allegation of constitutional deprivation, which in fact either was or was not previously raised, subject to resolution by applying sections 122-2.1(a)(2) and 122-2(c) of the Act. If the allegation was raised and ruled upon, then it is rebutted by the record, rendering it frivolous or patently without merit and subject to first-stage dismissal based on res judicata. If the allegation was not raised and ruled upon, then it is not rebutted by the record, thereby surviving firststage dismissal based on res judicata.
Frivolous or patently without merit refers only to the merits of the claim or claims alleged in the petition, i.e., whether the petition alleges constitutional deprivations, *114 not to any procedural requirements or limitations imposed by the Act. See Boclair, 202 Ill.2d at 102, 273 Ill.Dec. 560, 789 N.E.2d 734. However, if a petition is dismissed at the first stage as the result of a lack of procedural compliance based on waiver or procedural default for the failure to raise an issue that could have or should have been raised, that does not necessarily mean the petition lacks merit. See Boclair, 202 Ill.2d at 101, 273 Ill.Dec. 560, 789 N.E.2d 734. Rather, such petition raises questions of procedural compliance. As noted by Justice McMorrow in her specially concurring opinion in Boclair, "According to the majority opinion, matters of `procedural compliance' (202 Ill.2d at 102, 273 Ill.Dec. 560, 789 N.E.2d 734) may not be considered at the initial stage of postconviction review." (Emphasis omitted.) Boclair, 202 Ill.2d at 124, 273 Ill.Dec. 560, 789 N.E.2d 734 (McMorrow, J., specially concurring).

C. Act Prohibits First-Stage Dismissal Based on Waiver or Procedural Default
Waiver and procedural default raise questions of procedural compliance or questions requiring fact finding, resolution of disputed facts or consideration of matters outside the record not properly the subject of first-stage consideration. We agree with McGhee and Blair, that waiver does not address the question of whether a claim is frivolous or without merit but, rather, constitutes a procedural bar to defendant's right to prevail on a claim regardless of its substantive merit. McGhee, 337 Ill.App.3d at 995, 272 Ill.Dec. 509, 787 N.E.2d 324; Blair, 338 Ill.App.3d at 431-32, 272 Ill.Dec. 936, 788 N.E.2d 240. Procedural default, similar to waiver, constitutes a procedural bar to a defendant's right to prevail on a claim regardless of substantive merit. The mechanism for resolving affirmative matters such as waiver and procedural default, regarding procedural compliance or issues that could have or should have been raised, is provided by the Act in sections 122-4 and 122-5, which articulate second-stage procedures. The Act at the second stage allows for appointment of defense counsel (section 122-4), allows amendments to the petition (section 122-5) and allows the State to act as an adversary, raise affirmative matter, and answer or move to dismiss the petition (section 122-5).
The circuit court by sua sponte raising waiver or procedural default based upon issues that could have or should have been raised previously, and then ruling upon those very issues at the first stage, is acting as both judge and adversary inconsistent with the terms of the Act. Under the terms of the Act, at the first stage, there is no adversary yet in place to raise any affirmative matters, including matters of procedural compliance. There is no mechanism in place at the first stage for resolving affirmative matter raising factual disputes. The legislature, with section 122-5, provided the mechanism at the second stage by which affirmative matters, such as waiver and procedural default, raising questions of procedural compliance could properly be brought to the judge's attention by the State acting as an adversary filing a motion to dismiss, not by the judge acting as an adversary. 725 ILCS 5/122-5 (West 2000).
If the legislature intended for the circuit court to sua sponte go beyond the allegations of the petition at the first stage, act as an adversary and raise waiver or procedural default, the legislature could have so provided in the Act, by completely eliminating section 122-5, which provides for the State, by filing a motion to dismiss, to raise affirmative matters of waiver and procedural default at the second stage. 725 ILCS 5/122-5 (West 2000). The party *115 relying on an affirmative matter has the responsibility of raising it and pleading it. To interpret the Act to permit the circuit court, at the first stage, to raise and rule upon affirmative matters such as waiver and procedural default based on issues that could have been raised directly contradicts section 122-5, which permits motions to dismiss, responsive pleadings or input from the State at the second stage. 725 ILCS 5/122-5 (West 2000). It is only in the context of those responsive pleadings by the State that the circuit court at the second stage properly considers affirmative matters, such as waiver and procedural default, raising questions of procedural compliance or questions based on issues that could have or should have been raised.
The Act at the first stage does not permit any further pleading from the petitioner or any motions, responsive pleading or other input from the State once the petition is filed at the first stage. People v. Gaultney, 174 Ill.2d 410, 418, 221 Ill.Dec. 195, 675 N.E.2d 102 (1996). Thus, the Act at the first stage does not give the petitioner an opportunity to respond to affirmative matters such as waiver and procedural default raised sua sponte by the circuit court. The Act at the first stage does not give the State an opportunity to raise affirmative matters such as waiver and procedural default. To accept the argument that the circuit court may dismiss a petition at the first stage of the proceeding based on waiver or procedural default, we would have to ignore the plain language of the Act and condone the circuit court sua sponte acting as both adversary and judge by raising affirmative defenses regarding procedural compliance and ruling on the defenses raised with no input from the State or the defense. Neither the Act nor the case law interpreting the Act supports that argument.
The circuit court by sua sponte raising waiver or procedural default at the first stage of the post-conviction proceeding exceeds its limited role to act in an administrative capacity. Regarding the purpose of the first stage as recognized in People v. Rivera, 198 Ill.2d 364, 373, 261 Ill.Dec. 336, 763 N.E.2d 306 (2001): "[T]he summary dismissal stage of the post conviction proceeding does nothing more than allow the circuit court to act strictly in an administrative capacity by screening out those petitions which are without legal substance or are obviously without merit." Rivera, 198 Ill.2d at 373, 261 Ill.Dec. 336, 763 N.E.2d 306. At the first stage, the circuit court's compliance with the terms of section 122-2.1 results in a simplified administrative procedure for determining whether a petition has legal substance or merit, thereby preserving limited resources of the criminal justice system while focusing on claims that have merit. Rivera, 198 Ill.2d at 372-73, 261 Ill.Dec. 336, 763 N.E.2d 306. Rivera, like Boclair, recognizes substantive legal merit, not procedural compliance, as the focus of firststage review.
Consistent with the simplified purpose of the first stage, partial dismissal is not allowed. If any allegation raises the gist of a constitutional deprivation, substantively unrebutted by the record, then in keeping with its administrative role, the circuit court is to docket the entire petition for second-stage resolution. Rivera, 198 Ill.2d at 373, 261 Ill.Dec. 336, 763 N.E.2d 306. Rivera's approach to first-stage review streamlines the circuit court's role, eliminates confusion, and saves time and resources while furthering the ends of justice. Rivera, 198 Ill.2d at 372, 261 Ill.Dec. 336, 763 N.E.2d 306. If any one allegation raises a constitutional deprivation, substantively unrebutted by the record, the circuit court need not spend time and resources *116 on further review of the petition because at that point the entire petition shall be docketed for further consideration in accordance with sections 122-4 through 122-6. 725 ILCS 5/122-2.1(b) (West 2000); Rivera, 198 Ill.2d at 371, 261 Ill. Dec. 336, 763 N.E.2d 306.

D. Second-and Third-Stage Cases Are Not Instructive Regarding First-Stage Dismissal Based on Res Judicata, Waiver or Procedural Default
We note the circuit court and the State, by relying on second- and third-stage cases to resolve first-stage issues, as are raised by the instant case, further complicate proper application of the Act, adding unnecessary confusion to the simplified section 122-2.1 first-stage procedure. As noted in Rivera, "section 122-2.1 provides for a simplified procedure in order to ensure that the criminal justice system's limited resources are expended where most needed." Rivera, 198 Ill.2d at 372, 261 Ill.Dec. 336, 763 N.E.2d 306.
In the instant case, the circuit court in support of its finding that the issues raised by petitioner were barred by res judicata and waiver relied on People v. Johnson, 191 Ill.2d 257, 268, 246 Ill.Dec. 642, 730 N.E.2d 1107 (2000), and People v. Cloutier, 191 Ill.2d 392, 397, 247 Ill.Dec. 464, 732 N.E.2d 519 (2000). Johnson and Cloutier were cited by the circuit court for the proposition that issues decided on direct appeal are barred by res judicata and issues that could have been raised on direct appeal, but were not, are considered waived. Johnson, 191 Ill.2d at 268, 246 Ill.Dec. 642, 730 N.E.2d 1107; Cloutier, 191 Ill.2d at 397, 247 Ill.Dec. 464, 732 N.E.2d 519. We have no quarrel with those propositions; however, we note that Johnson and Cloutier involved petitions at the second stage of the post-conviction process where the State had filed a motion to dismiss. Johnson, 191 Ill.2d at 263, 246 Ill.Dec. 642, 730 N.E.2d 1107; Cloutier, 191 Ill.2d at 396, 247 Ill.Dec. 464, 732 N.E.2d 519. Neither case addressed the issue in the instant case regarding whether a first-stage petition can be dismissed based on waiver, procedural default or res judicata raised sua sponte by the circuit court. Neither case addressed the issue in the instant case regarding the circumstances under which waiver, procedural default or res judicata can foreclose review of an alleged constitutional deprivation based on a Strain violation in the context of a first-stage petition.
The State, in support of its argument that petitioner's claims are barred by waiver and res judicata, relies on People v. Silagy, 116 Ill.2d 357, 365, 107 Ill.Dec. 677, 507 N.E.2d 830 (1987), and People v. Winsett, 153 Ill.2d 335, 346, 180 Ill.Dec. 109, 606 N.E.2d 1186 (1992). Similar to the cases relied upon by the circuit court, we note that neither Silagy nor Winsett addressed first-stage petitions. In Silagy, the State, at the second stage of the postconviction proceeding, moved to dismiss the multiple claims raised in the petition, raising waiver, res judicata and other affirmative matter in support of dismissing the petition and denying defendant a thirdstage evidentiary hearing. People v. Silagy, 116 Ill.2d 357, 364, 107 Ill.Dec. 677, 507 N.E.2d 830 (1987). The circuit court granted dismissal at the second stage of the post-conviction proceeding, and the Illinois Supreme Court affirmed secondstage dismissal of the nonmeritorious petition without an evidentiary hearing. Silagy, 116 Ill.2d at 373, 107 Ill.Dec. 677, 507 N.E.2d 830.
People v. Winsett, 153 Ill.2d 335, 344, 180 Ill.Dec. 109, 606 N.E.2d 1186 (1992), involved the third stage of the post-conviction process during which an evidentiary hearing on the defendant's post-conviction *117 petition was held before the same judge who presided at the defendant's trial. Thus, the Illinois Supreme Court addressed the propriety of the trial court's ruling denying post-conviction relief at the third stage of the post-conviction process. Winsett affirmed the trial court's denial of post-conviction relief and reversed the appellate court's judgment, reinstating defendant's convictions and sentences. Winsett, 153 Ill.2d at 365, 180 Ill.Dec. 109, 606 N.E.2d 1186.
We have no quarrel with the proposition regarding res judicata as stated in Winsett, and quoted in the prosecution's brief, that "post-conviction review is limited to constitutional matters which have not been, and could not have been, previously adjudicated." Winsett, 153 Ill.2d at 346, 180 Ill.Dec. 109, 606 N.E.2d 1186. We note, however, that Winsett resolved those issues in the context of a third-stage evidentiary hearing. We, likewise, agree with the principle articulated in Silagy that postconviction issues that could have been raised on direct appeal, but were not, are considered waived. Silagy, 116 Ill.2d at 365, 107 Ill.Dec. 677, 507 N.E.2d 830. We note, however, that Silagy resolved the waiver issues in the context of a secondstage motion to dismiss brought by the State. Neither Winsett nor Silagy addressed the issue in the instant case regarding the circumstances under which waiver, procedural default or res judicata can foreclose review of an alleged constitutional deprivation based on a Strain violation in the context of a first-stage petition.
In recognizing the various principles of res judicata and waiver articulated in Silagy, Winsett, Johnson and Cloutier, we are mindful that strict application of res judicata and waiver will be relaxed where the alleged waiver stems from incompetency of counsel (see People v. Whitehead, 169 Ill.2d 355, 371, 215 Ill.Dec. 164, 662 N.E.2d 1304 (1996)) or where the facts relating to the claim do not appear on the record (Mahaffey, 194 Ill.2d at 171, 252 Ill.Dec. 1, 742 N.E.2d 251). It is not the intent of the Act that such claims be adjudicated on the pleadings at the first stage. Coleman, 183 Ill.2d at 382, 233 Ill.Dec. 789, 701 N.E.2d 1063. In Cloutier, Johnson, Silagy and Winsett, such claims were adjudicated not on pleadings at the first stage, but at the second and third stage consistent with the terms of the Act.
We further note that Cloutier, Johnson and Silagy were capital cases. A comprehensive article regarding the Act, authored by Justice Patrick J. Quinn and Judge John J. Hynes, questions applicability of capital cases to issues arising from firststage dismissal:
"Since the majority of post-conviction petitions reviewed by the Illinois Supreme Court are capital cases, most of these cases are dismissed at the second stage in the trial courts. The authors believe the applicability of these cases to the summary dismissal stage is questionable unless the Illinois Supreme Court specifically addresses section 122-2.1(a)(2), relating to summary dismissal. Decisions addressing dismissals at the second stage should not be relied upon when considering the appropriateness of summary dismissals entered prior to counsel being appointed for the petitioner." P. Quinn and J. Hynes, Impact of Recent Decisions upon Proceedings Under the Post-Conviction Hearing Act, 34 Loy. U. Chi. L.J. 639, 646 (2003).
We are mindful that there is no summary dismissal for post-conviction petitions filed in capital cases. 725 ILCS 5/122-2.1(a)(1) (West 2000). Coleman in which the Illinois Supreme Court specifically addressed section 122-2.1(2) and articulated the distinction between first stage, second stage and third stage petitions, *118 (183 Ill.2d at 380-82, 233 Ill.Dec. 789, 701 N.E.2d 1063), is one of the only capital cases instructive regarding firststage issues. As previously noted, the Act provides three stages. We repeatedly see circuit court judges, prosecutors and defense counsel confused as to what stage is operative. To avoid confusion, needless litigation, delay, and unnecessary expenditure of resources, the starting point for the circuit court in any post-conviction proceeding should be to identify which stage is under consideration and which section of the Act is operative. Likewise, the State and defense should be mindful, both at trial and on appeal, of the operative stage and section. Once the stage is properly identified, the applicable sections of the Act should be noted and followed. Any reference to case law should carefully consider the operative stage.
At the first stage, the initial determination to be made by the circuit court is whether the petition alleges a constitutional deprivation. If a constitutional deprivation is alleged, the next determination to be made by the circuit court is whether the constitutional deprivation is substantively rebutted by the record, rendering the petition frivolous and patently without merit. Regarding that determination, made at the first stage, the words of Coleman are particularly instructive: "At the dismissal stage of a post-conviction proceeding, all well-pleaded facts that are not positively rebutted by the original trial record are to be taken as true." Coleman, 183 Ill.2d at 385, 233 Ill.Dec. 789, 701 N.E.2d 1063. Thus, Coleman allows the circuit court, without engaging in fact finding, to apply the mechanism provided in section 122-2.1(c) and undertake an examination of the court file, of action taken by the appellate court and of any transcripts (725 ILCS 122-2.1(c)) in order to make an independent assessment as to whether the allegations in the petition, liberally construed and taken as true, set forth a constitutional claim for relief (Boclair, 202 Ill.2d at 99, 273 Ill.Dec. 560, 789 N.E.2d 734) not positively rebutted by the record. Coleman, 183 Ill.2d at 385, 233 Ill.Dec. 789, 701 N.E.2d 1063.
The second-and third-stage cases relied upon by the circuit court and the State serve to emphasize the fact that res judicata, procedural default or waiver, raising disputed questions of fact regarding issues that should or could have been raised, are not properly resolved at the first stage of the post-conviction process but, rather, at the second or third stage. Neither the Act nor the case law supports first-stage dismissal based upon res judicata, procedural default or waiver if the circuit court engages in fact finding, resolution of factual disputes or relies on matters outside the record in application of those principles.
If any allegation pleads a constitutional deprivation that is substantively unrebutted by the record, rendering the petition neither frivolous nor patently without merit under section 122-2.1(a)(2), then firststage dismissal is not allowed by the terms of the Act. 725 ILCS 5/122-2.1(a)(2), (c) (West 2000); Boclair, 202 Ill.2d 89, 273 Ill.Dec. 560, 789 N.E.2d 734; Coleman, 183 Ill.2d at 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063. The Act does not allow partial dismissals; therefore, if any one allegation states a constitutional deprivation that is substantively unrebutted by the record, the entire petition is to be docketed for further consideration in accordance with sections 122-4 through 122-6. 725 ILCS 5/122-2.1(b) (West 2000); Rivera, 198 Ill.2d at 371-73, 261 Ill.Dec. 336, 763 N.E.2d 306.
The plain language of the Act provides a mechanism for waiver or procedural default to be properly raised by the State in a motion to dismiss under section 122-5 *119 which is only allowed to be filed by the State at the second stage of the Act. 725 ILCS 5/122-5 (West 2000). If the motion to dismiss is denied and factual issues remain, then a third-stage evidentiary hearing is to be conducted in accordance with the terms of section 122-6 of the Act. Dismissing a petition at the first stage by application of res judicata, waiver or procedural default where the petition raises factual disputes or matters outside the record based upon issues that could have or should have been raised violates section 122-6, which limits fact finding and resolution of disputed facts to the third stage of the post-conviction process.
Regarding the third stage, the Illinois Supreme Court in Coleman recognized that factual disputes raised by the pleadings cannot be resolved by a motion to dismiss at either the first stage under section 122-2.1 or at the second stage under section 122-5 but, rather, can only be resolved by an evidentiary hearing:
"Thus, at the dismissal stage of a post conviction proceeding, whether under section 122-2.1 or under section 122-5, the circuit court is concerned merely with determining whether the petition's allegations sufficiently demonstrate a constitutional infirmity which would necessitate relief under the Act. Moreover, our past holdings have foreclosed the circuit court from engaging in any factfinding at a dismissal hearing because all well-pleaded facts are to be taken as true at this point in the proceeding." Coleman, 183 Ill.2d at 380-81 [233 Ill. Dec. 789, 701 N.E.2d 1063], citing People v. Caballero, 126 Ill.2d 248, 259 [128 Ill.Dec. 1, 533 N.E.2d 1089] (1989), and People v. Wegner, 40 Ill.2d 28, 31-32 [237 N.E.2d 486] (1968) (recognizing that factual disputes raised by the pleadings require a determination of the truth or falsity of the supporting affidavits or exhibits, a determination that cannot be properly made at a hearing on a motion to dismiss but, rather, can only be resolved through an evidentiary hearing).

V. CONCLUSION
This opinion should not be interpreted as limiting the role of the circuit court at the first stage; rather, the circuit court, consistent with the terms of section 122-2.1(a)(2) and section 122-2.1(c) of the Act, may examine the court file, examine any action taken by the appellate court and examine any transcripts of such proceeding to determine whether the petition states a constitutional deprivation that is unrebutted by the record, rendering the petition neither frivolous nor patently without merit. 725 ILCS 5/122-2.1(a)(2), (c) (West 2000).
Res judicata can be the basis for first-stage dismissal if application of the principle does not require the circuit court to engage in fact finding, resolve factual disputes or rely on matters outside the record. In the instant case, the circuit court properly considered the doctrine of res judicata because application of res judicata in the instant case did not require fact finding, resolution of disputed facts or consideration of matters outside the record. However, under section 5/122-2.1(c) it was error for the circuit court to dismiss the petition as frivolous and patently without merit based on res judicata because the record does not rebut the petition: it is undisputed that the gang bias voir dire issue was not pursued by defense counsel at trial or on appeal. Where application of res judicata does not require fact finding, resolution of disputed facts, or consideration of matters outside the record, it may be relied upon by the circuit court as a basis for first-stage dismissal if the issue was previously litigated. In the instant case, because the gang bias voir dire issue *120 was not previously litigated, the petition could not be dismissed based on res judicata. Thus, first-stage dismissal based upon the res judicata principle that an issue that has in fact been raised and ruled upon is frivolous or patently without merit is directly rebutted by the record.
The terms of the Act preclude firststage dismissal based on waiver or procedural default regarding matters of procedural compliance, or requiring fact finding, resolution of disputed facts or reliance on matters outside the record. Section 122-5 of the Act provides for matters of procedural compliance to be raised by the State at the second stage; section 122-6 provides for disputed facts to be resolved by an evidentiary hearing at the third stage. 725 ILCS 5/122-5, 122-6 (West 2000); Coleman, 183 Ill.2d at 380-81, 233 Ill.Dec. 789, 701 N.E.2d 1063. In the instant case, waiver or procedural default raises issues of procedural compliance or requires fact finding, resolution of disputed facts or consideration of matters outside the record, which is beyond the purpose of first-stage review.
Matters of procedural compliance, including waiver or procedural default as the result of issues that could have or should have been raised, frequently implicate competency of counsel issues. At the first stage, to state the "gist" of a meritorious constitutional deprivation, the postconviction petition "`need only present a limited amount of detail'" and need not set forth an entire claim. People v. Edwards, 197 Ill.2d 239, 245, 258 Ill.Dec. 753, 757 N.E.2d 442 (2001), quoting Gaultney, 174 Ill.2d at 418, 221 Ill.Dec. 195, 675 N.E.2d 102. We note defendant's petition does not use the word "counsel" in alleging as a basis for relief that the "failure to ask prospective jurors question that would reveal prejudice against gang members is reversible error." The inarticulate petition, however, raises questions regarding the fact that neither trial counsel nor the trial judge questioned potential jurors regarding possible bias toward gang members, and the gang bias voir dire issue was never raised on appeal.
The Illinois Supreme Court has repeatedly noted that procedural default or waiver may not preclude an ineffective assistance claim for what trial or appellate counsel allegedly ought to have done in representing a criminal defendant by raising issues that could have or should have been raised at an earlier time. See People v. Erickson, 161 Ill.2d 82, 88, 204 Ill.Dec. 231, 641 N.E.2d 455 (1994) (and cases cited therein). Claims of ineffective assistance of counsel frequently implicate matters outside the record. As noted in Coleman, "when a petitioner's claims are based upon matters outside the record, this court has emphasized that `it is not the intent of the [A]ct that [such] claims be adjudicated on the pleadings.' [Citation]" Coleman, 183 Ill.2d at 382, 233 Ill.Dec. 789, 701 N.E.2d 1063. As we have previously noted, at the first stage the circuit court resolves pleading questions, while the third stage is designed for resolution of disputed questions of fact by an evidentiary hearing. The Act provides the mechanism for matters of procedural compliance, including waiver and procedural default to be raised by the State following a motion to dismiss at the second stage.
In this opinion we take no position on the outcome of the second-stage proceeding. Consistent with the terms of the Act, the circuit court may give defendant the opportunity under section 122-5 to amend his petition, which implicates questions of ineffective assistance of counsel regarding the gang bias voir dire issue. We are mindful of the holding in Strain: "[W]hen testimony regarding gang membership and gang-related activity is to be an integral *121 part of the defendant's trial, the defendant must be afforded an opportunity to question the prospective jurors, either directly or through questions submitted to the trial court, concerning gang bias." Strain, 194 Ill.2d at 477, 252 Ill.Dec. 65, 742 N.E.2d 315.
For the reasons previously discussed, the dismissal order is vacated; the entire petition is to be docketed for second-stage consideration consistent with this opinion and consistent with the terms of the Post-Conviction Hearing Act, including sections 122-4 through 122-6.
Reversed and remanded with directions.
GALLAGHER and SMITH, JJ., concur.
